Top Description Inners Methods
org.springframework.http.server

public Interface PathContainer

Known Direct Subinterfaces
org.springframework.http.server.RequestPath
Known Direct Implementers
org.springframework.http.server.DefaultPathContainer
Imports
java.util.List, org.springframework.util.MultiValueMap

Structured representation of a URI path parsed via parsePath(String) into a sequence of Separator and PathSegment elements.

Each PathSegment exposes its content in decoded form and with path parameters removed. This makes it safe to match one path segment at a time without the risk of decoded reserved characters altering the structure of the path.

Author
Rossen Stoyanchev
Since
5.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
PathContainer.Element

A path element, either separator or path segment.

public static class
PathContainer.Options

Options to customize parsing based on the type of input path.

public static interface
PathContainer.PathSegment

Path segment element.

public static interface
PathContainer.Separator

Path separator element.

Method Summary

Modifier and TypeMethod and Description
public List<PathContainer.Element>
elements()

The contained path elements, either Separator or PathSegment.

public static PathContainer

Returns:

the parsed path
parsePath
(String
the encoded, raw path value to parse
path
)

Parse the path value into a sequence of "/" Separator and PathSegment elements.

public static PathContainer

Returns:

the parsed path
parsePath
(String
the encoded, raw path value to parse
path
,
PathContainer.Options
to customize parsing
options
)

Parse the path value into a sequence of Separator and PathSegment elements.

public default PathContainer

Returns:

the sub-path
subPath
(int
the start element index (inclusive)
index
)

Extract a sub-path from the given offset into the elements list.

public default PathContainer

Returns:

the sub-path
subPath
(int
the start element index (inclusive)
startIndex
,
int
the end element index (exclusive)
endIndex
)

Extract a sub-path from the given start offset into the element list (inclusive) and to the end offset (exclusive).

public String
value()

The original path from which this instance was parsed.

Method Detail

elementsback to summary
public List<PathContainer.Element> elements()

The contained path elements, either Separator or PathSegment.

parsePathback to summary
public static PathContainer parsePath(String path)

Parse the path value into a sequence of "/" Separator and PathSegment elements.

Parameters
path:String

the encoded, raw path value to parse

Returns:PathContainer

the parsed path

parsePathback to summary
public static PathContainer parsePath(String path, PathContainer.Options options)

Parse the path value into a sequence of Separator and PathSegment elements.

Parameters
path:String

the encoded, raw path value to parse

options:PathContainer.Options

to customize parsing

Returns:PathContainer

the parsed path

Since
5.2
subPathback to summary
public default PathContainer subPath(int index)

Extract a sub-path from the given offset into the elements list.

Parameters
index:int

the start element index (inclusive)

Returns:PathContainer

the sub-path

subPathback to summary
public default PathContainer subPath(int startIndex, int endIndex)

Extract a sub-path from the given start offset into the element list (inclusive) and to the end offset (exclusive).

Parameters
startIndex:int

the start element index (inclusive)

endIndex:int

the end element index (exclusive)

Returns:PathContainer

the sub-path

valueback to summary
public String value()

The original path from which this instance was parsed.

org.springframework.http.server back to summary

public Interface PathContainer.Element

Known Direct Subinterfaces
org.springframework.http.server.PathContainer.Separator, org.springframework.http.server.PathContainer.PathSegment

A path element, either separator or path segment.

Method Summary

Modifier and TypeMethod and Description
public String
value()

The unmodified, original value of this element.

Method Detail

valueback to summary
public String value()

The unmodified, original value of this element.

org.springframework.http.server back to summary

public Class PathContainer.Options

extends Object
Class Inheritance

Options to customize parsing based on the type of input path.
Since
5.2

Field Summary

Modifier and TypeField and Description
private final boolean
public static final PathContainer.Options
HTTP_PATH

Options for HTTP URL paths.

public static final PathContainer.Options
MESSAGE_ROUTE

Options for a message route.

private final char

Constructor Summary

AccessConstructor and Description
private
Options(char separator, boolean decodeAndParseSegments)

Method Summary

Modifier and TypeMethod and Description
public static PathContainer.Options
create(char
the separator for parsing the path into segments; currently this must be slash or dot.
separator
,
boolean
whether to URL decode path segment values and parse path parameters. If set to false, only escape sequences for the separator char are decoded.
decodeAndParseSegments
)

Create an Options instance with the given settings.

public char
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

decodeAndParseSegmentsback to summary
private final boolean decodeAndParseSegments
HTTP_PATHback to summary
public static final PathContainer.Options HTTP_PATH

Options for HTTP URL paths.

Separator '/' with URL decoding and parsing of path parameters.

MESSAGE_ROUTEback to summary
public static final PathContainer.Options MESSAGE_ROUTE

Options for a message route.

Separator '.' with neither URL decoding nor parsing of path parameters. Escape sequences for the separator character in segment values are still decoded.

separatorback to summary
private final char separator

Constructor Detail

Optionsback to summary
private Options(char separator, boolean decodeAndParseSegments)

Method Detail

createback to summary
public static PathContainer.Options create(char separator, boolean decodeAndParseSegments)

Create an Options instance with the given settings.

Parameters
separator:char

the separator for parsing the path into segments; currently this must be slash or dot.

decodeAndParseSegments:boolean

whether to URL decode path segment values and parse path parameters. If set to false, only escape sequences for the separator char are decoded.

separatorback to summary
public char separator()
shouldDecodeAndParseSegmentsback to summary
public boolean shouldDecodeAndParseSegments()
org.springframework.http.server back to summary

public Interface PathContainer.PathSegment

extends Element
Known Direct Implementers
org.springframework.http.server.DefaultPathContainer.DefaultPathSegment

Path segment element.

Method Summary

Modifier and TypeMethod and Description
public MultiValueMap<String, String>

Returns:

an unmodifiable map containing the parameters
parameters
()

Path parameters associated with this path segment.

public String
valueToMatch()

Return the path segment value, decoded and sanitized, for path matching.

public char[]
valueToMatchAsChars()

Expose valueToMatch() as a character array.

Inherited from org.springframework.http.server.PathContainer.Element:
value

Method Detail

parametersback to summary
public MultiValueMap<String, String> parameters()

Path parameters associated with this path segment.

Returns:MultiValueMap<String, String>

an unmodifiable map containing the parameters

valueToMatchback to summary
public String valueToMatch()

Return the path segment value, decoded and sanitized, for path matching.

valueToMatchAsCharsback to summary
public char[] valueToMatchAsChars()

Expose valueToMatch() as a character array.

org.springframework.http.server back to summary

public Interface PathContainer.Separator

extends Element
Known Direct Implementers
org.springframework.http.server.DefaultPathContainer.DefaultSeparator

Path separator element.

Method Summary

Inherited from org.springframework.http.server.PathContainer.Element:
value