1 25 package org.snipsnap.net.filter; 26 27 import org.radeox.util.logging.Logger; 28 import org.snipsnap.app.Application; 29 import org.snipsnap.config.Globals; 30 31 import javax.servlet.Filter ; 32 import javax.servlet.FilterChain ; 33 import javax.servlet.FilterConfig ; 34 import javax.servlet.ServletException ; 35 import javax.servlet.ServletRequest ; 36 import javax.servlet.ServletResponse ; 37 import javax.servlet.http.HttpServletRequest ; 38 import java.io.IOException ; 39 import java.io.UnsupportedEncodingException ; 40 41 47 public class EncRequestFilter implements Filter { 48 49 public void init(FilterConfig config) throws ServletException { 50 } 51 52 public void destroy() { 53 } 54 55 public void doFilter(ServletRequest request, ServletResponse response, 56 FilterChain chain) throws IOException , ServletException { 57 System.out.println("EncRequestFilter"); 58 HttpServletRequest req = (HttpServletRequest ) request; 59 60 try { 63 req = new EncRequestWrapper(req, req.getCharacterEncoding()); 64 } catch (UnsupportedEncodingException e) { 65 Logger.log(Logger.FATAL, "InitFilter: unsupported encoding '" + req.getCharacterEncoding() + "'", e); 66 } 67 68 chain.doFilter(req, response); 69 } 70 } | Popular Tags |