com.caucho.services.server
Class ServiceContext

java.lang.Object
  extended by com.caucho.services.server.ServiceContext

public class ServiceContext
extends java.lang.Object

Context for a service, to handle request-specific information.


Field Summary
private  int _count
           
private  java.util.HashMap _headers
           
private static java.lang.ThreadLocal _localContext
           
private  java.lang.String _objectId
           
private  javax.servlet.ServletRequest _request
           
private  java.lang.String _serviceName
           
 
Constructor Summary
private ServiceContext()
           
 
Method Summary
 void addHeader(java.lang.String header, java.lang.Object value)
          Adds a header.
static void begin(javax.servlet.ServletRequest request, java.lang.String serviceName, java.lang.String objectId)
          Sets the request object prior to calling the service's method.
static void end()
          Cleanup at the end of a request.
static ServiceContext getContext()
          Returns the service request.
static java.lang.Object getContextHeader(java.lang.String header)
          Gets a header from the context.
static java.lang.String getContextObjectId()
          Returns the object id, corresponding to the ?id= of the URL.
static javax.servlet.ServletRequest getContextRequest()
          Returns the service request.
static java.lang.String getContextServiceName()
          Returns the service id, corresponding to the pathInfo of the URL.
 java.lang.Object getHeader(java.lang.String header)
          Gets a header.
static java.lang.String getObjectId()
          Deprecated.  
static javax.servlet.ServletRequest getRequest()
          Deprecated.  
static java.lang.String getServiceName()
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_localContext

private static final java.lang.ThreadLocal _localContext

_request

private javax.servlet.ServletRequest _request

_serviceName

private java.lang.String _serviceName

_objectId

private java.lang.String _objectId

_count

private int _count

_headers

private java.util.HashMap _headers
Constructor Detail

ServiceContext

private ServiceContext()
Method Detail

begin

public static void begin(javax.servlet.ServletRequest request,
                         java.lang.String serviceName,
                         java.lang.String objectId)
                  throws javax.servlet.ServletException
Sets the request object prior to calling the service's method.

Parameters:
request - the calling servlet request
serviceId - the service identifier
objectId - the object identifier
Throws:
javax.servlet.ServletException

getContext

public static ServiceContext getContext()
Returns the service request.


addHeader

public void addHeader(java.lang.String header,
                      java.lang.Object value)
Adds a header.


getHeader

public java.lang.Object getHeader(java.lang.String header)
Gets a header.


getContextHeader

public static java.lang.Object getContextHeader(java.lang.String header)
Gets a header from the context.


getContextRequest

public static javax.servlet.ServletRequest getContextRequest()
Returns the service request.


getContextServiceName

public static java.lang.String getContextServiceName()
Returns the service id, corresponding to the pathInfo of the URL.


getContextObjectId

public static java.lang.String getContextObjectId()
Returns the object id, corresponding to the ?id= of the URL.


end

public static void end()
Cleanup at the end of a request.


getRequest

public static javax.servlet.ServletRequest getRequest()
Deprecated. 

Returns the service request.


getServiceName

public static java.lang.String getServiceName()
Deprecated. 

Returns the service id, corresponding to the pathInfo of the URL.


getObjectId

public static java.lang.String getObjectId()
Deprecated. 

Returns the object id, corresponding to the ?id= of the URL.



Copyright 2003-2011. All Rights Reserved.