nbubna 2003/10/06 17:33:19
Modified: src/java/org/apache/velocity/tools/view/servlet
VelocityViewServlet.java
Log:
we no longer use the encoding member, so drop that.
Continue to support the output.encoding property by concatenating it to the
defaultContentType if a charset is not already specified therein and if the
output.encoding property is not merely the default.
Revision Changes Path
1.17 +24 -6
jakarta-velocity-tools/src/java/org/apache/velocity/tools/view/servlet/VelocityViewServlet.java
Index: VelocityViewServlet.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity-tools/src/java/org/apache/velocity/tools/view/servlet/VelocityViewServlet.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- VelocityViewServlet.java 7 Oct 2003 00:19:04 -0000 1.16
+++ VelocityViewServlet.java 7 Oct 2003 00:33:19 -0000 1.17
@@ -183,9 +183,6 @@
/** Cache of writers */
private static SimplePool writerPool = new SimplePool(40);
- /** The encoding to use when generating outputing. */
- private String encoding = null;
-
/** The default content type. */
private String defaultContentType;
@@ -209,9 +206,30 @@
// we can get these now that velocity is initialized
defaultContentType =
RuntimeSingleton.getString(CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
- encoding =
- RuntimeSingleton.getString(RuntimeSingleton.OUTPUT_ENCODING,
+
+ String encoding =
+ RuntimeSingleton.getString(RuntimeSingleton.OUTPUT_ENCODING,
DEFAULT_OUTPUT_ENCODING);
+
+ if (!DEFAULT_OUTPUT_ENCODING.equalsIgnoreCase(encoding))
+ {
+ int index = defaultContentType.lastIndexOf("charset");
+ if (index < 0)
+ {
+ // append character encoding to default content-type
+ defaultContentType += "; charset=" + encoding;
+ }
+ else
+ {
+ // they may have configuration issues
+ Velocity.warn("VelocityViewServlet: " +
+ "Charset was already specified in content-type. " +
+ "Output encoding property will be ignored.");
+ }
+ }
+
+ Velocity.info("VelocityViewServlet: Default content-type is: " +
+ defaultContentType);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]