Glock, Thomas schrieb:

My flex client httpservice by default only sets the content-type request header to "application/x-www-form-urlencoded" what it needed to do for tomcat is set the content-type request header to content-type = "application/x-www-form-urlencoded; charset=UTF-8";

As some browsers do not send this particular content-type correctly ( at least Firefox and Safari skip the "charset=utf-8" part),
I added a servlet.Filter :

public class RequestCharset2utf8Filter implements javax.servlet.Filter {
...
        public void doFilter(ServletRequest req, ServletResponse res, 
FilterChain chain) throws IOException, ServletException {
                request.setCharacterEncoding("UTF-8");
                chain.doFilter( req, res);
        }
}

as the first filter to my webapp:
in web.xml:

 <filter>
     <filter-name>CharsetEncodingFilter</filter-name>
     <filter-class>my.package.servlet.RequestCharset2utf8Filter</filter-class>
 </filter>
 <filter-mapping>
  <filter-name>CharsetEncodingFilter</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>


I run it on tomcat 6.0.18 .

And:
wonder is of course right, but life isn't all beer and skittles.

--
mit freundlichem Gruß,

Frank Wesemann
Fotofinder GmbH         USt-IdNr. DE812854514
Software Entwicklung    Web: http://www.fotofinder.com/
Potsdamer Str. 96       Tel: +49 30 25 79 28 90
10785 Berlin            Fax: +49 30 25 79 28 999

Sitz: Berlin
Amtsgericht Berlin Charlottenburg (HRB 73099)
Geschäftsführer: Ali Paczensky



Reply via email to