use of org.eclipse.scout.rt.server.context.RunMonitorCancelRegistry.IRegistrationHandle in project scout.rt by eclipse.
the class ServiceTunnelServlet method doPost.
protected ServiceTunnelResponse doPost(ServiceTunnelRequest serviceRequest) throws ServletException {
ClientNotificationCollector collector = new ClientNotificationCollector();
ServerRunContext serverRunContext = ServerRunContexts.copyCurrent().withLocale(serviceRequest.getLocale()).withUserAgent(UserAgents.createByIdentifier(serviceRequest.getUserAgent())).withClientNotificationCollector(collector).withClientNodeId(serviceRequest.getClientNodeId());
if (serviceRequest.getSessionId() != null) {
serverRunContext.withSession(lookupServerSessionOnHttpSession(serviceRequest.getSessionId(), serverRunContext));
}
final IRegistrationHandle registrationHandle = registerForCancellation(serverRunContext, serviceRequest);
try {
ServiceTunnelResponse serviceResponse = invokeService(serverRunContext, serviceRequest);
// include client notifications in response (piggyback)
serviceResponse.setNotifications(collector.consume());
return serviceResponse;
} finally {
registrationHandle.unregister();
}
}
Aggregations