Package net.targetr.rc.monitoring.logs
Class CommunicationsInterceptor
java.lang.Object
net.targetr.rc.monitoring.logs.CommunicationsInterceptor
- All Implemented Interfaces:
HttpInterceptor,WebSocketFrameInterceptor
public class CommunicationsInterceptor
extends Object
implements HttpInterceptor, WebSocketFrameInterceptor
Interceptor for monitoring RCWeb HTTP requests and WebSocket frames.
-
Constructor Summary
ConstructorsConstructorDescriptionCommunicationsInterceptor(HttpRequestMonitor httpRequestMonitor, WebSocketFrameMonitor webSocketFrameMonitor) Constructs a communications interceptor using the supplied monitors. -
Method Summary
Modifier and TypeMethodDescriptionvoidcloseWebSocket(HttpRequest httpReq, WebSocketResponse httpRes) Called when an existing websocket is closed.voidfinish()Called when handling the request and writing the response has finished.voidframeIn(WebSocketFrame frame) Called when a frame is received from the client.voidframeOut(WebSocketFrame frame) Called when a frame is sent to the client.voidopenWebSocket(HttpRequest httpReq, WebSocketResponse httpRes) Called when a new websocket is opened.voidstartRequest(SuperSocket client) Called before reading a request on a new or reused connection.voidstartResponse(HttpRequest request, HttpResponse response) Called when a response is ready to write, including an error response.
-
Constructor Details
-
CommunicationsInterceptor
public CommunicationsInterceptor(HttpRequestMonitor httpRequestMonitor, WebSocketFrameMonitor webSocketFrameMonitor) Constructs a communications interceptor using the supplied monitors.- Parameters:
httpRequestMonitor- the HTTP request monitorwebSocketFrameMonitor- the WebSocket frame monitor
-
-
Method Details
-
startRequest
Description copied from interface:HttpInterceptorCalled before reading a request on a new or reused connection.- Specified by:
startRequestin interfaceHttpInterceptor- Parameters:
client- socket connected to the client.- Throws:
IOException- an exception occurred starting the interception.
-
startResponse
Description copied from interface:HttpInterceptorCalled when a response is ready to write, including an error response.Used for aborting interception based on request.
- Specified by:
startResponsein interfaceHttpInterceptor- Parameters:
request- completed requestresponse- generated response to intercept- Throws:
IOException- an exception occurred during the interception.
-
openWebSocket
Description copied from interface:WebSocketFrameInterceptorCalled when a new websocket is opened.- Specified by:
openWebSocketin interfaceWebSocketFrameInterceptor- Parameters:
httpReq- the http request that upgraded to web sockethttpRes- the http response that will become a web socket
-
closeWebSocket
Description copied from interface:WebSocketFrameInterceptorCalled when an existing websocket is closed.- Specified by:
closeWebSocketin interfaceWebSocketFrameInterceptor- Parameters:
httpReq- the http request that upgraded to web sockethttpRes- the http response that became a web socket
-
frameIn
Description copied from interface:WebSocketFrameInterceptorCalled when a frame is received from the client.- Specified by:
frameInin interfaceWebSocketFrameInterceptor- Parameters:
frame- the received frame
-
frameOut
Description copied from interface:WebSocketFrameInterceptorCalled when a frame is sent to the client.- Specified by:
frameOutin interfaceWebSocketFrameInterceptor- Parameters:
frame- the sent frame
-
finish
Description copied from interface:HttpInterceptorCalled when handling the request and writing the response has finished.- Specified by:
finishin interfaceHttpInterceptor- Throws:
IOException- an exception occurred after the interception.
-