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
AsyncIOWriter
redirect
in interface AsyncIOWriter
redirect
in class AsyncIOWriterAdapter
IOException
public AsyncIOWriter writeError(AtmosphereResponse response, int errorCode, String message) throws IOException
AsyncIOWriter
writeError
in interface AsyncIOWriter
writeError
in class AsyncIOWriterAdapter
errorCode
- the error codeIOException
public AsyncIOWriter write(AtmosphereResponse response, String data) throws IOException
AsyncIOWriter
write
in interface AsyncIOWriter
write
in class AsyncIOWriterAdapter
data
- the WebSocket messageIOException
public AsyncIOWriter write(AtmosphereResponse response, byte[] data) throws IOException
AsyncIOWriter
write
in interface AsyncIOWriter
write
in class AsyncIOWriterAdapter
data
- the WebSocket messageIOException
public AsyncIOWriter write(AtmosphereResponse response, byte[] data, int offset, int length) throws IOException
AsyncIOWriter
write
in interface AsyncIOWriter
write
in class AsyncIOWriterAdapter
data
- the WebSocket messageoffset
- offset of the messagelength
- length of the messageIOException
protected void invokeInterceptor(AtmosphereResponse response, byte[] data, int offset, int length) throws IOException
IOException
protected void writeReady(AtmosphereResponse response, byte[] responseDraft) throws IOException
IOException
public void close(AtmosphereResponse response) throws IOException
AsyncIOWriter
close
in interface AsyncIOWriter
close
in class AsyncIOWriterAdapter
IOException
public AsyncIOWriter flush(AtmosphereResponse response) throws IOException
AsyncIOWriter
flush
in interface AsyncIOWriter
flush
in class AsyncIOWriterAdapter
IOException
public 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.