org.glassfish.jersey.server
Class Application

java.lang.Object
  extended by org.glassfish.jersey.server.Application
All Implemented Interfaces:
Inflector<javax.ws.rs.core.Request,Future<javax.ws.rs.core.Response>>

public final class Application
extends Object
implements Inflector<javax.ws.rs.core.Request,Future<javax.ws.rs.core.Response>>

Jersey server-side application. Container implementations use the application to instance to process requests by invoking the apply(request, responseWriter) method on a configured application 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

Nested Class Summary
static interface Application.Builder
          Jersey application builder that provides programmatic API for creating server-side JAX-RS / Jersey applications.
 
Constructor Summary
Application()
           
 
Method Summary
 void addModules(org.glassfish.hk2.Module... modules)
          Dynamically binds HK2 modules.
 Future<javax.ws.rs.core.Response> apply(javax.ws.rs.core.Request request)
          Invokes a request and returns the response future.
 void apply(javax.ws.rs.core.Request request, ContainerResponseWriter responseWriter)
          The main request/response processing entry point for Jersey container implementations.
static Application.Builder builder()
          Create new application builder configured with custom ResourceConfig.
static Application.Builder builder(ResourceConfig resourceConfig)
          Create new application builder configured with custom ResourceConfig.
 ServiceProviders getServiceProviders()
           
 org.glassfish.hk2.Services getServices()
          Returns Services relevant to current application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Application

public Application()
Method Detail

builder

public static Application.Builder builder()
Create new application builder configured with custom ResourceConfig.

Returns:
new application builder.

builder

public static Application.Builder builder(@Nullable
                                          ResourceConfig resourceConfig)
Create new application builder configured with custom ResourceConfig.

Parameters:
resourceConfig - custom ResourceConfig
Returns:
new application builder.

apply

public Future<javax.ws.rs.core.Response> apply(javax.ws.rs.core.Request request)
Invokes a request and returns the response future.

Specified by:
apply in interface Inflector<javax.ws.rs.core.Request,Future<javax.ws.rs.core.Response>>
Parameters:
request - request data.
Returns:
response future.

apply

public void apply(javax.ws.rs.core.Request request,
                  ContainerResponseWriter responseWriter)
The main request/response processing entry point for Jersey container implementations. The method invokes the request processing and uses the provided container context to suspend & resume the processing as well as write the response back to the container.

Parameters:
request - request data.
responseWriter - request-scoped container context.

getServices

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

Returns:
Services instance.

getServiceProviders

public ServiceProviders getServiceProviders()

addModules

public void addModules(org.glassfish.hk2.Module... modules)
Dynamically binds HK2 modules.

Parameters:
modules - newly bound modules.
See Also:
Module


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