Save This Page
Home » spring-framework-2.5.5-with-dependencies » org.springframework » web » servlet » mvc » annotation » [javadoc | source]
org.springframework.web.servlet.mvc.annotation
public class: AnnotationMethodHandlerAdapter [javadoc | source]
java.lang.Object
   org.springframework.context.support.ApplicationObjectSupport
      org.springframework.web.context.support.WebApplicationObjectSupport
         org.springframework.web.servlet.support.WebContentGenerator
            org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter

All Implemented Interfaces:
    HandlerAdapter, ServletContextAware, ApplicationContextAware

Implementation of the org.springframework.web.servlet.HandlerAdapter interface that maps handler methods based on HTTP paths, HTTP methods and request parameters expressed through the RequestMapping annotation.

Supports request parameter binding through the RequestParam annotation. Also supports the ModelAttribute annotation for exposing model attribute values to the view, as well as InitBinder for binder initialization methods and SessionAttributes for automatic session management of specific attributes.

This adapter can be customized through various bean properties. A common use case is to apply shared binder initialization logic through a custom WebBindingInitializer .

Field Summary
public static final  String PAGE_NOT_FOUND_LOG_CATEGORY    Log category to use when no mapped handler is found for a request. 
protected static final  Log pageNotFoundLogger    Additional logger to use when no mapped handler is found for a request. 
Fields inherited from org.springframework.web.servlet.support.WebContentGenerator:
METHOD_GET,  METHOD_HEAD,  METHOD_POST
Fields inherited from org.springframework.context.support.ApplicationObjectSupport:
logger
Constructor:
 public AnnotationMethodHandlerAdapter() 
Method from org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter Summary:
createBinder,   getLastModified,   handle,   handleNoSuchRequestHandlingMethod,   invokeHandlerMethod,   setAlwaysUseFullPath,   setCustomArgumentResolver,   setCustomArgumentResolvers,   setMethodNameResolver,   setParameterNameDiscoverer,   setPathMatcher,   setSessionAttributeStore,   setSynchronizeOnSession,   setUrlDecode,   setUrlPathHelper,   setWebBindingInitializer,   supports
Methods from org.springframework.web.servlet.support.WebContentGenerator:
applyCacheSeconds,   applyCacheSeconds,   cacheForSeconds,   cacheForSeconds,   checkAndPrepare,   checkAndPrepare,   getCacheSeconds,   getSupportedMethods,   isRequireSession,   isUseCacheControlHeader,   isUseCacheControlNoStore,   isUseExpiresHeader,   preventCaching,   setCacheSeconds,   setRequireSession,   setSupportedMethods,   setUseCacheControlHeader,   setUseCacheControlNoStore,   setUseExpiresHeader
Methods from org.springframework.web.context.support.WebApplicationObjectSupport:
getServletContext,   getTempDir,   getWebApplicationContext,   initApplicationContext,   initServletContext,   isContextRequired,   setServletContext
Methods from org.springframework.context.support.ApplicationObjectSupport:
getApplicationContext,   getMessageSourceAccessor,   initApplicationContext,   initApplicationContext,   isContextRequired,   requiredContextClass,   setApplicationContext
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter Detail:
 protected ServletRequestDataBinder createBinder(HttpServletRequest request,
    Object target,
    String objectName) throws Exception 
    Template method for creating a new ServletRequestDataBinder instance.

    The default implementation creates a standard ServletRequestDataBinder. This can be overridden for custom ServletRequestDataBinder subclasses.

 public long getLastModified(HttpServletRequest request,
    Object handler) 
 public ModelAndView handle(HttpServletRequest request,
    HttpServletResponse response,
    Object handler) throws Exception 
 protected ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException ex,
    HttpServletRequest request,
    HttpServletResponse response) throws Exception 
    Handle the case where no request handler method was found.

    The default implementation logs a warning and sends an HTTP 404 error. Alternatively, a fallback view could be chosen, or the NoSuchRequestHandlingMethodException could be rethrown as-is.

 protected ModelAndView invokeHandlerMethod(HttpServletRequest request,
    HttpServletResponse response,
    Object handler) throws Exception 
 public  void setAlwaysUseFullPath(boolean alwaysUseFullPath) 
    Set if URL lookup should always use the full path within the current servlet context. Else, the path within the current servlet mapping is used if applicable (that is, in the case of a ".../*" servlet mapping in web.xml).

    Default is "false".

 public  void setCustomArgumentResolver(WebArgumentResolver argumentResolver) 
    Set a custom ArgumentResolvers to use for special method parameter types. Such a custom ArgumentResolver will kick in first, having a chance to resolve an argument value before the standard argument handling kicks in.
 public  void setCustomArgumentResolvers(WebArgumentResolver[] argumentResolvers) 
    Set one or more custom ArgumentResolvers to use for special method parameter types. Any such custom ArgumentResolver will kick in first, having a chance to resolve an argument value before the standard argument handling kicks in.
 public  void setMethodNameResolver(MethodNameResolver methodNameResolver) 
    Set the MethodNameResolver to use for resolving default handler methods (carrying an empty @RequestMapping annotation).

    Will only kick in when the handler method cannot be resolved uniquely through the annotation metadata already.

 public  void setParameterNameDiscoverer(ParameterNameDiscoverer parameterNameDiscoverer) 
 public  void setPathMatcher(PathMatcher pathMatcher) 
    Set the PathMatcher implementation to use for matching URL paths against registered URL patterns. Default is AntPathMatcher.
 public  void setSessionAttributeStore(SessionAttributeStore sessionAttributeStore) 
 public  void setSynchronizeOnSession(boolean synchronizeOnSession) 
    Set if controller execution should be synchronized on the session, to serialize parallel invocations from the same client.

    More specifically, the execution of each handler method will get synchronized if this flag is "true". The best available session mutex will be used for the synchronization; ideally, this will be a mutex exposed by HttpSessionMutexListener.

    The session mutex is guaranteed to be the same object during the entire lifetime of the session, available under the key defined by the SESSION_MUTEX_ATTRIBUTE constant. It serves as a safe reference to synchronize on for locking on the current session.

    In many cases, the HttpSession reference itself is a safe mutex as well, since it will always be the same object reference for the same active logical session. However, this is not guaranteed across different servlet containers; the only 100% safe way is a session mutex.

 public  void setUrlDecode(boolean urlDecode) 
    Set if context path and request URI should be URL-decoded. Both are returned undecoded by the Servlet API, in contrast to the servlet path.

    Uses either the request encoding or the default encoding according to the Servlet spec (ISO-8859-1).

 public  void setUrlPathHelper(UrlPathHelper urlPathHelper) 
    Set the UrlPathHelper to use for resolution of lookup paths.

    Use this to override the default UrlPathHelper with a custom subclass, or to share common UrlPathHelper settings across multiple HandlerMappings and HandlerAdapters.

 public  void setWebBindingInitializer(WebBindingInitializer webBindingInitializer) 
    Specify a WebBindingInitializer which will apply pre-configured configuration to every DataBinder that this controller uses.
 public boolean supports(Object handler)