Class PathPatternParser
java.lang.Object
org.springframework.web.util.pattern.PathPatternParser
Parser for URI path patterns producing 
PathPattern instances that can
 then be matched to requests.
 The PathPatternParser and PathPattern are specifically
 designed for use with HTTP URL paths in web applications where a large number
 of URI path patterns, continuously matched against incoming requests,
 motivates the need for efficient matching.
 
For details of the path pattern syntax see PathPattern.
- Since:
- 5.0
- Author:
- Andy Clement
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final PathPatternParserShared, read-only instance ofPathPatternParser.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionReturn theconfiguredpattern parsing options.booleanWhether case-sensitive pattern matching is enabled.booleanDeprecated.Process the path pattern content, a character at a time, breaking it into path elements around separator boundaries and verifying the structure at each stage.voidsetCaseSensitive(boolean caseSensitive) Whether path pattern matching should be case-sensitive.voidsetMatchOptionalTrailingSeparator(boolean matchOptionalTrailingSeparator) Deprecated.transparent support for trailing slashes is deprecated as of 6.0 in favor of configuring explicit redirects through a proxy, Servlet/web filter, or a controller.voidsetPathOptions(PathContainer.Options pathOptions) Set options for parsing patterns.
- 
Field Details- 
defaultInstanceShared, read-only instance ofPathPatternParser. Uses default settings:- matchOptionalTrailingSeparator=true
- caseSensitivetrue
- pathOptions=PathContainer.Options.HTTP_PATH
 
 
- 
- 
Constructor Details- 
PathPatternParserpublic PathPatternParser()
 
- 
- 
Method Details- 
setMatchOptionalTrailingSeparator@Deprecated(since="6.0") public void setMatchOptionalTrailingSeparator(boolean matchOptionalTrailingSeparator) Deprecated.transparent support for trailing slashes is deprecated as of 6.0 in favor of configuring explicit redirects through a proxy, Servlet/web filter, or a controller.Whether aPathPatternproduced by this parser should automatically match request paths with a trailing slash.If set to trueaPathPatternwithout a trailing slash will also match request paths with a trailing slash. If set tofalseaPathPatternwill only match request paths with a trailing slash.The default was changed in 6.0 from truetofalsein order to support the deprecation of the property.
- 
isMatchOptionalTrailingSeparatorDeprecated.as of 6.0 together withsetMatchOptionalTrailingSeparator(boolean).Whether optional trailing slashing match is enabled.
- 
setCaseSensitivepublic void setCaseSensitive(boolean caseSensitive) Whether path pattern matching should be case-sensitive.The default is true.
- 
isCaseSensitivepublic boolean isCaseSensitive()Whether case-sensitive pattern matching is enabled.
- 
setPathOptionsSet options for parsing patterns. These should be the same as the options used to parse input paths.PathContainer.Options.HTTP_PATHis used by default.- Since:
- 5.2
 
- 
getPathOptionsReturn theconfiguredpattern parsing options.- Since:
- 5.2
 
- 
parseProcess the path pattern content, a character at a time, breaking it into path elements around separator boundaries and verifying the structure at each stage. Produces a PathPattern object that can be used for fast matching against paths. Each invocation of this method delegates to a new instance of theInternalPathPatternParserbecause that class is not thread-safe.- Parameters:
- pathPattern- the input path pattern, e.g. /project/{name}
- Returns:
- a PathPattern for quickly matching paths against request paths
- Throws:
- PatternParseException- in case of parse errors
 
 
- 
setMatchOptionalTrailingSeparator(boolean).