public class ServletServerHttpConnection extends Object implements ServerHttpConnection
ServerHttpConnection
backed by Servlet
.Constructor and Description |
---|
ServletServerHttpConnection(javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse)
Initiate.
|
Modifier and Type | Method and Description |
---|---|
Serializable |
exportState()
Exports the state of the current
HttpRequest and
HttpResponse . |
String |
getHttpMethod()
Obtains the client sent HTTP method of the
ServerHttpConnection . |
HttpRequest |
getHttpRequest()
Obtains the
HttpRequest for this ServerHttpConnection . |
HttpResponse |
getHttpResponse()
Obtains the
HttpResponse for this ServerHttpConnection . |
InetSocketAddress |
getLocalAddress()
Obtains the local address for this
ServerHttpConnection . |
InetSocketAddress |
getRemoteAddress()
Obtains the remote address for this
ServerHttpConnection . |
void |
importState(Serializable momento)
Imports and overrides the current
HttpRequest and
HttpResponse with the input momento. |
boolean |
isSecure()
Indicates if the connection is over a secure channel (e.g.
|
public ServletServerHttpConnection(javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse)
servletRequest
- HttpServletRequest
.servletResponse
- HttpServletResponse
.public boolean isSecure()
ServerHttpConnection
isSecure
in interface ServerHttpConnection
true
if connection is over a secure channel.public InetSocketAddress getLocalAddress()
ServerHttpConnection
ServerHttpConnection
.getLocalAddress
in interface ServerHttpConnection
InetSocketAddress
describing the local Socket
for
this ServerHttpConnection
.public InetSocketAddress getRemoteAddress()
ServerHttpConnection
ServerHttpConnection
.getRemoteAddress
in interface ServerHttpConnection
InetSocketAddress
describing the remote Socket
for this ServerHttpConnection
.public HttpRequest getHttpRequest()
ServerHttpConnection
HttpRequest
for this ServerHttpConnection
.getHttpRequest
in interface ServerHttpConnection
HttpRequest
for this ServerHttpConnection
.public HttpResponse getHttpResponse()
ServerHttpConnection
HttpResponse
for this ServerHttpConnection
.getHttpResponse
in interface ServerHttpConnection
HttpResponse
for this ServerHttpConnection
.public String getHttpMethod()
ServerHttpConnection
Obtains the client sent HTTP method of the ServerHttpConnection
.
As the HttpRequest
method is overridden, this method may be used
by logic requiring to know the actual client HTTP method. An example of
this logic is the POST/redirect/GET pattern that needs to know whether
the client sent HttpRequest
method is a POST
or
GET
(regardless of imported state).
getHttpMethod
in interface ServerHttpConnection
ServerHttpConnection.exportState()
,
ServerHttpConnection.importState(Serializable)
public Serializable exportState() throws IOException
ServerHttpConnection
Exports the state of the current HttpRequest
and
HttpResponse
.
This enables maintaining the state of the HttpRequest
/
HttpResponse
and later reinstating them (typically after a
redirect).
exportState
in interface ServerHttpConnection
HttpRequest
and
HttpResponse
state.IOException
- Should the state not be able to be exported.ServerHttpConnection.importState(Serializable)
public void importState(Serializable momento) throws IllegalArgumentException, IOException
ServerHttpConnection
HttpRequest
and
HttpResponse
with the input momento.importState
in interface ServerHttpConnection
momento
- Momento exported from a ServerHttpConnection
.IllegalArgumentException
- Should the momento be invalid.IOException
- Should the state not be able to be imported.ServerHttpConnection.exportState()
Copyright © 2005–2016. All rights reserved.