# Supporting Additional Mime Types

To display content, Placeholders refer to a document's MIME type and then generate the HTML tags that a browser requires for the specific document type. For example, to display an image-type document, an ad placeholder must generate the <img> tag that a browser requires for images. By default, ad placeholders can generate the appropriate HTML only for the following MIME types:

- HTML, XML, plain text - For this type of content, a Placeholder passes the text directly to the JSP.
- Images - For this type of content, a Placeholder generates an <img> tag with attributes that the browser needs to display the image. If you want images to be clickable, you must specify the target URL and other link-related information as content properties in the Virtual Content Repository.
- Shockwave files - For this type of content, a Placeholder generates the <OBJECT> tag, which Microsoft Internet Explorer on Windows uses to display the file, and the <EMBED> tag, which browsers that support the Netscape-compatible plug-in use to display the file. In Virtual Content Repository you can specify attributes for the <OBJECT> and <EMBED> tags.

If you are familiar with basic Java programming, you can write classes that enable placeholders to generate HTML for additional MIME types. To support additional MIME types, you must complete the following tasks:

Create and Compile a Java Class to Generate HTML

Register the New Class

## Create and Compile a Java Class to Generate HTML

To generate the HTML that the browser requires to display the MIME type, use WebLogic Workshop to create a Java Project in your application, then create and compile a Java class in that Java Project that implements the com.bea.p13n.ad.AdContentProvider interface. For information on this interface, see the WebLogic Portal Javadoc.

## Register the New Class

After you save the class in a directory that is in your classpath, you must notify WebLogic Portal of its existence:

1. Stop the server.
2. Create a backup copy of your application's META-INF\application-config.xml file.
3. Open application-config.xml in a text editor and find the <AdService> element.
4. Add the following as a subelement of <AdService>:

       <AdContentProvider
       Name="MIME-type"
       Provider="YourClass.class"
       Properties="optional-properties-for-your-class"
       >
       </AdContentProvider>

   Provide the following values for the attributes of the AdContentProvider element:
   Name - The name of the MIME type that you want to support.
   Provider - The name of the compiled Java file. If you saved the file below a directory that your CLASSPATH environment variable names, you must include the file's pathname, starting one directory level below the directory in classpath.
   Properties - Any additional properties or parameters want to pass to your object. For example, if you added <PORTAL_APP>/classes to the system classpath, save your class to support AVI files as <PORTAL_APP>/classes/myclasses/MimeAvi.class.

   For example:

       <AdContentProvider
       Name="video/x-msvideo"
       Provider="myclasses.MimeAvi"
       Properties=""
       >
       </AdContentProvider>

5. Save your modifications to application-config.xml.
6. Restart the server.
7. Activate the content provider in the WebLogic Administration Portal Service Administration tools.
   1. Launch the WebLogic Administration Portal by entering the following URL in a browser: http://<server>:<port>/<portal_app>Admin. For example, http://localhost:7001/myPortalAppAdmin. Log in with a portal or system administrator username and password. The default login is weblogic/weblogic.
   2. In the WebLogic Administration Portal, click Service Administration.
   3. In the left resource tree, click Add/remove configurable item.
   4. In the list of configurable items that appears, select the checkbox next to the content provider you added.
   5. Click Update at the bottom of the window.

Related Topics

Creating Placeholders

Developing Personalized Applications