public final class UriRouterContext extends AbstractContext
Context
which is created when a request has been routed. The
context includes:
UriRouterContext
may just redefine only the
{code matchedUri}, remainingUri
, uriTemplateVariables
as
part of their routing process.Modifier and Type | Class and Description |
---|---|
static class |
UriRouterContext.Builder
Ease
UriRouterContext construction. |
data
Constructor and Description |
---|
UriRouterContext(Context parent,
String matchedUri,
String remainingUri,
Map<String,String> uriTemplateVariables)
Creates a new routing context having the provided parent, URI template
variables, and an ID automatically generated using
UUID.randomUUID() . |
UriRouterContext(Context parent,
String matchedUri,
String remainingUri,
Map<String,String> uriTemplateVariables,
URI originalUri)
Creates a new routing context having the provided parent, URI template
variables, and an ID automatically generated using
UUID.randomUUID() . |
UriRouterContext(JsonValue savedContext,
ClassLoader classLoader)
Restore from JSON representation.
|
Modifier and Type | Method and Description |
---|---|
String |
getBaseUri()
Returns the portion of the request URI which has been routed so far.
|
String |
getMatchedUri()
Returns the portion of the request URI which matched the URI template.
|
URI |
getOriginalUri()
Get the original URI.
|
String |
getRemainingUri()
Returns the portion of the request URI which is remaining to be matched
be the next router.
|
Map<String,String> |
getUriTemplateVariables()
Returns an unmodifiable
Map containing the parsed URI template
variables, keyed on the URI template variable name. |
static UriRouterContext.Builder |
uriRouterContext(Context parent)
Return a builder for a new
UriRouterContext . |
asContext, containsContext, containsContext, getContext, getContextName, getId, getParent, getRootId, isRootContext, toJsonValue, toString
public UriRouterContext(Context parent, String matchedUri, String remainingUri, Map<String,String> uriTemplateVariables)
UUID.randomUUID()
.
The parameters provided in this UriRouterContext
will override any
parameters inherited from parent UriRouterContext
s.parent
- The parent server context.matchedUri
- The matched URIremainingUri
- The remaining URI to be matched.uriTemplateVariables
- A Map
containing the parsed URI template variables,
keyed on the URI template variable name.public UriRouterContext(Context parent, String matchedUri, String remainingUri, Map<String,String> uriTemplateVariables, URI originalUri)
UUID.randomUUID()
.
The parameters provided in this UriRouterContext
will override any
parameters inherited from parent UriRouterContext
s.parent
- The parent server context. (not null)matchedUri
- The matched URIremainingUri
- The remaining URI to be matched.uriTemplateVariables
- A Map
containing the parsed URI template variables,
keyed on the URI template variable name. (not null)originalUri
- The original URI. If not null it will override the
originalUri
defined in the closest UriRouterContext
referenced in the context's chain.public UriRouterContext(JsonValue savedContext, ClassLoader classLoader)
savedContext
- The JSON representation from which this context's attributes
should be parsed.classLoader
- The ClassLoader which can properly resolve the persisted class-name.public String getBaseUri()
null
but may be "" (empty string).null
portion of the request URI which has been
routed so far.public String getMatchedUri()
null
but may be "" (empty string).null
portion of the request URI which matched the
URI template.public String getRemainingUri()
null
but may be
"" (empty string).null
portion of the request URI which is
remaining to be matched.public Map<String,String> getUriTemplateVariables()
Map
containing the parsed URI template
variables, keyed on the URI template variable name.Map
containing the parsed URI template
variables, keyed on the URI template variable name.public URI getOriginalUri()
public static UriRouterContext.Builder uriRouterContext(Context parent)
UriRouterContext
.parent
- parent contextUriRouterContext
.Copyright 2011-2017 ForgeRock AS.