Package org.atmosphere.interceptor
Class SimpleRestInterceptor
java.lang.Object
org.atmosphere.cpr.AtmosphereInterceptorAdapter
org.atmosphere.interceptor.SimpleRestInterceptor
- All Implemented Interfaces:
AtmosphereInterceptor,AtmosphereConfigAware,InvokationOrder
An Atmosphere interceptor to enable a simple rest binding protocol.
This protocol is a simplified version of SwaggerSocket with some new features
https://github.com/swagger-api/swaggersocket
This interceptor currently handles both Websocket and SSE protocols.
It was originally developed for enabling atmosphere for kafka-rest at
https://github.com/elakito/kafka-rest-atmosphere
- Author:
- elakito
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.atmosphere.interceptor.InvokationOrder
InvokationOrder.PRIORITY -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated.always use detached modeprotected static final Stringprotected static final Stringstatic final StringDeprecated.always use detached modestatic final StringThe internal header consisting of the {tracking-id}#{request-id}Fields inherited from interface org.atmosphere.interceptor.InvokationOrder
AFTER_DEFAULT, BEFORE_DEFAULT, FIRST_BEFORE_DEFAULT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(AtmosphereConfig config) Configure an AtmosphereFramework object.protected AtmosphereRequestcreateAtmosphereRequest(AtmosphereRequest request, String body) protected byte[]createResponse(AtmosphereResponse response, byte[] payload) protected static booleangetBoolean(org.json.JSONObject obj, String key) protected Stringprotected Stringprotected Object[]protected static StringInvoked before anAtmosphereResourcegets dispatched toAtmosphereHandler.protected static booleanisJSONObject(byte[] b) protected static booleanisLastResponse(AtmosphereRequest request, AtmosphereResponse response) protected static org.json.JSONObjectparseJsonPart(Reader reader) protected static byte[]quote(byte[] b) Methods inherited from class org.atmosphere.cpr.AtmosphereInterceptorAdapter
destroy, postInspect, priority, toString
-
Field Details
-
PROTOCOL_DETACHED_KEY
Deprecated.always use detached modeServlet init property to enable the detached mode in the response- See Also:
-
X_ATMOSPHERE_SIMPLE_REST_PROTOCOL_DETACHED
Deprecated.always use detached modeConnection request property to enable the detached mode in the response- See Also:
-
X_REQUEST_KEY
The internal header consisting of the {tracking-id}#{request-id}- See Also:
-
REQUEST_DISPATCHED
- See Also:
-
REQUEST_ID
- See Also:
-
-
Constructor Details
-
SimpleRestInterceptor
public SimpleRestInterceptor()
-
-
Method Details
-
configure
Description copied from interface:AtmosphereConfigAwareConfigure an AtmosphereFramework object.- Specified by:
configurein interfaceAtmosphereConfigAware- Overrides:
configurein classAtmosphereInterceptorAdapter- Parameters:
config-AtmosphereConfig
-
inspect
Description copied from interface:AtmosphereInterceptorInvoked before anAtmosphereResourcegets dispatched toAtmosphereHandler.- Specified by:
inspectin interfaceAtmosphereInterceptor- Overrides:
inspectin classAtmosphereInterceptorAdapter- Parameters:
r- aAtmosphereResource- Returns:
Action.CONTINUEorAction.SUSPENDto dispatch theAtmosphereResourceto otherAtmosphereInterceptororAtmosphereHandler. ReturnAction.TYPE.CANCELLEDto stop the processing.
-
getHeartbeatBroadcasterName
-
getHeartbeatTemplate
-
getHeartbeatTemplateArguments
-
createAtmosphereRequest
protected AtmosphereRequest createAtmosphereRequest(AtmosphereRequest request, String body) throws IOException - Throws:
IOException
-
createResponse
-
isLastResponse
-
isJSONObject
protected static boolean isJSONObject(byte[] b) -
quote
protected static byte[] quote(byte[] b) -
parseJsonPart
- Throws:
org.json.JSONException
-
getString
-
getBoolean
-