Top Description Inners Fields Constructors Methods
org.springframework.web.util.pattern

public Class PathPatternRouteMatcher

extends Object
implements RouteMatcher
Class Inheritance
All Implemented Interfaces
org.springframework.util.RouteMatcher
Imports
java.util.Comparator, .Map, java.util.concurrent.ConcurrentHashMap, org.springframework.http.server.PathContainer, org.springframework.lang.Nullable, org.springframework.util.Assert, .RouteMatcher

RouteMatcher built on PathPatternParser that uses PathContainer and PathPattern as parsed representations of routes and patterns.
Author
Rossen Stoyanchev
Since
5.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
PathPatternRouteMatcher()

Default constructor with PathPatternParser customized for MESSAGE_ROUTE and without matching of trailing separator.

public

Method Summary

Modifier and TypeMethod and Description
public String
combine(String
the first pattern
pattern1
,
String
the second pattern
pattern2
)

Implements org.springframework.util.RouteMatcher.combine.

Combines two patterns into a single pattern.
private PathContainer
private PathPattern
public Comparator<String>
getPatternComparator(RouteMatcher.Route
the full path to use for comparison
route
)

Implements org.springframework.util.RouteMatcher.getPatternComparator.

Given a route, return a Comparator suitable for sorting patterns in order of explicitness for that route, so that more specific patterns come before more generic ones.
public boolean
isPattern(String
the route to check
route
)

Implements org.springframework.util.RouteMatcher.isPattern.

Whether the given route contains pattern syntax which requires the match(String, Route) method, or if it is a regular String that could be compared directly to others.
public boolean
match(String
the pattern to try to match
pattern
,
RouteMatcher.Route
the route to test against
route
)

Implements org.springframework.util.RouteMatcher.match.

Match the given route against the given pattern.
public Map<String, String>
matchAndExtract(String
the pattern, possibly containing templates variables
pattern
,
RouteMatcher.Route
the route to extract template variables from
route
)

Implements org.springframework.util.RouteMatcher.matchAndExtract.

Match the pattern to the route and extract template variables.
public RouteMatcher.Route
parseRoute(String
the route to parse
routeValue
)

Implements org.springframework.util.RouteMatcher.parseRoute.

Return a parsed representation of the given route.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

parserback to summary
private final PathPatternParser parser
pathPatternCacheback to summary
private final Map<String, PathPattern> pathPatternCache

Constructor Detail

PathPatternRouteMatcherback to summary
public PathPatternRouteMatcher()

Default constructor with PathPatternParser customized for MESSAGE_ROUTE and without matching of trailing separator.

PathPatternRouteMatcherback to summary
public PathPatternRouteMatcher(PathPatternParser parser)

Constructor with given PathPatternParser.

Method Detail

combineback to summary
public String combine(String pattern1, String pattern2)

Implements org.springframework.util.RouteMatcher.combine.

Doc from org.springframework.util.RouteMatcher.combine.

Combines two patterns into a single pattern.

Parameters
pattern1:String

the first pattern

pattern2:String

the second pattern

Returns:String

the combination of the two patterns

Annotations
@Override
getPathContainerback to summary
private PathContainer getPathContainer(RouteMatcher.Route route)
getPathPatternback to summary
private PathPattern getPathPattern(String pattern)
getPatternComparatorback to summary
public Comparator<String> getPatternComparator(RouteMatcher.Route route)

Implements org.springframework.util.RouteMatcher.getPatternComparator.

Doc from org.springframework.util.RouteMatcher.getPatternComparator.

Given a route, return a Comparator suitable for sorting patterns in order of explicitness for that route, so that more specific patterns come before more generic ones.

Parameters
route:RouteMatcher.Route

the full path to use for comparison

Returns:Comparator<String>

a comparator capable of sorting patterns in order of explicitness

Annotations
@Override
isPatternback to summary
public boolean isPattern(String route)

Implements org.springframework.util.RouteMatcher.isPattern.

Doc from org.springframework.util.RouteMatcher.isPattern.

Whether the given route contains pattern syntax which requires the match(String, Route) method, or if it is a regular String that could be compared directly to others.

Parameters
route:String

the route to check

Returns:boolean

true if the given route represents a pattern

Annotations
@Override
matchback to summary
public boolean match(String pattern, RouteMatcher.Route route)

Implements org.springframework.util.RouteMatcher.match.

Doc from org.springframework.util.RouteMatcher.match.

Match the given route against the given pattern.

Parameters
pattern:String

the pattern to try to match

route:RouteMatcher.Route

the route to test against

Returns:boolean

true if there is a match, false otherwise

Annotations
@Override
matchAndExtractback to summary
public Map<String, String> matchAndExtract(String pattern, RouteMatcher.Route route)

Implements org.springframework.util.RouteMatcher.matchAndExtract.

Doc from org.springframework.util.RouteMatcher.matchAndExtract.

Match the pattern to the route and extract template variables.

Parameters
pattern:String

the pattern, possibly containing templates variables

route:RouteMatcher.Route

the route to extract template variables from

Returns:Map<String, String>

a map with template variables and values

Annotations
@Override
@Nullable
parseRouteback to summary
public RouteMatcher.Route parseRoute(String routeValue)

Implements org.springframework.util.RouteMatcher.parseRoute.

Doc from org.springframework.util.RouteMatcher.parseRoute.

Return a parsed representation of the given route.

Parameters
routeValue:String

the route to parse

Returns:RouteMatcher.Route

the parsed representation of the route

Annotations
@Override
org.springframework.web.util.pattern back to summary

private Class PathPatternRouteMatcher.PathContainerRoute

extends Object
implements Route
Class Inheritance
  • java.lang.Object
  • org.springframework.web.util.pattern.PathPatternRouteMatcher.PathContainerRoute
All Implemented Interfaces
org.springframework.util.RouteMatcher.Route

Field Summary

Modifier and TypeField and Description
private final PathContainer

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public String
value()

Implements org.springframework.util.RouteMatcher.Route.value.

The original route value.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

pathContainerback to summary
private final PathContainer pathContainer

Constructor Detail

PathContainerRouteback to summary
pack-priv PathContainerRoute(PathContainer pathContainer)

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
valueback to summary
public String value()

Implements org.springframework.util.RouteMatcher.Route.value.

Doc from org.springframework.util.RouteMatcher.Route.value.

The original route value.

Annotations
@Override