Package com.vaadin.flow.router
Class LocationUtil
java.lang.Object
com.vaadin.flow.router.LocationUtil
Utility class exposing reusable utility methods for location.
- Since:
- 2.7
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringensureRelativeNonNull(String location) Handles given location when it is eithernullor starts with "/".parsePathToSegments(String path) Deprecated.parsePathToSegments(String path, boolean removeExtraParts) Parses the given path to parts split by the path separator.static QueryParametersparseQueryParameters(String location) Parses query parameters from the given location.static voidverifyRelativePath(String path) ThrowsInvalidLocationExceptionif the provided path is not parseable as a relative path.
-
Method Details
-
verifyRelativePath
ThrowsInvalidLocationExceptionif the provided path is not parseable as a relative path. A relative path should be parseable as a URI without a scheme or host, it should not contain any..segments and it shouldn't start with/.- Parameters:
path- the (decoded) path to check, not null
-
parsePathToSegments
Deprecated.Parses the given path to parts split by the path separator, ignoring the query string and fragment if either present. The path is verified withverifyRelativePath(String).- Parameters:
path- the path to parse- Returns:
- tha path split into parts
-
parsePathToSegments
Parses the given path to parts split by the path separator.Ignores the query string and fragment if either is present and removeExtraParts is true. The path is verified with
verifyRelativePath(String).- Parameters:
path- the path to parseremoveExtraParts- true to remove a potential query string and a URI fragment, false to use the path as is- Returns:
- tha path split into parts
-
ensureRelativeNonNull
Handles given location when it is eithernullor starts with "/".- Parameters:
location- the location to handle- Returns:
- the cleaned up location, not
null
-
parseQueryParameters
Parses query parameters from the given location.- Parameters:
location- the location to parse the query parameters from- Returns:
- the query parameters
-
parsePathToSegments(String, boolean)