use of com.predic8.membrane.core.interceptor.Interceptor in project service-proxy by membrane.
the class RewriteInterceptorIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
interceptor = new RewriteInterceptor();
interceptor.getMappings().add(new Mapping("/blz-service\\?wsdl", "/axis2/services/BLZService?wsdl", null));
Rule rule = new ServiceProxy(new ServiceProxyKey("localhost", "POST", ".*", 3006), "thomas-bayer.com", 80);
rule.getInterceptors().add(interceptor);
router = new HttpRouter();
router.getRuleManager().addProxyAndOpenPortIfNew(rule);
}
use of com.predic8.membrane.core.interceptor.Interceptor in project service-proxy by membrane.
the class SOAPMessageValidatorInterceptorTest method createValidatorInterceptor.
private ValidatorInterceptor createValidatorInterceptor(String wsdl) throws Exception {
ValidatorInterceptor interceptor = new ValidatorInterceptor();
interceptor.setWsdl(wsdl);
interceptor.setResourceResolver(new ResolverMap());
interceptor.init();
return interceptor;
}
use of com.predic8.membrane.core.interceptor.Interceptor in project service-proxy by membrane.
the class ValidatorInterceptorTest method createValidatorInterceptor.
private ValidatorInterceptor createValidatorInterceptor(String wsdl) throws Exception {
ValidatorInterceptor interceptor = new ValidatorInterceptor();
interceptor.setResourceResolver(new ResolverMap());
interceptor.setWsdl(wsdl);
interceptor.init();
return interceptor;
}
use of com.predic8.membrane.core.interceptor.Interceptor in project service-proxy by membrane.
the class MyApplication method main.
public static void main(String[] args) throws Exception {
System.out.println("Starting up");
// create a new service proxy that listens on port 8080 and has a target to localhost:2001
ServiceProxy sp = createServiceProxy();
// create an enclosing WebSocket interceptor to add our own Logging interceptor to it
WebSocketInterceptor ws = new WebSocketInterceptor();
ws.getInterceptors().add(new MyWebSocketLogInterceptor());
// attach the WebSocket interceptor to the service proxy
sp.getInterceptors().add(ws);
// add the service proxy to a new router instance and start it
HttpRouter router = new HttpRouter();
router.add(sp);
router.init();
System.out.println("Starting finished - Waiting for WebSocket communication");
}
use of com.predic8.membrane.core.interceptor.Interceptor in project service-proxy by membrane.
the class AdminPageBuilder method createServiceProxyVisualization.
public void createServiceProxyVisualization(AbstractServiceProxy proxy, String relativeRootPath) {
List<Interceptor> leftStack = new ArrayList<Interceptor>(), rightStack = new ArrayList<Interceptor>();
List<Interceptor> list = new ArrayList<Interceptor>(proxy.getInterceptors());
list.add(new // fake interceptor so that both stacks end with the same size
AbstractInterceptor() {
@Override
public EnumSet<Flow> getFlow() {
return Flow.Set.REQUEST_RESPONSE;
}
});
// build left and right stacks
for (Interceptor i : list) {
EnumSet<Flow> f = i.getFlow();
if (i instanceof ResponseInterceptor) {
for (Interceptor i2 : ((ResponseInterceptor) i).getInterceptors()) rightStack.add(i2);
} else if (i instanceof RequestInterceptor) {
for (Interceptor i3 : ((RequestInterceptor) i).getInterceptors()) leftStack.add(i3);
} else if (f.contains(Flow.REQUEST)) {
if (f.contains(Flow.RESPONSE)) {
// fill left and right to same height
while (leftStack.size() < rightStack.size()) leftStack.add(null);
while (rightStack.size() < leftStack.size()) rightStack.add(null);
// put i into both
leftStack.add(i);
rightStack.add(i);
} else {
leftStack.add(i);
}
} else {
if (f.contains(Flow.RESPONSE)) {
rightStack.add(i);
}
}
}
boolean noTarget = proxy.getTargetURL() == null && proxy.getTargetHost() == null;
table().cellspacing("0px").cellpadding("0px").classAttr("spv").style("width:662px");
createListenerRow(proxy);
if (leftStack.size() > 1 || !noTarget) {
createBeginArrowsRow();
for (int i = 0; i < leftStack.size() - 1 - (noTarget ? 1 : 0); i++) {
tr().style("background:url(\"" + relativeRootPath + "/admin/images/spv-middle.png\");background-repeat:repeat-y;display:inline-table");
createInterceptorRow(leftStack, rightStack, i, false);
end();
}
createEndArrowsRow();
if (noTarget) {
tr();
createInterceptorRow(leftStack, rightStack, leftStack.size() - 2, true);
end();
} else {
createTargetRow(proxy);
}
}
end();
}
Aggregations