WebCab.de: Content-Type

Home: WAPstacles: Content-Type

Content-Type

A WAP gateway and a WAP browser need to know how to deal with the data received from a WWW server. It's not the file extension on the server which indicates the data's format but a field in the HTTP header of the server's response. This field's or header's name is "Content-Type". In case of a WML deck the content type header must contain the value "text/vnd.wap.wml" which is a so-called MIME type. MIME is the abbreviation for "Multipurpose Internet Mail Extensions" and is specified in RFC 2045.

A complete HTTP header may look like:

HTTP/1.1 200 OK
Connection: close
Date: Sat, 04 Nov 2000 12:31:57 GMT
Accept-Ranges: bytes
Server: Apache/1.3.12
Content-Length: 970
Content-Type: text/vnd.wap.wml
ETag: "0-3ca-39eea0d8"
Last-Modified: Thu, 19 Oct 2000 07:20:56 GMT
Client-Date: Sat, 04 Nov 2000 12:31:57 GMT
Client-Peer: 127.0.0.1:80

If your WWW server's configuration doesn't know which MIME type should be sent if a WML deck has been requested then it's very probable that the server responds with the MIME type text/plain. Then the WAP gateway doesn't know that the response's content is a WML deck. It is very probable that the gateway will sent an error message like "unknown content" to the browser.

So, you need to configure your server if you store WML decks as files on it. You should also include some other new WAP MIME types to avoid problems in the future. You need to associate the files' extensions with the appropriate MIME types in the configuration.

Content MIME type Extension
WML source text/vnd.wap.wml wml
WML compiled application/vnd.wap.wmlc wmlc
Wireless BitMaps image/vnd.wap.wbmp wbmp
WMLScript source text/vnd.wap.wmlscript wmls
WMLScript compiled application/vnd.wap.wmlscriptc wmlsc

If you operate an Apache server you can add these MIME types either in the httpd.conf file or in a .htaccess file in one of your document directories.

httpd.conf:

AddType text/vnd.wap.wml .wml
AddType application/vnd.wap.wmlc .wmlc
AddType image/vnd.wap.wbmp .wbmp
AddType text/vnd.wap.wmlscript .wmls
AddType application/vnd.wap.wmlscript .wmlsc

.htaccess:

AddType text/vnd.wap.wml .wml
AddType application/vnd.wap.wmlc .wmlc
AddType image/vnd.wap.wbmp .wbmp
AddType text/vnd.wap.wmlscript .wmls
AddType application/vnd.wap.wmlscript .wmlsc

If you create the content on-the-fly on the server with an application then your application needs to send the same MIME types. You don't need to care about file extensions because the application doesn't store the content on the server.

From a WAP gateway's point of view, there is no difference in the server's response if the content has been read by the server out of a file or has been created on-the-fly by an application.

[ < Prev ] [ Next > ]

© 2000-2017 WebCab.de TM, Contact