Package org.springframework.web.socket.server

Examples of org.springframework.web.socket.server.HandshakeFailureException


    ServerHttpRequest request = new ServletServerHttpRequest(servletRequest);
    ServerHttpResponse response = new ServletServerHttpResponse(servletResponse);

    HandshakeInterceptorChain chain = new HandshakeInterceptorChain(this.interceptors, this.wsHandler);
    HandshakeFailureException failure = null;

    try {
      if (logger.isDebugEnabled()) {
        logger.debug(servletRequest.getMethod() + " " + servletRequest.getRequestURI());
      }
      Map<String, Object> attributes = new HashMap<String, Object>();
      if (!chain.applyBeforeHandshake(request, response, attributes)) {
        return;
      }
      this.handshakeHandler.doHandshake(request, response, this.wsHandler, attributes);
      chain.applyAfterHandshake(request, response, null);
      response.close();
    }
    catch (HandshakeFailureException ex) {
      failure = ex;
    }
    catch (Throwable ex) {
      failure = new HandshakeFailureException("Uncaught failure for request " + request.getURI(), ex);
    }
    finally {
      if (failure != null) {
        chain.applyAfterHandshake(request, response, failure);
        throw failure;
View Full Code Here


          }
          handleSuccess(servletRequest, servletResponse, upgradeInfo, upgradeResponse);
          break;
        case HANDSHAKE_FAILED:
          // Should never happen
          throw new HandshakeFailureException("Unexpected handshake failure: " + request.getURI());
        case NOT_APPLICABLE:
          // Should never happen
          throw new HandshakeFailureException("Unexpected handshake mapping failure: " + request.getURI());
      }
    }
    catch (Exception ex) {
      throw new HandshakeFailureException("Error during handshake: " + request.getURI(), ex);
    }
    finally {
      if (tyrusEndpoint != null) {
        getEndpointHelper().unregister(engine, tyrusEndpoint);
      }
View Full Code Here

      try {
        return constructor.newInstance(registration.getEndpoint(), registration, provider, container,
            "/",  registration.getConfigurator(), sessionListener, clusterContext, null);
      }
      catch (Exception ex) {
        throw new HandshakeFailureException("Failed to register " + registration, ex);
      }
    }
View Full Code Here

    public void register(TyrusWebSocketEngine engine, Object endpoint) {
      try {
        registerMethod.invoke(engine, endpoint);
      }
      catch (Exception ex) {
        throw new HandshakeFailureException("Failed to register " + endpoint, ex);
      }
    }
View Full Code Here

    public void unregister(TyrusWebSocketEngine engine, Object endpoint) {
      try {
        unRegisterMethod.invoke(engine, endpoint);
      }
      catch (Exception ex) {
        throw new HandshakeFailureException("Failed to unregister " + endpoint, ex);
      }
    }
View Full Code Here

    public void register(TyrusWebSocketEngine engine, Object endpoint) {
      try {
        registerMethod.invoke(engine, endpoint);
      }
      catch (Exception ex) {
        throw new HandshakeFailureException("Failed to register " + endpoint, ex);
      }
    }
View Full Code Here

    private Object newInstance(Object httpSocket) {
      try {
        return webSocketConstructor.newInstance(httpSocket);
      }
      catch (Exception ex) {
        throw new HandshakeFailureException("Failed to create TyrusMuxableWebSocket", ex);
      }
    }
View Full Code Here

    private void upgrade(Object webSocket, Object httpSocket, ServletContext servletContext) {
      try {
        webSocketUpgradeMethod.invoke(webSocket, httpSocket, servletContext);
      }
      catch (Exception ex) {
        throw new HandshakeFailureException("Failed to upgrade TyrusMuxableWebSocket", ex);
      }
    }
View Full Code Here

    private void registerForReadEvent(Object webSocket) {
      try {
        webSocketReadEventMethod.invoke(webSocket);
      }
      catch (Exception ex) {
        throw new HandshakeFailureException("Failed to register WebSocket for read event", ex);
      }
    }
View Full Code Here

    private Writer newInstance(HttpServletResponse response, Object webSocket, boolean isProtected) {
      try {
        return (Writer) constructor.newInstance(webSocket, response, null, isProtected);
      }
      catch (Exception ex) {
        throw new HandshakeFailureException("Failed to create TyrusServletWriter", ex);
      }
    }
View Full Code Here

TOP

Related Classes of org.springframework.web.socket.server.HandshakeFailureException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.