Skip to content

Instantly share code, notes, and snippets.

@vvasabi
Created May 15, 2012 04:56
Show Gist options
  • Save vvasabi/2699227 to your computer and use it in GitHub Desktop.
Save vvasabi/2699227 to your computer and use it in GitHub Desktop.
Filter that wraps request in CustomRequestWrapper
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
public class WrapRequestFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
// NOOP
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
chain.doFilter(new CustomRequestWrapper((HttpServletRequest)request),
response);
}
@Override
public void destroy() {
// NOOP
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment