Top Description Inners Fields Constructors Methods
jakarta.ws.rs.ext

public abstract Class RuntimeDelegate

extends Object
Class Inheritance
Imports
java.lang.reflect.ReflectPermission, java.net.URL, java.util.concurrent.CompletionStage, jakarta.ws.rs.SeBootstrap, .SeBootstrap.Instance, jakarta.ws.rs.core.Application, .EntityPart, .Link, .UriBuilder, .Response.ResponseBuilder, .Variant.VariantListBuilder

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.
Authors
Paul Sandoz, Marc Hadley
Since
1.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
RuntimeDelegate.HeaderDelegate<
a JAX-RS type that corresponds to the value of a HTTP header.
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.

Field Summary

Modifier and TypeField and Description
private static volatile RuntimeDelegate
public static final String
JAXRS_RUNTIME_DELEGATE_PROPERTY

Name of the property identifying the RuntimeDelegate implementation to be returned from RuntimeDelegate#getInstance().

private static final Object
private static ReflectPermission

Constructor Summary

AccessConstructor and Description
protected
RuntimeDelegate()

Allows custom implementations to extend the RuntimeDelegate class.

Method Summary

Modifier and TypeMethod and Description
public abstract CompletionStage<SeBootstrap.Instance>

Returns:

CompletionStage asynchronously producing handle of the running application instance.
bootstrap
(Application
The application to start up.
application
,
SeBootstrap.Configuration
The bootstrap configuration.
configuration
)

Perform startup of the application in Java SE environments.

public abstract CompletionStage<SeBootstrap.Instance>

Returns:

CompletionStage asynchronously producing handle of the running application instance.
bootstrap
(Class<? extends Application>
The application class to instantiate and start.
clazz
,
SeBootstrap.Configuration
The bootstrap configuration.
configuration
)

Perform startup of the application in Java SE environments.

public abstract SeBootstrap.Configuration.Builder

Returns:

new SeBootstrap.Configuration.Builder instance.
createConfigurationBuilder
()

Create a new instance of a jakarta.ws.rs.SeBootstrap.Configuration.Builder.

public abstract <
endpoint type.
T
>
T

Returns:

a configured instance of the requested type.
createEndpoint
(Application
the application configuration.
application
,
Class<T>
the type of endpoint instance to be created.
endpointType
)

Create a configured instance of the supplied endpoint type.

public abstract EntityPart.Builder

Returns:

new EntityPart.Builder instance with specified part name
createEntityPartBuilder
(String
name for this part within the multipart body.
partName
)

Create a new instance of a jakarta.ws.rs.core.EntityPart.Builder.

public abstract <
header type.
T
>
RuntimeDelegate.HeaderDelegate<T>

Returns:

an instance of HeaderDelegate for the supplied type.
createHeaderDelegate
(Class<T>
the class of the header.
type
)

Obtain an instance of a HeaderDelegate for the supplied class.

public abstract Link.Builder

Returns:

new Link.Builder instance.
createLinkBuilder
()

Create a new instance of a jakarta.ws.rs.core.Link.Builder.

public abstract Response.ResponseBuilder

Returns:

new ResponseBuilder instance.
createResponseBuilder
()

Create a new instance of a jakarta.ws.rs.core.Response.ResponseBuilder.

public abstract UriBuilder

Returns:

new UriBuilder instance.
createUriBuilder
()

Create a new instance of a jakarta.ws.rs.core.UriBuilder.

public abstract Variant.VariantListBuilder

Returns:

new VariantListBuilder instance.
createVariantListBuilder
()

Create a new instance of a jakarta.ws.rs.core.Variant.VariantListBuilder.

private static RuntimeDelegate

Returns:

an instance of RuntimeDelegate.
findDelegate
()

Obtain a RuntimeDelegate instance using the method described in getInstance.

public static RuntimeDelegate

Returns:

an instance of RuntimeDelegate.
getInstance
()

Obtain a RuntimeDelegate instance.

public static void
setInstance(final RuntimeDelegate
the runtime delegate instance
rd
)

Set the runtime delegate that will be used by JAX-RS classes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cachedDelegateback to summary
private static volatile RuntimeDelegate cachedDelegate
JAXRS_RUNTIME_DELEGATE_PROPERTYback to summary
public static final String JAXRS_RUNTIME_DELEGATE_PROPERTY

Name of the property identifying the RuntimeDelegate implementation to be returned from RuntimeDelegate#getInstance().

RD_LOCKback to summary
private static final Object RD_LOCK
suppressAccessChecksPermissionback to summary
private static ReflectPermission suppressAccessChecksPermission

Constructor Detail

RuntimeDelegateback to summary
protected RuntimeDelegate()

Allows custom implementations to extend the RuntimeDelegate class.

Method Detail

bootstrapback to summary
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:Application

The application to start up.

configuration:SeBootstrap.Configuration

The bootstrap configuration.

Returns:CompletionStage<SeBootstrap.Instance>

CompletionStage asynchronously producing handle of the running application instance.

bootstrapback to summary
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:Class<? extends Application>

The application class to instantiate and start.

configuration:SeBootstrap.Configuration

The bootstrap configuration.

Returns:CompletionStage<SeBootstrap.Instance>

CompletionStage asynchronously producing handle of the running application instance.

