本文整理了Java中io.vertx.core.MultiMap.getAll()
方法的一些代码示例,展示了MultiMap.getAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MultiMap.getAll()
方法的具体详情如下:
包路径:io.vertx.core.MultiMap
类名称:MultiMap
方法名:getAll
[英]Like #getAll(String) but accepting a CharSequence as a parameter
[中]比如#getAll(String),但接受CharSequence作为参数
代码示例来源:origin: eclipse-vertx/vert.x
/**
* Check if there is a header with the specified {@code name} and {@code value}.
*
* If {@code caseInsensitive} is {@code true}, {@code value} is compared in a case-insensitive way.
*
* @param name the name to search for
* @param value the value to search for
* @return {@code true} if at least one entry is found
*/
default boolean contains(String name, String value, boolean caseInsensitive) {
return getAll(name).stream()
.anyMatch(val -> caseInsensitive ? val.equalsIgnoreCase(value) : val.equals(value));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Override
public List<String> cookies() {
synchronized (conn) {
if (cookies == null) {
cookies = new ArrayList<>();
cookies.addAll(headers().getAll(HttpHeaders.SET_COOKIE));
if (trailers != null) {
cookies.addAll(trailers.getAll(HttpHeaders.SET_COOKIE));
}
}
return cookies;
}
}
代码示例来源:origin: eclipse-vertx/vert.x
/**
* Like {@link #contains(String, String, boolean)} but accepting {@code CharSequence} parameters.
*/
@GenIgnore(GenIgnore.PERMITTED_TYPE)
default boolean contains(CharSequence name, CharSequence value, boolean caseInsensitive) {
Predicate<String> predicate;
if (caseInsensitive) {
String valueAsString = value.toString();
predicate = val -> val.equalsIgnoreCase(valueAsString);
} else {
predicate = val -> val.contentEquals(value);
}
return getAll(name).stream().anyMatch(predicate);
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testGetAllConvertUpperCase() {
map.set("foo", "foo_value");
assertEquals(Collections.singletonList("foo_value"), map.getAll("Foo"));
assertEquals(Collections.singletonList("foo_value"), map.getAll((CharSequence) "Foo"));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testGetAllTest1()
throws Exception {
MultiMap mmap = newMultiMap();
CharSequence name = String.valueOf(new Object());
List<String> result = mmap.getAll(name);
assertNotNull(result);
assertEquals(0, result.size());
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testGetAllTest3()
throws Exception {
MultiMap mmap = newMultiMap();
String name = "name";
List<String> result = mmap.getAll(name);
assertNotNull(result);
assertEquals(0, result.size());
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testGetAllTest2()
throws Exception {
MultiMap mmap = newMultiMap();
String name = "1";
List<String> result = mmap.getAll(name);
assertNotNull(result);
assertEquals(0, result.size());
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testGetShouldReturnEntriesFromListInOrder() {
MultiMap mmap = newMultiMap();
mmap.add("header", Arrays.<CharSequence>asList("value1", "value2", "value3"));
assertEquals("value1", mmap.get("header"));
assertEquals(Arrays.asList("value1", "value2", "value3"), mmap.getAll("header"));
}
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testGetAllHashColl() {
MultiMap mm = newMultiMap();
String name1 = this.sameHash1;
String name2 = this.sameHash2;
mm.add(name1, "value1");
mm.add(name2, "value2");
assertEquals(2, mm.size());
assertEquals("[value1]", mm.getAll(name1).toString());
assertEquals("[value2]", mm.getAll(name2).toString());
mm = newMultiMap();
name1 = this.sameBucket1;
name2 = this.sameBucket2;
mm.add(name1, "value1");
mm.add(name2, "value2");
assertEquals(2, mm.size());
assertEquals("[value1]", mm.getAll(name1).toString());
assertEquals("[value2]", mm.getAll(name2).toString());
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testGetAll()
throws Exception {
MultiMap mmap = newMultiMap();
String name = "name";
mmap.add(name, "value1");
mmap.add(name, "value2");
List<String> result = mmap.getAll(name);
assertNotNull(result);
assertEquals(2, result.size());
assertEquals("value1", result.get(0));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testPutHeaderReplacesPreviousHeaders() throws Exception {
server.requestHandler(req ->
req.response()
.putHeader("Location", "http://example1.org")
.putHeader("location", "http://example2.org")
.end());
server.listen(onSuccess(server -> {
client.request(HttpMethod.GET, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, DEFAULT_TEST_URI, onSuccess(resp -> {
assertEquals(singletonList("http://example2.org"), resp.headers().getAll("LocatioN"));
testComplete();
})).end();
}));
await();
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testGetShouldReturnAddedEntriesInOrder() {
MultiMap mmap = newMultiMap();
mmap.add("header", "value1");
mmap.add("header", "value2");
mmap.add("header", "value3");
assertEquals("value1", mmap.get("header"));
assertEquals(Arrays.asList("value1", "value2", "value3"), mmap.getAll("header"));
}
代码示例来源:origin: vert-x3/vertx-examples
List<String> authorities = new ArrayList<>();
for (String authority : ctx.request().params().getAll("authority")) {
authorities.add(authority);
代码示例来源:origin: vert-x3/vertx-examples
for (String authority : ctx.request().params().getAll("authority")) {
authorities.add(authority);
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testTrailers() throws Exception {
server.requestHandler(req -> {
HttpServerResponse resp = req.response();
resp.setChunked(true);
resp.write("some-content");
resp.putTrailer("Foo", "foo_value");
resp.putTrailer("bar", "bar_value");
resp.putTrailer("juu", (List<String>)Arrays.asList("juu_value_1", "juu_value_2"));
resp.end();
});
startServer();
client.getNow(DEFAULT_HTTPS_PORT, DEFAULT_HTTPS_HOST, "/somepeth", onSuccess(resp -> {
assertEquals(null, resp.getTrailer("foo"));
resp.exceptionHandler(this::fail);
resp.endHandler(v -> {
assertEquals("foo_value", resp.getTrailer("foo"));
assertEquals("foo_value", resp.getTrailer("Foo"));
assertEquals("bar_value", resp.getTrailer("bar"));
assertEquals(2, resp.trailers().getAll("juu").size());
assertEquals("juu_value_1", resp.trailers().getAll("juu").get(0));
assertEquals("juu_value_2", resp.trailers().getAll("juu").get(1));
testComplete();
});
}));
await();
}
代码示例来源:origin: eclipse-vertx/vert.x
HttpClientResponse resp = ar.result();
for (String name : resp.headers().names()) {
request.response().putHeader(name, resp.headers().getAll(name));
for (String name : request.headers().names()) {
if (!name.equals("Proxy-Authorization")) {
clientRequest.putHeader(name, request.headers().getAll(name));
代码示例来源:origin: eclipse-vertx/vert.x
assertEquals("foo_request_value", req.getHeader("Foo_request"));
assertEquals("bar_request_value", req.getHeader("bar_request"));
assertEquals(2, req.headers().getAll("juu_request").size());
assertEquals("juu_request_value_1", req.headers().getAll("juu_request").get(0));
assertEquals("juu_request_value_2", req.headers().getAll("juu_request").get(1));
reqCount.incrementAndGet();
HttpServerResponse resp = req.response();
assertEquals("foo_value", resp.getHeader("foo_response"));
assertEquals("bar_value", resp.getHeader("bar_response"));
assertEquals(2, resp.headers().getAll("juu_response").size());
assertEquals("juu_value_1", resp.headers().getAll("juu_response").get(0));
assertEquals("juu_value_2", resp.headers().getAll("juu_response").get(1));
resp.endHandler(v -> {
assertOnIOContext(ctx);
代码示例来源:origin: io.vertx/vertx-core
@Test
public void testGetAllConvertUpperCase() {
map.set("foo", "foo_value");
assertEquals(Collections.singletonList("foo_value"), map.getAll("Foo"));
assertEquals(Collections.singletonList("foo_value"), map.getAll((CharSequence) "Foo"));
}
代码示例来源:origin: io.vertx/vertx-core
@Test
public void testGetAllTest1()
throws Exception {
MultiMap mmap = newMultiMap();
CharSequence name = String.valueOf(new Object());
List<String> result = mmap.getAll(name);
assertNotNull(result);
assertEquals(0, result.size());
}
代码示例来源:origin: io.vertx/vertx-core
@Test
public void testGetShouldReturnEntriesFromListInOrder() {
MultiMap mmap = newMultiMap();
mmap.add("header", Arrays.<CharSequence>asList("value1", "value2", "value3"));
assertEquals("value1", mmap.get("header"));
assertEquals(Arrays.asList("value1", "value2", "value3"), mmap.getAll("header"));
}
}
内容来源于网络,如有侵权,请联系作者删除!