You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by il...@apache.org on 2001/04/12 23:43:36 UTC
cvs commit: jakarta-turbine/xdocs/services mimetype-service.xml rundata-service.xml
ilkka 01/04/12 14:43:36
Modified: xdocs/services mimetype-service.xml rundata-service.xml
Log:
Added documentation about MIME types to RunDataService and MimeTypeService.
Revision Changes Path
1.4 +63 -29 jakarta-turbine/xdocs/services/mimetype-service.xml
Index: mimetype-service.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine/xdocs/services/mimetype-service.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- mimetype-service.xml 2001/04/12 01:11:17 1.3
+++ mimetype-service.xml 2001/04/12 21:43:36 1.4
@@ -11,8 +11,11 @@
<section name="Mimetype Service">
<p>
-This service provides support for locale specific character encodings in
-the RunData interface and its default implementation.
+The MimeType Service maintains mappings between MIME types and
+the corresponding file name extensions, and between locales and
+character encodings. The mappings are typically defined in
+properties or files located in user's home directory, Java home
+directory or the current class jar depending on the implementation.
</p>
</section>
@@ -36,6 +39,29 @@
.
.
.
+# -------------------------------------------------------------------
+#
+# M I M E T Y P E S E R V I C E
+#
+# -------------------------------------------------------------------
+
+# This property specifies a file containing mappings between MIME
+# content types and the corresponding file name extensions. The
+# service itself contains a hardcoded set of most common mappings.
+# The file must use the same syntax as the mime.types file of
+# the Apache Server, i.e.
+# <mimetype> <ext1> <ext2>...
+#
+#services.MimeTypeService.mime.types=/WEB-INF/conf/mime.types
+
+# This property specifies a file containing mappings between locales
+# and the corresponding character encodings. The service itself
+# contains a hardcoded set of most common mappings.
+# The file should use the Java property file syntax, i.e.
+# <lang_country_variant>=<charset>
+#
+#services.MimeTypeService.charsets=/WEB-INF/conf/charset.properties
+
]]></source>
</section>
@@ -43,40 +69,26 @@
<section name="Usage">
<p>
-The RunData interface has new methods, getLocale() and setLocale(), with
-which to specify explicitly the locale for the servlet response. If
-setLocale() is not called, the "locale.default.language" and
-"locale.default.country" properties from TR are used to determine the
-locale. If these properties are not set, the JVM's default locale determines
-the locale.
+The default RunData implementation uses the MimeType Service internally
+when resolving the character encoding of the servlet response. In addition,
+applications can use it for customized encoding and content type resolving.
</p>
<p>
-Turbine servlet and template only layouts have been updated to set the
-locale of the servlet response before writing its content.
+The mappings between locales and the corresponding character encodings
+are specified using the Java property file syntax, where the locale
+specification is the key of the property key and the charset is the value
+of the property. The locale specification consists of three parts:
</p>
-<p>
-If the locale is set to something else than the default locale or Locale.US,
-an explicit encoding is not specified with the setCharSet() method or the
-"locale.default.charset" property, and the main MIME type of the content is
-"text", the getContentType() method in the RunData interface adds a locale
-specific encoding (charset) to the content type automatically.
-</p>
-
-<p>
-It gets the charset from MimeTypeService, which maintains mappings between
-locales and charsets. A locale spec consists of three parts:
-</p>
-
<source><![CDATA[
<lang>_<country>_<variant>
]]></source>
<p>
The variant can be whatever is appropriate for the application, like a
-markup language spec, browser spec, etc. The service looks for charsets
-using the following search:
+markup language specification, a browser specification, etc. The service
+looks for charsets using the following search order:
</p>
<source><![CDATA[
@@ -89,11 +101,33 @@
<lang>=<charset>
]]></source>
+<p>
+The service contains defaults for several language mappings and more specific
+ones can be specified in an optional property file, e.g. __wml=UTF-8. The name
+of the property file can be given with a service property named "charsets".
+The service caches results of the search, which should guarantee good performance.
+</p>
+
+<p>
+The mappings between MIME types and the corresponding file name extensions
+are specified using the same syntax as the mime.types file of the Apache Server,
+i.e.:
+</p>
+
+<source><![CDATA[
+<mimetype> <ext1> <ext2>...
+]]></source>
+
+<p>
+The service contains defaults for most common MIME types, like text/plain,
+text/html, text/x-hdml, text/vnd.wap.wml, image/gif and image/jpeg. More
+specific ones can be specified in an optional MIME types file. The name of
+the MIME types file can be given with a service property named "mime.types".
+</p>
+
<p>
-The service contains defaults for several lang mappings and more specific
-ones can be defined in an optional property file, e.g. __wml=UTF-8. The name
-of the property file can be specified with a service property. The service
-caches results of the search, which should guarantee good performance.
+The TurbineMimeTypes class is a static accessor for the most common
+MimeType Service methods.
</p>
</section>
1.6 +45 -1 jakarta-turbine/xdocs/services/rundata-service.xml
Index: rundata-service.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine/xdocs/services/rundata-service.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- rundata-service.xml 2001/04/12 01:11:17 1.5
+++ rundata-service.xml 2001/04/12 21:43:36 1.6
@@ -47,6 +47,20 @@
.
.
.
+# -------------------------------------------------------------------
+#
+# R U N D A T A S E R V I C E
+#
+# -------------------------------------------------------------------
+# Default implementations of base interfaces for request processing.
+# Additional configurations can be defined by using other keys
+# in the place of the <default> key.
+# -------------------------------------------------------------------
+
+services.RunDataService.default.run.data=org.apache.turbine.services.rundata.DefaultTurbineRunData
+services.RunDataService.default.parameter.parser=org.apache.turbine.util.parser.DefaultParameterParser
+services.RunDataService.default.cookie.parser=org.apache.turbine.util.parser.DefaultCookieParser
+
]]></source>
@@ -64,8 +78,12 @@
<source><![CDATA[
+ getLocale()
+ setLocale(Locale locale)
getCharSet()
+ setCharSet(String charset)
getContentType()
+ setContentType(String mimetype)
getOut() //get PrintWriter Object
getRedirectURI()
getRemoteAddr()
@@ -79,9 +97,35 @@
]]></source>
<p>
-As always consult the Javadocs for more detail.
+The get/setLocale(), get/setCharSet() and get/setContentType() methods
+are used for specifying the locale, character encoding and content type
+of the body of the servlet response.
+</p>
+
+<p>
+The method setLocale() is called to specify explicitly the locale
+of the response. If setLocale() is not called, the "locale.default.language"
+and "locale.default.country" properties from Turbine Resources are used to
+determine the locale. If these properties are not set, the JVM's default
+locale determines the locale.
+</p>
+
+<p>
+If the locale is set to something else than the default locale or Locale.US,
+an explicit encoding is not specified with the setCharSet() method or the
+"locale.default.charset" property, and the main MIME type of the content is
+"text", the getContentType() method adds a locale specific encoding (charset)
+to the content type automatically.
+</p>
+
+<p>
+The locale specific charset is obtained from the MimeTypeService, which
+maintains mappings between locales and charsets.
</p>
+<p>
+As always consult the Javadocs for more detail.
+</p>
<p>
To use Turbine to only manipulate the functions that came with the Sun Servlet libraries is to miss out on Turbine's power. Turbine is a framework which enables manipulation of the HttpResponse and HttpRequest above and beyond the simple Servlet libraries. Turbine has services and layers surrounding those available with the Response and Request that allow easier creation and management of Websites and Web-enabled Applications. In fact you wont have to type import javax.servlet.* again!
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org