createConfigurationBuilderback to summary
public abstract SeBootstrap.Configuration.Builder createConfigurationBuilder()

Create a new instance of a jakarta.ws.rs.SeBootstrap.Configuration.Builder.

This method is not intended to be invoked by applications. Call SeBootstrap.Configuration#builder() instead.

Returns:SeBootstrap.Configuration.Builder

new SeBootstrap.Configuration.Builder instance.

See Also
SeBootstrap.Configuration.Builder
createEndpointback to summary
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.

Parameters
<T>
endpoint type.
application:Application

the application configuration.

endpointType:Class<T>

the type of endpoint instance to be created.

Returns:T

a configured instance of the requested type.

Exceptions
IllegalArgumentException:
if application is null or the requested endpoint type is not supported.
UnsupportedOperationException:
if the implementation supports no endpoint types.
createEntityPartBuilderback to summary
public abstract EntityPart.Builder createEntityPartBuilder(String partName) throws IllegalArgumentException

Create a new instance of a jakarta.ws.rs.core.EntityPart.Builder.

This method is not intended to be invoked by applications. Call EntityPart#withName(String) instead.

Parameters
partName:String

name for this part within the multipart body.

Returns:EntityPart.Builder

new EntityPart.Builder instance with specified part name

Exceptions
IllegalArgumentException:
if partName is null.
Since
3.1
createHeaderDelegateback to summary
public abstract <T> RuntimeDelegate.HeaderDelegate<T> createHeaderDelegate(Class<T> type) throws IllegalArgumentException

Obtain an instance of a HeaderDelegate for the supplied class. An implementation is required to support the following values for type: jakarta.ws.rs.core.CacheControl, jakarta.ws.rs.core.Cookie, jakarta.ws.rs.core.EntityTag, jakarta.ws.rs.core.Link, jakarta.ws.rs.core.NewCookie, jakarta.ws.rs.core.MediaType and java.util.Date.

Parameters
<T>
header type.
type:Class<T>

the class of the header.

Returns:RuntimeDelegate.HeaderDelegate<T>

an instance of HeaderDelegate for the supplied type.

Exceptions
IllegalArgumentException:
if type is null.
See Also
jakarta.ws.rs.ext.RuntimeDelegate.HeaderDelegate
createLinkBuilderback to summary
public abstract Link.Builder createLinkBuilder()

Create a new instance of a jakarta.ws.rs.core.Link.Builder.

Returns:Link.Builder

new Link.Builder instance.

See Also
jakarta.ws.rs.core.Link.Builder
createResponseBuilderback to summary
public abstract Response.ResponseBuilder createResponseBuilder()

Create a new instance of a jakarta.ws.rs.core.Response.ResponseBuilder.

Returns:Response.ResponseBuilder

new ResponseBuilder instance.

See Also
jakarta.ws.rs.core.Response.ResponseBuilder
createUriBuilderback to summary
public abstract UriBuilder createUriBuilder()

Create a new instance of a jakarta.ws.rs.core.UriBuilder.

Returns:UriBuilder

new UriBuilder instance.

See Also
jakarta.ws.rs.core.UriBuilder
createVariantListBuilderback to summary
public abstract Variant.VariantListBuilder createVariantListBuilder()

Create a new instance of a jakarta.ws.rs.core.Variant.VariantListBuilder.

Returns:Variant.VariantListBuilder

new VariantListBuilder instance.

See Also
jakarta.ws.rs.core.Variant.VariantListBuilder
findDelegateback to summary
private static RuntimeDelegate findDelegate()

Obtain a RuntimeDelegate instance using the method described in getInstance.

Returns:RuntimeDelegate

an instance of RuntimeDelegate.

getInstanceback to summary
public static RuntimeDelegate getInstance()

Obtain a 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:

  • 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 is jakarta.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:RuntimeDelegate

an instance of RuntimeDelegate.

setInstanceback to summary
public static void setInstance(final RuntimeDelegate rd)

Set the runtime delegate that will be used by JAX-RS classes. If this method is not called prior to getInstance then an implementation will be sought as described in getInstance.

Parameters
rd:RuntimeDelegate

the runtime delegate instance

Exceptions
SecurityException:
if there is a security manager and the permission ReflectPermission("suppressAccessChecks") has not been granted.
jakarta.ws.rs.ext back to summary

public Interface RuntimeDelegate.HeaderDelegate<T>

Type Parameters
<T>
a JAX-RS type that corresponds to the value of a HTTP header.

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.

Method Summary

Modifier and TypeMethod and Description
public T

Returns:

the newly created instance of T.
fromString
(String
the string value.
value
)

Parse the supplied value and create an instance of T.

public String

Returns:

a String representation of the value.
toString
(T
the value of type T.
value
)

Convert the supplied value to a String.

Method Detail

fromStringback to summary
public T fromString(String value)

Parse the supplied value and create an instance of T.

Parameters
value:String

the string value.

Returns:T

the newly created instance of T.

Exceptions
IllegalArgumentException:
if the supplied string cannot be parsed or is null.
toStringback to summary
public String toString(T value)

Convert the supplied value to a String.

Parameters
value:T

the value of type T.

Returns:String

a String representation of the value.

Exceptions
IllegalArgumentException:
if the supplied object cannot be serialized or is null.