i18n, Shift_JIS, Chinese BIG5, GB2312, Russian KOI8-R, Apache Tomcat
i18n (Internationalization) for Servlets/JSP on Apache Tomcat. HTTP request with 2 bytes characters (Japanese Shift_JIS, Chinese BIG5, Chinese GB2312 or Russian KOI8-R). HTTP response for Locale.
This page lists the Java API, patch and article related with Internationalization (i18n).
|
 |
: Product by OOP-Research |
 |
: Documentation written by OOP-Research |
 |
: Patch for the other vendor's system |
In the template framework design by OOP ViewGenerator API, all the response can be generated from the normal HTML (or any other mark-up languages such as XHTML, WML or HDML).
Unlike the JSP/JSTL based-solutions (such as Apache Struts and JavaServer Faces), the web designers (or page authors) need not learn a bit of custom tag libraries.
They can write the view part of the web applications in the normal HTML, by their favorite ways.
HTML-to-XML conversion tool (with Java Swing GUI) converts the normal HTML into the template XML.
You can also specify the acceptable data type for the request parameters from the CGI FORM:
[HtmlToXml]
Once you finish the conversion, please place the generated XML into:
- (docBase)/WEB-INF/classes
directory (or its sub-directories).
Then, ViewGenerator API in your Servlet will read it.
Your Servlet can insert the arbitrary Strings into the HTML fragments and send the concatenated HTML tags to the web browser.
Because the XML includes the acceptable data types from the CGI FORM, a few lines of code are enough for the input validation in your Servlet.
In addition, this Java API makes the localization (L10n, Japanese message for Japanese users and Chinese message for Chinese users) of your Servlet much easier.
In case of Apache Struts or JavaServer Faces, the localized messages should be written in the property resource file for the expected Locale.
But, in this framework, what you need is to write the normal HTML for each expected Locale along with the localized messages.
There is not difficulty even in the 2 bytes characters such as Japanese Shift_JIS, Chinese BIG5 or GB2312.
This Java API parses InputStream of HTTP POST request with multipart/form-data encode.
By this Java API, only the single method call is enough for your file upload Servlets or JSP.
The uploaded file can be saved on the file system.
Your Servlets/JSP has the full control over where to save the uploaded files.
Or if you don't want to save the uploaded files, your Servlets/JSP can get the binary contents, the file name and the Content-Type of the uploaded files.
You can restrict the size of file to be uploaded.
Since 2.0, you can also restrict the mime-types (Content-Type) of the files to be uploaded.
As for the image file (JPEG, GIF or PNG), you can set the maximum width/height.
When the user tries to upload the larger files or the files of the invalid mime-types, this API will throw the exception, i.e. your Servlets/JSP has a chance to catch the exception and show the appropriate message.
Optionally, this Java API can check if the binary contents of the uploaded file are really the PNG, JPEG, GIF or PDF.
If the binary contents do not match with the expected pattern of PNG, JPEG, GIF or PDF, this Java API throws the exception.
By this way, your JSP/Servlet can prevent the fake file being uploaded.
In addition, your Servlets/JSP on Apache Tomcat can specify the charset used for parsing the text parameters in HTTP POST request with multipart/form-data encoding.
By this way, your Servlets/JSP on Apache Tomcat can parse the multipart/form-data with any charset, even if it is 2 bytes characters such as Japanese Shift_JIS, Chinese BIG5, Chinese GB2312 or Russian KOI8-R.
This Java API stores the HTTP request parameters into the SQL table through JDBC. The unique ID is issued for each request, and another JSP / Servlet can use it to get the parameter values later.
Within the SQL table, the parameter values are stored in the form of URL-encoded String. Regardless of the configuration of the SQL database, the request parameters in the various charsets (including the 2 byte character such as Japanese Shift_JIS, Chinese BIG5, Chinese GB2312 or Russian KOI8-R) can be stored into the single database.
This strategy also eliminates the unnecessary byte-to-String conversion.
With its easy programming interface, a few lines of code are enough for your interactive web applications and WAP services on Apache Tomcat.
Tomcat3.1 is the implementation of JavaServerPages1.1 and Servle2.2 specification and developed and maintained by the Jakarta Project. This is an un-official patch for Tomcat3.1.
We, the developers in the Tomcat developer mailing list), have talked about the Servlets Specification v2.2 and JSP Specification v1.1, and I resumed my proposal based on such a discussion. I'm eager to hear your opinion to my proposal!
|
|
Caution!
|
All the APIs for Servlet/JSP introduced by this web site are now included in Bento framework:
- Simpler than JSTL or Apache Struts
- MVC framework by HTML
- Input validation from CGI FORM
- Easy user authentication
- Easy localization (L10n)
To download the APIs and source code examples, please visit the web site of Bento framework.
|
|