|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface HttpResponse
Writes a response back to the client.
IMPORTANT: The connection will remain open untilend() or error(Throwable) is called. Don't
forget these!
| Method Summary | |
|---|---|
Charset |
charset()
Current Charset used to encode to response as. |
HttpResponse |
charset(Charset charset)
For text based responses, sets the Charset to encode the response as. |
HttpResponse |
chunked()
Turns the response into a chunked response after this method is called, write(String) should be used to send chunks |
boolean |
containsHeader(String name)
Test to see if this response has a header of the specified name |
HttpResponse |
content(byte[] content)
Write binary based content back to the client. |
HttpResponse |
content(ByteBuffer buffer)
Write binary based content back to the client. |
HttpResponse |
content(String content)
Write text based content back to the client. |
HttpResponse |
cookie(HttpCookie httpCookie)
Adds a cookie |
HttpResponse |
end()
Marks the response as ended. |
HttpResponse |
error(Throwable error)
Marks the response as erroneous. |
HttpResponse |
header(String name,
Date value)
Adds a Date (RFC 1123 format) HTTP header. |
HttpResponse |
header(String name,
long value)
Adds a numeric HTTP header. |
HttpResponse |
header(String name,
String value)
Adds an HTTP header. |
int |
status()
Retrieve HTTP status code that this response is going to return. |
HttpResponse |
status(int status)
Sets the HTTP status code. |
HttpResponse |
write(String content)
Writes immediately to the client without closing the connection. |
| Method Detail |
|---|
HttpResponse charset(Charset charset)
HttpResponse chunked()
write(String) should be used to send chunks
Charset charset()
charset(Charset)HttpResponse status(int status)
int status()
status(int)
HttpResponse header(String name,
String value)
HttpResponse header(String name,
long value)
HttpResponse header(String name,
Date value)
boolean containsHeader(String name)
HttpResponse cookie(HttpCookie httpCookie)
httpCookie - the cookieHttpResponse content(String content)
charset(Charset),
content(byte[])HttpResponse write(String content)
content(String) method caches content until end() is called()
TODO: Make content write immediately instead and remove this method?
content - what to writeHttpResponse content(byte[] content)
content(String)HttpResponse content(ByteBuffer buffer)
content(String)HttpResponse error(Throwable error)
end() or error(Throwable) called. No more
operations should be performed on a response after these.
HttpResponse end()
end() or error(Throwable) called. No more
operations should be performed on a response after these.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||