Java Code Examples for io.vertx.core.MultiMap#addAll()
The following examples show how to use
io.vertx.core.MultiMap#addAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VertxRequestTransmitter.java From ethsigner with Apache License 2.0 | 5 votes |
private MultiMap createHeaders(final MultiMap headers) { final MultiMap requestHeaders = new VertxHttpHeaders(); requestHeaders.addAll(headers); requestHeaders.remove(HttpHeaders.CONTENT_LENGTH); requestHeaders.remove(HttpHeaders.ORIGIN); renameHeader(requestHeaders, HttpHeaders.HOST, HttpHeaders.X_FORWARDED_HOST); return requestHeaders; }
Example 2
Source File: MailEncoder.java From vertx-mail-client with Apache License 2.0 | 5 votes |
/** * create the headers of the MIME message by combining the headers the user has supplied with the ones necessary for * the message * * @return MultiMap of final headers */ private MultiMap createHeaders(MultiMap additionalHeaders) { MultiMap headers = MultiMap.caseInsensitiveMultiMap();; if (!message.isFixedHeaders()) { headers.set("MIME-Version", "1.0"); headers.set("Message-ID", Utils.generateMessageID(hostname, userAgent)); headers.set("Date", Utils.generateDate()); if (message.getSubject() != null) { headers.set("Subject", Utils.encodeHeader(message.getSubject(), 9)); } if (message.getFrom() != null) { headers.set("From", Utils.encodeHeaderEmail(message.getFrom(), 6)); } if (message.getTo() != null) { headers.set("To", Utils.encodeEmailList(message.getTo(), 4)); } if (message.getCc() != null) { headers.set("Cc", Utils.encodeEmailList(message.getCc(), 4)); } headers.addAll(additionalHeaders); } // add the user-supplied headers as last step, this way it is possible // to supply a custom Message-ID for example. MultiMap headersToSet = message.getHeaders(); if (headersToSet != null) { for (String key : headersToSet.names()) { headers.remove(key); } headers.addAll(headersToSet); } messageID = headers.get("Message-ID"); return headers; }
Example 3
Source File: GraphiQLHandlerImpl.java From vertx-web with Apache License 2.0 | 5 votes |
private String replacement(RoutingContext rc) { JsonObject json = new JsonObject(); if (options.getGraphQLUri() != null) { json.put("graphQLUri", options.getGraphQLUri()); } MultiMap headers = MultiMap.caseInsensitiveMultiMap(); Map<String, String> fixedHeaders = options.getHeaders(); if (fixedHeaders != null) { fixedHeaders.forEach(headers::add); } Function<RoutingContext, MultiMap> rh; synchronized (this) { rh = this.graphiQLRequestHeadersFactory; } MultiMap dynamicHeaders = rh.apply(rc); if (dynamicHeaders != null) { headers.addAll(dynamicHeaders); } if (!headers.isEmpty()) { JsonObject headersJson = new JsonObject(); headers.forEach(header -> headersJson.put(header.getKey(), header.getValue())); json.put("headers", headersJson); } if (options.getQuery() != null) { json.put("query", options.getQuery()); } if (options.getVariables() != null) { json.put("parameters", options.getVariables()); } return json.encode(); }