use of org.everrest.websockets.WSConnection in project che by eclipse.
the class WebSocketMethodInvokerDecorator method invokeMethod.
@Override
public Object invokeMethod(Object resource, GenericResourceMethod genericMethodResource, ApplicationContext context) {
WSConnection wsConnection = (WSConnection) org.everrest.core.impl.EnvironmentContext.getCurrent().get(WSConnection.class);
if (wsConnection != null) {
EnvironmentContext environmentContext = (EnvironmentContext) wsConnection.getAttribute(ENVIRONMENT_CONTEXT);
if (environmentContext != null) {
try {
EnvironmentContext.setCurrent(environmentContext);
LOG.debug("Websocket {} in http session {}", wsConnection.getId(), wsConnection.getHttpSession());
return super.invokeMethod(resource, genericMethodResource, context);
} finally {
EnvironmentContext.reset();
}
} else {
LOG.warn("EnvironmentContext is null");
}
}
return super.invokeMethod(resource, genericMethodResource, context);
}
Aggregations