use of com.predic8.membrane.core.interceptor.rewrite.ReverseProxyingInterceptor in project service-proxy by membrane.
the class Transport method init.
public void init(Router router) throws Exception {
this.router = router;
if (interceptors.isEmpty()) {
interceptors.add(new RuleMatchingInterceptor());
interceptors.add(new ExchangeStoreInterceptor(router.getExchangeStore()));
interceptors.add(new DispatchingInterceptor());
interceptors.add(new ReverseProxyingInterceptor());
interceptors.add(new UserFeatureInterceptor());
interceptors.add(new HTTPClientInterceptor());
}
for (Interceptor interceptor : interceptors) {
interceptor.init(router);
}
}
use of com.predic8.membrane.core.interceptor.rewrite.ReverseProxyingInterceptor in project service-proxy by membrane.
the class ReverseProxyingInterceptorTest method getRewrittenDestination.
/**
* Lets the ReverseProxyingInterceptor handle a fake Exchange and returns the rewritten "Destination" header.
*/
private String getRewrittenDestination(String requestHostHeader, String requestDestinationHeader, int port, String requestURI, String targetScheme, int targetPort) throws Exception {
Exchange exc = createExchange(requestHostHeader, requestDestinationHeader, port, requestURI, null);
String url = new URL(targetScheme, "target", targetPort, exc.getRequest().getUri()).toString();
exc.getDestinations().add(url);
Assert.assertEquals(Outcome.CONTINUE, rp.handleRequest(exc));
return exc.getRequest().getHeader().getFirstValue(Header.DESTINATION);
}
use of com.predic8.membrane.core.interceptor.rewrite.ReverseProxyingInterceptor in project service-proxy by membrane.
the class ReverseProxyingInterceptorTest method getRewrittenRedirectionLocation.
/**
* Lets the ReverseProxyingInterceptor handle a fake Exchange and returns the rewritten "Location" header.
*/
private String getRewrittenRedirectionLocation(String requestHostHeader, int port, String requestURI, String redirectionURI) throws Exception {
Exchange exc = createExchange(requestHostHeader, null, port, requestURI, redirectionURI);
Assert.assertEquals(Outcome.CONTINUE, rp.handleResponse(exc));
return exc.getResponse().getHeader().getFirstValue(Header.LOCATION);
}
Aggregations