Package org.atmosphere.cpr
Class AtmosphereInterceptorWriter
java.lang.Object
org.atmosphere.cpr.AsyncIOWriterAdapter
org.atmosphere.cpr.AtmosphereInterceptorWriter
- All Implemented Interfaces:
AsyncIOWriter
- Direct Known Subclasses:
WebSocket
An
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.- Author:
- Jeanfrancois Arcand
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final LinkedList<AsyncIOInterceptor> protected final LinkedList<AsyncIOInterceptor> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(AtmosphereResponse response) Close the underlying connection.filters()flush(AtmosphereResponse response) Flush the buffered content.interceptor(AsyncIOInterceptor filter) Add anAsyncIOInterceptorthat will be invoked in the order it was added.interceptor(AsyncIOInterceptor filter, int index) Add anAsyncIOInterceptorthat will be invoked at the specified index position.protected voidinvokeInterceptor(AtmosphereResponse response, byte[] data, int offset, int length) redirect(AtmosphereResponse response, String location) Redirect a WebSocket request to another location.write(AtmosphereResponse response, byte[] data) Write a WebSocket message.write(AtmosphereResponse response, byte[] data, int offset, int length) Write a WebSocket message.write(AtmosphereResponse response, String data) Write a WebSocket message.writeError(AtmosphereResponse response, int errorCode, String message) Write an error code.protected voidwriteReady(AtmosphereResponse response, byte[] responseDraft)
-
Field Details
-
filters
-
reversedFilters
-
-
Constructor Details
-
AtmosphereInterceptorWriter
public AtmosphereInterceptorWriter()
-
-
Method Details
-
redirect
Description copied from interface:AsyncIOWriterRedirect a WebSocket request to another location.- Specified by:
redirectin interfaceAsyncIOWriter- Overrides:
redirectin classAsyncIOWriterAdapter- Parameters:
location-- Throws:
IOException
-
writeError
public AsyncIOWriter writeError(AtmosphereResponse response, int errorCode, String message) throws IOException Description copied from interface:AsyncIOWriterWrite an error code.- Specified by:
writeErrorin interfaceAsyncIOWriter- Overrides:
writeErrorin classAsyncIOWriterAdapter- Parameters:
errorCode- the error codemessage-- Throws:
IOException
-
write
Description copied from interface:AsyncIOWriterWrite a WebSocket message.- Specified by:
writein interfaceAsyncIOWriter- Overrides:
writein classAsyncIOWriterAdapter- Parameters:
data- the WebSocket message- Throws:
IOException
-
write
Description copied from interface:AsyncIOWriterWrite a WebSocket message.- Specified by:
writein interfaceAsyncIOWriter- Overrides:
writein classAsyncIOWriterAdapter- Parameters:
data- the WebSocket message- Throws:
IOException
-
write
public AsyncIOWriter write(AtmosphereResponse response, byte[] data, int offset, int length) throws IOException Description copied from interface:AsyncIOWriterWrite a WebSocket message.- Specified by:
writein interfaceAsyncIOWriter- Overrides:
writein classAsyncIOWriterAdapter- Parameters:
data- the WebSocket messageoffset- offset of the messagelength- length of the message- Throws:
IOException
-
invokeInterceptor
protected void invokeInterceptor(AtmosphereResponse response, byte[] data, int offset, int length) throws IOException - Throws:
IOException
-
writeReady
-
close
Description copied from interface:AsyncIOWriterClose the underlying connection.- Specified by:
closein interfaceAsyncIOWriter- Overrides:
closein classAsyncIOWriterAdapter- Throws:
IOException
-
flush
Description copied from interface:AsyncIOWriterFlush the buffered content.- Specified by:
flushin interfaceAsyncIOWriter- Overrides:
flushin classAsyncIOWriterAdapter- Throws:
IOException
-
interceptor
Add anAsyncIOInterceptorthat will be invoked in the order it was added.- Parameters:
filter-invalid input: '@return this'
-
interceptor
Add anAsyncIOInterceptorthat will be invoked at the specified index position.- Parameters:
filter-invalid input: '@param index @return this'
-
filters
-