On Monday, October 6, 2003, at 01:37 AM, Nathan Bubna wrote:
Daniel L. Rall said:Nathan Bubna wrote:...Daniel L. Rall said:outputbut what really bugs me is that the string manipulation apparently will occur for every request, whether dynamic selection ofencoding occurs for that request or not. when i port this to the VVS, i'd
rather implement it in a way that only does the manipulation when it'sneeded, ...Gotcha. The dynamic selection check always has to occur. Changes to saveonstring manipulation would be preferable, but in the grand scheme of things IThat
didn't see saving on a single StringBuffer worth spending much time on.not withstanding, I'm be happy to discuss any improvement proposal you come
up with.
alright. after looking a little more at your content-type code, the servlet
API, and Matthew Payne's proposal, here's what i'm leaning toward for the VVS
(no opinion yet as to whether VelocityServlet should do the same):
1. take Matthew's suggestion and use response.getWriter() instead of getOutputStream(). (also use getWriter() in the error() method.)
I think we should do this in VelocityServlet for consistency. I'd like to see VS go and point people towards VVS, but for backwards compat, we should keep it around.
2. drop any explicit dealings with encoding in the VVS. note that we can do
this only if we do #1. this is because according to
http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ ServletResponse.html#getWriter()
determination of the PrintWriter's encoding is determined by
response.setContentType(str) (as long as it's called before getWriter(), and
it is). this should make the VVS's setContentType(req,res) sufficient, and we
won't need to mess with encoding stuff during mergeTemplate() anymore.
so, for those wanting to set the charset (character encoding) per-application,
they then need only set it as part of their content-type in their
velocity.properties. (i suppose we could also still accept an encoding
separately in velocity.props and concat it to the content-type during servlet
init)
Won't that be confusing?
for those wanting per-request configuration of the charset, they can override
the VVS's setContentType(req, res) method to implement this as they please.
(though i'm open to suggestions on ways to make this easier for them, if you
like.)
thoughts?
Nathan Bubna [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Geir Magnusson Jr 203-247-1713(m) [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
