|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.atmosphere.cpr.AtmosphereResponse
public class AtmosphereResponse
An Atmosphere's response representation. An AtmosphereResponse can be used to construct bi-directional asynchronous
application. If the underlying transport is a WebSocket or if its associated AtmosphereResource has been
suspended, this object can be used to write message back tp the client at any moment.
This object can delegates the write operation to AsyncIOWriter.
| Nested Class Summary | |
|---|---|
static class |
AtmosphereResponse.Builder
|
| Field Summary |
|---|
| Fields inherited from interface javax.servlet.http.HttpServletResponse |
|---|
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_EXPECTATION_FAILED, SC_FORBIDDEN, SC_FOUND, SC_GATEWAY_TIMEOUT, SC_GONE, SC_HTTP_VERSION_NOT_SUPPORTED, SC_INTERNAL_SERVER_ERROR, SC_LENGTH_REQUIRED, SC_METHOD_NOT_ALLOWED, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_MULTIPLE_CHOICES, SC_NO_CONTENT, SC_NON_AUTHORITATIVE_INFORMATION, SC_NOT_ACCEPTABLE, SC_NOT_FOUND, SC_NOT_IMPLEMENTED, SC_NOT_MODIFIED, SC_OK, SC_PARTIAL_CONTENT, SC_PAYMENT_REQUIRED, SC_PRECONDITION_FAILED, SC_PROXY_AUTHENTICATION_REQUIRED, SC_REQUEST_ENTITY_TOO_LARGE, SC_REQUEST_TIMEOUT, SC_REQUEST_URI_TOO_LONG, SC_REQUESTED_RANGE_NOT_SATISFIABLE, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_TEMPORARY_REDIRECT, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY |
| Constructor Summary | |
|---|---|
AtmosphereResponse(AsyncIOWriter asyncIOWriter,
AtmosphereRequest atmosphereRequest,
boolean destroyable)
|
|
AtmosphereResponse(javax.servlet.http.HttpServletResponse r,
AsyncIOWriter asyncIOWriter,
AtmosphereRequest atmosphereRequest,
boolean destroyable)
|
|
| Method Summary | |
|---|---|
void |
addCookie(javax.servlet.http.Cookie cookie)
|
void |
addDateHeader(String name,
long date)
|
void |
addHeader(String name,
String value)
|
void |
addIntHeader(String name,
int value)
|
AtmosphereResponse |
asyncIOWriter(AsyncIOWriter asyncIOWriter)
Set an implementation of AsyncIOWriter that will be invoked every time a write operation is ready to be
processed. |
void |
close()
Close the associated AsyncIOWriter |
void |
closeStreamOrWriter()
Close the associated PrintWriter or OutputStream |
boolean |
containsHeader(String name)
|
void |
destroy()
|
String |
encodeRedirectUrl(String url)
|
String |
encodeRedirectURL(String url)
|
String |
encodeUrl(String url)
|
String |
encodeURL(String url)
|
boolean |
equals(Object o)
|
void |
flushBuffer()
|
AsyncIOWriter |
getAsyncIOWriter()
Return the underlying AsyncIOWriter |
int |
getBufferSize()
|
String |
getCharacterEncoding()
|
String |
getContentType()
|
String |
getHeader(String name)
|
Collection<String> |
getHeaderNames()
|
Collection<String> |
getHeaders(String name)
|
Locale |
getLocale()
|
javax.servlet.ServletOutputStream |
getOutputStream()
|
int |
getStatus()
|
String |
getStatusMessage()
|
PrintWriter |
getWriter()
|
int |
hashCode()
|
Map<String,String> |
headers()
|
boolean |
isCommitted()
|
boolean |
isDestroyable()
Can this object be destroyed. |
AtmosphereRequest |
request()
Return the associated AtmosphereRequest |
AtmosphereResponse |
request(AtmosphereRequest atmosphereRequest)
Set the associated AtmosphereRequest |
void |
reset()
|
void |
resetBuffer()
|
void |
sendError(int sc)
|
void |
sendError(int sc,
String msg)
|
void |
sendRedirect(String location)
|
void |
setBufferSize(int size)
|
void |
setCharacterEncoding(String charSet)
|
void |
setContentLength(int len)
|
void |
setContentType(String contentType)
|
void |
setDateHeader(String name,
long date)
|
void |
setHeader(String name,
String value)
|
void |
setIntHeader(String name,
int value)
|
void |
setLocale(Locale locale)
|
void |
setStatus(int status)
|
void |
setStatus(int status,
String statusMessage)
|
String |
toString()
|
static AtmosphereResponse |
wrap(javax.servlet.http.HttpServletResponse response)
Wrap an HttpServletResponse |
AtmosphereResponse |
write(byte[] data)
Write the bytes by either using the PrintWriter or OutputStream. |
AtmosphereResponse |
write(byte[] data,
int offset,
int length)
Write the bytes by either using the PrintWriter or OutputStream. |
AtmosphereResponse |
write(String data)
Write the String by either using the PrintWriter or OutputStream. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AtmosphereResponse(AsyncIOWriter asyncIOWriter,
AtmosphereRequest atmosphereRequest,
boolean destroyable)
public AtmosphereResponse(javax.servlet.http.HttpServletResponse r,
AsyncIOWriter asyncIOWriter,
AtmosphereRequest atmosphereRequest,
boolean destroyable)
| Method Detail |
|---|
public void destroy()
public void addCookie(javax.servlet.http.Cookie cookie)
addCookie in interface javax.servlet.http.HttpServletResponsepublic boolean containsHeader(String name)
containsHeader in interface javax.servlet.http.HttpServletResponsepublic String encodeURL(String url)
encodeURL in interface javax.servlet.http.HttpServletResponsepublic String encodeRedirectURL(String url)
encodeRedirectURL in interface javax.servlet.http.HttpServletResponsepublic String encodeUrl(String url)
encodeUrl in interface javax.servlet.http.HttpServletResponsepublic String encodeRedirectUrl(String url)
encodeRedirectUrl in interface javax.servlet.http.HttpServletResponse
public void sendError(int sc,
String msg)
throws IOException
sendError in interface javax.servlet.http.HttpServletResponseIOException
public void sendError(int sc)
throws IOException
sendError in interface javax.servlet.http.HttpServletResponseIOException
public void sendRedirect(String location)
throws IOException
sendRedirect in interface javax.servlet.http.HttpServletResponseIOException
public void setDateHeader(String name,
long date)
setDateHeader in interface javax.servlet.http.HttpServletResponse
public void addDateHeader(String name,
long date)
addDateHeader in interface javax.servlet.http.HttpServletResponse
public void setHeader(String name,
String value)
setHeader in interface javax.servlet.http.HttpServletResponse
public void addHeader(String name,
String value)
addHeader in interface javax.servlet.http.HttpServletResponse
public void setIntHeader(String name,
int value)
setIntHeader in interface javax.servlet.http.HttpServletResponse
public void addIntHeader(String name,
int value)
addIntHeader in interface javax.servlet.http.HttpServletResponsepublic void setStatus(int status)
setStatus in interface javax.servlet.http.HttpServletResponse
public void setStatus(int status,
String statusMessage)
setStatus in interface javax.servlet.http.HttpServletResponsepublic int getStatus()
getStatus in interface javax.servlet.http.HttpServletResponsepublic String getStatusMessage()
public Map<String,String> headers()
public String getHeader(String name)
getHeader in interface javax.servlet.http.HttpServletResponsepublic Collection<String> getHeaders(String name)
getHeaders in interface javax.servlet.http.HttpServletResponsepublic Collection<String> getHeaderNames()
getHeaderNames in interface javax.servlet.http.HttpServletResponsepublic void setCharacterEncoding(String charSet)
setCharacterEncoding in interface javax.servlet.ServletResponse
public void flushBuffer()
throws IOException
flushBuffer in interface javax.servlet.ServletResponseIOExceptionpublic int getBufferSize()
getBufferSize in interface javax.servlet.ServletResponsepublic String getCharacterEncoding()
getCharacterEncoding in interface javax.servlet.ServletResponsepublic boolean isDestroyable()
public javax.servlet.ServletOutputStream getOutputStream()
throws IOException
getOutputStream in interface javax.servlet.ServletResponseIOException
public PrintWriter getWriter()
throws IOException
getWriter in interface javax.servlet.ServletResponseIOExceptionpublic void setContentLength(int len)
setContentLength in interface javax.servlet.ServletResponsepublic void setContentType(String contentType)
setContentType in interface javax.servlet.ServletResponsepublic String getContentType()
getContentType in interface javax.servlet.ServletResponsepublic boolean isCommitted()
isCommitted in interface javax.servlet.ServletResponsepublic void reset()
reset in interface javax.servlet.ServletResponsepublic void resetBuffer()
resetBuffer in interface javax.servlet.ServletResponsepublic void setBufferSize(int size)
setBufferSize in interface javax.servlet.ServletResponsepublic void setLocale(Locale locale)
setLocale in interface javax.servlet.ServletResponsepublic Locale getLocale()
getLocale in interface javax.servlet.ServletResponsepublic AsyncIOWriter getAsyncIOWriter()
AsyncIOWriter
public AtmosphereResponse asyncIOWriter(AsyncIOWriter asyncIOWriter)
AsyncIOWriter that will be invoked every time a write operation is ready to be
processed.
asyncIOWriter - of AsyncIOWriter
public AtmosphereRequest request()
AtmosphereRequest
AtmosphereRequestpublic AtmosphereResponse request(AtmosphereRequest atmosphereRequest)
AtmosphereRequest
atmosphereRequest - a AtmosphereRequest
public void close()
throws IOException
AsyncIOWriter
IOExceptionpublic void closeStreamOrWriter()
PrintWriter or OutputStream
public AtmosphereResponse write(String data)
PrintWriter or OutputStream. The decision is
based on the request attribute ApplicationConfig.PROPERTY_USE_STREAM
data - the String to writepublic AtmosphereResponse write(byte[] data)
PrintWriter or OutputStream. The decision is
based on the request attribute ApplicationConfig.PROPERTY_USE_STREAM
data - the bytes to write
public AtmosphereResponse write(byte[] data,
int offset,
int length)
PrintWriter or OutputStream. The decision is
based on the request attribute ApplicationConfig.PROPERTY_USE_STREAM
data - the bytes to writeoffset - the first byte position to writelength - the data lengthpublic static final AtmosphereResponse wrap(javax.servlet.http.HttpServletResponse response)
HttpServletResponse
response - HttpServletResponse
AtmosphereResponsepublic boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||