HDIV API 2.0.4

org.hdiv.filter
Class ValidatorFilter

java.lang.Object
  extended by org.springframework.web.filter.GenericFilterBean
      extended by org.springframework.web.filter.OncePerRequestFilter
          extended by org.hdiv.filter.ValidatorFilter
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 ValidatorFilter
extends org.springframework.web.filter.OncePerRequestFilter

An unique filter exists within HDIV. This filter has two responsabilities: initialize and validate. In fact, the actual validation is not implemented in this class, it is delegated to ValidatorHelper.

Author:
Roberto Velasco, Gorka Vicente
See Also:
ValidatorHelperThreadLocal

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
ValidatorFilter()
          Creates a new ValidatorFilter object.
 
Method Summary
protected  void doFilterInternal(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain filterChain)
          Called by the container each time a request/response pair is passed through the chain due to a client request for a resource at the end of the chain.
protected  void initFilterBean()
          Called by the web container to indicate to a filter that it is being placed into service.
 void initHDIV(javax.servlet.http.HttpServletRequest request)
          Initialize HDIV HTTP session
 boolean isMultipartContent(java.lang.String contentType)
          Utility method that determines whether the request contains multipart content.
protected  void processRequest(IValidationHelper validationHelper, ResponseWrapper responseWrapper, javax.servlet.FilterChain filterChain)
          Processes requests for both HTTP GET and POST methods.
 
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

ValidatorFilter

public ValidatorFilter()
Creates a new ValidatorFilter object.

Method Detail

initFilterBean

protected void initFilterBean()
                       throws javax.servlet.ServletException
Called by the web container to indicate to a filter that it is being placed into service.

Overrides:
initFilterBean in class org.springframework.web.filter.GenericFilterBean
Throws:
javax.servlet.ServletException
See Also:
Filter.init(javax.servlet.FilterConfig)

doFilterInternal

protected void doFilterInternal(javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpServletResponse response,
                                javax.servlet.FilterChain filterChain)
                         throws javax.servlet.ServletException,
                                java.io.IOException
Called by the container each time a request/response pair is passed through the chain due to a client request for a resource at the end of the chain.

Specified by:
doFilterInternal in class org.springframework.web.filter.OncePerRequestFilter
Parameters:
servletRequest - request
servletResponse - response
filterChain - filter chain
Throws:
javax.servlet.ServletException
java.io.IOException
See Also:
Filter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)

initHDIV

public void initHDIV(javax.servlet.http.HttpServletRequest request)
Initialize HDIV HTTP session

Parameters:
request - HTTP request

isMultipartContent

public boolean isMultipartContent(java.lang.String contentType)
Utility method that determines whether the request contains multipart content.

Parameters:
contentType - content type
Returns:
true if the request is multipart. false otherwise.

processRequest

protected void processRequest(IValidationHelper validationHelper,
                              ResponseWrapper responseWrapper,
                              javax.servlet.FilterChain filterChain)
                       throws java.lang.Exception
Processes requests for both HTTP GET and POST methods.

Parameters:
validationHelper - validation helper
responseWrapper - response wrapper
filterChain - filter chain
Throws:
java.lang.Exception - if there is an error in request process.

HDIV 2.0.4

Copyright © 2008 hdiv.org. All Rights Reserved.