|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.continuuity.http.BasicHttpResponder
public class BasicHttpResponder
HttpResponder responds back to the client that initiated the request. Caller can use sendJson method to respond back to the client in json format.
| Constructor Summary | |
|---|---|
BasicHttpResponder(org.jboss.netty.channel.Channel channel,
boolean keepalive)
|
|
| Method Summary | |
|---|---|
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 BasicHttpResponder(org.jboss.netty.channel.Channel channel,
boolean keepalive)
| Method Detail |
|---|
public void sendJson(org.jboss.netty.handler.codec.http.HttpResponseStatus status,
Object object)
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)
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)
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)
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)
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)
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)
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)
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)
sendChunk(ChannelBuffer) and 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)
sendChunkStart(HttpResponseStatus, Multimap)
should be called before calling this method. sendChunkEnd() should be called after all chunks are done.
sendChunk in interface HttpRespondercontent - the chunk of content to sendpublic void sendChunkEnd()
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)
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 HttpResponder
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||