本文整理了Java中io.vertx.core.MultiMap.names()
方法的一些代码示例,展示了MultiMap.names()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MultiMap.names()
方法的具体详情如下:
包路径:io.vertx.core.MultiMap
类名称:MultiMap
方法名:names
[英]Gets a immutable java.util.Set of all names
[中]获取一个不可变的java。util。所有名字的集合
代码示例来源:origin: vert-x3/vertx-examples
@Override
public void start() throws Exception {
vertx.createHttpServer().requestHandler(req -> {
System.out.println("Got request " + req.uri());
for (String name : req.headers().names()) {
System.out.println(name + ": " + req.headers().get(name));
}
req.handler(data -> System.out.println("Got data " + data.toString("ISO-8859-1")));
req.endHandler(v -> {
// Now send back a response
req.response().setChunked(true);
for (int i = 0; i < 10; i++) {
req.response().write("server-data-chunk-" + i);
}
req.response().end();
});
}).listen(8282);
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testNamesTest1()
throws Exception {
MultiMap mmap = newMultiMap();
Set<String> result = mmap.names();
assertNotNull(result);
assertEquals(0, result.size());
}
代码示例来源:origin: vert-x3/vertx-examples
@Override
public void start() throws Exception {
vertx.createHttpServer().requestHandler(req -> {
if (req.uri().equals("/")) {
// Serve the index page
req.response().sendFile("index.html");
} else if (req.uri().startsWith("/form")) {
req.response().setChunked(true);
req.setExpectMultipart(true);
req.endHandler((v) -> {
for (String attr : req.formAttributes().names()) {
req.response().write("Got attr " + attr + " : " + req.formAttributes().get(attr) + "\n");
}
req.response().end();
});
} else {
req.response().setStatusCode(404).end();
}
}).listen(8080);
}
}
代码示例来源:origin: vert-x3/vertx-examples
@Override
public void start() throws Exception {
SelfSignedCertificate certificate = SelfSignedCertificate.create();
HttpServerOptions serverOptions = new HttpServerOptions()
.setSsl(true)
.setKeyCertOptions(certificate.keyCertOptions());
vertx.createHttpServer(serverOptions).requestHandler(req -> {
System.out.println("Got request " + req.uri());
for (String name : req.headers().names()) {
System.out.println(name + ": " + req.headers().get(name));
}
req.handler(data -> System.out.println("Got data " + data.toString("ISO-8859-1")));
req.endHandler(v -> {
// Now send back a response
req.response().setChunked(true);
for (int i = 0; i < 10; i++) {
req.response().write("server-data-chunk-" + i);
}
req.response().end();
});
}).listen(8282);
}
代码示例来源:origin: vert-x3/vertx-examples
httpServerResponse.setChunked(true);
MultiMap headers = ctx.request().headers();
for (String key : headers.names()) {
httpServerResponse.write(key + ": ");
httpServerResponse.write(headers.get(key));
httpServerResponse.setChunked(true);
MultiMap headers = ctx.request().headers();
for (String key : headers.names()) {
httpServerResponse.write(key + ": ");
httpServerResponse.write(headers.get(key));
代码示例来源:origin: advantageous/qbit
@SuppressWarnings("NullableProblems")
@Override
public Set<String> keySet() {
return vertxMap.names();
}
代码示例来源:origin: advantageous/qbit
@Override
public Iterable<String> keySetMulti() {
return vertxMap.names();
}
代码示例来源:origin: eclipse-vertx/vert.x
assertEquals(Collections.emptySet(), req.response().headers().names());
req.response().end();
});
代码示例来源:origin: eclipse-vertx/vert.x
if (ar.succeeded()) {
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: apache/servicecomb-java-chassis
@Override
public Collection<String> getHeaderNames() {
return clientResponse.headers().names();
}
}
代码示例来源:origin: apache/servicecomb-java-chassis
@Override
public Enumeration<String> getParameterNames() {
if (parameterMap != null) {
return Collections.enumeration(parameterMap.keySet());
}
return Collections.enumeration(this.vertxRequest.params().names());
}
代码示例来源:origin: apache/servicecomb-java-chassis
@Override
public Enumeration<String> getHeaderNames() {
return Collections.enumeration(vertxRequest.headers().names());
}
代码示例来源:origin: apache/servicecomb-java-chassis
@Override
public Enumeration<String> getHeaderNames() {
return Collections.enumeration(clientRequest.headers().names());
}
代码示例来源:origin: apache/servicecomb-java-chassis
@Override
public Collection<String> getHeaderNames() {
return serverResponse.headers().names();
}
代码示例来源:origin: apache/servicecomb-java-chassis
@Override
public Map<String, String[]> getParameterMap() {
if (parameterMap == null) {
Map<String, String[]> paramMap = new HashMap<>();
MultiMap map = this.vertxRequest.params();
for (String name : map.names()) {
List<String> valueList = map.getAll(name);
paramMap.put(name, map.getAll(name).toArray(new String[valueList.size()]));
}
parameterMap = paramMap;
}
return parameterMap;
}
代码示例来源:origin: gravitee-io/gravitee-gateway
public EvaluableHttpResponse(final HttpClientResponse response, final String content) {
this.statusCode = response.statusCode();
this.content = content;
// Copy HTTP headers
response.headers().names().forEach(headerName ->
httpHeaders.put(headerName, response.headers().getAll(headerName)));
}
代码示例来源:origin: vert-x3/vertx-web
private void deliverMessage(SockJSSocket sock, String address, Message message) {
JsonObject envelope = new JsonObject().put("type", "rec").put("address", address).put("body", message.body());
if (message.replyAddress() != null) {
envelope.put("replyAddress", message.replyAddress());
}
if (message.headers() != null && !message.headers().isEmpty()) {
JsonObject headersCopy = new JsonObject();
for (String name : message.headers().names()) {
List<String> values = message.headers().getAll(name);
if (values.size() == 1) {
headersCopy.put(name, values.get(0));
} else {
headersCopy.put(name, values);
}
}
envelope.put("headers", headersCopy);
}
checkCallHook(() -> new BridgeEventImpl(BridgeEventType.RECEIVE, envelope, sock),
() -> sock.write(buffer(envelope.encode())),
() -> log.debug("outbound message rejected by bridge event handler"));
}
代码示例来源:origin: io.vertx/vertx-core
@Test
public void testNamesTest1()
throws Exception {
MultiMap mmap = newMultiMap();
Set<String> result = mmap.names();
assertNotNull(result);
assertEquals(0, result.size());
}
代码示例来源:origin: gravitee-io/gravitee-gateway
private void handleClientResponse(VertxProxyConnection proxyConnection, HttpClientResponse clientResponse) {
VertxProxyResponse proxyClientResponse = new VertxProxyResponse(clientResponse);
proxyConnection.setProxyResponse(proxyClientResponse);
// Copy HTTP headers
clientResponse.headers().names().forEach(headerName ->
proxyClientResponse.headers().put(headerName, clientResponse.headers().getAll(headerName)));
proxyClientResponse.pause();
// Copy body content
clientResponse.handler(event -> proxyClientResponse.bodyHandler().handle(Buffer.buffer(event.getBytes())));
// Signal end of the response
clientResponse.endHandler(v -> proxyClientResponse.endHandler().handle(null));
proxyConnection.handleResponse(proxyClientResponse);
}
代码示例来源:origin: io.vertx/vertx-core
assertEquals(Collections.emptySet(), req.response().headers().names());
req.response().end();
});
内容来源于网络,如有侵权,请联系作者删除!