org.springframework.web.servlet.mvc.method

Class AbstractHandlerMethodAdapter

    • Constructor Detail

      • AbstractHandlerMethodAdapter

        public AbstractHandlerMethodAdapter()
    • Method Detail

      • setOrder

        public void setOrder(int order)
        Specify the order value for this HandlerAdapter bean.

        The default value is Ordered.LOWEST_PRECEDENCE, meaning non-ordered.

        See Also:
        Ordered.getOrder()
      • getOrder

        public int getOrder()
        Description copied from interface: Ordered
        Get the order value of this object.

        Higher values are interpreted as lower priority. As a consequence, the object with the lowest value has the highest priority (somewhat analogous to Servlet load-on-startup values).

        Same order values will result in arbitrary sort positions for the affected objects.

        Specified by:
        getOrder in interface Ordered
        Returns:
        the order value
        See Also:
        Ordered.HIGHEST_PRECEDENCE, Ordered.LOWEST_PRECEDENCE
      • supports

        public final boolean supports(java.lang.Object handler)
        This implementation expects the handler to be an HandlerMethod.
        Specified by:
        supports in interface HandlerAdapter
        Parameters:
        handler - the handler instance to check
        Returns:
        whether or not this adapter can adapt the given handler
      • supportsInternal

        protected abstract boolean supportsInternal(HandlerMethod handlerMethod)
        Given a handler method, return whether or not this adapter can support it.
        Parameters:
        handlerMethod - the handler method to check
        Returns:
        whether or not this adapter can adapt the given method
      • handle

        @Nullable
        public final ModelAndView handle(HttpServletRequest request,
                                                   HttpServletResponse response,
                                                   java.lang.Object handler)
                                            throws java.lang.Exception
        This implementation expects the handler to be an HandlerMethod.
        Specified by:
        handle in interface HandlerAdapter
        Parameters:
        request - current HTTP request
        response - current HTTP response
        handler - handler to use. This object must have previously been passed to the supports method of this interface, which must have returned true.
        Returns:
        a ModelAndView object with the name of the view and the required model data, or null if the request has been handled directly
        Throws:
        java.lang.Exception - in case of errors
      • handleInternal

        @Nullable
        protected abstract ModelAndView handleInternal(HttpServletRequest request,
                                                                 HttpServletResponse response,
                                                                 HandlerMethod handlerMethod)
                                                          throws java.lang.Exception
        Use the given handler method to handle the request.
        Parameters:
        request - current HTTP request
        response - current HTTP response
        handlerMethod - handler method to use. This object must have previously been passed to the supportsInternal(HandlerMethod) this interface, which must have returned true.
        Returns:
        a ModelAndView object with the name of the view and the required model data, or null if the request has been handled directly
        Throws:
        java.lang.Exception - in case of errors