io.undertow.websockets.spi.WebSocketHttpExchange.getResponseHeaders()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中io.undertow.websockets.spi.WebSocketHttpExchange.getResponseHeaders()方法的一些代码示例,展示了WebSocketHttpExchange.getResponseHeaders()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebSocketHttpExchange.getResponseHeaders()方法的具体详情如下:
包路径:io.undertow.websockets.spi.WebSocketHttpExchange
类名称:WebSocketHttpExchange
方法名:getResponseHeaders

WebSocketHttpExchange.getResponseHeaders介绍

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

/**
   * Create the {@code ExtensionFunction} list associated with the negotiated extensions defined in the exchange's response.
   *
   * @param exchange the exchange used to retrieve negotiated extensions
   * @return         a list of {@code ExtensionFunction} with the implementation of the extensions
   */
  protected final List<ExtensionFunction> initExtensions(final WebSocketHttpExchange exchange) {
    String extHeader = exchange.getResponseHeaders().get(Headers.SEC_WEB_SOCKET_EXTENSIONS_STRING) != null ?
        exchange.getResponseHeaders().get(Headers.SEC_WEB_SOCKET_EXTENSIONS_STRING).get(0) : null;

    List<ExtensionFunction> negotiated = new ArrayList<>();
    if (extHeader != null) {
      List<WebSocketExtension> extensions = WebSocketExtension.parse(extHeader);
      if (extensions != null && !extensions.isEmpty()) {
        for (WebSocketExtension ext : extensions) {
          for (ExtensionHandshake extHandshake : availableExtensions) {
            if (extHandshake.getName().equals(ext.getName())) {
              negotiated.add(extHandshake.create());
            }
          }
        }
      }
    }
    return negotiated;
  }
}

代码示例来源:origin: io.undertow/undertow-core

/**
   * Create the {@code ExtensionFunction} list associated with the negotiated extensions defined in the exchange's response.
   *
   * @param exchange the exchange used to retrieve negotiated extensions
   * @return         a list of {@code ExtensionFunction} with the implementation of the extensions
   */
  protected final List<ExtensionFunction> initExtensions(final WebSocketHttpExchange exchange) {
    String extHeader = exchange.getResponseHeaders().get(Headers.SEC_WEB_SOCKET_EXTENSIONS_STRING) != null ?
        exchange.getResponseHeaders().get(Headers.SEC_WEB_SOCKET_EXTENSIONS_STRING).get(0) : null;

    List<ExtensionFunction> negotiated = new ArrayList<>();
    if (extHeader != null) {
      List<WebSocketExtension> extensions = WebSocketExtension.parse(extHeader);
      if (extensions != null && !extensions.isEmpty()) {
        for (WebSocketExtension ext : extensions) {
          for (ExtensionHandshake extHandshake : availableExtensions) {
            if (extHandshake.getName().equals(ext.getName())) {
              negotiated.add(extHandshake.create());
            }
          }
        }
      }
    }
    return negotiated;
  }
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/**
   * Create the {@code ExtensionFunction} list associated with the negotiated extensions defined in the exchange's response.
   *
   * @param exchange the exchange used to retrieve negotiated extensions
   * @return         a list of {@code ExtensionFunction} with the implementation of the extensions
   */
  protected final List<ExtensionFunction> initExtensions(final WebSocketHttpExchange exchange) {
    String extHeader = exchange.getResponseHeaders().get(Headers.SEC_WEB_SOCKET_EXTENSIONS_STRING) != null ?
        exchange.getResponseHeaders().get(Headers.SEC_WEB_SOCKET_EXTENSIONS_STRING).get(0) : null;

    List<ExtensionFunction> negotiated = new ArrayList<>();
    if (extHeader != null) {
      List<WebSocketExtension> extensions = WebSocketExtension.parse(extHeader);
      if (extensions != null && !extensions.isEmpty()) {
        for (WebSocketExtension ext : extensions) {
          for (ExtensionHandshake extHandshake : availableExtensions) {
            if (extHandshake.getName().equals(ext.getName())) {
              negotiated.add(extHandshake.create());
            }
          }
        }
      }
    }
    return negotiated;
  }
}

代码示例来源:origin: io.skullabs.kikaha/kikaha-core

public WebSocketSession(final WebSocketHttpExchange originalExchange, final WebSocketChannel channel, final URLMatcher urlMatcher, Serializer serializer, Unserializer unserializer, ExecutorService executorService) {
  this.originalExchange = originalExchange;
  this.urlMatcher = urlMatcher;
  this.channel = channel;
  this.requestHeaders = originalExchange.getRequestHeaders();
  this.responseHeaders = originalExchange.getResponseHeaders();
  this.userPrincipal = originalExchange.getUserPrincipal();
  this.requestURI = channel.getUrl();
  this.peerConnections = retrievePeerConnectionsForCurrentURLRequest( channel );
  this.requestParameters = extractRequestParameters( channel );
  this.serializer = serializer;
  this.unserializer = unserializer;
  this.executorService = executorService;
}

相关文章