List of usage examples for javax.websocket Session getRequestURI
URI getRequestURI();
From source file:org.wso2.carbon.device.mgt.extensions.remote.session.endpoint.SubscriptionEndpoint.java
/** * Web socket onClose use to handle socket connection close * * @param session - Registered session. * @param deviceType - DeviceType//from w w w.ja va 2 s . c om * @param deviceId - Device Identifier * @param reason - Status code for web-socket close. */ public void onClose(Session session, CloseReason reason, @PathParam("deviceType") String deviceType, @PathParam("deviceId") String deviceId) { ServiceHolder.getInstance().getRemoteSessionManagementService().endSession(session, "Remote session closed"); if (log.isDebugEnabled()) { log.debug("websocket closed due to " + reason.getReasonPhrase() + ", for session ID:" + session.getId() + ", for request URI - " + session.getRequestURI() + " device type: " + deviceType + " device " + "id: " + deviceId); } }
From source file:org.wso2.carbon.device.mgt.extensions.remote.session.endpoint.SubscriptionEndpoint.java
/** * Web socket onError use to handle socket connection error * * @param session - Registered session. * @param throwable - Web socket exception * @param deviceType - DeviceType/*from ww w .j a v a 2 s . c om*/ * @param deviceId - Device Identifier */ public void onError(Session session, Throwable throwable, @PathParam("deviceType") String deviceType, @PathParam("deviceId") String deviceId) { if (throwable instanceof IOException) { if (log.isDebugEnabled()) { log.error("Error occurred in session ID: " + session.getId() + " device type: " + deviceType + "device id: " + deviceId + ", for request URI - " + session.getRequestURI() + ", " + throwable.getMessage(), throwable); } } else { log.error("Error occurred in session ID: " + session.getId() + " device type: " + deviceType + " device " + "id: " + deviceId + ", for request URI - " + session.getRequestURI() + ", " + throwable.getMessage(), throwable); } try { ServiceHolder.getInstance().getRemoteSessionManagementService().endSession(session, "Remote session closed"); if (session.isOpen()) { session.close(new CloseReason(CloseReason.CloseCodes.PROTOCOL_ERROR, "Unexpected Error Occurred")); } } catch (IOException ex) { if (log.isDebugEnabled()) { log.error("Failed to disconnect the client.", ex); } } }
From source file:org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint.SubscriptionEndpoint.java
/** * Web socket onClose - Remove the registered sessions * * @param session - Users registered session. * @param reason - Status code for web-socket close. * @param streamName - StreamName extracted from the ws url. * @param version - Version extracted from the ws url. *//*from www . j a v a 2 s . c o m*/ public void onClose(Session session, CloseReason reason, String streamName, String version) { if (log.isDebugEnabled()) { log.debug("Closing a WebSocket due to " + reason.getReasonPhrase() + ", for session ID:" + session.getId() + ", for request URI - " + session.getRequestURI()); } ServiceHolder.getInstance().getWebsocketOutputCallbackControllerService().unsubscribeWebsocket(streamName, version, session); }
From source file:org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint.SubscriptionEndpoint.java
/** * Web socket onError - Remove the registered sessions * * @param session - Users registered session. * @param throwable - Status code for web-socket close. * @param streamName - StreamName extracted from the ws url. * @param version - Version extracted from the ws url. *//*ww w .j a v a 2s .co m*/ public void onError(Session session, Throwable throwable, String streamName, String version) { log.error("Error occurred in session ID: " + session.getId() + ", for request URI - " + session.getRequestURI() + ", " + throwable.getMessage(), throwable); ServiceHolder.getInstance().getWebsocketOutputCallbackControllerService().unsubscribeWebsocket(streamName, version, session); }
From source file:org.wso2.carbon.event.input.adapter.websocket.internal.WebsocketClient.java
@Override public void onClose(Session session, javax.websocket.CloseReason closeReason) { if (log.isDebugEnabled()) { log.debug("Input ws-adaptor: WebsocketClient Endpoint closed: " + closeReason.toString() + "for request URI - " + session.getRequestURI()); }/*w w w. ja v a 2s . c o m*/ try { session.close(); } catch (IOException e) { log.error("Error occurred during closing session. Session ID:" + session.getId() + ", for request URI - " + session.getRequestURI() + ", Reason: " + e.getMessage(), e); } }
From source file:org.wso2.carbon.event.input.adapter.websocket.internal.WebsocketClient.java
@Override public void onError(Session session, Throwable thr) { log.error("Error occurred during session ID:" + session.getId() + ", for request URI - " + session.getRequestURI() + ", Reason: " + thr, thr); try {//from w w w .j a v a 2 s. c o m session.close(); } catch (IOException e) { log.error("Error occurred during closing session. Session ID:" + session.getId() + ", for request URI - " + session.getRequestURI() + ", Reason: " + e.getMessage(), e); } }
From source file:org.wso2.carbon.event.input.adaptor.websocket.internal.WebsocketClient.java
@Override public void onClose(javax.websocket.Session session, javax.websocket.CloseReason closeReason) { if (log.isDebugEnabled()) { log.debug("Input ws-adaptor: WebsocketClient Endpoint closed: " + closeReason.toString() + "for request URI - " + session.getRequestURI()); }/*w ww .j a va 2 s . c o m*/ }
From source file:org.wso2.carbon.event.input.adaptor.websocket.internal.WebsocketClient.java
@Override public void onError(javax.websocket.Session session, java.lang.Throwable thr) { log.error("Error occured during session ID:" + session.getId() + ", for request URI - " + session.getRequestURI() + ", Reason: " + thr); }
From source file:org.wso2.carbon.event.output.adapter.websocket.internal.WebsocketClient.java
@Override public void onOpen(Session session, EndpointConfig endpointConfig) { if (log.isDebugEnabled()) { log.debug("Websocket Output Adaptor: WebsocketClient connected, with session ID: " + session.getId() + ", to the remote end point URI - " + session.getRequestURI()); }// w ww. j av a 2s .c o m }