use of com.predic8.membrane.core.interceptor.server.WebServerInterceptor in project service-proxy by membrane.
the class OAuth2ResourceInterceptor method init.
@Override
public void init(Router router) throws Exception {
name = "OAuth 2 Client";
setFlow(Flow.Set.REQUEST_RESPONSE);
super.init(router);
auth.init(router);
statistics = new OAuth2Statistics();
uriFactory = router.getUriFactory();
if (sessionManager == null)
sessionManager = new SessionManager();
// TODO maybe do this differently as now the attribute in the bean is overwritten ( when set from external proxies.xml )
sessionManager.setCookieName("SESSION_ID_CLIENT");
sessionManager.init(router);
if (loginLocation != null) {
wsi = new WebServerInterceptor();
wsi.setDocBase(loginLocation);
router.getResolverMap().resolve(ResolverMap.combine(router.getBaseLocation(), wsi.getDocBase(), "./index.html")).close();
wsi.init(router);
}
if (publicURL == null)
initPublicURLOnFirstExchange = true;
else
normalizePublicURL();
firstInitWhenDynamicAuthorizationService = getAuthService().supportsDynamicRegistration();
if (!getAuthService().supportsDynamicRegistration())
firstInitWhenDynamicAuthorizationService = false;
new CleanupThread(sessionManager).start();
}
use of com.predic8.membrane.core.interceptor.server.WebServerInterceptor in project service-proxy by membrane.
the class ResolverTest method setup.
@BeforeClass
public static void setup() throws Exception {
ServiceProxy sp = new ServiceProxy(new ServiceProxyKey(3029), "localhost", 8080);
sp.getInterceptors().add(new AbstractInterceptor() {
@Override
public Outcome handleRequest(Exchange exc) throws Exception {
hit = true;
return Outcome.CONTINUE;
}
});
WebServerInterceptor i = new WebServerInterceptor();
if (deployment.equals(STANDALONE))
i.setDocBase("src/test/resources");
else {
i.setDocBase("/test");
router.getResolverMap().addSchemaResolver(resolverMap.getFileSchemaResolver());
}
sp.getInterceptors().add(i);
router.add(sp);
router.init();
}
use of com.predic8.membrane.core.interceptor.server.WebServerInterceptor in project service-proxy by membrane.
the class LimitInterceptorTest method before.
@BeforeClass
public static void before() throws Exception {
router = new HttpRouter();
ServiceProxy sp2 = new ServiceProxy(new ServiceProxyKey("*", "*", ".*", 3026), "", -1);
LimitInterceptor wi = new LimitInterceptor();
wi.setMaxBodyLength(10);
wi.setFlow(Flow.Set.REQUEST);
sp2.getInterceptors().add(wi);
WebServerInterceptor wi2 = new WebServerInterceptor();
wi2.setDocBase("classpath:");
wi2.init();
sp2.getInterceptors().add(wi2);
router.getRuleManager().addProxyAndOpenPortIfNew(sp2);
router.init();
}
Aggregations