tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Purcell" <>
Subject filter question
Date Wed, 23 Feb 2005 19:49:01 GMT
I am having trouble with a filter. Code below.
What I am trying to achieve is as follows: We have a current web-site, with a lot of jsp pages,
etc. We are moving the code to a load-balanced environment, and I would like to put a hidden
"IP" address into each display page. This way I can know which environment the page came from
when debugging, etc.
I figured I could use a 'filter' and have each page insert the IP into itself in a hidden
field. I am unable to achieve my goal and could use a hand if anyone has experience with this.
Is this possible, or will I have to write into a header and then edit each jsp page to show
the value?
Here is what I have, but it does not print anything on pages.
And I have the servlet code from SCWCD book
package chapter18;
import javax.servlet.*;

public class HelloWorldFilter
    implements Filter
    public void destroy()
    public void doFilter(ServletRequest servletrequest, ServletResponse servletresponse, FilterChain
        throws ServletException, IOException
        PrintWriter printwriter = servletresponse.getWriter();
    public void init(FilterConfig filterconfig)
        filterConfig = filterconfig;
        System.out.println("Chapter 18: HelloWorldFilter initialized");
    public HelloWorldFilter()
    private FilterConfig filterConfig;

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message