org.springframework.web.servlet

Interface HandlerMapping

    • Field Detail

      • PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE

        static final java.lang.String PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE
        Name of the HttpServletRequest attribute that contains the path within the handler mapping, in case of a pattern match, or the full relevant URI (typically within the DispatcherServlet's mapping) else.

        Note: This attribute is not required to be supported by all HandlerMapping implementations. URL-based HandlerMappings will typically support it, but handlers should not necessarily expect this request attribute to be present in all scenarios.

      • BEST_MATCHING_PATTERN_ATTRIBUTE

        static final java.lang.String BEST_MATCHING_PATTERN_ATTRIBUTE
        Name of the HttpServletRequest attribute that contains the best matching pattern within the handler mapping.

        Note: This attribute is not required to be supported by all HandlerMapping implementations. URL-based HandlerMappings will typically support it, but handlers should not necessarily expect this request attribute to be present in all scenarios.

      • INTROSPECT_TYPE_LEVEL_MAPPING

        static final java.lang.String INTROSPECT_TYPE_LEVEL_MAPPING
        Name of the boolean HttpServletRequest attribute that indicates whether type-level mappings should be inspected.

        Note: This attribute is not required to be supported by all HandlerMapping implementations.

      • URI_TEMPLATE_VARIABLES_ATTRIBUTE

        static final java.lang.String URI_TEMPLATE_VARIABLES_ATTRIBUTE
        Name of the HttpServletRequest attribute that contains the URI templates map, mapping variable names to values.

        Note: This attribute is not required to be supported by all HandlerMapping implementations. URL-based HandlerMappings will typically support it, but handlers should not necessarily expect this request attribute to be present in all scenarios.

      • MATRIX_VARIABLES_ATTRIBUTE

        static final java.lang.String MATRIX_VARIABLES_ATTRIBUTE
        Name of the HttpServletRequest attribute that contains a map with URI variable names and a corresponding MultiValueMap of URI matrix variables for each.

        Note: This attribute is not required to be supported by all HandlerMapping implementations and may also not be present depending on whether the HandlerMapping is configured to keep matrix variable content

      • PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE

        static final java.lang.String PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE
        Name of the HttpServletRequest attribute that contains the set of producible MediaTypes applicable to the mapped handler.

        Note: This attribute is not required to be supported by all HandlerMapping implementations. Handlers should not necessarily expect this request attribute to be present in all scenarios.

    • Method Detail

      • getHandler

        @Nullable
        HandlerExecutionChain getHandler(HttpServletRequest request)
                                            throws java.lang.Exception
        Return a handler and any interceptors for this request. The choice may be made on request URL, session state, or any factor the implementing class chooses.

        The returned HandlerExecutionChain contains a handler Object, rather than even a tag interface, so that handlers are not constrained in any way. For example, a HandlerAdapter could be written to allow another framework's handler objects to be used.

        Returns null if no match was found. This is not an error. The DispatcherServlet will query all registered HandlerMapping beans to find a match, and only decide there is an error if none can find a handler.

        Parameters:
        request - current HTTP request
        Returns:
        a HandlerExecutionChain instance containing handler object and any interceptors, or null if no mapping found
        Throws:
        java.lang.Exception - if there is an internal error