Package com.activeviam.web.core.api
Interface IUrlBuilder
public interface IUrlBuilder
Definition of a URL builder following Atoti conventions.
This can be used to create full URLs or just parts of it.
It offers a much more detailed API than url(String...).
- Author:
- ActiveViam
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceInterface representing a builder with enough information and options to build an URL.static interfaceInterface for a buildable builder with at least API type.static interfaceInterface for a buildable builder with at least prefix.static interfaceInterface for a buildable builder with at least service name.static interfaceInterface for a buildable builder with at least path information.static interfaceInterface for a buildable builder with at least API version.static interfaceBase interface for an URL Builder.static interfaceInterface offering to set the hostname in an URL.static interfaceInterface allowing to define the path parts of the URL.static interfaceRecursive interface allowing to define prefix for the URL.static interfaceInterface to define the name of the service API exposed.static interfaceInterface offering a method to define the version of an API.static interfaceInterface allowing to choose the type of API to target.static interfaceInterface offering option for a trailing / in the URL. -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic IUrlBuilder.IBuildercreate()Creates a new builder for URLs following Atoti conventions.static StringnormalizeUrl(String url, boolean withTrailingSlash) Normalizes a URL, removing extra "/" characters.static StringBuild an url by joining the different given parts separated by /.static StringBuild an url by joining the different given parts separated by /.
-
Method Details
-
create
Creates a new builder for URLs following Atoti conventions. -
url
Build an url by joining the different given parts separated by /.The url starts with /.
E.g: - url("a", "/b", "/c/") returns /a/b/c - url("http://localhost:9090", "a", "/b", "/c/") returns http://localhost:9090/a/b/c -
url
Build an url by joining the different given parts separated by /.The url start with / and may end with /.
E.g: - url("a", "/b", "/c") returns /a/b/c/ - url("http://localhost:9090", "a", "/b", "/c") returns http://localhost:9090/a/b/c/- Parameters:
withTrailingSlash- true if the url need to end with "/", false otherwise.
-
normalizeUrl
Normalizes a URL, removing extra "/" characters.- Parameters:
url- the url to normalize.withTrailingSlash- true if the url wants to end with "/", false otherwise.If true and the trailing / is missing, it is added to the url. If false and present, it is removed.
- Returns:
- the normalized url.
-