|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnextapp.echoservlet.Connection
public class Connection
A wrapper that holds information about an HTTP request, provides facilities to generate a response, and provides access to the application instance that is to process it.
| Field Summary | |
|---|---|
static java.lang.String |
INSTANCE_PEER_SESSION_KEY_PREFIX
The prefix that will be used to determine the key name under which the application will be stored in HttpSession. |
static java.util.Date |
serverStartUpDate
|
| Constructor Summary | |
|---|---|
Connection()
|
|
Connection(EchoServer server,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Creates a connection object that will handle the given
request and response. |
|
| 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. |
java.lang.String |
getCacheIdPrefix()
Returns a prefix to prepend to cache ids in order to ensure that incorrect cached resources are used by client in the event either the server or the users session has restarted. |
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. |
Service |
retrieveService(Id id)
Returns the service that corresponds to the specified Id. |
void |
setContentType(ContentType contentType)
Sets the content type of the response. |
void |
setReponse(javax.servlet.http.HttpServletResponse response)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String INSTANCE_PEER_SESSION_KEY_PREFIX
HttpSession. The
application's URI will be appended to the session prefix to form a unique
value.
public static java.util.Date serverStartUpDate
| Constructor Detail |
|---|
public Connection()
public Connection(EchoServer server,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.io.IOException,
javax.servlet.ServletException
connection object that will handle the given
request and response. The InstancePeer will be pulled from the session if
one exists. A session will NOT be created if one does not exist.
server - The EchoServer generating the connection.request - The HTTP request object that was passed to the servlet.response - The HTTP response object that was passed to the servlet.
java.io.IOException
javax.servlet.ServletException| Method Detail |
|---|
public java.lang.String getApplicationUri()
public java.lang.String getCacheIdPrefix()
InstancePeer has been
created, otherwise defers responsibility to the InstancePeer.
public Id getIdParameter(java.lang.String name)
name - The parameter name.
public InstancePeer getInstancePeer()
InstancePeer associated with this connection.
If the session has not been initialized, null is returned.
InstancePeer associated with this connection.public java.io.OutputStream getOutputStream()
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.
OutputStream object that may be used to
generate a response to the client.public java.lang.String getParameter(java.lang.String name)
name - The name of the parameter to return.
public java.util.Enumeration getParameterNames()
public javax.servlet.http.HttpServletRequest getRequest()
HttpServletRequest wrapped by this
Connection.
HttpServletRequest wrapped by this
Connection.public javax.servlet.http.HttpServletResponse getResponse()
HttpServletResponse wrapped by this
Connection.
HttpServletResponse wrapped by this
Connection.public EchoServer getServer()
EchoServer wrapped by this
Connection.
EchoServer wrapped by this
Connection.public VariableData getVariableData()
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.
VariableData object associated with this
Connection.public java.io.PrintWriter getWriter()
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.
PrintWriter object that may be used to
generate a response to the client.public java.lang.String correctUri(java.lang.String uri)
uri - The URI to correct.
public Service retrieveService(Id id)
id - The id of the service to return.
public void setContentType(ContentType contentType)
contentType - The content type of the response.public void setReponse(javax.servlet.http.HttpServletResponse response)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||