Package org.springframework.web.socket.server.support

Examples of org.springframework.web.socket.server.support.OriginHandshakeInterceptor


    setRequest("GET", sockJsPrefix + sockJsPath);
    wsService.handleRequest(this.request, this.response, sockJsPath, this.wsHandler);
    assertNotEquals(403, this.servletResponse.getStatus());

    resetRequestAndResponse();
    OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor();
    interceptor.setAllowedOrigins(Arrays.asList("http://mydomain1.com"));
    wsService.setHandshakeInterceptors(Arrays.asList(interceptor));
    setRequest("GET", sockJsPrefix + sockJsPath);
    setOrigin("http://mydomain1.com");
    wsService.handleRequest(this.request, this.response, sockJsPath, this.wsHandler);
    assertNotEquals(403, this.servletResponse.getStatus());
View Full Code Here


      Element interceptorsElement = DomUtils.getChildElementByTagName(element, "handshake-interceptors");
      ManagedList<? super Object> interceptors = WebSocketNamespaceUtils.parseBeanSubElements(interceptorsElement, context);
      String allowedOriginsAttribute = element.getAttribute("allowed-origins");
      List<String> allowedOrigins = Arrays.asList(StringUtils.tokenizeToStringArray(allowedOriginsAttribute, ","));
      if (!allowedOrigins.isEmpty()) {
        OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor();
        interceptor.setAllowedOrigins(allowedOrigins);
        interceptors.add(interceptor);
      }
      strategy = new WebSocketHandlerMappingStrategy(handshakeHandler, interceptors);
    }
View Full Code Here

      ManagedList<? super Object> interceptors = WebSocketNamespaceUtils.parseBeanSubElements(interceptorsElement, context);
      String allowedOriginsAttribute = element.getAttribute("allowed-origins");
      List<String> allowedOrigins = Arrays.asList(StringUtils.tokenizeToStringArray(allowedOriginsAttribute, ","));
      if (!allowedOrigins.isEmpty()) {
        sockJsServiceDef.getPropertyValues().add("allowedOrigins", allowedOrigins);
        OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor();
        interceptor.setAllowedOrigins(allowedOrigins);
        interceptors.add(interceptor);
      }
      sockJsServiceDef.getPropertyValues().add("handshakeInterceptors", interceptors);

      String attrValue = sockJsElement.getAttribute("name");
View Full Code Here

      Element interceptorsElement = DomUtils.getChildElementByTagName(element, "handshake-interceptors");
      ManagedList<? super Object> interceptors = WebSocketNamespaceUtils.parseBeanSubElements(interceptorsElement, context);
      String allowedOriginsAttribute = element.getAttribute("allowed-origins");
      List<String> allowedOrigins = Arrays.asList(StringUtils.tokenizeToStringArray(allowedOriginsAttribute, ","));
      if (!allowedOrigins.isEmpty()) {
        OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor();
        interceptor.setAllowedOrigins(allowedOrigins);
        interceptors.add(interceptor);
      }
      ConstructorArgumentValues cavs = new ConstructorArgumentValues();
      cavs.addIndexedArgumentValue(0, subProtoHandler);
      if (handshakeHandler != null) {
View Full Code Here

  protected HandshakeInterceptor[] getInterceptors() {
    List<HandshakeInterceptor> interceptors = new ArrayList<HandshakeInterceptor>();
    interceptors.addAll(this.interceptors);
    if (!this.allowedOrigins.isEmpty()) {
      OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor();
      interceptor.setAllowedOrigins(this.allowedOrigins);
      interceptors.add(interceptor);
    }
    return interceptors.toArray(new HandshakeInterceptor[interceptors.size()]);
  }
View Full Code Here

  protected HandshakeInterceptor[] getInterceptors() {
    List<HandshakeInterceptor> interceptors = new ArrayList<HandshakeInterceptor>();
    interceptors.addAll(this.interceptors);
    if (!this.allowedOrigins.isEmpty()) {
      OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor();
      interceptor.setAllowedOrigins(this.allowedOrigins);
      interceptors.add(interceptor);
    }
    return interceptors.toArray(new HandshakeInterceptor[interceptors.size()]);
  }
View Full Code Here

TOP

Related Classes of org.springframework.web.socket.server.support.OriginHandshakeInterceptor

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.