Package org.kiwiproject.config
Class EndpointConfiguration
java.lang.Object
org.kiwiproject.config.EndpointConfiguration
Configuration for a specific REST endpoint. Can be used standalone or in conjunction with
SecureEndpointsConfiguration.
As this is a configuration class generally intended to be populated from external configuration, it is mutable.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTo use thisEndpointConfiguration.Builderstandalone, use thebuilder()method. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Return a new builder instance to create a standaloneEndpointConfiguration.Return a new builder instance to create aEndpointConfigurationwithin aSecureEndpointsConfiguration.A single domain, or a comma-separated list of domains.Return the domains as a list.getPath()The path component of the URI.getPort()The port the endpoint listens on.The connection scheme, e.g. https or https.getTag()Use this to uniquely identify an endpoint within aSecureEndpointsConfiguration, or to provide a way to find anEndpointConfigurationin any collection of them, e.g. using aStream.filter(Predicate)on a stream of endpoint configurations.getURI()Uses this endpoint'spathto build a URI as a String.Uses this endpoint'spathto build aURI.Configures any URI rewriting that should be performed when building URIs.booleanisSecure()Returns true if the scheme is "wss" or "https".voidSet the domain(s), which can be a single domain (e.g. example.org) or multiple domains separated by commas.voidThe path component of the URI.voidThe port the endpoint listens on.voidThe connection scheme, e.g. https or https.voidUse this to uniquely identify an endpoint within aSecureEndpointsConfiguration, or to provide a way to find anEndpointConfigurationin any collection of them, e.g. using aStream.filter(Predicate)on a stream of endpoint configurations.voidsetUrlRewriteConfiguration(UrlRewriteConfiguration urlRewriteConfiguration) Configures any URI rewriting that should be performed when building URIs.jakarta.ws.rs.core.UriBuilderConverts the URI returned bygetURI()into a Jakarta RESTUriBuilder.
-
Constructor Details
-
EndpointConfiguration
public EndpointConfiguration()
-
-
Method Details
-
builder
Return a new builder instance to create a standaloneEndpointConfiguration.- Returns:
- the builder instance
-
builder
Return a new builder instance to create aEndpointConfigurationwithin aSecureEndpointsConfiguration. Supply theSecureEndpointsConfiguration.Builderwhich is being used to build theSecureEndpointsConfiguration.- Parameters:
parent- the parent builder- Returns:
- the builder instance
-
isSecure
public boolean isSecure()Returns true if the scheme is "wss" or "https".- Returns:
- true if using a secure scheme
-
setDomain
Set the domain(s), which can be a single domain (e.g. example.org) or multiple domains separated by commas. If a comma-separated list of domains is specified, whitespace is allowed and trimmed. For example this is valid: " domain-1.test , domain-2.test , domain-3.test " and results in the three domains "domain-1.test", "domain-2.test", and "domain-3.test".- Parameters:
singleDomainOrCsv- a single domain like example.org or a comma-delimited list of domains
-
getDomains
Return the domains as a list.- Returns:
- the list of domains
-
getURI
Uses this endpoint'spathto build a URI as a String. The host in the returned URI will be the result of round-robin among the domains returned bygetDomains().- Returns:
- the URI as a
String - Implementation Note:
- This currently builds URIs using simple string substitution, any leading or trailing slashes on the domain are stripped.
-
getUriObject
Uses this endpoint'spathto build aURI. -
toUriBuilder
public jakarta.ws.rs.core.UriBuilder toUriBuilder()Converts the URI returned bygetURI()into a Jakarta RESTUriBuilder.Note that Jakarta REST must be in the classpath when calling this method.
- Returns:
- a new
UriBuilderinstance
-
getTag
Use this to uniquely identify an endpoint within aSecureEndpointsConfiguration, or to provide a way to find anEndpointConfigurationin any collection of them, e.g. using aStream.filter(Predicate)on a stream of endpoint configurations. -
getScheme
The connection scheme, e.g. https or https. -
getDomain
A single domain, or a comma-separated list of domains.- See Also:
-
getPort
The port the endpoint listens on. -
getPath
The path component of the URI. -
getUrlRewriteConfiguration
Configures any URI rewriting that should be performed when building URIs. -
setTag
Use this to uniquely identify an endpoint within aSecureEndpointsConfiguration, or to provide a way to find anEndpointConfigurationin any collection of them, e.g. using aStream.filter(Predicate)on a stream of endpoint configurations. -
setScheme
The connection scheme, e.g. https or https. -
setPort
The port the endpoint listens on. -
setPath
The path component of the URI. -
setUrlRewriteConfiguration
Configures any URI rewriting that should be performed when building URIs.
-