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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidfinish()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.Sanitizes a header value based on the header key.Replaces the final number of an IP address string with an asterisk.voidstartRequest(SuperSocket client) HttpHandler has received a new connectionabout about to start communications.voidstartResponse(HttpRequest request, HttpResponse response) The request has be read and response is ready to write.
-
Constructor Details
-
CommunicationsInterceptor
public CommunicationsInterceptor()Constructs a new RCWebInterceptor.
-
-
Method Details
-
startRequest
Description copied from interface:HttpInterceptorHttpHandler has received a new connectionabout about to start communications.- Specified by:
startRequestin interfaceHttpInterceptor- Parameters:
client- socket connected to the client.- Throws:
IOException- an exception occurred starting the interception.
-
startResponse
Description copied from interface:HttpInterceptorThe request has be read and response is ready to write.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.
-
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.
-
sanitize
Sanitizes a header value based on the header key.- Parameters:
key- The header keyvalue- The header value- Returns:
- The sanitized header value
-
sanitizeIpValue
Replaces the final number of an IP address string with an asterisk.- Parameters:
ip- The input IP address (e.g., "10.0.0.1")- Returns:
- The masked IP string (e.g., "10.0.0.*")
-