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

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

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

MultiMap.addAll介绍

[英]Adds all the entries from another MultiMap to this one
[中]将另一个多重映射中的所有条目添加到此多重映射

代码示例

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

@Test
public void testAddTest2()
  throws Exception {
 MultiMap mmap = newMultiMap();
 HashMap<String, String> map = new HashMap<String, String>();
 map.put("a", "b");
 map.put("c", "d");
 assertEquals("a: b\nc: d\n", mmap.addAll(map).toString());
}

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

@Test
public void testAddTest3()
  throws Exception {
 MultiMap mmap = newMultiMap();
 HashMap<String, String> map = new HashMap<String, String>();
 map.put("a", "b");
 assertEquals("a: b\n", mmap.addAll(map).toString());
}

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

@Test
public void testAddTest4()
  throws Exception {
 MultiMap mmap = newMultiMap();
 Map<String, String> map = new HashMap<String, String>();
 assertEquals("", mmap.addAll(map).toString());
}

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

@Test
public void testAddTest5()
  throws Exception {
 MultiMap mmap = newMultiMap();
 MultiMap headers = newMultiMap();
 assertEquals("", mmap.addAll(headers).toString());
}

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

next.headers().addAll(headers);

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

@Test
public void testAddTest1()
  throws Exception {
 MultiMap mmap = newMultiMap();
 HashMap<String, String> map = new HashMap<String, String>();
 map.put("a", "b");
 MultiMap result = mmap.addAll(map);
 assertNotNull(result);
 assertFalse(result.isEmpty());
 assertEquals(1, result.size());
 assertEquals("a: b\n", result.toString());
}

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

HttpServerResponse resp = req.response();
 resp.setStatusCode(sc);
 resp.headers().addAll(reqHeaders);
 resp.end();
});

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

@Test
public void testAddMultiMap()
  throws Exception {
 MultiMap mmap = newMultiMap();
 MultiMap mm = newMultiMap();
 mm.add("Header1", "value1");
 mm.add("Header2", "value2");
 MultiMap result = mmap.addAll(mm);
 assertEquals(2, result.size());
 assertEquals("Header1: value1\nHeader2: value2\n", result.toString());
}

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

protected MultiMap checkEmptyHttpResponse(HttpMethod method, int sc, MultiMap reqHeaders) throws Exception {
 server.requestHandler(req -> {
  HttpServerResponse resp = req.response();
  resp.setStatusCode(sc);
  resp.headers().addAll(reqHeaders);
  resp.end();
 });
 startServer();
 try {
  CompletableFuture<MultiMap> result = new CompletableFuture<>();
  client.request(method, DEFAULT_HTTP_PORT, DEFAULT_HTTPS_HOST, "/", onSuccess(resp -> {
   Buffer body = Buffer.buffer();
   resp.exceptionHandler(result::completeExceptionally);
   resp.handler(body::appendBuffer);
   resp.endHandler(v -> {
    if (body.length() > 0) {
     result.completeExceptionally(new Exception());
    } else {
     result.complete(resp.headers());
    }
   });
  })).setFollowRedirects(false)
   .exceptionHandler(result::completeExceptionally)
   .end();
  return result.get(20, TimeUnit.SECONDS);
 } finally {
  client.close();
 }
}

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

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

代码示例来源:origin: apache/servicecomb-java-chassis

public static void addDefaultHeaders(HttpClientRequest request) {
 request.headers().addAll(getDefaultHeaders());
}

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

@Test
public void testAddTest2()
  throws Exception {
 MultiMap mmap = newMultiMap();
 HashMap<String, String> map = new HashMap<String, String>();
 map.put("a", "b");
 map.put("c", "d");
 assertEquals("a: b\nc: d\n", mmap.addAll(map).toString());
}

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

@Test
public void testAddTest3()
  throws Exception {
 MultiMap mmap = newMultiMap();
 HashMap<String, String> map = new HashMap<String, String>();
 map.put("a", "b");
 assertEquals("a: b\n", mmap.addAll(map).toString());
}

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

@Override
 public void handle(RoutingContext ctx) {
  if (icon == null) {
   init(ctx.vertx());
  }
  if ("/favicon.ico".equals(ctx.request().path())) {
   ctx.response().headers().addAll(icon.headers);
   ctx.response().end(icon.body);
  } else {
   ctx.next();
  }
 }
}

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

@Test
public void testAddTest4()
  throws Exception {
 MultiMap mmap = newMultiMap();
 Map<String, String> map = new HashMap<String, String>();
 assertEquals("", mmap.addAll(map).toString());
}

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

@Test
public void testAddTest5()
  throws Exception {
 MultiMap mmap = newMultiMap();
 MultiMap headers = newMultiMap();
 assertEquals("", mmap.addAll(headers).toString());
}

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

@Test
public void testAddTest1()
  throws Exception {
 MultiMap mmap = newMultiMap();
 HashMap<String, String> map = new HashMap<String, String>();
 map.put("a", "b");
 MultiMap result = mmap.addAll(map);
 assertNotNull(result);
 assertFalse(result.isEmpty());
 assertEquals(1, result.size());
 assertEquals("a: b\n", result.toString());
}

代码示例来源:origin: apache/servicecomb-java-chassis

void doEnd() {
 if (failed) {
  deleteFileUploads();
  return;
 }
 if (deleteUploadedFilesOnEnd) {
  context.addBodyEndHandler(x -> deleteFileUploads());
 }
 HttpServerRequest req = context.request();
 if (mergeFormAttributes && req.isExpectMultipart()) {
  req.params().addAll(req.formAttributes());
 }
 context.setBody(body);
 context.next();
}

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

void doEnd() {
 if (failed) {
  deleteFileUploads();
  return;
 }
 if (deleteUploadedFilesOnEnd) {
  context.addBodyEndHandler(x -> deleteFileUploads());
 }
 HttpServerRequest req = context.request();
 if (mergeFormAttributes && req.isExpectMultipart()) {
  req.params().addAll(req.formAttributes());
 }
 context.setBody(body);
 context.next();
}

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

@Test
public void testAddMultiMap()
  throws Exception {
 MultiMap mmap = newMultiMap();
 MultiMap mm = newMultiMap();
 mm.add("Header1", "value1");
 mm.add("Header2", "value2");
 MultiMap result = mmap.addAll(mm);
 assertEquals(2, result.size());
 assertEquals("Header1: value1\nHeader2: value2\n", result.toString());
}

相关文章