io.vertx.core.MultiMap.caseInsensitiveMultiMap()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(132)

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

MultiMap.caseInsensitiveMultiMap介绍

[英]Create a multi-map implementation with case insensitive keys, for instance it can be used to hold some HTTP headers.
[中]创建一个带有不区分大小写键的多映射实现,例如,它可以用来保存一些HTTP头。

代码示例

代码示例来源:origin: vert-x3/vertx-examples

@Override
 public void start() throws Exception {

  WebClient client = WebClient.create(vertx);

  MultiMap form = MultiMap.caseInsensitiveMultiMap();
  form.add("firstName", "Dale");
  form.add("lastName", "Cooper");
  form.add("male", "true");

  client.post(8080, "localhost", "/").sendForm(form, ar -> {
   if (ar.succeeded()) {
    HttpResponse<Buffer> response = ar.result();
    System.out.println("Got HTTP response with status " + response.statusCode());
   } else {
    ar.cause().printStackTrace();
   }
  });
 }
}

代码示例来源:origin: vert-x3/vertx-examples

@Override
 public void start() throws Exception {
  WebClient client = WebClient.create(vertx);

  MultiMap form = MultiMap.caseInsensitiveMultiMap();
  form.add("firstName", "Dale");
  form.add("lastName", "Cooper");
  form.add("male", "true");

  client
   .post(8080, "localhost", "/")
   .putHeader("content-type", "multipart/form-data")
   .sendForm(form, ar -> {
    if (ar.succeeded()) {
     HttpResponse<Buffer> response = ar.result();
     System.out.println("Got HTTP response with status " + response.statusCode());
    } else {
     ar.cause().printStackTrace();
    }
   });
 }
}

代码示例来源:origin: eclipse-vertx/vert.x

