tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Tapestry Wiki] Update of "Tapestry5Utf8Encoding" by YoshikazuKuramochi
Date Fri, 14 Mar 2008 16:39:38 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tapestry Wiki" for change notification.

The following page has been changed by YoshikazuKuramochi:
http://wiki.apache.org/tapestry/Tapestry5Utf8Encoding

The comment on the change is:
Utf8Filter with tapestry-upload

------------------------------------------------------------------------------
  = How to use UTF-8 encoding in T5 =
  
- T5.0.5 now supports UTF-8 encoding by default and doesn't need the decoratePageResponseRenderer()
below. The Utf8Filter changes are still needed to decode form submissions.
+ T5.0.5 now supports UTF-8 encoding by default and doesn't need the decoratePageResponseRenderer()
below. The Utf8``Filter changes are still needed to decode form submissions.
  
  Follow the instructions below to use "foreign" characters, i.e. ones outside ISO-8859-1.
  
@@ -62, +62 @@

  
  }}}
  
+ == Utf8Filter with tapestry-upload ==
+ 
+ If you use file upload form with fields, in order to decode the field values properly Utf8``Filter
needs to implement Http``Servlet``Request``Filter instead of Request``Filter and add the filter
before Multipart``Filter.
+ 
+ {{{
+     public HttpServletRequestFilter buildUtf8Filter()
+     {
+         return new HttpServletRequestFilter()
+         {
+             public boolean service(HttpServletRequest request, HttpServletResponse response,
+                     HttpServletRequestHandler handler) throws IOException
+             {
+                 request.setCharacterEncoding("UTF-8");
+                 return handler.service(request, response);
+             }
+         };
+     }
+ 
+     public void contributeHttpServletRequestHandler(
+             OrderedConfiguration<HttpServletRequestFilter> configuration,
+             @InjectService("Utf8Filter")
+             HttpServletRequestFilter utf8Filter)
+     {
+         configuration.add("Utf8Filter", utf8Filter, "before:MultipartFilter");
+     }
+ }}}
+ 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Mime
View raw message