nextapp.echoservlet
Class ThreadSafeConnection

java.lang.Object
  extended by nextapp.echoservlet.Connection
      extended by nextapp.echoservlet.ThreadSafeConnection

public class ThreadSafeConnection
extends Connection

Thread safe implementation of Connection, that throws a ThreadSensitiveOperation when an operation is called that is not shareable between multiple threads.


Field Summary
 
Fields inherited from class nextapp.echoservlet.Connection
INSTANCE_PEER_SESSION_KEY_PREFIX, serverStartUpDate
 
Constructor Summary
ThreadSafeConnection(Connection decorated)
           
 
Method Summary
 java.lang.String correctUri(java.lang.String uri)
          Corrects relative-path URIs to include the application name, such that they can properly retrieve the desired resource.
 java.lang.String getApplicationUri()
          Returns the URI of the application.
 Id getIdParameter(java.lang.String name)
          Returns the specified request parameter as an Id value.
 InstancePeer getInstancePeer()
          Returns the InstancePeer associated with this connection.
 java.io.OutputStream getOutputStream()
          Returns the OutputStream object that may be used to generate a response.
 java.lang.String getParameter(java.lang.String name)
          Returns the value of the HTTP parameter associated with the given name.
 java.util.Enumeration getParameterNames()
          Returns an enumeration of all parameter names passed in the request.
 javax.servlet.http.HttpServletRequest getRequest()
          Returns the HttpServletRequest wrapped by this Connection.
 javax.servlet.http.HttpServletResponse getResponse()
          Returns the HttpServletResponse wrapped by this Connection.
 EchoServer getServer()
          Returns the EchoServer wrapped by this Connection.
 VariableData getVariableData()
          Returns the VariableData associated with this Connection.
 java.io.PrintWriter getWriter()
          Returns the PrintWriter object that may be used to generate a response.
 void setContentType(ContentType contentType)
          Sets the content type of the response.
 
Methods inherited from class nextapp.echoservlet.Connection
getCacheIdPrefix, retrieveService, setReponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadSafeConnection

public ThreadSafeConnection(Connection decorated)
Method Detail

correctUri

public java.lang.String correctUri(java.lang.String uri)
Description copied from class: Connection
Corrects relative-path URIs to include the application name, such that they can properly retrieve the desired resource.

Overrides:
correctUri in class Connection
Parameters:
uri - The URI to correct.
Returns:
The corrected URI.

getApplicationUri

public java.lang.String getApplicationUri()
Description copied from class: Connection
Returns the URI of the application.

Overrides:
getApplicationUri in class Connection
Returns:
The URI of the application.

getIdParameter

public Id getIdParameter(java.lang.String name)
Description copied from class: Connection
Returns the specified request parameter as an Id value. If the parameter is was not provided in the request, or if the parameter is not a valid Id value, null is returned.

Overrides:
getIdParameter in class Connection
Parameters:
name - The parameter name.
Returns:
The parameter as an Id.

getParameter

public java.lang.String getParameter(java.lang.String name)
Description copied from class: Connection
Returns the value of the HTTP parameter associated with the given name.

Overrides:
getParameter in class Connection
Parameters:
name - The name of the parameter to return.
Returns:
The value of the HTTP parameter associated with the given name.

getParameterNames

public java.util.Enumeration getParameterNames()
Description copied from class: Connection
Returns an enumeration of all parameter names passed in the request.

Overrides:
getParameterNames in class Connection
Returns:
An enumeration of all parameter names passed in the request.

getVariableData

public VariableData getVariableData()
Description copied from class: Connection
Returns the VariableData associated with this Connection. If an InstancePeer exists, its VariableData is returned, otherwise, a temporary VariableData object is returned that contains defaults used for initialization.

Overrides:
getVariableData in class Connection
Returns:
The VariableData object associated with this Connection.

getInstancePeer

public InstancePeer getInstancePeer()
Description copied from class: Connection
Returns the InstancePeer associated with this connection. If the session has not been initialized, null is returned.

Overrides:
getInstancePeer in class Connection
Returns:
The InstancePeer associated with this connection.

getRequest

public javax.servlet.http.HttpServletRequest getRequest()
Description copied from class: Connection
Returns the HttpServletRequest wrapped by this Connection.

Overrides:
getRequest in class Connection
Returns:
The HttpServletRequest wrapped by this Connection.

getResponse

public javax.servlet.http.HttpServletResponse getResponse()
Description copied from class: Connection
Returns the HttpServletResponse wrapped by this Connection.

Overrides:
getResponse in class Connection
Returns:
The HttpServletResponse wrapped by this Connection.

getServer

public EchoServer getServer()
Description copied from class: Connection
Returns the EchoServer wrapped by this Connection.

Overrides:
getServer in class Connection
Returns:
The EchoServer wrapped by this Connection.

getWriter

public java.io.PrintWriter getWriter()
Description copied from class: Connection
Returns the PrintWriter object that may be used to generate a response. This method may be called once. If it is called, the getOuputStream() method may not be called. This method wraps a call to HttpServletResponse.getWriter(). The PrintWriter will be closed by the servlet container.

Overrides:
getWriter in class Connection
Returns:
the PrintWriter object that may be used to generate a response to the client.

setContentType

public void setContentType(ContentType contentType)
Description copied from class: Connection
Sets the content type of the response. This method will automatically append a character encoding to non-binary content types.

Overrides:
setContentType in class Connection
Parameters:
contentType - The content type of the response.

getOutputStream

public java.io.OutputStream getOutputStream()
Description copied from class: Connection
Returns the OutputStream object that may be used to generate a response. This method may be called once. If it is called, the getWriter() method may not be called. This method wraps a call to HttpServletResponse.getOutputStream(). The OutputStream will be closed by the servlet container.

Overrides:
getOutputStream in class Connection
Returns:
the OutputStream object that may be used to generate a response to the client.