Show TOC

MIME Types of a PageLocate this document in the navigation structure

Use

In this tutorial, you will learn how to use MIME types other than text/html in your BSPs.

Prerequisites

You know how to create BSP applications.

Process

If you want to create a BSP, you do not usually need to consider the MIME Type of the page. The SAP Web Application Server selects the correct type and sends it in the header of the HTTP response. In the case of pages with the filename extensions .htm or .html, the MIME type is usually text/html.

But what happens, for example, if you want to display the page on a WAP mobile phone and therefore want to use WML rather than HTML as the markup language? In this case, the SAP Web Application Server again selects the MIME type based on the file name extension, which for a WML page is .wml, and inserts it into the HTTP response.

Use the table SDOKMIME to assign a particular file name extension to a particular MIME type. This table contains the majority of the MIME types used in the Internet. If you want to add more types, make the relevant entries in the customer table SDOKMIME_C. Now, once you specify an appropriate file name extension for a particular file, SAP Web Application Server selects the correct MIME type.

Note

You can make the required settings in the Implementation Guide (IMG) in the respective tables. To do this, in the SAP Reference IMG, choose Start of the navigation path SAP Web Application Server Next navigation step Basis Services Next navigation step Knowledge Provider Next navigation step Document Management Service End of the navigation path. Then choose the activities Define MIME Type for File Name Extension and Define File Name Extension for MIME Type.

Every activity has accompanying documentation.

In practice, the need will also arise to set the MIME type dynamically. To do this, call the following method in the event handler that determines the page:

runtime->server->response->set_header_field

Example

For example, if the content is an XML document, the call looks like this:

call method runtime->server->response->set_header_field
exporting         name  = 'content-type'
                  value = 'text/xml'.