List of usage examples for io.vertx.core.http HttpClientRequest absoluteURI
String absoluteURI();
From source file:io.gravitee.gateway.http.connector.VertxHttpClient.java
License:Apache License
private void handleClientResponse(final VertxProxyConnection proxyConnection, final HttpClientResponse clientResponse, final HttpClientRequest clientRequest) { 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();/*from w ww .ja v a 2s.co m*/ // 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)); clientResponse.exceptionHandler(throwable -> { LOGGER.error("Unexpected error while handling backend response for request {} {} - {}", clientRequest.method(), clientRequest.absoluteURI(), throwable.getMessage()); ProxyResponse clientResponse1 = new EmptyProxyResponse(HttpStatusCode.BAD_GATEWAY_502); proxyConnection.handleResponse(clientResponse1); }); proxyConnection.handleResponse(proxyClientResponse); }