Java Code Examples for io.vertx.core.http.HttpClientResponse#headers()
The following examples show how to use
io.vertx.core.http.HttpClientResponse#headers() .
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: DigestBlob.java From sfs with Apache License 2.0 | 6 votes |
public DigestBlob(HttpClientResponse httpClientResponse) { super(httpClientResponse); digests = new HashMap<>(); BaseEncoding baseEncoding = base64(); MultiMap headers = httpClientResponse.headers(); for (String headerName : headers.names()) { Matcher matcher = COMPUTED_DIGEST.matcher(headerName); if (matcher.find()) { String digestName = matcher.group(1); Optional<MessageDigestFactory> oMessageDigestFactory = fromValueIfExists(digestName); if (oMessageDigestFactory.isPresent()) { MessageDigestFactory messageDigestFactory = oMessageDigestFactory.get(); withDigest(messageDigestFactory, baseEncoding.decode(headers.get(headerName))); } } } }
Example 2
Source File: HttpClientResponseHeaderLogger.java From sfs with Apache License 2.0 | 6 votes |
@Override public HttpClientResponse call(HttpClientResponse httpClientResponse) { if (LOGGER.isDebugEnabled()) { StringBuilder sb = new StringBuilder(); sb.append("\r\nHttp Header Dump >>>>>\r\n\r\n"); sb.append(format("HTTP/1.1 %d %s\r\n", httpClientResponse.statusCode(), httpClientResponse.statusMessage())); MultiMap headers = httpClientResponse.headers(); for (String headerName : headers.names()) { List<String> values = headers.getAll(headerName); sb.append(format("%s: %s\r\n", headerName, on(',').join(values))); } sb.append("\r\n"); sb.append("Http Header Dump <<<<<\r\n"); LOGGER.debug(sb.toString()); } return httpClientResponse; }
Example 3
Source File: AssertObjectHeaders.java From sfs with Apache License 2.0 | 6 votes |
@Override public HttpClientResponse call(HttpClientResponse httpClientResponse) { out.println("Assert #" + assertIndex); MultiMap headers = httpClientResponse.headers(); String etag = headers.get(ETAG); String contentMd5 = headers.get(CONTENT_MD5); String contentSha512 = headers.get(X_CONTENT_SHA512); String versionId = headers.get(X_CONTENT_VERSION); String contentLength = headers.get(CONTENT_LENGTH); String acceptRanges = headers.get(ACCEPT_RANGES); String lastModified = headers.get(LAST_MODIFIED); String date = headers.get(DATE); String serverSideEncryption = headers.get(X_SERVER_SIDE_ENCRYPTION); assertEquals(context, base16().lowerCase().encode(dataMd5), etag); assertEquals(context, base64().encode(dataMd5), contentMd5); assertEquals(context, base64().encode(dataSha512), contentSha512); assertEquals(context, expectedVersion, parseLong(versionId)); //VertxAssert.assertEquals(context, expectedContentLength, Long.parseLong(contentLength)); assertEquals(context, "none", acceptRanges); assertNotNull(context, lastModified); assertNotNull(context, date); assertEquals(context, this.serverSideEncryption, parseBoolean(serverSideEncryption)); return httpClientResponse; }
Example 4
Source File: CrudHttpClient.java From hono with Eclipse Public License 2.0 | 5 votes |
/** * Checks if the the response have proper headers set. * * @param response The response to check. * @param result the result will fail in case headers are not set */ private void checkCorsHeaders(final HttpClientResponse response, final Promise<?> result) { final MultiMap headers = response.headers(); if (!"*".equals(headers.get(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN))) { result.fail("Response does not contain proper Access-Control-Allow-Origin header"); } }
Example 5
Source File: DefaultRestClientRequest.java From vertx-rest-client with Apache License 2.0 | 5 votes |
private HttpInputMessage createHttpInputMessage(ByteBuf body, HttpClientResponse httpClientResponse) { return new BufferedHttpInputMessage( body, httpClientResponse.headers(), httpClientResponse.trailers(), httpClientResponse.statusMessage(), httpClientResponse.statusCode(), httpClientResponse.cookies() ); }
Example 6
Source File: HeaderBlob.java From sfs with Apache License 2.0 | 4 votes |
public HeaderBlob(HttpClientResponse httpClientResponse) { MultiMap headers = httpClientResponse.headers(); this.volume = headers.get(X_CONTENT_VOLUME); this.position = parseLong(headers.get(X_CONTENT_POSITION)); this.length = parseLong(headers.get(X_CONTENT_LENGTH)); }