public class AtmosphereInterceptorWriter extends AsyncIOWriterAdapter
AsyncIOWriter that delegates the write operation to its AsyncIOInterceptor. If no
AsyncIOInterceptor is specified, this class does nothing and the responses will never get written.| Modifier and Type | Field and Description |
|---|---|
protected LinkedList<AsyncIOInterceptor> |
filters |
protected LinkedList<AsyncIOInterceptor> |
reversedFilters |
| Constructor and Description |
|---|
AtmosphereInterceptorWriter() |
| Modifier and Type | Method and Description |
|---|---|
void |
close(AtmosphereResponse response)
Close the underlying connection.
|
LinkedList<AsyncIOInterceptor> |
filters() |
AsyncIOWriter |
flush(AtmosphereResponse response)
Flush the buffered content.
|
AtmosphereInterceptorWriter |
interceptor(AsyncIOInterceptor filter)
Add an
AsyncIOInterceptor that will be invoked in the order it was added. |
AtmosphereInterceptorWriter |
interceptor(AsyncIOInterceptor filter,
int index)
Add an
AsyncIOInterceptor that will be invoked at the specified index position. |
protected void |
invokeInterceptor(AtmosphereResponse response,
byte[] data,
int offset,
int length) |
AsyncIOWriter |
redirect(AtmosphereResponse response,
String location)
Redirect a WebSocket request to another location.
|
AsyncIOWriter |
write(AtmosphereResponse response,
byte[] data)
Write a WebSocket message.
|
AsyncIOWriter |
write(AtmosphereResponse response,
byte[] data,
int offset,
int length)
Write a WebSocket message.
|
AsyncIOWriter |
write(AtmosphereResponse response,
String data)
Write a WebSocket message.
|
AsyncIOWriter |
writeError(AtmosphereResponse response,
int errorCode,
String message)
Write an error code.
|
protected void |
writeReady(AtmosphereResponse response,
byte[] responseDraft) |
protected final LinkedList<AsyncIOInterceptor> filters
protected final LinkedList<AsyncIOInterceptor> reversedFilters
public AsyncIOWriter redirect(AtmosphereResponse response, String location) throws IOException
AsyncIOWriterredirect in interface AsyncIOWriterredirect in class AsyncIOWriterAdapterIOExceptionpublic AsyncIOWriter writeError(AtmosphereResponse response, int errorCode, String message) throws IOException
AsyncIOWriterwriteError in interface AsyncIOWriterwriteError in class AsyncIOWriterAdaptererrorCode - the error codeIOExceptionpublic AsyncIOWriter write(AtmosphereResponse response, String data) throws IOException
AsyncIOWriterwrite in interface AsyncIOWriterwrite in class AsyncIOWriterAdapterdata - the WebSocket messageIOExceptionpublic AsyncIOWriter write(AtmosphereResponse response, byte[] data) throws IOException
AsyncIOWriterwrite in interface AsyncIOWriterwrite in class AsyncIOWriterAdapterdata - the WebSocket messageIOExceptionpublic AsyncIOWriter write(AtmosphereResponse response, byte[] data, int offset, int length) throws IOException
AsyncIOWriterwrite in interface AsyncIOWriterwrite in class AsyncIOWriterAdapterdata - the WebSocket messageoffset - offset of the messagelength - length of the messageIOExceptionprotected void invokeInterceptor(AtmosphereResponse response, byte[] data, int offset, int length) throws IOException
IOExceptionprotected void writeReady(AtmosphereResponse response, byte[] responseDraft) throws IOException
IOExceptionpublic void close(AtmosphereResponse response) throws IOException
AsyncIOWriterclose in interface AsyncIOWriterclose in class AsyncIOWriterAdapterIOExceptionpublic AsyncIOWriter flush(AtmosphereResponse response) throws IOException
AsyncIOWriterflush in interface AsyncIOWriterflush in class AsyncIOWriterAdapterIOExceptionpublic AtmosphereInterceptorWriter interceptor(AsyncIOInterceptor filter)
AsyncIOInterceptor that will be invoked in the order it was added.filter - {@link AsyncIOInterceptorpublic AtmosphereInterceptorWriter interceptor(AsyncIOInterceptor filter, int index)
AsyncIOInterceptor that will be invoked at the specified index position.filter - {@link AsyncIOInterceptorindex - public LinkedList<AsyncIOInterceptor> filters()
Copyright © 2016. All rights reserved.