private Object createTyrusEndpoint(Endpoint endpoint, String endpointPath, @Nullable String protocol, List<Extension> extensions, WebSocketContainer container, TyrusWebSocketEngine engine) throws DeploymentException { ServerEndpointRegistration endpointConfig = new ServerEndpointRegistration(endpointPath, endpoint); endpointConfig.setSubprotocols(Collections.singletonList(protocol)); endpointConfig.setExtensions(extensions); return createEndpoint(endpointConfig, this.componentProvider, container, engine); }
throws HandshakeFailureException { HttpServletRequest servletRequest = getHttpServletRequest(request); HttpServletResponse servletResponse = getHttpServletResponse(response); TyrusServerContainer serverContainer = (TyrusServerContainer) getContainer(servletRequest); TyrusWebSocketEngine engine = (TyrusWebSocketEngine) serverContainer.getWebSocketEngine(); Object tyrusEndpoint = null; tyrusEndpoint = createTyrusEndpoint(endpoint, path, selectedProtocol, extensions, serverContainer, engine); register(engine, tyrusEndpoint); RequestContext requestContext = createRequestContext(servletRequest, path, headers); TyrusUpgradeResponse upgradeResponse = new TyrusUpgradeResponse(); UpgradeInfo upgradeInfo = engine.upgrade(requestContext, upgradeResponse); logger.trace("Successful request upgrade: " + upgradeResponse.getHeaders()); handleSuccess(servletRequest, servletResponse, upgradeInfo, upgradeResponse); unregisterTyrusEndpoint(engine, tyrusEndpoint); throw new HandshakeFailureException("Error during handshake: " + request.getURI(), ex); unregisterTyrusEndpoint(engine, tyrusEndpoint); if (!success) { throw new HandshakeFailureException("Unexpected handshake failure: " + request.getURI());
private void unregisterTyrusEndpoint(TyrusWebSocketEngine engine, @Nullable Object tyrusEndpoint) { if (tyrusEndpoint != null) { try { unregister(engine, tyrusEndpoint); } catch (Throwable ex) { // ignore } } }
throws HandshakeFailureException { HttpServletRequest servletRequest = getHttpServletRequest(request); HttpServletResponse servletResponse = getHttpServletResponse(response); TyrusServerContainer serverContainer = (TyrusServerContainer) getContainer(servletRequest); TyrusWebSocketEngine engine = (TyrusWebSocketEngine) serverContainer.getWebSocketEngine(); Object tyrusEndpoint = null; tyrusEndpoint = createTyrusEndpoint(endpoint, path, selectedProtocol, extensions, serverContainer, engine); register(engine, tyrusEndpoint); RequestContext requestContext = createRequestContext(servletRequest, path, headers); TyrusUpgradeResponse upgradeResponse = new TyrusUpgradeResponse(); UpgradeInfo upgradeInfo = engine.upgrade(requestContext, upgradeResponse); logger.trace("Successful request upgrade: " + upgradeResponse.getHeaders()); handleSuccess(servletRequest, servletResponse, upgradeInfo, upgradeResponse); unregisterTyrusEndpoint(engine, tyrusEndpoint); throw new HandshakeFailureException("Error during handshake: " + request.getURI(), ex); unregisterTyrusEndpoint(engine, tyrusEndpoint); if (!success) { throw new HandshakeFailureException("Unexpected handshake failure: " + request.getURI());
private void unregisterTyrusEndpoint(TyrusWebSocketEngine engine, @Nullable Object tyrusEndpoint) { if (tyrusEndpoint != null) { try { unregister(engine, tyrusEndpoint); } catch (Throwable ex) { // ignore } } }
private Object createTyrusEndpoint(Endpoint endpoint, String endpointPath, @Nullable String protocol, List<Extension> extensions, WebSocketContainer container, TyrusWebSocketEngine engine) throws DeploymentException { ServerEndpointRegistration endpointConfig = new ServerEndpointRegistration(endpointPath, endpoint); endpointConfig.setSubprotocols(Collections.singletonList(protocol)); endpointConfig.setExtensions(extensions); return createEndpoint(endpointConfig, this.componentProvider, container, engine); }
throws HandshakeFailureException { HttpServletRequest servletRequest = getHttpServletRequest(request); HttpServletResponse servletResponse = getHttpServletResponse(response); TyrusServerContainer serverContainer = (TyrusServerContainer) getContainer(servletRequest); TyrusWebSocketEngine engine = (TyrusWebSocketEngine) serverContainer.getWebSocketEngine(); Object tyrusEndpoint = null; tyrusEndpoint = createTyrusEndpoint(endpoint, path, selectedProtocol, extensions, serverContainer, engine); register(engine, tyrusEndpoint); RequestContext requestContext = createRequestContext(servletRequest, path, headers); TyrusUpgradeResponse upgradeResponse = new TyrusUpgradeResponse(); UpgradeInfo upgradeInfo = engine.upgrade(requestContext, upgradeResponse); logger.trace("Successful request upgrade: " + upgradeResponse.getHeaders()); handleSuccess(servletRequest, servletResponse, upgradeInfo, upgradeResponse); unregisterTyrusEndpoint(engine, tyrusEndpoint); throw new HandshakeFailureException("Error during handshake: " + request.getURI(), ex); unregisterTyrusEndpoint(engine, tyrusEndpoint); if (!success) { throw new HandshakeFailureException("Unexpected handshake failure: " + request.getURI());
private void unregisterTyrusEndpoint(TyrusWebSocketEngine engine, @Nullable Object tyrusEndpoint) { if (tyrusEndpoint != null) { try { unregister(engine, tyrusEndpoint); } catch (Throwable ex) { // ignore } } }
private Object createTyrusEndpoint(Endpoint endpoint, String endpointPath, @Nullable String protocol, List<Extension> extensions, WebSocketContainer container, TyrusWebSocketEngine engine) throws DeploymentException { ServerEndpointRegistration endpointConfig = new ServerEndpointRegistration(endpointPath, endpoint); endpointConfig.setSubprotocols(Collections.singletonList(protocol)); endpointConfig.setExtensions(extensions); return createEndpoint(endpointConfig, this.componentProvider, container, engine); }