Sun Java System Web Server 7.0 Administrator's Configuration File Reference

Chapter 8 MIME Types

The MIME types file in the config directory contains mappings between the Multipurpose Internet Mail Extensions (MIME) types and file extensions. For example, the MIME types file maps the extensions .html and .htm to the type text/html:

type=text/html exts=htm,html

When the Web Server receives a request from a client, it uses the MIME type mappings to determine the kind of resource that is requested.

MIME types are defined by three attributes: language (lang), encoding (enc), and content type (type). At least one of these attributes must be present for each type. The most commonly used attribute is type. The server frequently considers the type when deciding how to generate the response to the client. The enc and lang attributes are rarely used. The default MIME types file is mime.types.

This chapter discusses the following sections:

Determining the MIME Type

During the ObjectType stage in the request handling process, the server determines the MIME type attributes of the resource requested by the client. You can use different SAFs to determine the MIME type. The most commonly used SAF is type-by-extension, which tells the server to look up the MIME type according to the requested resource’s file extension in the MIME types table. The MIME types table is stored in a MIME type file. For more information on the format of this file, see MIME Types Syntax.

The directive in obj.conf that tells the server to look up the MIME type according to the extension is:

ObjectType fn=type-by-extension

If the server uses a different SAF, such as force-type to determine the type, the MIME types table is not used for that particular request.

For more details, see ObjectType.

Referencing MIME Types Files in server.xml

If you create MIME type files, you must reference them in server.xml using the mime-file element. Because the mime-file element can appear as a child element of both the server and virtual-server elements, you can create MIME types files that apply to the entire server or only to specific virtual servers. For more information, see mime-file.

Generating the Server Response Using the MIME Type

The server considers the value of the type attribute when deciding which Service directive in obj.conf to use to generate the response to the client.

By default, if the type does not start with magnus-internal/, the server sends the requested file to the client. The directive in obj.conf that contains this instruction is:

