Package jakarta.ws.rs.ext
Class RuntimeDelegate
java.lang.Object
jakarta.ws.rs.ext.RuntimeDelegate
Implementations of JAX-RS provide a concrete subclass of RuntimeDelegate and various JAX-RS API methods defer to
methods of RuntimeDelegate for their functionality. Regular users of JAX-RS are not expected to use this class
directly and overriding an implementation of this class with a user supplied subclass may cause unexpected behavior.
- Since:
- 1.0
- Author:
- Paul Sandoz, Marc Hadley
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Defines the contract for a delegate that is responsible for converting between the String form of a HTTP header and the corresponding JAX-RS typeT
. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Name of the property identifying theRuntimeDelegate
implementation to be returned fromgetInstance()
. -
Constructor Summary
ModifierConstructorDescriptionprotected
Allows custom implementations to extend theRuntimeDelegate
class. -
Method Summary
Modifier and TypeMethodDescriptionabstract CompletionStage<SeBootstrap.Instance>
bootstrap
(Application application, SeBootstrap.Configuration configuration) Perform startup of the application in Java SE environments.abstract CompletionStage<SeBootstrap.Instance>
bootstrap
(Class<? extends Application> clazz, SeBootstrap.Configuration configuration) Perform startup of the application in Java SE environments.abstract SeBootstrap.Configuration.Builder
Create a new instance of aSeBootstrap.Configuration.Builder
.abstract <T> T
createEndpoint
(Application application, Class<T> endpointType) Create a configured instance of the supplied endpoint type.abstract EntityPart.Builder
createEntityPartBuilder
(String partName) Create a new instance of aEntityPart.Builder
.abstract <T> RuntimeDelegate.HeaderDelegate<T>
createHeaderDelegate
(Class<T> type) Obtain an instance of aRuntimeDelegate.HeaderDelegate
for the supplied class.abstract Link.Builder
Create a new instance of aLink.Builder
.abstract Response.ResponseBuilder
Create a new instance of aResponse.ResponseBuilder
.abstract UriBuilder
Create a new instance of aUriBuilder
.abstract Variant.VariantListBuilder
Create a new instance of aVariant.VariantListBuilder
.static RuntimeDelegate
Obtain aRuntimeDelegate
instance.static void
Set the runtime delegate that will be used by JAX-RS classes.
-
Field Details
-
JAXRS_RUNTIME_DELEGATE_PROPERTY
Name of the property identifying theRuntimeDelegate
implementation to be returned fromgetInstance()
.- See Also:
-
-
Constructor Details
-
RuntimeDelegate
protected RuntimeDelegate()Allows custom implementations to extend theRuntimeDelegate
class.
-
-
Method Details
-
getInstance
Obtain aRuntimeDelegate
instance. If an instance had not already been created and set viasetInstance(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:
- If a resource with the name of
META-INF/services/jakarta.ws.rs.ext.RuntimeDelegate
exists, then its first line, if present, is used as the UTF-8 encoded name of the implementation class. - If the $java.home/lib/jaxrs.properties file exists and it is readable by the
java.util.Properties.load(InputStream)
method and it contains an entry whose key isjakarta.ws.rs.ext.RuntimeDelegate
, then the value of that entry is used as the name of the implementation class. - If a system property with the name
jakarta.ws.rs.ext.RuntimeDelegate
is defined, then its value is used as the name of the implementation class. - Finally, a default implementation class name is used.
- Returns:
- an instance of
RuntimeDelegate
.
- If a resource with the name of
-
setInstance
Set the runtime delegate that will be used by JAX-RS classes. If this method is not called prior togetInstance()
then an implementation will be sought as described ingetInstance()
.- Parameters:
rd
- the runtime delegate instance- Throws:
SecurityException
- if there is a security manager and the permission ReflectPermission("suppressAccessChecks") has not been granted.
-
createUriBuilder
Create a new instance of aUriBuilder
.- Returns:
- new
UriBuilder
instance. - See Also:
-
createResponseBuilder
Create a new instance of aResponse.ResponseBuilder
.- Returns:
- new
ResponseBuilder
instance. - See Also:
-
createVariantListBuilder
Create a new instance of aVariant.VariantListBuilder
.- Returns:
- new
VariantListBuilder
instance. - See Also:
-
createEndpoint
public abstract <T> T createEndpoint(Application application, Class<T> endpointType) throws IllegalArgumentException, UnsupportedOperationException Create a configured instance of the supplied endpoint type. How the returned endpoint instance is published is dependent on the type of endpoint.- Type Parameters:
T
- endpoint type.- Parameters:
application
- the application configuration.endpointType
- the type of endpoint instance to be created.- Returns:
- a configured instance of the requested type.
- Throws:
IllegalArgumentException
- if application is null or the requested endpoint type is not supported.UnsupportedOperationException
- if the implementation supports no endpoint types.
-
createHeaderDelegate
public abstract <T> RuntimeDelegate.HeaderDelegate<T> createHeaderDelegate(Class<T> type) throws IllegalArgumentException Obtain an instance of aRuntimeDelegate.HeaderDelegate
for the supplied class. An implementation is required to support the following values for type:CacheControl
,Cookie
,EntityTag
,Link
,NewCookie
,MediaType
andjava.util.Date
.- Type Parameters:
T
- header type.- Parameters:
type
- the class of the header.- Returns:
- an instance of
HeaderDelegate
for the supplied type. - Throws:
IllegalArgumentException
- if type isnull
.- See Also:
-
createLinkBuilder
Create a new instance of aLink.Builder
.- Returns:
- new
Link.Builder
instance. - See Also:
-
createConfigurationBuilder
Create a new instance of aSeBootstrap.Configuration.Builder
.This method is not intended to be invoked by applications. Call
SeBootstrap.Configuration.builder()
instead.- Returns:
- new
SeBootstrap.Configuration.Builder
instance. - See Also:
-
bootstrap
public abstract CompletionStage<SeBootstrap.Instance> bootstrap(Application application, SeBootstrap.Configuration configuration) Perform startup of the application in Java SE environments.This method is not intended to be invoked by applications. Call
SeBootstrap.start(Application, SeBootstrap.Configuration)
instead.- Parameters:
application
- The application to start up.configuration
- The bootstrap configuration.- Returns:
CompletionStage
asynchronously producing handle of the running applicationinstance
.
-
bootstrap
public abstract CompletionStage<SeBootstrap.Instance> bootstrap(Class<? extends Application> clazz, SeBootstrap.Configuration configuration) Perform startup of the application in Java SE environments.This method is not intended to be invoked by applications. Call
SeBootstrap.start(Class, SeBootstrap.Configuration)
instead.- Parameters:
clazz
- The application class to instantiate and start.configuration
- The bootstrap configuration.- Returns:
CompletionStage
asynchronously producing handle of the running applicationinstance
.
-
createEntityPartBuilder
public abstract EntityPart.Builder createEntityPartBuilder(String partName) throws IllegalArgumentException Create a new instance of aEntityPart.Builder
.This method is not intended to be invoked by applications. Call
EntityPart.withName(String)
instead.- Parameters:
partName
- name for this part within the multipart body.- Returns:
- new
EntityPart.Builder
instance with specified part name - Throws:
IllegalArgumentException
- ifpartName
isnull
.- Since:
- 3.1
-