Package org.kiwiproject.config
Class EndpointConfiguration
- java.lang.Object
-
- org.kiwiproject.config.EndpointConfiguration
-
public class EndpointConfiguration extends Object
Configuration for a specific REST endpoint. Can be used standalone or in conjunction withSecureEndpointsConfiguration.As this is a configuration class generally intended to be populated from external configuration, it is mutable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEndpointConfiguration.BuilderTo use thisEndpointConfiguration.Builderstandalone, use thebuilder()method.
-
Constructor Summary
Constructors Constructor Description EndpointConfiguration()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EndpointConfiguration.Builderbuilder()Return a new builder instance to create a standaloneEndpointConfiguration.static EndpointConfiguration.Builderbuilder(SecureEndpointsConfiguration.Builder parent)Return a new builder instance to create aEndpointConfigurationwithin aSecureEndpointsConfiguration.List<String>getDomains()Return the domains as a list.StringgetURI()Uses this endpoint'spathto build a URI as a String.URIgetUriObject()Uses this endpoint'spathto build aURI.booleanisSecure()Returns true if the scheme is "wss" or "https".voidsetDomain(String singleDomainOrCsv)Set the domain(s), which can be a single domain (e.g.javax.ws.rs.core.UriBuildertoUriBuilder()Converts the URI returned bygetURI()into a JAX-RSUriBuilder.
-
-
-
Method Detail
-
builder
public static EndpointConfiguration.Builder builder()
Return a new builder instance to create a standaloneEndpointConfiguration.- Returns:
- the builder instance
-
builder
public static EndpointConfiguration.Builder builder(SecureEndpointsConfiguration.Builder parent)
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
public void setDomain(String singleDomainOrCsv)
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
public List<String> getDomains()
Return the domains as a list.- Returns:
- the list of domains
-
getURI
public String 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 any leading or trailing slashes on the domain are stripped.
-
toUriBuilder
public javax.ws.rs.core.UriBuilder toUriBuilder()
Converts the URI returned bygetURI()into a JAX-RSUriBuilder.Note that JAX-RS must be in the classpath when calling this method.
- Returns:
- a JAX-RS
UriBuilderinstance
-
-