本文整理了Java中io.vertx.core.MultiMap.contains()
方法的一些代码示例,展示了MultiMap.contains()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MultiMap.contains()
方法的具体详情如下:
包路径:io.vertx.core.MultiMap
类名称:MultiMap
方法名:contains
[英]Like #contains(String,String,boolean) but accepting CharSequence parameters.
[中]Like#包含(String、String、boolean)但接受CharSequence参数。
代码示例来源:origin: eclipse-vertx/vert.x
private boolean contentLengthSet() {
return headers != null && headers().contains(CONTENT_LENGTH);
}
代码示例来源:origin: eclipse-vertx/vert.x
@Override
public void handle(HttpServerRequest req) {
if (req.headers()
.contains(UPGRADE, WEBSOCKET, true)
|| handlers.requestHandler == null) {
// Missing upgrade header + null request handler will be handled when creating the handshake by sending a 400 error
handle((HttpServerRequestImpl) req);
} else {
handlers.requestHandler.handle(req);
}
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testContainsConvertUpperCase() {
map.set("foo", "foo_value");
assertTrue(map.contains("Foo"));
assertTrue(map.contains((CharSequence) "Foo"));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testContainsTest1()
throws Exception {
MultiMap mmap = newMultiMap();
CharSequence name = String.valueOf(new Object());
assertFalse(mmap.contains(name));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testContainsTest3()
throws Exception {
MultiMap mmap = newMultiMap();
String name = "0123456789";
boolean result = mmap.contains(name);
assertFalse(result);
mmap.add(name, "");
result = mmap.contains(name);
assertTrue(result);
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testContainsValueStringIgnoreCase() {
MultiMap mmap = newMultiMap();
mmap.add("headeR", "vAlue");
assertTrue(mmap.contains("heaDer", "vAlue", true));
assertTrue(mmap.contains("heaDer", "Value", true));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testContainsValueString() {
MultiMap mmap = newMultiMap();
mmap.add("headeR", "vAlue");
assertTrue(mmap.contains("heaDer", "vAlue", false));
assertFalse(mmap.contains("heaDer", "Value", false));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testContainsTest2()
throws Exception {
MultiMap mmap = newMultiMap();
String name = "";
assertFalse(mmap.contains(name));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testRemoveTest4()
throws Exception {
MultiMap mmap = newMultiMap();
String name = "name";
String value = "value";
mmap.add(name, value);
assertTrue(mmap.contains(name));
MultiMap result = mmap.remove(name);
assertFalse(result.contains(name));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testContainsValueCharSequenceIgnoreCase() {
MultiMap mmap = newMultiMap();
mmap.add("headeR", "vAlue");
CharSequence name = HttpHeaders.createOptimized("heaDer");
CharSequence vAlue = HttpHeaders.createOptimized("vAlue");
CharSequence Value = HttpHeaders.createOptimized("Value");
assertTrue(mmap.contains(name, vAlue, true));
assertTrue(mmap.contains(name, Value, true));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testContainsValueCharSequence() {
MultiMap mmap = newMultiMap();
mmap.add("headeR", "vAlue");
CharSequence name = HttpHeaders.createOptimized("heaDer");
CharSequence vAlue = HttpHeaders.createOptimized("vAlue");
CharSequence Value = HttpHeaders.createOptimized("Value");
assertTrue(mmap.contains(name, vAlue, false));
assertFalse(mmap.contains(name, Value, false));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testContainsValueStringIgnoreCase() {
server.requestHandler(req -> {
assertTrue(req.headers().contains("Foo", "foo", true));
assertTrue(req.headers().contains("Foo", "fOo", true));
req.response().putHeader("quux", "quux");
req.response().end();
});
server.listen(onSuccess(server -> {
HttpClientRequest req = client.request(HttpMethod.GET, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, DEFAULT_TEST_URI, onSuccess(resp -> {
assertTrue(resp.headers().contains("Quux", "quux", true));
assertTrue(resp.headers().contains("Quux", "quUx", true));
testComplete();
}));
req.putHeader("foo", "foo");
req.end();
}));
await();
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testContainsValueString() {
server.requestHandler(req -> {
assertTrue(req.headers().contains("Foo", "foo", false));
assertFalse(req.headers().contains("Foo", "fOo", false));
req.response().putHeader("quux", "quux");
req.response().end();
});
server.listen(onSuccess(server -> {
HttpClientRequest req = client.request(HttpMethod.GET, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, DEFAULT_TEST_URI, onSuccess(resp -> {
assertTrue(resp.headers().contains("Quux", "quux", false));
assertFalse(resp.headers().contains("Quux", "quUx", false));
testComplete();
}));
req.putHeader("foo", "foo");
req.end();
}));
await();
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testContainsValueCharSequence() {
CharSequence Foo = HttpHeaders.createOptimized("Foo");
CharSequence foo = HttpHeaders.createOptimized("foo");
CharSequence fOo = HttpHeaders.createOptimized("fOo");
CharSequence Quux = HttpHeaders.createOptimized("Quux");
CharSequence quux = HttpHeaders.createOptimized("quux");
CharSequence quUx = HttpHeaders.createOptimized("quUx");
server.requestHandler(req -> {
assertTrue(req.headers().contains(Foo, foo, false));
assertFalse(req.headers().contains(Foo, fOo, false));
req.response().putHeader(quux, quux);
req.response().end();
});
server.listen(onSuccess(server -> {
HttpClientRequest req = client.request(HttpMethod.GET, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, DEFAULT_TEST_URI, onSuccess(resp -> {
assertTrue(resp.headers().contains(Quux, quux, false));
assertFalse(resp.headers().contains(Quux, quUx, false));
testComplete();
}));
req.putHeader(foo, foo);
req.end();
}));
await();
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testContainsValueCharSequenceIgnoreCase() {
CharSequence Foo = HttpHeaders.createOptimized("Foo");
CharSequence foo = HttpHeaders.createOptimized("foo");
CharSequence fOo = HttpHeaders.createOptimized("fOo");
CharSequence Quux = HttpHeaders.createOptimized("Quux");
CharSequence quux = HttpHeaders.createOptimized("quux");
CharSequence quUx = HttpHeaders.createOptimized("quUx");
server.requestHandler(req -> {
assertTrue(req.headers().contains(Foo, foo, true));
assertTrue(req.headers().contains(Foo, fOo, true));
req.response().putHeader(quux, quux);
req.response().end();
});
server.listen(onSuccess(server -> {
HttpClientRequest req = client.request(HttpMethod.GET, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, DEFAULT_TEST_URI, onSuccess(resp -> {
assertTrue(resp.headers().contains(Quux, quux, true));
assertTrue(resp.headers().contains(Quux, quUx, true));
testComplete();
}));
req.putHeader(foo, foo);
req.end();
}));
await();
}
代码示例来源:origin: eclipse-vertx/vert.x
assertEquals("foo", req.headers().get("foo"));
assertEquals("foo", req.headers().get("fOO"));
assertTrue(req.headers().contains("Foo"));
assertTrue(req.headers().contains("foo"));
assertTrue(req.headers().contains("fOO"));
assertEquals("quux", req.response().headers().get("quux"));
assertEquals("quux", req.response().headers().get("qUUX"));
assertTrue(req.response().headers().contains("Quux"));
assertTrue(req.response().headers().contains("quux"));
assertTrue(req.response().headers().contains("qUUX"));
assertEquals("quux", resp.headers().get("quux"));
assertEquals("quux", resp.headers().get("qUUX"));
assertTrue(resp.headers().contains("Quux"));
assertTrue(resp.headers().contains("quux"));
assertTrue(resp.headers().contains("qUUX"));
testComplete();
}));
assertEquals("foo", req.headers().get("foo"));
assertEquals("foo", req.headers().get("fOO"));
assertTrue(req.headers().contains("Foo"));
assertTrue(req.headers().contains("foo"));
assertTrue(req.headers().contains("fOO"));
代码示例来源:origin: io.vertx/vertx-core
@Test
public void testContainsConvertUpperCase() {
map.set("foo", "foo_value");
assertTrue(map.contains("Foo"));
assertTrue(map.contains((CharSequence) "Foo"));
}
代码示例来源:origin: io.vertx/vertx-core
@Test
public void testContainsTest1()
throws Exception {
MultiMap mmap = newMultiMap();
CharSequence name = String.valueOf(new Object());
assertFalse(mmap.contains(name));
}
代码示例来源:origin: io.vertx/vertx-core
@Test
public void testContainsTest2()
throws Exception {
MultiMap mmap = newMultiMap();
String name = "";
assertFalse(mmap.contains(name));
}
代码示例来源:origin: io.vertx/vertx-core
@Test
public void testContainsValueCharSequenceIgnoreCase() {
MultiMap mmap = newMultiMap();
mmap.add("headeR", "vAlue");
CharSequence name = HttpHeaders.createOptimized("heaDer");
CharSequence vAlue = HttpHeaders.createOptimized("vAlue");
CharSequence Value = HttpHeaders.createOptimized("Value");
assertTrue(mmap.contains(name, vAlue, true));
assertTrue(mmap.contains(name, Value, true));
}
内容来源于网络,如有侵权,请联系作者删除!