use of com.predic8.membrane.core.Router in project service-proxy by membrane.
the class SOAPRESTHelper method getTransformer.
protected XSLTTransformer getTransformer(String ss) throws Exception {
String key = ss == null ? "null" : ss;
XSLTTransformer t = xsltTransformers.get(key);
if (t == null) {
int concurrency = 2 * Runtime.getRuntime().availableProcessors();
t = new XSLTTransformer(ss, router, concurrency);
XSLTTransformer t2 = xsltTransformers.putIfAbsent(key, t);
if (t2 != null)
return t2;
}
return t;
}
use of com.predic8.membrane.core.Router in project service-proxy by membrane.
the class MembraneAuthorizationService method init.
@Override
public void init() throws Exception {
if (src == null)
throw new Exception("No wellknown file source configured. - Cannot work without one");
if (dynamicRegistration != null) {
dynamicRegistration.init(router);
supportsDynamicRegistration = true;
}
try {
String[] urls = src.split(Pattern.quote(" "));
if (urls.length == 1) {
String url = urls[0] + "/.well-known/openid-configuration";
parseSrc(dynamicRegistration != null ? dynamicRegistration.retrieveOpenIDConfiguration(url) : router.getResolverMap().resolve(url));
} else if (urls.length == 2) {
String internalUrl = urls[1] + "/.well-known/openid-configuration";
parseSrc(dynamicRegistration != null ? dynamicRegistration.retrieveOpenIDConfiguration(internalUrl) : router.getResolverMap().resolve(internalUrl));
publicAuthorizationEndpoint = urls[0] + new URI(authorizationEndpoint).getPath();
} else if (urls.length > 2)
throw new RuntimeException("src property is not set correctly: " + src);
} catch (ResourceRetrievalException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
adjustScope();
prepareClaimsForLoginUrl();
}
use of com.predic8.membrane.core.Router in project service-proxy by membrane.
the class AdminPageBuilder method createClustersTable.
protected void createClustersTable(String balancerName) throws UnsupportedEncodingException {
table().attr("cellpadding", "0", "cellspacing", "0", "border", "0", "class", "display clustersTable");
thead();
tr();
createThs("Name", "#Nodes", "Health");
end();
end();
tbody();
for (Cluster c : BalancerUtil.lookupBalancer(router, balancerName).getClusters()) {
tr();
td();
createLink(!c.getName().isEmpty() ? c.getName() : "<unnamed>", "clusters", "show", createQueryString("balancer", balancerName, "cluster", c.getName()));
end();
createTds(String.valueOf(BalancerUtil.lookupBalancer(router, balancerName).getAllNodesByCluster(c.getName()).size()), getFormatedHealth(balancerName, c.getName()));
end();
}
end();
end();
}
use of com.predic8.membrane.core.Router in project service-proxy by membrane.
the class AdminPageBuilder method getFormatedHealth.
private String getFormatedHealth(String balancerName) {
Balancer balancer = BalancerUtil.lookupBalancer(router, balancerName);
int available = 0, all = 0;
for (Cluster c : balancer.getClusters()) {
all += balancer.getAllNodesByCluster(c.getName()).size();
available += balancer.getAvailableNodesByCluster(c.getName()).size();
}
return String.format("%d up/ %d down", available, all - available);
}
use of com.predic8.membrane.core.Router in project service-proxy by membrane.
the class ClusterNotificationInterceptorTest method setUp.
@Override
@Before
public void setUp() throws Exception {
Rule rule = new ServiceProxy(new ServiceProxyKey("localhost", "*", ".*", 3002), "thomas-bayer.com", 80);
router = new HttpRouter();
router.getRuleManager().addProxyAndOpenPortIfNew(rule);
interceptor = new ClusterNotificationInterceptor();
router.addUserFeatureInterceptor(interceptor);
lbi = new LoadBalancingInterceptor();
lbi.setName("Default");
Rule rule2 = new ServiceProxy(new ServiceProxyKey("localhost", "*", ".*", 3003), "thomas-bayer.com", 80);
router.getRuleManager().addProxyAndOpenPortIfNew(rule2);
rule2.getInterceptors().add(lbi);
router.init();
}
Aggregations