Chapter 23 Creating Java Servlets
Jaguar supports the HTTP 1.1 internationalization features defined in the Java Servlet 2.2 specification. Using these features, you can develop servlets that respond in the language specified by the request header, or configure localized versions of Web site's static pages.
For complete information about HTTP 1.1 internationalization, refer to the Java Servlet 2.2 specification and the HTTP 1.1 specification.
HTTP 1.1 supports internationalization via an accept-language header that can be included in requests. The accept-language headers describe the languages the client accepts. For example, if documents are stored on the server in Japanese and English, clients that use Japanese as the accept-language header receive the Japanese version of the page. When clients use English as the accept-language header, they receive the English version. Accept-language headers can be sent only by Web browsers that use the HTTP 1.1 protocol.
The com.sybase.jaguar.server.http.acceptlang property determines whether Jaguar parses accept-language headers to respond to requests for localized content. To enable accept-language header parsing, set this property to true using the All Properties tab in the Server Properties window in Jaguar Manager.
For servlet development, Jaguar supports internationalization compliant methods that are described in the Java Servlet 2.2 specification. These methods, getLocale and getLocales on the ServletRequest interface and setLocale on the ServletResponse interface:
A separate directory is required for each supported language along with a default directory. Jaguar refers to these directories to locate different language versions of a document. For example, if the client requests the URL:
http://www.someplace.com/somepage.html
and Jaguar supports English and French. There will be two versions of the page on the server plus the default:
http://www.someplace.com/en/somepage.html
http://www.someplace.com/fr/somepage.html
http://www.someplace.com/somepage.html
A Language selection algorithm selects the appropriate language after evaluating the override criteria and the quality values specified. If multiple languages are specified, then the algorithm checks the various options in descending order of priority. For example, if the client requests this URL with en, fr specified in the accept-language header:
http://www.someplace.com/somepage.html
Jaguar first looks for:
http://www.someplace.com/en/somepage.html
If not found, the server looks for:
http://www.someplace.com/fr/somepage.html
If this is not found, the server tries to load the default page:
http://www.someplace.com/somepage.html
Similarly, for static web resources in a Web applications, the language name tag is prefixed to the static web resource URL to construct the URL for the resource. Jaguar provides multiple language support to the following Web application resources:
Copyright © 2000 Sybase, Inc. All rights reserved. |