use of org.vertx.java.core.MultiMap in project fabric8 by jboss-fuse.
the class HttpGatewayTest method testENTESB7600.
@Test
public void testENTESB7600() throws Exception {
// response can not contain CONTENT_LENGTH and TRANSFER_ENCODING see https://tools.ietf.org/html/rfc7230#section-3.3.3
startRestEndpoint();
startHttpGateway();
System.out.println("Requesting...");
final FutureHandler<HttpClientResponse> future = new FutureHandler<>();
vertx.createHttpClient().setHost("localhost").setPort(8080).get("/hello/world?wsdl", new Handler<HttpClientResponse>() {
@Override
public void handle(HttpClientResponse event) {
future.handle(event);
}
}).end();
MultiMap responseHeaders = future.await().headers();
assertTrue((responseHeaders.contains(CONTENT_LENGTH) && !responseHeaders.contains(TRANSFER_ENCODING)) || (!responseHeaders.contains(CONTENT_LENGTH) && responseHeaders.contains(TRANSFER_ENCODING)));
stopHttpGateway();
stopVertx();
}
use of org.vertx.java.core.MultiMap in project fabric8 by jboss-fuse.
the class ReverseUriPolicy method handle.
@Override
public void handle(HttpClientResponse clientResponse) {
delegate.handle(clientResponse);
MultiMap headers = clientResponse.headers();
for (String headerName : rewriteHeaders) {
List<String> headerValues = headers.getAll(headerName);
int size = headerValues.size();
if (size > 0) {
List<String> newHeaders = new ArrayList<String>(size);
for (String headerValue : headerValues) {
String newValue = headerValue;
if (headerValue != null && headerValue.length() > 0) {
newValue = proxyMappingDetails.rewriteBackendUrl(headerValue);
}
}
LOG.info("Rewriting header " + headerName + " from: " + headerValues + " to: " + newHeaders);
headers.set(headerName, newHeaders);
}
}
}
Aggregations