org.apache.tapestry
Class RedirectFilter

java.lang.Object
  extended byorg.apache.tapestry.RedirectFilter
All Implemented Interfaces:
javax.servlet.Filter

public class RedirectFilter
extends java.lang.Object
implements javax.servlet.Filter

Filter used to redirect a root context URL (i.e., "/context" or "/context/" to the Tapestry application servlet (typically, "/context/app"). This servlet is mapped to "/" and must have a <init-parameter&;gt; redirect-path that is the application servlet's path (i.e., "/app"). If no value is specified, then "/app" is used. The path is always relative to the servlet context, and should always begin with a leading slash.

Filters are only available in Servlet API 2.3 and above.

Servlet API 2.4 is expected to allow a servlets in the welcome list (equivalent to index.html or index.jsp), at which point this filter should no longer be necessary.

Since:
3.0
Author:
Howard Lewis Ship

Field Summary
static java.lang.String REDIRECT_PATH_PARAM
           
 
Constructor Summary
RedirectFilter()
           
 
Method Summary
 void destroy()
           
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
          This filter intercepts the so-called "default" servlet, whose job is to provide access to standard resources packaged within the web application context.
 void init(javax.servlet.FilterConfig config)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REDIRECT_PATH_PARAM

public static final java.lang.String REDIRECT_PATH_PARAM
See Also:
Constant Field Values
Constructor Detail

RedirectFilter

public RedirectFilter()
Method Detail

init

public void init(javax.servlet.FilterConfig config)
          throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Filter
Throws:
javax.servlet.ServletException

destroy

public void destroy()
Specified by:
destroy in interface javax.servlet.Filter

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain chain)
              throws java.io.IOException,
                     javax.servlet.ServletException
This filter intercepts the so-called "default" servlet, whose job is to provide access to standard resources packaged within the web application context. This code is interested in only the very root, redirecting to the appropriate Tapestry application servlet. Other values are passed through unchanged.

Specified by:
doFilter in interface javax.servlet.Filter
Throws:
java.io.IOException
javax.servlet.ServletException