public interface PublicAddress
The default implementation uses a variety of strategies to attempt to provide the desired result most of the time. Information used includes:
If the default implementation isn't doing what you want it to, you can usually simply configure the public address via
ServerConfigBuilder.publicAddress(java.net.URI)
. Alternatively, you can register an instance of
your own implementation.
Modifier and Type | Method and Description |
---|---|
default HttpUrlBuilder |
builder(Context ctx)
Creates a URL builder using the public address as the base.
|
URI |
get(Context ctx)
The advertised public address.
|
default URI |
get(Context ctx,
Action<? super HttpUrlBuilder> action)
Creates a URL by building a URL based on the public address.
|
default URI |
get(Context ctx,
String path)
Creates a URL by appending the given path to the public address
|
static PublicAddress |
of(URI uri)
Creates a new public address object using the given URI.
|
static PublicAddress of(URI uri)
The path, query and fragment components of the URI will be stripped.
uri
- the uriURI get(Context ctx)
ctx
- the handling context at the time the public address is neededdefault HttpUrlBuilder builder(Context ctx)
ctx
- the handling context at the time the public address is neededdefault URI get(Context ctx, Action<? super HttpUrlBuilder> action) throws Exception
ctx
- the handling context at the time the public address is neededaction
- the additions to the public addressException
- any thrown by action