|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.continuuity.http.InternalHttpResponder
public class InternalHttpResponder
InternalHttpResponder is used when a handler is being called internally by some other handler, and thus there is no need to go through the network. It stores the status code and content in memory and returns them when asked.
| Constructor Summary | |
|---|---|
InternalHttpResponder()
|
|
| Method Summary | |
|---|---|
InternalHttpResponse |
getResponse()
|
void |
sendByteArray(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
byte[] bytes,
com.google.common.collect.Multimap<String,String> headers)
Send a response containing raw bytes. |
void |
sendBytes(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
ByteBuffer buffer,
com.google.common.collect.Multimap<String,String> headers)
Sends a response containing raw bytes. |
void |
sendChunk(org.jboss.netty.buffer.ChannelBuffer content)
Add a chunk of data to the response. |
void |
sendChunkEnd()
Called after all chunks are done. |
void |
sendChunkStart(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
com.google.common.collect.Multimap<String,String> headers)
Respond to the client saying the response will be in chunks. |
void |
sendContent(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
org.jboss.netty.buffer.ChannelBuffer content,
String contentType,
com.google.common.collect.Multimap<String,String> headers)
Send response back to client. |
void |
sendError(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
String errorMessage)
Sends error message back to the client. |
void |
sendFile(File file,
com.google.common.collect.Multimap<String,String> headers)
Sends a file content back to client. |
void |
sendJson(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
Object object)
Sends json response back to the client. |
void |
sendJson(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
Object object,
Type type)
Sends json response back to the client. |
void |
sendJson(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
Object object,
Type type,
com.google.gson.Gson gson)
Sends json response back to the client using the given gson object. |
void |
sendStatus(org.jboss.netty.handler.codec.http.HttpResponseStatus status)
Send only a status code back to client without any content. |
void |
sendStatus(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
com.google.common.collect.Multimap<String,String> headers)
Send only a status code back to client without any content. |
void |
sendString(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
String data)
Send a string response back to the http client. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public InternalHttpResponder()
| Method Detail |
|---|
public void sendJson(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
Object object)
HttpResponder
sendJson in interface HttpResponderstatus - Status of the response.object - Object that will be serialized into Json and sent back as content.
public void sendJson(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
Object object,
Type type)
HttpResponder
sendJson in interface HttpResponderstatus - Status of the response.object - Object that will be serialized into Json and sent back as content.type - Type of object.
public void sendJson(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
Object object,
Type type,
com.google.gson.Gson gson)
HttpResponder
sendJson in interface HttpResponderstatus - Status of the response.object - Object that will be serialized into Json and sent back as content.type - Type of object.gson - Gson object for serialization.
public void sendString(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
String data)
HttpResponder
sendString in interface HttpResponderstatus - status of the Http response.data - string data to be sent back.public void sendStatus(org.jboss.netty.handler.codec.http.HttpResponseStatus status)
HttpResponder
sendStatus in interface HttpResponderstatus - status of the Http response.
public void sendStatus(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
com.google.common.collect.Multimap<String,String> headers)
HttpResponder
sendStatus in interface HttpResponderstatus - status of the Http response.headers - Headers to send.
public void sendByteArray(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
byte[] bytes,
com.google.common.collect.Multimap<String,String> headers)
HttpResponder
sendByteArray in interface HttpResponderstatus - status of the Http response.bytes - bytes to be sent back.headers - headers to be sent back. This will overwrite any headers set by the framework.
public void sendBytes(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
ByteBuffer buffer,
com.google.common.collect.Multimap<String,String> headers)
HttpResponder
sendBytes in interface HttpResponderstatus - status of the Http responsebuffer - bytes to sendheaders - Headers to send.
public void sendError(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
String errorMessage)
HttpResponder
sendError in interface HttpResponderstatus - Status of the response.errorMessage - Error message sent back to the client.
public void sendChunkStart(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
com.google.common.collect.Multimap<String,String> headers)
HttpResponderHttpResponder.sendChunk(ChannelBuffer) and HttpResponder.sendChunkEnd().
sendChunkStart in interface HttpResponderstatus - the status code to respond with. Defaults to 200-OK if null.headers - additional headers to send with the response. May be null.public void sendChunk(org.jboss.netty.buffer.ChannelBuffer content)
HttpResponderHttpResponder.sendChunkStart(HttpResponseStatus, Multimap)
should be called before calling this method. HttpResponder.sendChunkEnd() should be called after all chunks are done.
sendChunk in interface HttpRespondercontent - the chunk of content to sendpublic void sendChunkEnd()
HttpResponder
sendChunkEnd in interface HttpResponder
public void sendContent(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
org.jboss.netty.buffer.ChannelBuffer content,
String contentType,
com.google.common.collect.Multimap<String,String> headers)
HttpResponder
sendContent in interface HttpResponderstatus - Status of the response.content - Content to be sent back.contentType - Type of content.headers - Headers to be sent back.
public void sendFile(File file,
com.google.common.collect.Multimap<String,String> headers)
HttpResponder
sendFile in interface HttpResponderpublic InternalHttpResponse getResponse()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||