NextApp Echo3
v3.0.b4

nextapp.echo.webcontainer
Class Connection

java.lang.Object
  extended by nextapp.echo.webcontainer.Connection

public class Connection
extends java.lang.Object

A representation of a connection to the server by the client, encapsulating the servlet request and response objects, and providing access to the relevant application instance. Connections also manage the life-cycle of UserInstances within the HttpSession.


Method Summary
 java.io.OutputStream getOutputStream()
          Returns the OutputStream object that may be used to generate a response.
 java.lang.Object getProperty(java.lang.String key)
          Returns a property from the Connection-persistent property map.
 javax.servlet.http.HttpServletRequest getRequest()
          Returns the HttpServletRequest wrapped by this Connection.
 javax.servlet.http.HttpServletResponse getResponse()
          Returns the HttpServletResponse wrapped by this Connection.
 WebContainerServlet getServlet()
          Returns the WebContainerServlet wrapped by this Connection.
 UserInstance getUserInstance()
          Returns the UserInstance 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.
 void setProperty(java.lang.String key, java.lang.Object value)
          Sets a property in the Connection-persistent property map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getOutputStream

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

Returns:
the OutputStream object that may be used to generate a response to the client

getProperty

public java.lang.Object getProperty(java.lang.String key)
Returns a property from the Connection-persistent property map. (Properties are disposed of when Connection has completed).

Parameters:
key - the property key (for namespacing purposes, keys should be prefaced with the full class name of the object setting the property)
Returns:
the property value

getRequest

public javax.servlet.http.HttpServletRequest getRequest()
Returns the HttpServletRequest wrapped by this Connection.

Returns:
the HttpServletRequest wrapped by this Connection

getResponse

public javax.servlet.http.HttpServletResponse getResponse()
Returns the HttpServletResponse wrapped by this Connection.

Returns:
the HttpServletResponse wrapped by this Connection

getServlet

public WebContainerServlet getServlet()
Returns the WebContainerServlet wrapped by this Connection.

Returns:
the WebContainerServlet wrapped by this Connection

getUserInstance

public UserInstance getUserInstance()
Returns the UserInstance associated with this connection. If the session has not been initialized, null is returned.

Returns:
the UserInstance associated with this connection

getWriter

public java.io.PrintWriter getWriter()
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.

Returns:
the PrintWriter object that may be used to generate a response to the client

setContentType

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

Parameters:
contentType - the content type of the response

setProperty

public void setProperty(java.lang.String key,
                        java.lang.Object value)
Sets a property in the Connection-persistent property map. (Properties are disposed of when Connection has completed).

Parameters:
key - the property key (for namespacing purposes, keys should be prefaced with the full class name of the object setting the property)
value - the new property value

NextApp Echo3
v3.0.b4