gpt4 book ai didi

org.apache.tomcat.websocket.WsWebSocketContainer.addHeader()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-23 19:25:05 26 4
gpt4 key购买 nike

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

WsWebSocketContainer.addHeader介绍

暂无

代码示例

代码示例来源:origin: org.apache.tomcat/tomcat7-websocket

private static ByteBuffer createRequest(URI uri, Map<String,List<String>> reqHeaders) {
  ByteBuffer result = ByteBuffer.allocate(4 * 1024);
  // Request line
  result.put(GET_BYTES);
  byte[] path = (null == uri.getPath() || "".equals(uri.getPath()))
      ? ROOT_URI_BYTES : uri.getRawPath().getBytes(StandardCharsets.ISO_8859_1);
  result.put(path);
  String query = uri.getRawQuery();
  if (query != null) {
    result.put((byte) '?');
    result.put(query.getBytes(StandardCharsets.ISO_8859_1));
  }
  result.put(HTTP_VERSION_BYTES);
  // Headers
  for (Entry<String, List<String>> entry : reqHeaders.entrySet()) {
    result = addHeader(result, entry.getKey(), entry.getValue());
  }
  // Terminating CRLF
  result.put(CRLF);
  result.flip();
  return result;
}

代码示例来源:origin: org.apache.tomcat.embed/tomcat-embed-websocket

private static ByteBuffer createRequest(URI uri, Map<String,List<String>> reqHeaders) {
  ByteBuffer result = ByteBuffer.allocate(4 * 1024);
  // Request line
  result.put(GET_BYTES);
  if (null == uri.getPath() || "".equals(uri.getPath())) {
    result.put(ROOT_URI_BYTES);
  } else {
    result.put(uri.getRawPath().getBytes(StandardCharsets.ISO_8859_1));
  }
  String query = uri.getRawQuery();
  if (query != null) {
    result.put((byte) '?');
    result.put(query.getBytes(StandardCharsets.ISO_8859_1));
  }
  result.put(HTTP_VERSION_BYTES);
  // Headers
  for (Entry<String, List<String>> entry : reqHeaders.entrySet()) {
    result = addHeader(result, entry.getKey(), entry.getValue());
  }
  // Terminating CRLF
  result.put(CRLF);
  result.flip();
  return result;
}

代码示例来源:origin: codefollower/Tomcat-Research

private ByteBuffer createRequest(URI uri,
    Map<String,List<String>> reqHeaders) {
  ByteBuffer result = ByteBuffer.allocate(4 * 1024);
  // Request line
  result.put("GET ".getBytes(StandardCharsets.ISO_8859_1));
  result.put(uri.getRawPath().getBytes(StandardCharsets.ISO_8859_1));
  String query = uri.getRawQuery();
  if (query != null) {
    result.put((byte) '?');
    result.put(query.getBytes(StandardCharsets.ISO_8859_1));
  }
  result.put(" HTTP/1.1\r\n".getBytes(StandardCharsets.ISO_8859_1));
  // Headers
  Iterator<Entry<String,List<String>>> iter =
      reqHeaders.entrySet().iterator();
  while (iter.hasNext()) {
    Entry<String,List<String>> entry = iter.next();
    addHeader(result, entry.getKey(), entry.getValue());
  }
  // Terminating CRLF
  result.put(crlf);
  result.flip();
  return result;
}

代码示例来源:origin: org.jboss.web/jbossweb

private ByteBuffer createRequest(URI uri,
    Map<String,List<String>> reqHeaders) {
  ByteBuffer result = ByteBuffer.allocate(4 * 1024);
  // Request line
  result.put("GET ".getBytes(StandardCharsets.ISO_8859_1));
  result.put(uri.getRawPath().getBytes(StandardCharsets.ISO_8859_1));
  String query = uri.getRawQuery();
  if (query != null) {
    result.put((byte) '?');
    result.put(query.getBytes(StandardCharsets.ISO_8859_1));
  }
  result.put(" HTTP/1.1\r\n".getBytes(StandardCharsets.ISO_8859_1));
  // Headers
  Iterator<Entry<String,List<String>>> iter =
      reqHeaders.entrySet().iterator();
  while (iter.hasNext()) {
    Entry<String,List<String>> entry = iter.next();
    addHeader(result, entry.getKey(), entry.getValue());
  }
  // Terminating CRLF
  result.put(crlf);
  result.flip();
  return result;
}

代码示例来源:origin: org.apache.tomcat/tomcat-websocket

private static ByteBuffer createRequest(URI uri, Map<String,List<String>> reqHeaders) {
  ByteBuffer result = ByteBuffer.allocate(4 * 1024);
  // Request line
  result.put(GET_BYTES);
  if (null == uri.getPath() || "".equals(uri.getPath())) {
    result.put(ROOT_URI_BYTES);
  } else {
    result.put(uri.getRawPath().getBytes(StandardCharsets.ISO_8859_1));
  }
  String query = uri.getRawQuery();
  if (query != null) {
    result.put((byte) '?');
    result.put(query.getBytes(StandardCharsets.ISO_8859_1));
  }
  result.put(HTTP_VERSION_BYTES);
  // Headers
  for (Entry<String, List<String>> entry : reqHeaders.entrySet()) {
    result = addHeader(result, entry.getKey(), entry.getValue());
  }
  // Terminating CRLF
  result.put(CRLF);
  result.flip();
  return result;
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com