org.opennms.web
Class AddRefreshHeaderFilter

java.lang.Object
  extended by org.opennms.web.AddRefreshHeaderFilter
All Implemented Interfaces:
Filter

public class AddRefreshHeaderFilter
extends Object
implements Filter

A filter that adds an HTTP Refresh header to a servlet or JSP's response. The amount of time to wait before refresh is configurable.

Author:
Lawrence Karnowski , OpenNMS

Field Summary
protected  FilterConfig filterConfig
           
protected  String seconds
           
 
Constructor Summary
AddRefreshHeaderFilter()
           
 
Method Summary
 void destroy()
           
 void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
          Adds a Refresh HTTP header before processing the request.
 void init(FilterConfig config)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filterConfig

protected FilterConfig filterConfig

seconds

protected String seconds
Constructor Detail

AddRefreshHeaderFilter

public AddRefreshHeaderFilter()
Method Detail

doFilter

public void doFilter(ServletRequest request,
                     ServletResponse response,
                     FilterChain chain)
              throws IOException,
                     ServletException
Adds a Refresh HTTP header before processing the request.

This is a strange implementation, because intuitively, you would add the header after the content has been produced (in other words, after you had already called FilterChain.doFilter. However, the Servlet 2.3 spec (proposed final draft) states (albeitly in an off-handed fashion) that you can only "examine" the response headers after the doFilter call. Evidently this means that you cannot change the headers after the doFilter. If you call setHeader nothing happens.

Specified by:
doFilter in interface Filter
Throws:
IOException
ServletException

init

public void init(FilterConfig config)
Specified by:
init in interface Filter

destroy

public void destroy()
Specified by:
destroy in interface Filter


Copyright © 2009. All Rights Reserved.