org.springmodules.validation.bean.context.web
Class ValidationContextHandlerInterceptor

java.lang.Object
  extended by org.springframework.web.servlet.handler.HandlerInterceptorAdapter
      extended by org.springmodules.validation.bean.context.web.ValidationContextHandlerInterceptor
All Implemented Interfaces:
HandlerInterceptor

public class ValidationContextHandlerInterceptor
extends HandlerInterceptorAdapter

An interceptor that sets the validation context based on configured mappings of url patterns to validation context tokens. This interceptor is the Spring MVC counterpart of the ValidationContextFilter.

Author:
Uri Boness

Constructor Summary
ValidationContextHandlerInterceptor()
           
 
Method Summary
 PathMatcher getPathMatcher()
           
 ValidationContextUrlMapping[] getValidationContextUrlMappings()
           
 void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView)
          Clears
 boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
          Creates and sets the validation context based on the request URI.
 void setPathMatcher(PathMatcher pathMatcher)
           
 void setValidationContextUrlMappings(ValidationContextUrlMapping[] validationContextUrlMappings)
           
 
Methods inherited from class org.springframework.web.servlet.handler.HandlerInterceptorAdapter
afterCompletion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidationContextHandlerInterceptor

public ValidationContextHandlerInterceptor()
Method Detail

preHandle

public boolean preHandle(HttpServletRequest request,
                         HttpServletResponse response,
                         Object handler)
                  throws Exception
Creates and sets the validation context based on the request URI. The validation context tokens are determined by the configured ValidationContextUrlMapping's.

Specified by:
preHandle in interface HandlerInterceptor
Overrides:
preHandle in class HandlerInterceptorAdapter
Throws:
Exception
See Also:
HandlerInterceptorAdapter.preHandle(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, Object), setValidationContextUrlMappings(ValidationContextUrlMapping[])

postHandle

public void postHandle(HttpServletRequest request,
                       HttpServletResponse response,
                       Object handler,
                       ModelAndView modelAndView)
                throws Exception
Clears

Specified by:
postHandle in interface HandlerInterceptor
Overrides:
postHandle in class HandlerInterceptorAdapter
Parameters:
request -
response -
handler -
modelAndView -
Throws:
Exception

getValidationContextUrlMappings

public ValidationContextUrlMapping[] getValidationContextUrlMappings()

setValidationContextUrlMappings

public void setValidationContextUrlMappings(ValidationContextUrlMapping[] validationContextUrlMappings)

getPathMatcher

public PathMatcher getPathMatcher()

setPathMatcher

public void setPathMatcher(PathMatcher pathMatcher)


Copyright © 2009. All Rights Reserved.