org.glassfish.jersey.server
Class ApplicationHandler

java.lang.Object
  extended by org.glassfish.jersey.server.ApplicationHandler

public final class ApplicationHandler
extends java.lang.Object

Jersey server-side application handler.

Container implementations use the ApplicationHandler API to process requests by invoking the apply(request) method on a configured application handler instance.

Author:
Pavel Bucek (pavel.bucek at oracle.com), Jakub Podlesak (jakub.podlesak at oracle.com), Marek Potociar (marek.potociar at oracle.com)
See Also:
ResourceConfig, ContainerProvider

Constructor Summary
ApplicationHandler()
          Create a new Jersey application handler using a default configuration.
ApplicationHandler(Application application)
          Create a new Jersey server-side application handler configured by an instance of a JAX-RS Application sub-class.
ApplicationHandler(java.lang.Class<? extends Application> jaxrsApplicationClass)
          Create a new Jersey server-side application handler configured by a JAX-RS Application (sub-)class.
 
Method Summary
 void apply(ContainerRequestContext containerContext)
          The main request/response processing entry point for Jersey container implementations.
 java.util.concurrent.Future<Response> apply(Request request)
          Invokes a request and returns the response future.
 ResourceConfig getConfiguration()
          Get the application configuration.
 ServiceProviders getServiceProviders()
          Get the service providers configured for the application.
 org.glassfish.hk2.Services getServices()
          Returns Services relevant to current application.
 void registerAdditionalModules(java.util.Set<org.glassfish.hk2.Module> modules)
          Registers modules into the HK2 service register.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApplicationHandler

public ApplicationHandler()
Create a new Jersey application handler using a default configuration.


ApplicationHandler

public ApplicationHandler(java.lang.Class<? extends Application> jaxrsApplicationClass)
Create a new Jersey server-side application handler configured by a JAX-RS Application (sub-)class.

Parameters:
jaxrsApplicationClass - JAX-RS Application (sub-)class that will be instantiated and used to configure the new Jersey application handler.

ApplicationHandler

public ApplicationHandler(Application application)
Create a new Jersey server-side application handler configured by an instance of a JAX-RS Application sub-class.

Parameters:
application - an instance of a JAX-RS Application (sub-)class that will be used to configure the new Jersey application handler.
Method Detail

registerAdditionalModules

public void registerAdditionalModules(java.util.Set<org.glassfish.hk2.Module> modules)
Registers modules into the HK2 service register.

Parameters:
modules - Modules to be registered.

apply

public java.util.concurrent.Future<Response> apply(Request request)
Invokes a request and returns the response future.

Parameters:
request - request data.
Returns:
response future.

apply

public void apply(ContainerRequestContext containerContext)
The main request/response processing entry point for Jersey container implementations.

The method invokes the request processing of the provided jax-rs request from the container request context and uses the container response writer from the provided container request context to suspend & resume the processing as well as write the response back to the container. If the container request context contains security context it will be registered for further request processing. Custom scope injections will be initialized into the request scope.

Parameters:
containerContext - container request context of the current request.

getServices

public org.glassfish.hk2.Services getServices()
Returns Services relevant to current application.

Returns:
Services instance.

getServiceProviders

public ServiceProviders getServiceProviders()
Get the service providers configured for the application.

Returns:
application service providers.

getConfiguration

public ResourceConfig getConfiguration()
Get the application configuration.

Returns:
application configuration.


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.
OSZAR »