com.vaadin.flow.router.
Class LocationUtil
- java.lang.Object
-
- com.vaadin.flow.router.LocationUtil
-
public class LocationUtil extends Object
Utility class exposing reusable utility methods for location.
Since:
2.7
-
-
Method Summary
All Methods Modifier and Type Method Description static String
ensureRelativeNonNull(String location)
Handles given location when it is either
null
or starts with "/".static List<String>
parsePathToSegments(String path)
Parses the given path to parts split by the path separator, ignoring the query string and fragment if either present.
static QueryParameters
parseQueryParameters(String location)
Parses query parameters from the given location.
static void
verifyRelativePath(String path)
Throws
InvalidLocationException
if the provided path is not parseable as a relative path.
-
-
-
Method Detail
-
verifyRelativePath
public static void verifyRelativePath(String path)
Throws
InvalidLocationException
if 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
public static List<String> parsePathToSegments(String path)
Parses the given path to parts split by the path separator, ignoring the query string and fragment if either present. The path is verified with
verifyRelativePath(String)
.Parameters:
path
- the path to parseReturns:
tha path split into parts
-
ensureRelativeNonNull
public static String ensureRelativeNonNull(String location)
Handles given location when it is either
null
or starts with "/".Parameters:
location
- the location to handleReturns:
the cleaned up location, not
null
-
parseQueryParameters
public static QueryParameters parseQueryParameters(String location)
Parses query parameters from the given location.
Parameters:
location
- the location to parse the query parameters fromReturns:
the query parameters
-
-