Search in sources :

Example 6 with ProxyRule

use of com.predic8.membrane.core.rules.ProxyRule in project service-proxy by membrane.

the class DynamicAdminPageInterceptor method handlePruleShowRequest.

@Mapping("/admin/proxy/show/?(\\?.*)?")
public Response handlePruleShowRequest(final Map<String, String> params, String relativeRootPath) throws Exception {
    StringWriter writer = new StringWriter();
    final ProxyRule rule = (ProxyRule) RuleUtil.findRuleByIdentifier(router, params.get("name"));
    return respond(new AdminPageBuilder(writer, router, relativeRootPath, params, readOnly) {

        @Override
        protected int getSelectedTab() {
            return TAB_ID_PROXIES;
        }

        @Override
        protected String getTitle() {
            return super.getTitle() + " " + rule.toString() + " Proxy";
        }

        @Override
        protected void createTabContent() throws Exception {
            h1().text(rule.toString() + " Proxy").end();
            if (rule.getKey().getPort() != -1) {
                table();
                createTr("Listen Port", "" + rule.getKey().getPort());
                end();
            }
            h2().text("Status Codes").end();
            createStatusCodesTable(rule.getStatisticsByStatusCodes());
            h2().text("Interceptors").end();
            createInterceptorTable(rule.getInterceptors());
        }
    }.createPage());
}
Also used : StringWriter(java.io.StringWriter) ProxyRule(com.predic8.membrane.core.rules.ProxyRule)

Aggregations

ProxyRule (com.predic8.membrane.core.rules.ProxyRule)5 ProxyRuleKey (com.predic8.membrane.core.rules.ProxyRuleKey)4 Before (org.junit.Before)3 HttpRouter (com.predic8.membrane.core.HttpRouter)2 ServiceProxy (com.predic8.membrane.core.rules.ServiceProxy)2 ServiceProxyKey (com.predic8.membrane.core.rules.ServiceProxyKey)2 ProxyConfiguration (com.predic8.membrane.core.transport.http.client.ProxyConfiguration)2 Router (com.predic8.membrane.core.Router)1 KeyStore (com.predic8.membrane.core.config.security.KeyStore)1 SSLParser (com.predic8.membrane.core.config.security.SSLParser)1 TrustStore (com.predic8.membrane.core.config.security.TrustStore)1 Exchange (com.predic8.membrane.core.exchange.Exchange)1 MemoryExchangeStore (com.predic8.membrane.core.exchangestore.MemoryExchangeStore)1 AbstractInterceptor (com.predic8.membrane.core.interceptor.AbstractInterceptor)1 CountInterceptor (com.predic8.membrane.core.interceptor.CountInterceptor)1 Outcome (com.predic8.membrane.core.interceptor.Outcome)1 ResolverMap (com.predic8.membrane.core.resolver.ResolverMap)1 Rule (com.predic8.membrane.core.rules.Rule)1 HttpClient (com.predic8.membrane.core.transport.http.HttpClient)1 HttpClientConfiguration (com.predic8.membrane.core.transport.http.client.HttpClientConfiguration)1