public class Location extends Object implements Serializable
Constructor and Description |
---|
Location(List<String> segments)
Creates a new location based on a list of path segments.
|
Location(List<String> segments,
QueryParameters queryParameters)
Creates a new location based on a list of path segments and query
parameters.
|
Location(String location)
Creates a new
Location object for given location string. |
Location(String location,
QueryParameters queryParameters)
Creates a new
Location object for given location string and query
parameters. |
Modifier and Type | Method and Description |
---|---|
String |
getFirstSegment()
Gets the first segment of this path.
|
String |
getPath()
Gets the path of this location as a string.
|
String |
getPathWithQueryParameters()
Gets the path string with
QueryParameters . |
QueryParameters |
getQueryParameters()
Gets the request parameters used for current location.
|
List<String> |
getSegments()
Gets all the path segments of this location.
|
Optional<Location> |
getSubLocation()
Creates a new location without the first path segment.
|
Location |
toggleTrailingSlash()
Removes or adds slash to the end of the location path.
|
public Location(String location)
Location
object for given location string. This
string can contain relative path and query parameters, if needed.location
- the relative location, not null
public Location(String location, QueryParameters queryParameters)
Location
object for given location string and query
parameters. Location string can not contain query parameters or exception
will be thrown. To pass query parameters, either specify them in
QueryParameters
in this constructor, or use
Location(String)
location
- the relative location, not null
queryParameters
- query parameters information, not null
IllegalArgumentException
- if location string contains query parameters insidepublic Location(List<String> segments)
segments
- a non-empty list of path segments, not null
public Location(List<String> segments, QueryParameters queryParameters)
segments
- a non-empty list of path segments, not null
and not
emptyqueryParameters
- query parameters information, not null
public List<String> getSegments()
public QueryParameters getQueryParameters()
public String getFirstSegment()
null
public Optional<Location> getSubLocation()
public String getPath()
null
public String getPathWithQueryParameters()
QueryParameters
.Copyright © 2018. All rights reserved.