Package org.kiwiproject.config
Class UrlRewriteConfiguration
java.lang.Object
org.kiwiproject.config.UrlRewriteConfiguration
Specifies URL rewriting configuration used by
EndpointConfiguration. Currently, supports only a URL
path prefix.
As this is a configuration class generally intended to be populated from external configuration, it is mutable and supports construction in a variety of ways - no argument constructor and setter methods, all-arguments constructor, or a builder. Once constructed, it is intended to be read-only, though this cannot be enforced and still have setter methods.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Constructor Summary
ConstructorsConstructorDescriptionUrlRewriteConfiguration(String pathPrefix) Creates a newUrlRewriteConfigurationinstance. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()If specified, then URIs/URLs generated byEndpointConfigurationwill include this prefix, e.g.static UrlRewriteConfigurationnone()Returns and instance that will not perform any URL rewriting.voidsetPathPrefix(String pathPrefix) If specified, then URIs/URLs generated byEndpointConfigurationwill include this prefix, e.g.booleanWhether URL rewrites will be performed.
-
Constructor Details
-
UrlRewriteConfiguration
public UrlRewriteConfiguration() -
UrlRewriteConfiguration
Creates a newUrlRewriteConfigurationinstance.- Parameters:
pathPrefix- If specified, then URIs/URLs generated byEndpointConfigurationwill include this prefix, e.g. given a URLhttps://acme.com/order/12345and a prefix of/my-proxy, the resulting URL ishttps://acme.com/my-proxy/order/12345.
-
-
Method Details
-
none
Returns and instance that will not perform any URL rewriting. Useful as a default value.- Returns:
- a new "no-rewriting" UrlRewriteConfiguration
-
shouldRewrite
public boolean shouldRewrite()Whether URL rewrites will be performed.- Returns:
- true if there is a path prefix, false otherwise
-
builder
-
getPathPrefix
If specified, then URIs/URLs generated byEndpointConfigurationwill include this prefix, e.g. given a URLhttps://acme.com/order/12345and a prefix of/my-proxy, the resulting URL ishttps://acme.com/my-proxy/order/12345. -
setPathPrefix
If specified, then URIs/URLs generated byEndpointConfigurationwill include this prefix, e.g. given a URLhttps://acme.com/order/12345and a prefix of/my-proxy, the resulting URL ishttps://acme.com/my-proxy/order/12345.
-