public final class ApplicationHandler extends Object implements ContainerLifecycleListener
 Container implementations use the ApplicationHandler API to process requests
 by invoking the handle(request)
 method on a configured application  handler instance.
 
 ApplicationHandler provides two implementations of config that can be injected
 into the application classes. The first is resource config which implements Configuration
 itself and is configured by the user. The resource config is not modified by this application handler so the future reloads of
 the application is not disrupted by providers found on a classpath. This config can
 be injected only as ResourceConfig or Application. The second one can be injected into the
 Configuration parameters / fields and contains info about all the properties / provider classes / provider instances
 from the resource config and also about all the providers found during processing classes registered under
 server properties. After the application handler is initialized both configurations are marked as
 read-only.
 
 Application handler instance also acts as an aggregate ContainerLifecycleListener instance
 for the associated application. It aggregates all the registered container lifecycle listeners
 under a single, umbrella listener, represented by this application handler instance, that delegates all container lifecycle
 listener method calls to all the registered listeners. Jersey containers are expected to invoke
 the container lifecycle methods directly on the active ApplicationHandler instance. The application handler will then
 make sure to delegate the lifecycle listener calls further to all the container lifecycle listeners registered within the
 application. Additionally, invoking the ContainerLifecycleListener.onShutdown(Container) method on this application
 handler instance will release all the resources associated with the underlying application instance as well as close the
 application-specific injection manager.
 
ResourceConfig, 
Configuration, 
ContainerProvider| Constructor and Description | 
|---|
ApplicationHandler()
Create a new Jersey application handler using a default configuration. 
 | 
ApplicationHandler(jakarta.ws.rs.core.Application application)
Create a new Jersey server-side application handler configured by an instance
 of a  
JAX-RS Application sub-class. | 
ApplicationHandler(jakarta.ws.rs.core.Application application,
                  org.glassfish.jersey.internal.inject.Binder customBinder)
Create a new Jersey server-side application handler configured by an instance
 of a  
ResourceConfig and a custom Binder. | 
ApplicationHandler(jakarta.ws.rs.core.Application application,
                  org.glassfish.jersey.internal.inject.Binder customBinder,
                  Object parentManager)
Create a new Jersey server-side application handler configured by an instance
 of a  
ResourceConfig, custom Binder and a parent used by InjectionManager. | 
ApplicationHandler(Class<? extends jakarta.ws.rs.core.Application> jaxrsApplicationClass)
Create a new Jersey server-side application handler configured by a
  
JAX-RS Application (sub-)class. | 
| Modifier and Type | Method and Description | 
|---|---|
Future<ContainerResponse> | 
apply(ContainerRequest requestContext)
Invokes a request and returns the  
response future. | 
Future<ContainerResponse> | 
apply(ContainerRequest request,
     OutputStream outputStream)
Invokes a request and returns the  
response future. | 
ResourceConfig | 
getConfiguration()
Get the application configuration. 
 | 
org.glassfish.jersey.internal.inject.InjectionManager | 
getInjectionManager()
Returns  
InjectionManager relevant to current application. | 
void | 
handle(ContainerRequest request)
The main request/response processing entry point for Jersey container implementations. 
 | 
void | 
onReload(Container container)
Invoked when the  
container has been reloaded. | 
void | 
onShutdown(Container container)
Invoke at the  
container shut-down. | 
void | 
onStartup(Container container)
Invoked at the  
container start-up. | 
public ApplicationHandler()
public ApplicationHandler(Class<? extends jakarta.ws.rs.core.Application> jaxrsApplicationClass)
JAX-RS Application (sub-)class.jaxrsApplicationClass - JAX-RS Application (sub-)class that will be
                              instantiated and used to configure the new Jersey
                              application handler.public ApplicationHandler(jakarta.ws.rs.core.Application application)
JAX-RS Application sub-class.application - an instance of a JAX-RS Application (sub-)class that
                    will be used to configure the new Jersey application handler.public ApplicationHandler(jakarta.ws.rs.core.Application application,
                          org.glassfish.jersey.internal.inject.Binder customBinder)
ResourceConfig and a custom Binder.application - an instance of a JAX-RS Application (sub-)class that
                     will be used to configure the new Jersey application handler.customBinder - additional custom bindings used to configure the application's.public ApplicationHandler(jakarta.ws.rs.core.Application application,
                          org.glassfish.jersey.internal.inject.Binder customBinder,
                          Object parentManager)
ResourceConfig, custom Binder and a parent used by InjectionManager.application - an instance of a JAX-RS Application (sub-)class that
                      will be used to configure the new Jersey application handler.customBinder - additional custom bindings used during InjectionManager creation.parentManager - parent used in InjectionManager for a specific DI provider.public Future<ContainerResponse> apply(ContainerRequest requestContext)
response future.requestContext - request data.public Future<ContainerResponse> apply(ContainerRequest request, OutputStream outputStream)
response future.request - request data.outputStream - response output stream.public void handle(ContainerRequest request)
 The method invokes the request processing of the provided
 container request context and uses the
 container response writer to suspend & resume the processing
 as well as write the response back to the container.
 
 The the security context stored in the container request context
 is bound as an injectable instance in the scope of the processed request context.
 Also, any custom scope injections
 are initialized in the current request scope.
 
request - container request context of the current request.public org.glassfish.jersey.internal.inject.InjectionManager getInjectionManager()
InjectionManager relevant to current application.InjectionManager instance.public ResourceConfig getConfiguration()
public void onStartup(Container container)
ContainerLifecycleListenercontainer start-up. This method is invoked even
 when application is reloaded and new instance of application has started.onStartup in interface ContainerLifecycleListenercontainer - container that has been started.public void onReload(Container container)
ContainerLifecycleListenercontainer has been reloaded.onReload in interface ContainerLifecycleListenercontainer - container that has been reloaded.public void onShutdown(Container container)
ContainerLifecycleListenercontainer shut-down. This method is invoked even before
 the application is being stopped as a part of reload.onShutdown in interface ContainerLifecycleListenercontainer - container that has been shut down.Copyright © 2007-2021, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.