Search in sources :

Example 1 with AbstractHttpHandler

use of com.predic8.membrane.core.transport.http.AbstractHttpHandler in project service-proxy by membrane.

the class RuleMatchingInterceptor method getRule.

private Rule getRule(Exchange exc) {
    Request request = exc.getRequest();
    AbstractHttpHandler handler = exc.getHandler();
    // retrieve value to match
    String hostHeader = request.getHeader().getHost();
    String method = request.getMethod();
    String uri = request.getUri();
    String version = request.getVersion();
    int port = handler.isMatchLocalPort() ? handler.getLocalPort() : -1;
    String localIP = handler.getLocalAddress().getHostAddress();
    // match it
    Rule rule = router.getRuleManager().getMatchingRule(hostHeader, method, uri, version, port, localIP);
    if (rule != null) {
        if (log.isDebugEnabled())
            log.debug("Matching Rule found for RuleKey " + hostHeader + " " + method + " " + uri + " " + port + " " + localIP);
        return rule;
    }
    return findProxyRule(exc);
}
Also used : Request(com.predic8.membrane.core.http.Request) Rule(com.predic8.membrane.core.rules.Rule) NullRule(com.predic8.membrane.core.rules.NullRule) ProxyRule(com.predic8.membrane.core.rules.ProxyRule) AbstractHttpHandler(com.predic8.membrane.core.transport.http.AbstractHttpHandler)

Aggregations

Request (com.predic8.membrane.core.http.Request)1 NullRule (com.predic8.membrane.core.rules.NullRule)1 ProxyRule (com.predic8.membrane.core.rules.ProxyRule)1 Rule (com.predic8.membrane.core.rules.Rule)1 AbstractHttpHandler (com.predic8.membrane.core.transport.http.AbstractHttpHandler)1