org.atmosphere.cpr
Interface AsyncProtocol

All Known Subinterfaces:
WebSocketProtocol
All Known Implementing Classes:
EchoProtocol, SimpleHttpProtocol

public interface AsyncProtocol

An interface used by an AtmosphereResponse to manipulate the response before it gets delegated to an AsyncIOWriter

Author:
Jeanfrancois Arcand

Method Summary
 byte[] handleResponse(AtmosphereResponse<?> res, byte[] message, int offset, int length)
          Give a chance to a AsyncProtocol to modify the final response using a fake HttpServletResponse that was dispatched to a ServletContainer and it's framework or application running it.
 String handleResponse(AtmosphereResponse<?> res, String message)
          Give a chance to a AsyncProtocol to modify the final response using a fake HttpServletResponse that was dispatched to a ServletContainer and it's framework or application running it.
 boolean inspectResponse()
          Return true if this implementation will manipulate/change the WebSocket message;
 

Method Detail

inspectResponse

boolean inspectResponse()
Return true if this implementation will manipulate/change the WebSocket message;

Returns:
true if this implementation will manipulate/change the WebSocket message;

handleResponse

String handleResponse(AtmosphereResponse<?> res,
                      String message)
Give a chance to a AsyncProtocol to modify the final response using a fake HttpServletResponse that was dispatched to a ServletContainer and it's framework or application running it. This method is only invoked when AtmosphereResponse is about to write some data.

Parameters:
res - HttpServletResponse
message - the String message;
Returns:
a new response String

handleResponse

byte[] handleResponse(AtmosphereResponse<?> res,
                      byte[] message,
                      int offset,
                      int length)
Give a chance to a AsyncProtocol to modify the final response using a fake HttpServletResponse that was dispatched to a ServletContainer and it's framework or application running it. This method is only invoked when AtmosphereResponse is about to write some data.

Parameters:
res - HttpServletResponse
message - the WebSocket message;
offset - offset of the message
length - the length of the message
Returns:
a new byte[] message.


Copyright © 2011. All Rights Reserved.