Java Code Examples for io.vertx.core.MultiMap#forEach()
The following examples show how to use
io.vertx.core.MultiMap#forEach() .
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: AccessibleHandler.java From dfx with Apache License 2.0 | 5 votes |
private void mergeRequestParams(JsonObject body, MultiMap params) { if (params == null) { return; } params.forEach(entry -> body.put(entry.getKey(), entry.getValue())); logger.debug("Merged paramaters {}: ", body); }
Example 2
Source File: RestVerticle.java From raml-module-builder with Apache License 2.0 | 5 votes |
private void getOkapiHeaders(RoutingContext rc, Map<String, String> headers, String[] tenantId){ MultiMap mm = rc.request().headers(); Consumer<Map.Entry<String,String>> consumer = entry -> { String headerKey = entry.getKey().toLowerCase(); if(headerKey.startsWith(OKAPI_HEADER_PREFIX)){ if(headerKey.equalsIgnoreCase(ClientGenerator.OKAPI_HEADER_TENANT)){ tenantId[0] = entry.getValue(); } headers.put(headerKey, entry.getValue()); } }; mm.forEach(consumer); }
Example 3
Source File: HttpModuleClient2.java From raml-module-builder with Apache License 2.0 | 5 votes |
private void mergeHeaders(Map<String, String >headers1, MultiMap headers2, String endpoint){ Consumer<Map.Entry<String,String>> consumer = entry -> { String headerKey = entry.getKey().toLowerCase(); if(headerKey.startsWith("x-okapi")){ headers1.put(headerKey, entry.getValue()); } }; if(headers != null){ headers2.forEach(consumer); } else{ log.warn("headers passed into chainedRequest are null, from endpoint " + endpoint); } }
Example 4
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(); }
Example 5
Source File: HttpHeadersExtractAdapter.java From hawkular-apm with Apache License 2.0 | 4 votes |
public HttpHeadersExtractAdapter(final MultiMap multiValuedMap) { // Convert to single valued map this.map = new HashMap<>(); multiValuedMap.forEach(entry -> map.put(entry.getKey(), entry.getValue())); }
Example 6
Source File: ValidationHandlerImpl.java From vertx-web with Apache License 2.0 | 4 votes |
private Map<String, List<String>> copyMultiMapInMap(MultiMap multiMap) { Map<String, List<String>> map = new HashMap<>(); multiMap.forEach((e) -> map.computeIfAbsent(e.getKey(), k -> new ArrayList<>()).add(e.getValue())); return map; }
Example 7
Source File: EchoServerVertx.java From apiman with Apache License 2.0 | 4 votes |
private HeaderMap multimapToMap(MultiMap headers) { HeaderMap map = new HeaderMap(); headers.forEach(pair -> map.add(pair.getKey(), pair.getValue())); return map; }