tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "bognár, attila" <attila.bog...@netalfa.com>
Subject Re: x-forwarded-for
Date Fri, 18 Apr 2003 15:15:18 GMT


Tim Funk írta:
> You can fake it in a filter by using a wrapper like this:
> 
> public void doFilter(ServletRequest request,
>                      ServletResponse response,
>                      FilterChain chain)
>               throws java.io.IOException,
>                      ServletException {
> 
>     HttpServletRequest hreq = (HttpServletRequest)request;
> 
>     ServletRequest r = new HttpServletRequestWrapper(hreq) {
>                          public String getRemoteAddr() {
>                return getRequest().getHeader("x-forwarded-for");
>                          }
>                          public String getRemoteHost() {
>                return getRemoteAddr();
>                          }
>                        };
>     chain.doFilter(r, response);
> }
> 
> -Tim

thanks for the idea, I will meditate on it and its consequences 
(benefits/drawbacks).

attila



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message