org.springframework.web.servlet.mvc

Class HttpRequestHandlerAdapter

  • java.lang.Object
    • org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter
    • Constructor Detail

      • HttpRequestHandlerAdapter

        public HttpRequestHandlerAdapter()
    • Method Detail

      • supports

        public boolean supports(java.lang.Object handler)
        Description copied from interface: HandlerAdapter
        Given a handler instance, return whether or not this HandlerAdapter can support it. Typical HandlerAdapters will base the decision on the handler type. HandlerAdapters will usually only support one handler type each.

        A typical implementation:

        return (handler instanceof MyHandler);

        Specified by:
        supports in interface HandlerAdapter
        Parameters:
        handler - handler object to check
        Returns:
        whether or not this object can use the given handler
      • handle

        @Nullable
        public ModelAndView handle(HttpServletRequest request,
                                             HttpServletResponse response,
                                             java.lang.Object handler)
                                      throws java.lang.Exception
        Description copied from interface: HandlerAdapter
        Use the given handler to handle this request. The workflow that is required may vary widely.
        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