|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmmhttp.protocol.Response
mmhttp.protocol.ChunkedResponse
public class ChunkedResponse
This a special type of Response that supports HTTP 1.1 Chunking.
A snippet from the HTTP 1.1 RFC:
The chunked encoding modifies the body of a message in
order to transfer it as a series of chunks, each with its
own size indicator, followed by an OPTIONAL trailer
containing entity-header fields. This allows dynamically
produced content to be transferred along with the
information necessary for the recipient to verify that it
has received the full message.
Field Summary |
---|
Fields inherited from class mmhttp.protocol.Response |
---|
CRLF, DEFAULT_CONTENT_TYPE |
Constructor Summary | |
---|---|
ChunkedResponse()
|
Method Summary | |
---|---|
void |
add(byte[] bytes)
Sends a chunk of data to the client. |
void |
add(java.lang.String text)
Sends a chunk of text to the client. |
protected void |
addSpecificHeaders()
|
void |
addTrailingHeader(java.lang.String key,
java.lang.String value)
Trailing headers are sent to the client after all the chunks have been delievered. |
void |
close()
Call this method to conclude the response. |
void |
closeAll()
This is a short cut to be used if there are not traling headers. |
void |
closeChunks()
Call this method when you are through sending all the chunks. |
void |
closeTrailer()
Call this method when you're finished sending trailing headers. |
int |
getContentSize()
A method to get the size of the response content. |
boolean |
isReadyToSend()
|
void |
readyToSend(ResponseSender sender)
Begins the transfer of the HTTP response. |
Methods inherited from class mmhttp.protocol.Response |
---|
addHeader, addStandardHeaders, getContentType, getEncodedBytes, getHeader, getReasonPhrase, getReasonPhrase, getStatus, makeHttpHeaders, makeStandardHttpDateFormat, redirect, setContentType, setExpiresHeader, setLastModifiedHeader, setMaxAge, setStatus |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ChunkedResponse()
Method Detail |
---|
public void readyToSend(ResponseSender sender) throws java.lang.Exception
readyToSend
in class Response
sender
- is responsible for transmitting the data
java.lang.Exception
public boolean isReadyToSend()
protected void addSpecificHeaders()
addSpecificHeaders
in class Response
public void add(java.lang.String text) throws java.lang.Exception
text
-
java.lang.Exception
public void add(byte[] bytes) throws java.lang.Exception
bytes
-
java.lang.Exception
public void addTrailingHeader(java.lang.String key, java.lang.String value) throws java.lang.Exception
key
- value
-
java.lang.Exception
closeChunks()
public void closeChunks() throws java.lang.Exception
java.lang.Exception
public void closeTrailer() throws java.lang.Exception
java.lang.Exception
addTrailingHeader(java.lang.String, java.lang.String)
public void close() throws java.lang.Exception
java.lang.Exception
public void closeAll() throws java.lang.Exception
java.lang.Exception
public int getContentSize()
Response
getContentSize
in class Response
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |