velosurf.validation
Class ValidationFilter

java.lang.Object
  extended by velosurf.validation.ValidationFilter
All Implemented Interfaces:
javax.servlet.Filter

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

This class is an optional filter that will validate query data according to the velosurf.entity query parameter (may be multivalued). If data pass all validation constraints, the filter will let the request pass towards the form action. Otherwise, it will redirect back the user to the original form (using the referer query header). In this case, the filter will populate the session with the given values (escaped) so that they can be put back in the form.


Field Summary
private  javax.servlet.FilterConfig config
          filter config
private static java.lang.String ENTITY_KEY
          key used to identity an entity to be validated in HTTP parameters
 
Constructor Summary
ValidationFilter()
           
 
Method Summary
 void destroy()
          Destroy the filter.
 void doFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain filterChain)
          Filtering.
 void init(javax.servlet.FilterConfig filterConfig)
          initialization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

private javax.servlet.FilterConfig config
filter config


ENTITY_KEY

private static final java.lang.String ENTITY_KEY
key used to identity an entity to be validated in HTTP parameters

See Also:
Constant Field Values
Constructor Detail

ValidationFilter

public ValidationFilter()
Method Detail

init

public void init(javax.servlet.FilterConfig filterConfig)
          throws javax.servlet.ServletException
initialization.

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

doFilter

public void doFilter(javax.servlet.ServletRequest servletRequest,
                     javax.servlet.ServletResponse servletResponse,
                     javax.servlet.FilterChain filterChain)
              throws java.io.IOException,
                     javax.servlet.ServletException
Filtering.

Specified by:
doFilter in interface javax.servlet.Filter
Parameters:
servletRequest - request
servletResponse - response
filterChain - filter chain
Throws:
java.io.IOException
javax.servlet.ServletException

destroy

public void destroy()
Destroy the filter.

Specified by:
destroy in interface javax.servlet.Filter


~ooOoo~