Service method=(GET|HEAD|POST) type=*~magnus-internal/* fn=send-file

By convention, all values of type that require the server to do something other than just send the requested resource to the client start with magnus-internal/.

For example, if the requested resource’s file extension is .map, the type is mapped to magnus-internal/imagemap. If the extension is .cgi, .exe, or .bat, the type is set to magnus-internal/cgi:


type=magnus-internal/imagemap       exts=map
type=magnus-internal/cgi            exts=cgi,exe,bat

If the type starts with magnus-internal/, the server executes whichever Service directive in obj.conf matches the specified type. For example, if the type is magnus-internal/imagemap, the server uses the imagemap function to generate the response to the client, as indicated by the following directive:

Service method=(GET|HEAD) type=magnus-internal/imagemap fn=imagemap

Processing the Response in the Client Using the MIME Type

The Service function generates the data and sends it to the client that made the request. When the server sends the data to the client, it also sends headers. These headers include whichever MIME type attributes are known (which is usually type).

When the client receives the data, it uses the MIME type to decide what to do with the data. For browser clients, the browser usually displays the data in the browser window.

If the requested resource cannot be displayed in a browser but needs to be handled by another application, its type starts with application/, for example application/octet-stream (for .bin file extensions) or application/x-maker (for .fm file extensions). The client has its own set of user-editable mappings that tells it which application to use to handle which types of data.

For example, if the type is application/x-maker, the client usually handles it by opening Adobe® FrameMaker® to display the file.

MIME Types Syntax

The first line in the MIME types file identifies the file format:

#--Sun Microsystems MIME Information

Other uncommented lines have the following format:

type=type/subtype exts=[file extensions]

Sample MIME Types File

A sample of the MIME types file is as follows:

#--Sun Microsystems Inc. MIME Information
# Do not delete the above line. It is used to identify the file type.
#
# Copyright (c) 2006 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

type=application/octet-stream                    exts=bin
type=application/astound                         exts=asd,asn
type=application/fastman                         exts=lcc
type=application/java-archive                    exts=jar
type=application/java-serialized-object          exts=ser
type=application/java-vm                         exts=class
type=application/mac-binhex40                    exts=hqx
type=application/x-stuffit                       exts=sit
type=application/mbedlet                         exts=mbd
type=application/msword                          exts=doc,dot,wiz,rtf
type=application/oda                             exts=oda
type=application/pdf                             exts=pdf
type=application/postscript                      exts=ai,eps,ps
type=application/studiom                         exts=smp
type=application/timbuktu                        exts=tbt
type=application/vnd.ms-excel                    exts=xls,xlw,xla,xlc,xlm,xlt
type=application/vnd.ms-powerpoint               exts=ppt,pps,pot
type=application/vnd.ms-project                  exts=mpp
type=application/winhlp                          exts=hlp
type=application/x-javascript                    exts=js
type=application/x-javascript;charset=UTF-8      exts=jsu
type=application/x-java-jnlp-file                exts=jnlp
type=application/x-aim                           exts=aim
type=application/x-asap                          exts=asp
type=application/x-csh                           exts=csh
type=application/x-dvi                           exts=dvi
type=application/x-earthtime                     exts=etc
type=application/x-envoy                         exts=evy
type=application/x-gtar                          exts=gtar
type=application/x-cpio                          exts=cpio
type=application/x-hdf                           exts=hdf
type=application/x-latex                         exts=latex
type=application/x-javascript-config             exts=jsc
type=application/x-maker                         exts=fm
type=application/x-mif                           exts=mif,mi
type=application/x-mocha                         exts=mocha,moc
type=application/x-msaccess                      exts=mdb
type=application/x-mscardfile                    exts=crd
type=application/x-msclip                        exts=clp
type=application/x-msmediaview                   exts=m13,m14
type=application/x-msmetafile                    exts=wmf
type=application/x-msmoney                       exts=mny
type=application/x-mspublisher                   exts=pub
type=application/x-msschedule                    exts=scd
type=application/x-msterminal                    exts=trm
type=application/x-mswrite                       exts=wri
type=application/x-NET-Install                   exts=ins
type=application/x-netcdf                        exts=nc,cdf
type=application/x-ns-proxy-autoconfig           exts=proxy
type=application/x-salsa                         exts=slc
type=application/x-sh                            exts=sh
type=application/x-shar                          exts=shar
type=application/x-sprite                        exts=spr,sprite
type=application/x-tar                           exts=tar
type=application/x-tcl                           exts=tcl
type=application/x-perl                          exts=pl
type=application/x-tex                           exts=tex
type=application/x-texinfo                       exts=texinfo,texi
type=application/x-timbuktu                      exts=tbp
type=application/x-tkined                        exts=tki,tkined
type=application/x-troff-man                     exts=man
type=application/x-troff-me                      exts=me
type=application/x-troff-ms                      exts=ms
type=application/x-troff                         exts=t,tr,roff
type=application/x-wais-source                   exts=src
type=application/zip                             exts=zip
type=application/pre-encrypted                   exts=enc
type=application/x-pkcs7-crl                     exts=crl
type=application/x-fortezza-ckl                  exts=ckl
type=application/xml-dtd                         exts=dtd

type=audio/basic                                 exts=au,snd
type=audio/echospeech                            exts=es,esl
type=audio/midi                                  exts=midi,mid
type=audio/x-aiff                                exts=aif,aiff,aifc
type=audio/x-wav                                 exts=wav
type=audio/x-pn-realaudio                        exts=ra,ram
type=audio/x-pac                                 exts=pac
type=audio/x-epac                                exts=pae
type=audio/x-liveaudio                           exts=lam

type=drawing/x-dwf                               exts=dwf

type=image/fif                                   exts=fif
type=image/x-icon                                exts=ico
type=image/gif                                   exts=gif
type=image/ief                                   exts=ief
type=image/ifs                                   exts=ifs
type=image/jpeg                                  exts=jpeg,jpg,jpe,jfif,pjpeg,pjp
type=image/png                                   exts=png
type=image/tiff                                  exts=tiff,tif
type=image/vnd                                   exts=dwg,svf
type=image/wavelet                               exts=wi
type=image/bmp                                   exts=bmp
type=image/x-photo-cd                            exts=pcd
type=image/x-cmu-raster                          exts=ras
type=image/x-portable-anymap                     exts=pnm
type=image/x-portable-bitmap                     exts=pbm
type=image/x-portable-graymap                    exts=pgm
type=image/x-portable-pixmap                     exts=ppm
type=image/x-rgb                                 exts=rgb
type=image/x-xbitmap                             exts=xbm
type=image/x-xpixmap                             exts=xpm
type=image/x-xwindowdump                         exts=xwd

type=text/css                                    exts=css

type=text/html                                   exts=htm,html
type=text/plain                                  exts=txt
type=text/richtext                               exts=rtx
type=text/tab-separated-values                   exts=tsv
type=text/x-setext                               exts=etx
type=text/x-speech                               exts=talk
type=text/xml                                    exts=xml
type=text/xul                                    exts=xul

type=video/isivideo                              exts=fvi
type=video/mpeg                                  exts=mpeg,mpg,mpe,mpv,vbs,mpegv
type=video/x-mpeg2                               exts=mpv2,mp2v
type=video/msvideo                               exts=avi
type=video/quicktime                             exts=qt,mov,moov
type=video/vivo                                  exts=viv,vivo
type=video/wavelet                               exts=wv
type=video/x-sgi-movie                           exts=movie

type=x-world/x-svr                               exts=svr
type=x-world/x-vrml                              exts=wrl
type=x-world/x-vrt                               exts=vrt

type=x-conference/x-cooltalk                     exts=ice

enc=x-gzip                                       exts=gz
enc=x-compress                                   exts=z
enc=x-uuencode                                   exts=uu,uue

type=magnus-internal/imagemap                    exts=map
type=magnus-internal/parsed-html                 exts=shtml
type=magnus-internal/cgi                         exts=cgi,exe,bat

type=application/x-x509-ca-cert                  exts=cacert

type=application/x-x509-server-cert              exts=scert
type=application/x-x509-user-cert                exts=ucert
type=application/x-x509-email-cert               exts=ecert

type=application/vnd.sun.xml.writer              exts=sxw
type=application/vnd.sun.xml.writer.template     exts=stw
type=application/vnd.sun.xml.calc                exts=sxc
type=application/vnd.sun.xml.calc.template       exts=stc
type=application/vnd.sun.xml.draw                exts=sxd
type=application/vnd.sun.xml.draw.template       exts=std
type=application/vnd.sun.xml.impress             exts=sxi
type=application/vnd.sun.xml.impress.template    exts=sti
type=application/vnd.sun.xml.writer.global       exts=sxg
type=application/vnd.sun.xml.math                exts=sxm

type=application/vnd.stardivision.writer         exts=sdw
type=application/vnd.stardivision.writer-global  exts=sgl
type=application/vnd.stardivision.calc           exts=sdc
type=application/vnd.stardivision.draw           exts=sda
type=application/vnd.stardivision.impress        exts=sdd
type=application/vnd.stardivision.impress-packed exts=sdp
type=application/vnd.stardivision.math           exts=smf,sdf
type=application/vnd.stardivision.chart          exts=sds
type=application/vnd.stardivision.mail           exts=sdm