Package io.rocketbase.commons.util
Class UrlParts
java.lang.Object
io.rocketbase.commons.util.UrlParts
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringconcatPaths(Object... parts) static Stringchecks if given uri ends with slash or adds it if missingstatic Stringchecks if given uri ends with slash or adds it if missingstatic Stringchecks if given uri starts with slash or adds it if missingstatic StringgetBaseUrl(jakarta.servlet.http.HttpServletRequest request) get baseUrl without / at the endstatic StringremoveEndsWithSlash(String path) check if given uri end with slash and removes it if existing
-
Constructor Details
-
UrlParts
public UrlParts()
-
-
Method Details
-
concatPaths
-
ensureEndsWithSlash
checks if given uri ends with slash or adds it if missing- Parameters:
uri- given url- Returns:
- url with / at the end
-
ensureStartsWithSlash
checks if given uri starts with slash or adds it if missing- Parameters:
uri- given url- Returns:
- url with / at the beginning
-
ensureStartsAndEndsWithSlash
checks if given uri ends with slash or adds it if missing- Parameters:
path- given path of url- Returns:
- path with / at beginning + end
-
removeEndsWithSlash
check if given uri end with slash and removes it if existing- Parameters:
path- given path of url- Returns:
- path without / at end
-
getBaseUrl
get baseUrl without / at the end- Parameters:
request- current HttpServletRequest- Returns:
- baseUrl without /
-