com.sun.jersey.server.impl.application
Class WebApplicationImpl

java.lang.Object
  extended by com.sun.jersey.server.impl.application.WebApplicationImpl
All Implemented Interfaces:
Traceable, WebApplication

public final class WebApplicationImpl
extends Object
implements WebApplication

A Web application that contains a set of resources, each referenced by an absolute URI template.

Author:
Paul.Sandoz@Sun.Com

Constructor Summary
WebApplicationImpl()
           
 
Method Summary
 WebApplication clone()
          Clone the WebApplication instance.
 void destroy()
          Destroy the Web application.
 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.
 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 rc, IoCComponentProviderFactory _provider)
          Initiate the Web application.
 boolean isInitiated()
           
 boolean isTracingEnabled()
          Check if tracing is enabled.
 void trace(String message)
          Add a trace message.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebApplicationImpl

public WebApplicationImpl()
Method Detail

getFeaturesAndProperties

public FeaturesAndProperties getFeaturesAndProperties()
Description copied from interface: WebApplication
Get the features and properties.

Specified by:
getFeaturesAndProperties in interface WebApplication
Returns:
the features and properties.

clone

public WebApplication clone()
Description copied from interface: WebApplication
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.

Specified by:
clone in interface WebApplication
Overrides:
clone in class Object
Returns:
the cloned instance.

isInitiated

public boolean isInitiated()
Specified by:
isInitiated in interface WebApplication
Returns:
true if th web application is initiated, otherwise false.

initiate

public void initiate(ResourceConfig resourceConfig)
Description copied from interface: WebApplication
Initiate the Web application.

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

Specified by:
initiate in interface WebApplication
Parameters:
resourceConfig - the resource configuration containing the set of Web resources to be managed by the Web application.

initiate

public void initiate(ResourceConfig rc,
                     IoCComponentProviderFactory _provider)
Description copied from interface: WebApplication
Initiate the Web application.

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

Specified by:
initiate in interface WebApplication
Parameters:
rc - 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.

getProviders

public Providers getProviders()
Description copied from interface: WebApplication
Get the providers.

Specified by:
getProviders in interface WebApplication
Returns:
the providers.

getMessageBodyWorkers

public MessageBodyWorkers getMessageBodyWorkers()
Description copied from interface: WebApplication
Get the message body workers that can be used for getting message body readers and writers.

Specified by:
getMessageBodyWorkers in interface WebApplication
Returns:
the message body workers. The return value is undefined before the web application is initialized.

getExceptionMapperContext

public ExceptionMapperContext getExceptionMapperContext()
Description copied from interface: WebApplication
Get the exception mapper context that can be used to map exceptions to responses.

Specified by:
getExceptionMapperContext in interface WebApplication
Returns:
the exception mapper context.

getServerInjectableProviderFactory

public ServerInjectableProviderFactory getServerInjectableProviderFactory()
Description copied from interface: WebApplication
Get the server injectable provider factory.

Specified by:
getServerInjectableProviderFactory in interface WebApplication
Returns:
the server injectable provider factory

handleRequest

public void handleRequest(ContainerRequest request,
                          ContainerResponseWriter responseWriter)
                   throws IOException
Description copied from interface: WebApplication
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.

Specified by:
handleRequest in interface WebApplication
Parameters:
request - the HTTP container request.
responseWriter - the HTTP container response writer.
Throws:
IOException - if there is an IO error handling the request.

handleRequest

public void handleRequest(ContainerRequest request,
                          ContainerResponse response)
                   throws IOException
Description copied from interface: WebApplication
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.

Specified by:
handleRequest in interface WebApplication
Parameters:
request - the HTTP container request.
response - the HTTP container response.
Throws:
IOException - if there is an IO error handling the request.

destroy

public void destroy()
Description copied from interface: WebApplication
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.

Specified by:
destroy in interface WebApplication

isTracingEnabled

public boolean isTracingEnabled()
Description copied from interface: Traceable
Check if tracing is enabled.

Specified by:
isTracingEnabled in interface Traceable
Returns:
true if tracing is enabled, otherwise false.

trace

public void trace(String message)
Description copied from interface: Traceable
Add a trace message.

A trace message will be added if Traceable.isTracingEnabled() returns true and tracing contraints are satisfied.

Specified by:
trace in interface Traceable
Parameters:
message - the trace message to add.

getThreadLocalHttpContext

public HttpContext getThreadLocalHttpContext()
Description copied from interface: WebApplication
Get an instance of HttpContext that is a proxy to a thread local instance of HttpContext.

Specified by:
getThreadLocalHttpContext in interface WebApplication
Returns:
the thread local instance of HttpContext.


Copyright © 2013 Oracle Corporation. All Rights Reserved.