## com.sun.jersey.spi.container
Interface WebApplication

All Superinterfaces:
  Traceable

    public interface WebApplication

extends Traceable

A Web application that manages a set of resource classes.

The web application will dispatch HTTP requests to the matching resource method on the matching resource class.

Author:
  Paul.Sandoz@Sun.Com

Method Summary
`WebApplication` | `clone()` Clone the WebApplication instance.
`void` | `destroy()` Destroy the Web application.
`DispatchingListener` | `getDispatchingListener()` Get an instance of `DispatchingListener` that should be used to monitor request processing.
`ExceptionMapperContext` | `getExceptionMapperContext()` Get the exception mapper context that can be used to map exceptions to responses.
`FeaturesAndProperties` | `getFeaturesAndProperties()` Get the features and properties.
`MessageBodyWorkers` | `getMessageBodyWorkers()` Get the message body workers that can be used for getting message body readers and writers.
`Providers` | `getProviders()` Get the providers.
`RequestListener` | `getRequestListener()` Get an instance of `RequestListener` that should be used to monitor request processing.
`ResourceContext` | `getResourceContext()` Get the ResourceContext
`ResponseListener` | `getResponseListener()` Get an instance of `ResponseListener` that should be used to monitor request processing.
`com.sun.jersey.server.impl.inject.ServerInjectableProviderFactory` | `getServerInjectableProviderFactory()` Get the server injectable provider factory.
`HttpContext` | `getThreadLocalHttpContext()` Get an instance of `HttpContext` that is a proxy to a thread local instance of `HttpContext`.
`void` | `handleRequest(ContainerRequest request, ContainerResponse response)` Handle an HTTP request by dispatching the request to the appropriate matching Web resource that produces the response or otherwise producing the appropriate HTTP error response.
`void` | `handleRequest(ContainerRequest request, ContainerResponseWriter responseWriter)` Handle an HTTP request by dispatching the request to the appropriate matching Web resource that produces the response or otherwise producing the appropriate HTTP error response.
`void` | `initiate(ResourceConfig resourceConfig)` Initiate the Web application.
`void` | `initiate(ResourceConfig resourceConfig, IoCComponentProviderFactory provider)` Initiate the Web application.
`boolean` | `isInitiated()`

Methods inherited from interface com.sun.jersey.api.core.Traceable
`isTracingEnabled, trace`

Method Detail

### isInitiated

    boolean isInitiated()

  Returns:
    true if th web application is initiated, otherwise false.

### initiate

    void initiate(ResourceConfig resourceConfig)
                  throws java.lang.IllegalArgumentException,
                         ContainerException

  Initiate the Web application.

  This method can only be called once. Further calls will result in an exception.

  Parameters:
    `resourceConfig` - the resource configuration containing the set of Web resources to be managed by the Web application.
  Throws:
    `java.lang.IllegalArgumentException` - if resourceConfig is null.
    `ContainerException` - if a second or further call to the method is invoked.

### initiate

    void initiate(ResourceConfig resourceConfig,
                  IoCComponentProviderFactory provider)
                  throws java.lang.IllegalArgumentException,
                         ContainerException

  Initiate the Web application.

  This method can only be called once. Further calls will result in an exception.

  Parameters:
    `resourceConfig` - the resource configuration containing the set of Web resources to be managed by the Web application.
    `provider` - the IoC component provider factory to use, if null the default component provider factory will be used.
  Throws:
    `java.lang.IllegalArgumentException` - if resourceConfig is null.
    `ContainerException` - if a second or further call to the method is invoked.

### clone

    WebApplication clone()

  Clone the WebApplication instance.

  A new WebApplication instance will be created that is initiated with the `ResourceConfig` and `IoCComponentProviderFactory` instances that were used to initiate this WebApplication instance.

  Returns:
    the cloned instance.

### getFeaturesAndProperties

    FeaturesAndProperties getFeaturesAndProperties()

  Get the features and properties.

  Returns:
    the features and properties.

### getProviders

    Providers getProviders()

  Get the providers.

  Returns:
    the providers.
  Since:
    1.3

### getResourceContext

    ResourceContext getResourceContext()

  Get the ResourceContext

  Returns:
    ResourceContext
  Since:
    1.13

### getMessageBodyWorkers

    MessageBodyWorkers getMessageBodyWorkers()

  Get the message body workers that can be used for getting message body readers and writers.

  Returns:
    the message body workers. The return value is undefined before the web application is initialized.

### getExceptionMapperContext

    ExceptionMapperContext getExceptionMapperContext()

  Get the exception mapper context that can be used to map exceptions to responses.

  Returns:
    the exception mapper context.

### getThreadLocalHttpContext

    HttpContext getThreadLocalHttpContext()

  Get an instance of `HttpContext` that is a proxy to a thread local instance of `HttpContext`.

  Returns:
    the thread local instance of HttpContext.

### getServerInjectableProviderFactory

    com.sun.jersey.server.impl.inject.ServerInjectableProviderFactory getServerInjectableProviderFactory()

  Get the server injectable provider factory.

  Returns:
    the server injectable provider factory

### getRequestListener

    RequestListener getRequestListener()

  Get an instance of `RequestListener` that should be used to monitor request processing.

  Returns:
    the actual request listener

### getDispatchingListener

    DispatchingListener getDispatchingListener()

  Get an instance of `DispatchingListener` that should be used to monitor request processing.

  Returns:
    the actual dispatching listener

### getResponseListener

    ResponseListener getResponseListener()

  Get an instance of `ResponseListener` that should be used to monitor request processing.

  Returns:
    the actual response listener

### handleRequest

    void handleRequest(ContainerRequest request,
                       ContainerResponseWriter responseWriter)
                       throws java.io.IOException

  Handle an HTTP request by dispatching the request to the appropriate matching Web resource that produces the response or otherwise producing the appropriate HTTP error response.

  Parameters:
    `request` - the HTTP container request.
    `responseWriter` - the HTTP container response writer.
  Throws:
    `java.io.IOException` - if there is an IO error handling the request.

### handleRequest

    void handleRequest(ContainerRequest request,
                       ContainerResponse response)
                       throws java.io.IOException

  Handle an HTTP request by dispatching the request to the appropriate matching Web resource that produces the response or otherwise producing the appropriate HTTP error response.

  Parameters:
    `request` - the HTTP container request.
    `response` - the HTTP container response.
  Throws:
    `java.io.IOException` - if there is an IO error handling the request.

### destroy

    void destroy()

  Destroy the Web application.

  This method MUST only be called only once. Calls to `handlerRequest` MUST not occur while and after this method has been called.

Copyright © 2017 Oracle Corporation. All Rights Reserved.