com.gisgraphy.webapp.filter
Class StaticFilter

java.lang.Object
  extended by org.springframework.web.filter.GenericFilterBean
      extended by org.springframework.web.filter.OncePerRequestFilter
          extended by com.gisgraphy.webapp.filter.StaticFilter
All Implemented Interfaces:
javax.servlet.Filter, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.web.context.ServletContextAware

public class StaticFilter
extends org.springframework.web.filter.OncePerRequestFilter

A simple filter that allows the application to continue using the .html prefix for actions but also allows static files to be served up with the same extension. Dojo to serve up its HTML template code. The filter works on an include/exclude basis where all requests for active pages are redirected by the filter to thee dispatch servlet. All Dojo related .html requests are allowed to pass straight through to be processed by the servlet container as per normal.


Field Summary
 
Fields inherited from class org.springframework.web.filter.OncePerRequestFilter
ALREADY_FILTERED_SUFFIX
 
Fields inherited from class org.springframework.web.filter.GenericFilterBean
logger
 
Constructor Summary
StaticFilter()
           
 
Method Summary
 void doFilterInternal(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain chain)
          This method checks to see if the current path matches includes or excludes.
 void initFilterBean()
          Read the includes/excludes paramters and set the filter accordingly.
 
Methods inherited from class org.springframework.web.filter.OncePerRequestFilter
doFilter, getAlreadyFilteredAttributeName, shouldNotFilter
 
Methods inherited from class org.springframework.web.filter.GenericFilterBean
addRequiredProperty, afterPropertiesSet, destroy, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, setBeanName, setServletContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticFilter

public StaticFilter()
Method Detail

initFilterBean

public void initFilterBean()
Read the includes/excludes paramters and set the filter accordingly.

Overrides:
initFilterBean in class org.springframework.web.filter.GenericFilterBean

doFilterInternal

public void doFilterInternal(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response,
                             javax.servlet.FilterChain chain)
                      throws IOException,
                             javax.servlet.ServletException
This method checks to see if the current path matches includes or excludes. If it matches includes and not excludes, it forwards to the static resource and ends the filter chain. Otherwise, it forwards to the next filter in the chain.

Specified by:
doFilterInternal in class org.springframework.web.filter.OncePerRequestFilter
Parameters:
request - the current request
response - the current response
chain - the filter chain
Throws:
javax.servlet.ServletException - when something goes wrong
IOException - when something goes terribly wrong


Copyright © 2012. All Rights Reserved.