Top Description Fields Constructors Methods
org.springframework.web.servlet.handler

pack-priv Class PathPatternMatchableHandlerMapping

extends Object
implements MatchableHandlerMapping
Class Inheritance
All Implemented Interfaces
org.springframework.web.servlet.handler.MatchableHandlerMapping, org.springframework.web.servlet.HandlerMapping
Imports
java.util.Map, java.util.concurrent.ConcurrentHashMap, jakarta.servlet.http.HttpServletRequest, org.springframework.http.server.PathContainer, org.springframework.lang.Nullable, org.springframework.util.Assert, org.springframework.web.servlet.HandlerExecutionChain, org.springframework.web.util.ServletRequestPathUtils, org.springframework.web.util.pattern.PathPattern, .PathPatternParser

Decorate another MatchableHandlerMapping that's configured with a PathPatternParser in order to parse and cache String patterns passed into the match method.
Author
Rossen Stoyanchev
Since
5.3

Field Summary

Modifier and TypeField and Description
private final MatchableHandlerMapping
private static final int
private final PathPatternParser
private final Map<String, PathPattern>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public HandlerExecutionChain
getHandler(HttpServletRequest
current HTTP request
request
)

Implements org.springframework.web.servlet.HandlerMapping.getHandler.

Return a handler and any interceptors for this request.

public RequestMatchResult
match(HttpServletRequest
the current request
request
,
String
the pattern to match
pattern
)

Implements org.springframework.web.servlet.handler.MatchableHandlerMapping.match.

Determine whether the request matches the given pattern.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delegateback to summary
private final MatchableHandlerMapping delegate
MAX_PATTERNSback to summary
private static final int MAX_PATTERNS
parserback to summary
private final PathPatternParser parser
pathPatternCacheback to summary
private final Map<String, PathPattern> pathPatternCache

Constructor Detail

PathPatternMatchableHandlerMappingback to summary
public PathPatternMatchableHandlerMapping(MatchableHandlerMapping delegate)

Method Detail

getHandlerback to summary
public HandlerExecutionChain getHandler(HttpServletRequest request) throws Exception

Implements org.springframework.web.servlet.HandlerMapping.getHandler.

Doc from org.springframework.web.servlet.HandlerMapping.getHandler.

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:HttpServletRequest

current HTTP request

Returns:HandlerExecutionChain

a HandlerExecutionChain instance containing handler object and any interceptors, or null if no mapping found

Annotations
@Nullable
@Override
Exceptions
Exception:
if there is an internal error
matchback to summary
public RequestMatchResult match(HttpServletRequest request, String pattern)

Implements org.springframework.web.servlet.handler.MatchableHandlerMapping.match.

Doc from org.springframework.web.servlet.handler.MatchableHandlerMapping.match.

Determine whether the request matches the given pattern. Use this method when getPatternParser() returns null which means that the HandlerMapping is using String pattern matching.

Parameters
request:HttpServletRequest

the current request

pattern:String

the pattern to match

Returns:RequestMatchResult

the result from request matching, or null if none

Annotations
@Nullable
@Override