Package edu.uiuc.ncsa.security.servlet
Class MyTomcatFilter
- java.lang.Object
-
- edu.uiuc.ncsa.security.servlet.MyTomcatFilter
-
- All Implemented Interfaces:
javax.servlet.Filter
public class MyTomcatFilter extends Object implements javax.servlet.Filter
A really basic filter. Any path that starts with a "/pages" or a "/static" is intercepted and passed to the default java servlet that Tomcat runs. Your static content goes into the directory named static and your other content is served from the directory called pages. This fixes a feature of Tomcat 6 that allowed the default servlet to serve up static content from the top-level directory including possibly sensitive information. Tomcat 7 prohibits this, so we have to route static requests ourselves.Note that this (or some other similar filter) must be specified in your deployment descriptor (web.xml file) in order to serve up static pages.
Created by Jeff Gaynor
on 3/27/12 at 11:11 AM
-
-
Constructor Summary
Constructors Constructor Description MyTomcatFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
void
doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
void
init(javax.servlet.FilterConfig filterConfig)
-
-
-
Method Detail
-
destroy
public void destroy()
- Specified by:
destroy
in interfacejavax.servlet.Filter
-
init
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
- Specified by:
init
in interfacejavax.servlet.Filter
- Throws:
javax.servlet.ServletException
-
doFilter
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
- Specified by:
doFilter
in interfacejavax.servlet.Filter
- Throws:
IOException
javax.servlet.ServletException
-
-