|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.simpleframework.http.core.Conversation
public class Conversation
The Conversation object is used to set and interpret
the semantics of the HTTP headers with regard to the encoding
used for the response. This will ensure the the correct headers
are used so that if chunked encoding or a connection close is
needed that the headers are set accordingly. This allows both the
server and client to agree on the best semantics to use.
ResponseBuffer,
ResponseEncoder| Constructor Summary | |
|---|---|
Conversation(RequestHeader request,
ResponseHeader response)
Constructor for the Conversation object. |
|
| Method Summary | |
|---|---|
long |
getContentLength()
This is used to acquire the content length for the response. |
RequestHeader |
getRequest()
This provides the Request object. |
ResponseHeader |
getResponse()
This provides the Response object. |
boolean |
isChunkable()
The isChunkable method is used to determine if
the client supports chunked encoding. |
boolean |
isChunkedEncoded()
The isChunkedEncoded is used to determine whether
the chunked encoding scheme is desired. |
boolean |
isConnect()
This is used to determine if the method was a CONNECT. |
boolean |
isEmpty()
This is used to determine if the Response has a
message body. |
boolean |
isHead()
This is used to determine if the request method was HEAD. |
boolean |
isKeepAlive()
The isKeepAlive method is used to determine if
the connection semantics are set to maintain the connection. |
boolean |
isPersistent()
This checks the protocol version used in the request to check whether it supports persistent HTTP connections. |
boolean |
isTunnel()
This is used to determine if a tunnel should be established. |
boolean |
isWebSocket()
This is used to determine if a WebSocket upgrade was requested and established. |
void |
setChunkedEncoded()
This is used when the output is encoded in the chunked encoding. |
void |
setConnectionUpgrade()
This is used to set the response to a connection upgrade. |
void |
setContentLength(long length)
This is used to set the content length for the response. |
void |
setIdentityEncoded()
This will remove all explicit transfer encoding headers from the response header. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Conversation(RequestHeader request,
ResponseHeader response)
Conversation object. This is
used to create an object that makes use of both the request
and response HTTP headers to determine how best to deliver
the response body. Depending on the protocol version and the
existing response headers suitable semantics are determined.
request - this is the request from the clientresponse - this is the response that is to be sent| Method Detail |
|---|
public RequestHeader getRequest()
Request object. This can be
used to acquire the request HTTP headers and protocl version
used by the client. Typically the conversation provides all
the data needed to determine the type of response required.
public ResponseHeader getResponse()
Response object. This is used
when the commit is required on the response. By committing
the response the HTTP header is generated and delivered to
the underlying transport.
public long getContentLength()
public boolean isEmpty()
Response has a
message body. If this does not have a message body then true
is returned. This is determined as of RFC 2616 rules for the
presence of a message body. A message body must not be
included with a HEAD request or with a 304 or a 204 response.
If when this is called there is no message length delimiter
as specified by section RFC 2616 4.4, then there is no body.
public boolean isHead()
public boolean isConnect()
public void setContentLength(long length)
length - this is the length to set HTTP header topublic boolean isPersistent()
public boolean isKeepAlive()
isKeepAlive method is used to determine if
the connection semantics are set to maintain the connection.
This checks to see if there is a Connection header with the
keep-alive token, if so then the connection is keep alive, if
however there is no connection header the version is used.
public boolean isChunkable()
isChunkable method is used to determine if
the client supports chunked encoding. If the client does not
support chunked encoding then a connection close should be used
instead, this allows HTTP/1.0 clients to be supported properly.
public void setChunkedEncoded()
public void setConnectionUpgrade()
public void setIdentityEncoded()
public boolean isChunkedEncoded()
isChunkedEncoded is used to determine whether
the chunked encoding scheme is desired. This is enables data to
be encoded in such a way that a connection can be maintained
without a Content-Length header. If the output is chunked then
the connection is keep alive.
public boolean isWebSocket()
public boolean isTunnel()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||