java.lang.Object
de.cuioss.tools.net.UrlHelper
Provides some utility methods for url / path related data
- Author:
- Oliver Wolff
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic StringbooleanisValidUri(String uri) static Stringstatic StringSplit the given path String in a unified view with a list ofString.tryParseUri(String uri)
-
Constructor Details
-
UrlHelper
public UrlHelper()
-
-
Method Details
-
addTrailingSlashToUrl
- Parameters:
url- to be adapted- Returns:
- the given url if it already suffixed with '/' or null / empty. The given url suffixed with '/' otherwise
-
removeTrailingSlashesFromUrl
- Parameters:
url- to be adapted- Returns:
- the given url if it is not suffixed with '/' or null / empty. The given url '/' removed otherwise. Multiple trailing slashes will be removed as well
-
addPrecedingSlashToPath
- Parameters:
path- to be adapted- Returns:
- the given path if it already prefixed with '/'. The given path prefixed with '/' otherwise. In case of being null or empty it will return "/"
-
removePrecedingSlashFromPath
- Parameters:
path-- Returns:
- the given path if it is not suffixed with '/' or null / empty. The given path '/' removed otherwise. Multiple preceding slashes will be removed as well
-
splitPath
Split the given path String in a unified view with a list ofString. The individual path-elements are implicitly trimmed- Parameters:
pathString- if it is null or empty an empty List will be returned- Returns:
- the list view on the path elements. never null but may be empty
-
tryParseUri
- Parameters:
uri- value to be verified if it is a valid URI.- Returns:
- URI object, if the given value is a valid URI.
-
isValidUri
- Parameters:
uri- value to be verified if it is a valid URI.- Returns:
- true, if the given value is a valid URI. False otherwise.
-