com.sun.jersey.server.impl
Class ThreadLocalHttpContext

java.lang.Object
  extended by com.sun.jersey.server.impl.ThreadLocalHttpContext
All Implemented Interfaces:
HttpContext, Traceable

public final class ThreadLocalHttpContext
extends Object
implements HttpContext

Implementation of HttpContext using ThreadLocal to store HttpRequestContext and HttpResponseContext instances associated with threads.

Author:
Paul.Sandoz@Sun.Com

Constructor Summary
ThreadLocalHttpContext()
           
 
Method Summary
 HttpContext get()
           
 Map<String,Object> getProperties()
          Get the mutable properties.
 HttpRequestContext getRequest()
          Get the HTTP request information.
 HttpResponseContext getResponse()
          Get the HTTP response information.
 ExtendedUriInfo getUriInfo()
          Get the extended URI information.
 boolean isTracingEnabled()
          Check if tracing is enabled.
 void set(HttpContext context)
          Set the HttpContext for the current thread.
 void trace(String message)
          Add a trace message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadLocalHttpContext

public ThreadLocalHttpContext()
Method Detail

set

public void set(HttpContext context)
Set the HttpContext for the current thread.


get

public HttpContext get()

getUriInfo

public ExtendedUriInfo getUriInfo()
Description copied from interface: HttpContext
Get the extended URI information.

Specified by:
getUriInfo in interface HttpContext
Returns:
the extended URI information.

getRequest

public HttpRequestContext getRequest()
Description copied from interface: HttpContext
Get the HTTP request information.

Specified by:
getRequest in interface HttpContext
Returns:
the HTTP request information

getResponse

public HttpResponseContext getResponse()
Description copied from interface: HttpContext
Get the HTTP response information.

Specified by:
getResponse in interface HttpContext
Returns:
the HTTP response information

getProperties

public Map<String,Object> getProperties()
Description copied from interface: HttpContext
Get the mutable properties.

Care should be taken not to clear the properties or remove properties that are unknown otherwise unspecified behaviour may result.

Specified by:
getProperties in interface HttpContext
Returns:
the properties.

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.


Copyright © 2013 Oracle Corporation. All Rights Reserved.