com.scooterframework.web.controller
Class ScooterRequestFilter

java.lang.Object
  extended by com.scooterframework.web.controller.ScooterRequestFilter
All Implemented Interfaces:
javax.servlet.Filter

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

ScooterRequestFilter can be attached to either an individual servlet or to a URL pattern. This filter performs the following functions:

The following parameters are allowed to configure this filter in web.xml:

   Examples:
     excluded_paths: /images, /javascripts, /layouts, /stylesheets, /css
           encoding: UTF-8
 


Field Summary
protected  java.lang.String encoding
          Character encoding to be used.
protected  java.lang.String excludedPaths
          Directory paths that we want this filter to skip.
protected  LogUtil log
           
 
Constructor Summary
ScooterRequestFilter()
           
 
Method Summary
protected  void clearCachedRequestData()
          Cleans up all local cached data to prepare for the next request.
 void destroy()
          Take this filter out of service.
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
          Time the processing that is performed by all subsequent filters in the current filter stack, including the ultimately invoked servlet.
protected  java.lang.String getRequestMethod(javax.servlet.http.HttpServletRequest request)
          Returns the method of the request.
protected  java.lang.String getRequestPath(javax.servlet.http.HttpServletRequest request)
          Returns request path of the HttpServletRequest request.
 void init(javax.servlet.FilterConfig filterConfig)
          Place this filter into service.
protected  void initializeActionContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected  boolean isAjaxRequest(javax.servlet.http.HttpServletRequest request)
           
protected  boolean isFileUploadRequest(javax.servlet.http.HttpServletRequest request)
           
protected  boolean isLocalRequest(javax.servlet.http.HttpServletRequest request)
           
protected  boolean isStaticContentRequest(javax.servlet.http.HttpServletRequest request)
           
protected  void otherInit()
           
protected  java.lang.String requestInfo(boolean skipStatic, javax.servlet.http.HttpServletRequest request)
           
protected  boolean skippedRequestPath(javax.servlet.http.HttpServletRequest request)
          Checks if a request path must be skipped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

excludedPaths

protected java.lang.String excludedPaths
Directory paths that we want this filter to skip.


encoding

protected java.lang.String encoding
Character encoding to be used.


log

protected LogUtil log
Constructor Detail

ScooterRequestFilter

public ScooterRequestFilter()
Method Detail

init

public void init(javax.servlet.FilterConfig filterConfig)
          throws javax.servlet.ServletException
Place this filter into service.

Specified by:
init in interface javax.servlet.Filter
Parameters:
filterConfig - The filter configuration object
Throws:
javax.servlet.ServletException

otherInit

protected void otherInit()

destroy

public void destroy()
Take this filter out of service.

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
Time the processing that is performed by all subsequent filters in the current filter stack, including the ultimately invoked servlet.

Specified by:
doFilter in interface javax.servlet.Filter
Parameters:
request - The servlet request we are processing
chain - The filter chain we are processing
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet error occurs

isStaticContentRequest

protected boolean isStaticContentRequest(javax.servlet.http.HttpServletRequest request)

requestInfo

protected java.lang.String requestInfo(boolean skipStatic,
                                       javax.servlet.http.HttpServletRequest request)

getRequestPath

protected java.lang.String getRequestPath(javax.servlet.http.HttpServletRequest request)
Returns request path of the HttpServletRequest request. A request path is a combination of the request's servletPath and pathInfo.

Parameters:
request - HttpServletRequest
Returns:
request path

getRequestMethod

protected java.lang.String getRequestMethod(javax.servlet.http.HttpServletRequest request)
Returns the method of the request.


isAjaxRequest

protected boolean isAjaxRequest(javax.servlet.http.HttpServletRequest request)

clearCachedRequestData

protected void clearCachedRequestData()
Cleans up all local cached data to prepare for the next request.


initializeActionContext

protected void initializeActionContext(javax.servlet.http.HttpServletRequest request,
                                       javax.servlet.http.HttpServletResponse response)

skippedRequestPath

protected boolean skippedRequestPath(javax.servlet.http.HttpServletRequest request)
Checks if a request path must be skipped.

Parameters:
request -
Returns:
true if the request path should be skipped.

isLocalRequest

protected boolean isLocalRequest(javax.servlet.http.HttpServletRequest request)

isFileUploadRequest

protected boolean isFileUploadRequest(javax.servlet.http.HttpServletRequest request)