Language and File Types
Oracle Application Server Tips by Burleson
The next section of the httpd.conf file
deals with file types or mime support. Again, this section is
inside a Block Directive, and will only be read if the test returns
true. Mime support provides metadata about files, so that OHS
can service requests correctly, or if necessary, pass that
information to the client so that they can handle the file
correctly. We saw this in action with the MultiViews option
above. A good example is language support.
OHS uses the module mod_negotiation to
select the correct file using file mappings, or by executing a
filename pattern match and choosing from the results. Files
used by OHS to service requests can have multiple extensions. The
order of the extension does not matter unless OHS cannot identify an
extension. In that case, OHS uses the extensions to the right
of the unidentified extension only. For example:
In the three files above, we have defined
types for html and en, but not for jwg. The first two files
are identified as an HTML file associated with the language English.
The last file is only identified as an HTML file and no language
information can be determined. So, the order file extensions
added are irrelevant, as long as the undefined extensions are to the
left of the defined extensions. Also, extensions are case
sensitive (.z and .Z are two different extensions). Lets
return to our httpd.conf file and walk through this section.
AddEncoding x-compress Z
AddEncoding x-gzip gz tgz
The fist step is to read a file that is used
to define a long list of file types called mime.types. Next,
it defines additional extensions for compressed files.
This mapping is added to existing mapping and will override any
mappings that already exist for these extensions. The above
example marks a file with the .Z extension as encoded using
x-compress, and any file with the .gz or .tgz as encoded using x-gzip.
Now lets look at the language types and
character sets. When a client browser initiates a request, it
supplies a heading that also identifies the preferred language.
The preferred language is used to determine which file to serve that
browser if there are a number of files to select from. Taking
another section from the httpd.conf file:
AddLanguage da .da
AddLanguage nl .nl
AddLanguage en .en
AddLanguage et .ee
AddLanguage fr .fr
AddLanguage de .de
AddLanguage el .el
AddLanguage es .es_ES
AddLanguage he .he
AddCharset ISO-8859-8 .iso8859-8
AddLanguage it .it
AddLanguage ja .ja
AddCharset ISO-2022-JP .jis
AddLanguage ko .ko
AddLanguage kr .kr
AddCharset ISO-2022-KR .iso-kr
AddLanguage no .no
AddLanguage pl .po
AddCharset ISO-8859-2 .iso-pl
AddLanguage pt .pt
AddLanguage pt-br .pt-br
AddLanguage pt-BR .pt_BR
In this section we define file extensions
that support different languages. Using the AddLanguage
directive allows you to map an extension to a language code.
Normally, the extension is the same as the language code, however,
some will differ.
The language code for Poland is pl, however,
the .pl extension usually denotes a Perl script. Thus, we can
map .po to the language code pl and use the .po extension on the
Another thing to note is that documents in
some languages need a specific character set to properly display.
This can be defined using the AddCharset directive. For
example, the Korean language code is kr. We can see above that it
maps to the .kr extension. However, for the browser to
properly display this document, it needs to also know which
character set to use. The character set ISO-2022-KR is mapped
to the extension .iso-kr. Thus, a document in the format
filename.html.iso-kr.kr is an html document that requires the
ISO-2022-KR character set and is in Korean.
It is important to note that an extension
can only be mapped to one language. In the code segment below,
.en is mapped only to kr while both .po and .pl are mapped to
AddLanguage en .en
AddLanguage pl .pl
AddLanguage pl .po
AddLanguage kr .en
If more than one mapping is present for a
single extension, the last occurrence is used. The final step
in defining language support is to provide a priority list, so that
if two files tie, OHS will know which to use.
LanguagePriority en da nl et de el it ja kr no pl pt pt-br ru
This nested Block Directive establishes a
priority list in descending order to be used by the module
mod_negotiation to break a tie. Note that it is a language
list, not an extensions list.
final directive dealing with file types is the location of the magic
file. This file is used by the module mod_mime_magic and is
normally located in the ServerRoot/conf directory. This module
will look into an unknown file and use the definitions in the magic
file to try and determine the file type.
This is an excerpt from "Oracle
10g Application Server Administration Handbook" by Don Burleson
and John Garmany.