|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mmhttp.protocol.Response mmhttp.protocol.SimpleResponse
public class SimpleResponse
The most basic implementation of Response. Just set the status, headers, and content of the response and it's ready to go. The content of SimpleResponse is stored in memory so it should not be used for large data sets.
Field Summary |
---|
Fields inherited from class mmhttp.protocol.Response |
---|
CRLF, DEFAULT_CONTENT_TYPE |
Constructor Summary | |
---|---|
SimpleResponse()
Default constructor with no configuration. |
|
SimpleResponse(int status)
A convenience contructor that will set the port. |
|
SimpleResponse(int status,
java.lang.String content)
A convenience contructor that will set the port and content. |
Method Summary | |
---|---|
protected void |
addSpecificHeaders()
|
byte[] |
getBytes()
The HTTP response bytes are generated and returned. |
java.lang.String |
getContent()
|
byte[] |
getContentBytes()
|
int |
getContentSize()
A method to get the size of the response content. |
java.lang.String |
getText()
The HTTP response bytes are generated and converted into a String. |
void |
readyToSend(ResponseSender sender)
Converts the response into HTTP compliant bytes and sends them through the ResponseSender. |
void |
setContent(byte[] value)
Sets the content (body) of the response. |
void |
setContent(java.lang.String value)
Sets the content (body) of the 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 SimpleResponse()
public SimpleResponse(int status)
status
- public SimpleResponse(int status, java.lang.String content) throws java.lang.Exception
status
- content
-
java.lang.Exception
Method Detail |
---|
public void readyToSend(ResponseSender sender) throws java.lang.Exception
readyToSend
in class Response
sender
-
java.lang.Exception
public void setContent(java.lang.String value) throws java.lang.Exception
value
-
java.lang.Exception
public void setContent(byte[] value)
value
- public java.lang.String getContent()
public byte[] getContentBytes()
public java.lang.String getText()
public byte[] getBytes()
public int getContentSize()
Response
getContentSize
in class Response
protected void addSpecificHeaders()
addSpecificHeaders
in class Response
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |