public abstract class RuntimeDelegate extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
RuntimeDelegate.HeaderDelegate<T>
Defines the contract for a delegate that is responsible for
converting between the String form of a HTTP header and
the corresponding JAX-RS type
T . |
Modifier and Type | Field and Description |
---|---|
static String |
JAXRS_RUNTIME_DELEGATE_PROPERTY
Name of the property identifying the
RuntimeDelegate implementation
to be returned from getInstance() . |
Modifier | Constructor and Description |
---|---|
protected |
RuntimeDelegate()
Allows custom implementations to extend the
RuntimeDelegate class. |
Modifier and Type | Method and Description |
---|---|
abstract <T> T |
createEndpoint(Application application,
Class<T> endpointType)
Create a configured instance of the supplied endpoint type.
|
abstract <T> RuntimeDelegate.HeaderDelegate<T> |
createHeaderDelegate(Class<T> type)
Obtain an instance of a
RuntimeDelegate.HeaderDelegate for the supplied class. |
abstract Link.Builder |
createLinkBuilder()
Create a new instance of a
Link.Builder . |
abstract Response.ResponseBuilder |
createResponseBuilder()
Create a new instance of a
Response.ResponseBuilder . |
abstract UriBuilder |
createUriBuilder()
Create a new instance of a
UriBuilder . |
abstract Variant.VariantListBuilder |
createVariantListBuilder()
Create a new instance of a
Variant.VariantListBuilder . |
static RuntimeDelegate |
getInstance()
Obtain a
RuntimeDelegate instance. |
static void |
setInstance(RuntimeDelegate rd)
Set the runtime delegate that will be used by JAX-RS classes.
|
public static final String JAXRS_RUNTIME_DELEGATE_PROPERTY
RuntimeDelegate
implementation
to be returned from getInstance()
.protected RuntimeDelegate()
RuntimeDelegate
class.public static RuntimeDelegate getInstance()
RuntimeDelegate
instance. If an instance had not already been
created and set via setInstance(RuntimeDelegate)
, the first
invocation will create an instance which will then be cached for future use.
The algorithm used to locate the RuntimeDelegate subclass to use consists of the following steps:
META-INF/services/javax.ws.rs.ext.RuntimeDelegate
exists, then its first line, if present, is used as the UTF-8 encoded
name of the implementation class.
java.util.Properties.load(InputStream)
method and it contains
an entry whose key is javax.ws.rs.ext.RuntimeDelegate
, then the value of
that entry is used as the name of the implementation class.
javax.ws.rs.ext.RuntimeDelegate
is defined, then its value is used as the name of the implementation class.
RuntimeDelegate
.public static void setInstance(RuntimeDelegate rd)
getInstance()
then an implementation will
be sought as described in getInstance()
.rd
- the runtime delegate instanceSecurityException
- if there is a security manager and the permission
ReflectPermission("suppressAccessChecks") has not been granted.public abstract UriBuilder createUriBuilder()
UriBuilder
.UriBuilder
instance.UriBuilder
public abstract Response.ResponseBuilder createResponseBuilder()
Response.ResponseBuilder
.ResponseBuilder
instance.Response.ResponseBuilder
public abstract Variant.VariantListBuilder createVariantListBuilder()
Variant.VariantListBuilder
.VariantListBuilder
instance.Variant.VariantListBuilder
public abstract <T> T createEndpoint(Application application, Class<T> endpointType) throws IllegalArgumentException, UnsupportedOperationException
T
- endpoint type.application
- the application configuration.endpointType
- the type of endpoint instance to be created.IllegalArgumentException
- if application is null or the requested endpoint type is
not supported.UnsupportedOperationException
- if the implementation supports no endpoint types.public abstract <T> RuntimeDelegate.HeaderDelegate<T> createHeaderDelegate(Class<T> type) throws IllegalArgumentException
RuntimeDelegate.HeaderDelegate
for the supplied class. An
implementation is required to support the following values for type:
CacheControl
, Cookie
,
EntityTag
, Link
,
NewCookie
, MediaType
and java.util.Date
.T
- header type.type
- the class of the header.HeaderDelegate
for the supplied type.IllegalArgumentException
- if type is null
.RuntimeDelegate.HeaderDelegate
public abstract Link.Builder createLinkBuilder()
Link.Builder
.Link.Builder
instance.Link.Builder
Copyright © 2013. All Rights Reserved.