if (proxyOptions.getUsername() != null && proxyOptions.getPassword() != null) {
 if (headers == null) {
  headers = MultiMap.caseInsensitiveMultiMap();

代码示例来源:origin: eclipse-vertx/vert.x

assertEquals("HTTP/1.1 " + sc, statusLine.substring(0, statusLine.indexOf(' ', 9)));
assertEquals("", content.substring(idx + 4));
MultiMap respHeaders = MultiMap.caseInsensitiveMultiMap();
records.forEach(record -> {
 int index = record.indexOf(":");

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testNotModifiedDoesNotSetAutomaticallySetContentLengthHeader() throws Exception {
 MultiMap respHeaders = checkEmptyHttpResponse(HttpMethod.GET, 304, MultiMap.caseInsensitiveMultiMap());
 assertNull(respHeaders.get("content-length"));
 assertNull(respHeaders.get("transfer-encoding"));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testHeadDoesNotSetAutomaticallySetContentLengthHeader() throws Exception {
 MultiMap respHeaders = checkEmptyHttpResponse(HttpMethod.HEAD, 200, MultiMap.caseInsensitiveMultiMap());
 assertNull(respHeaders.get("content-length"));
 assertNull(respHeaders.get("transfer-encoding"));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testResetContentSetsContentLengthHeader() throws Exception {
 MultiMap respHeaders = checkEmptyHttpResponse(HttpMethod.GET, 205, MultiMap.caseInsensitiveMultiMap());
 assertEquals("0", respHeaders.get("content-length"));
 assertNull(respHeaders.get("transfer-encoding"));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testHeadRemovesTransferEncodingHeader() throws Exception {
 MultiMap respHeaders = checkEmptyHttpResponse(HttpMethod.HEAD, 200, MultiMap.caseInsensitiveMultiMap().set("transfer-encoding", "chunked"));
 assertNull(respHeaders.get("content-length"));
 assertNull(respHeaders.get("transfer-encoding"));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testNoContentRemovesContentLengthHeader() throws Exception {
 MultiMap respHeaders = checkEmptyHttpResponse(HttpMethod.GET, 204, MultiMap.caseInsensitiveMultiMap().set("content-length", "34"));
 assertNull(respHeaders.get("content-length"));
 assertNull(respHeaders.get("transfer-encoding"));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testNoContentRemovesTransferEncodingHeader() throws Exception {
 MultiMap respHeaders = checkEmptyHttpResponse(HttpMethod.GET, 204, MultiMap.caseInsensitiveMultiMap().set("transfer-encoding", "chunked"));
 assertNull(respHeaders.get("content-length"));
 assertNull(respHeaders.get("transfer-encoding"));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testNotModifiedRemovesTransferEncodingHeader() throws Exception {
 MultiMap respHeaders = checkEmptyHttpResponse(HttpMethod.GET, 304, MultiMap.caseInsensitiveMultiMap().set("transfer-encoding", "chunked"));
 assertNull(respHeaders.get("content-length"));
 assertNull(respHeaders.get("transfer-encoding"));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testResetContentRemovesTransferEncodingHeader() throws Exception {
 MultiMap respHeaders = checkEmptyHttpResponse(HttpMethod.GET, 205, MultiMap.caseInsensitiveMultiMap().set("transfer-encoding", "chunked"));
 assertEquals("0", respHeaders.get("content-length"));
 assertNull(respHeaders.get("transfer-encoding"));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testHeadAllowsContentLengthHeader() throws Exception {
 MultiMap respHeaders = checkEmptyHttpResponse(HttpMethod.HEAD, 200, MultiMap.caseInsensitiveMultiMap().set("content-length", "34"));
 assertEquals("34", respHeaders.get("content-length"));
 assertNull(respHeaders.get("transfer-encoding"));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testNotModifiedAllowsContentLengthHeader() throws Exception {
 MultiMap respHeaders = checkEmptyHttpResponse(HttpMethod.GET, 304, MultiMap.caseInsensitiveMultiMap().set("content-length", "34"));
 assertEquals("34", respHeaders.get("Content-Length"));
 assertNull(respHeaders.get("transfer-encoding"));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void test1xxRemovesTransferEncodingHeader() throws Exception {
 MultiMap respHeaders = checkEmptyHttpResponse(HttpMethod.GET, 102, MultiMap.caseInsensitiveMultiMap().set("transfer-encoding", "chunked"));
 assertNull(respHeaders.get("content-length"));
 assertNull(respHeaders.get("transfer-encoding"));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void test1xxRemovesContentLengthHeader() throws Exception {
 MultiMap respHeaders = checkEmptyHttpResponse(HttpMethod.GET, 102, MultiMap.caseInsensitiveMultiMap().set("content-length", "34"));
 assertNull(respHeaders.get("content-length"));
 assertNull(respHeaders.get("transfer-encoding"));
}

代码示例来源:origin: eclipse-vertx/vert.x

lastRequestHeaders = MultiMap.caseInsensitiveMultiMap().addAll(request.headers());
if (error != 0) {
 request.response().setStatusCode(error).end("proxy request failed");

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

@Test
public void testResetContentSetsContentLengthHeader() throws Exception {
 MultiMap respHeaders = checkEmptyHttpResponse(HttpMethod.GET, 205, MultiMap.caseInsensitiveMultiMap());
 assertEquals("0", respHeaders.get("content-length"));
 assertNull(respHeaders.get("transfer-encoding"));
}

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

@Test
public void testHeadAllowsContentLengthHeader() throws Exception {
 MultiMap respHeaders = checkEmptyHttpResponse(HttpMethod.HEAD, 200, MultiMap.caseInsensitiveMultiMap().set("content-length", "34"));
 assertEquals("34", respHeaders.get("content-length"));
 assertNull(respHeaders.get("transfer-encoding"));
}

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

@Test
public void testNoContentRemovesContentLengthHeader() throws Exception {
 MultiMap respHeaders = checkEmptyHttpResponse(HttpMethod.GET, 204, MultiMap.caseInsensitiveMultiMap().set("content-length", "34"));
 assertNull(respHeaders.get("content-length"));
 assertNull(respHeaders.get("transfer-encoding"));
}

相关文章