use of com.predic8.membrane.core.interceptor.Interceptor in project service-proxy by membrane.
the class HttpRouter method createTransport.
/**
* Same as the default config from monitor-beans.xml
*/
private Transport createTransport(ProxyConfiguration proxyConfiguration) {
Transport transport = new HttpTransport();
List<Interceptor> interceptors = new ArrayList<Interceptor>();
interceptors.add(new RuleMatchingInterceptor());
interceptors.add(new DispatchingInterceptor());
interceptors.add(new UserFeatureInterceptor());
HTTPClientInterceptor httpClientInterceptor = new HTTPClientInterceptor();
interceptors.add(httpClientInterceptor);
transport.setInterceptors(interceptors);
return transport;
}
use of com.predic8.membrane.core.interceptor.Interceptor in project service-proxy by membrane.
the class EtcdRegistryApiConfig method findAdminConsole.
private EtcdNodeInformation findAdminConsole() {
Object routerObj = context.getBean(Router.class);
if (routerObj == null)
throw new RuntimeException("Router not found, cannot publish admin console");
Router router = (Router) routerObj;
for (Rule r : router.getRuleManager().getRules()) {
if (!(r instanceof AbstractServiceProxy))
continue;
for (Interceptor i : r.getInterceptors()) {
if (i instanceof AdminConsoleInterceptor) {
String name = r.getName();
String host = ((ServiceProxy) r).getExternalHostname();
if (host == null)
host = getLocalHostname();
String port = Integer.toString(((AbstractServiceProxy) r).getPort());
EtcdNodeInformation node = new EtcdNodeInformation(null, null, host, port, name);
return node;
}
}
}
throw new RuntimeException("Admin console not found but is needed. Add a service proxy with an admin console.");
}
use of com.predic8.membrane.core.interceptor.Interceptor in project service-proxy by membrane.
the class AdminPageBuilder method createHelpIcon.
private void createHelpIcon(Interceptor i, String id) {
String helpId = i.getHelpId();
if (helpId != null) {
div().style("float:right;");
a().href("http://membrane-soa.org/service-proxy-doc/" + getVersion() + "/configuration/reference/" + helpId + ".htm");
span().classAttr("ui-icon ui-icon-help").title("help").end();
end();
end();
}
}
use of com.predic8.membrane.core.interceptor.Interceptor in project service-proxy by membrane.
the class AdminPageBuilder method createInterceptorTable.
protected void createInterceptorTable(List<Interceptor> interceptors) {
table().id("interceptortable").attr("cellpadding", "0", "cellspacing", "0", "border", "0", "class", "display", "id", "interceptor-table");
thead();
tr();
createThs("Order", "Name");
end();
end();
tbody();
int j = 0;
for (Interceptor i : interceptors) {
tr();
createTds("" + ++j, i.getDisplayName());
end();
}
end();
end();
}
use of com.predic8.membrane.core.interceptor.Interceptor 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);
}
}
Aggregations