List of usage examples for io.vertx.core MultiMap names
Set<String> names();
From source file:org.sfs.util.HttpServerRequestHeaderLogger.java
License:Apache License
@Override public T call(T httpServerRequest) { if (LOGGER.isDebugEnabled()) { StringBuilder sb = new StringBuilder(); sb.append("\r\nHttp Header Dump >>>>>\r\n\r\n"); String query = httpServerRequest.query(); sb.append(format("%s %s%s %s\r\n", httpServerRequest.method(), httpServerRequest.path(), query != null ? '?' + query : "", httpServerRequest.version().toString())); MultiMap headers = httpServerRequest.headers(); for (String headerName : headers.names()) { List<String> values = headers.getAll(headerName); sb.append(format("%s: %s\r\n", headerName, on(',').join(values))); }//from w w w . j a v a2 s . com sb.append("\r\n"); sb.append("Http Header Dump <<<<<\r\n"); LOGGER.debug(sb.toString()); } return httpServerRequest; }
From source file:org.sfs.util.HttpServerRequestHeaderToJsonObject.java
License:Apache License
public static JsonObject call(HttpServerRequest httpServerRequest) { JsonObject jsonObject = new JsonObject(); String query = httpServerRequest.query(); String requestLine = String.format("%s %s%s %s", httpServerRequest.method(), httpServerRequest.path(), query != null ? '?' + query : "", httpServerRequest.version().toString()); jsonObject.put("request_line", requestLine); MultiMap headers = httpServerRequest.headers(); JsonArray jsonHeaders = new JsonArray(); for (String headerName : headers.names()) { List<String> values = headers.getAll(headerName); JsonObject jsonHeader = new JsonObject(); jsonHeader.put(headerName, values); jsonHeaders.add(jsonHeader);/* w w w.j av a 2 s .c o m*/ } jsonObject.put("headers", jsonHeaders); return jsonObject; }
From source file:org.sfs.validate.ValidateParamComputedDigest.java
License:Apache License
@Override public SfsRequest call(SfsRequest httpServerRequest) { MultiMap params = httpServerRequest.params(); for (String param : params.names()) { Matcher matcher = COMPUTED_DIGEST.matcher(param); if (matcher.matches()) { String digestName = matcher.group(1); if (!fromValueIfExists(digestName).isPresent()) { JsonObject jsonObject = new JsonObject().put("message", format("%s is not a supported digest", digestName)); throw new HttpRequestValidationException(HTTP_BAD_REQUEST, jsonObject); }/*from ww w . j av a 2 s . c om*/ } } return httpServerRequest; }
From source file:org.sfs.vo.XBlob.java
License:Apache License
public XBlob merge(SfsRequest httpServerRequest) { MultiMap queryParams = httpServerRequest.params(); MultiMap headers = httpServerRequest.headers(); if (queryParams.contains(VOLUME)) { volume = tryParse(queryParams.get(VOLUME)); }//w w w.ja v a 2s. co m if (queryParams.contains(POSITION)) { position = Longs.tryParse(queryParams.get(POSITION)); } if (queryParams.contains(VERSION)) { version = base64().decode(queryParams.get(VERSION)); } if (headers.contains(CONTENT_LENGTH)) { length = Longs.tryParse(headers.get(CONTENT_LENGTH)); } for (String queryParam : queryParams.names()) { Matcher matcher = COMPUTED_DIGEST.matcher(queryParam); if (matcher.matches()) { MessageDigestFactory digest = fromValueIfExists(matcher.group(1)).get(); messageDigests.add(digest); } } return this; }
From source file:org.wisdom.framework.vertx.RequestFromVertx.java
License:Apache License
/** * Retrieves all headers./* w ww . ja va 2s . com*/ * * @return headers */ @Override public Map<String, List<String>> headers() { if (headers != null) { return headers; } headers = new HashMap<>(); final MultiMap requestHeaders = request.headers(); Set<String> names = requestHeaders.names(); for (String name : names) { headers.put(name, requestHeaders.getAll(name)); } return headers; }