Search in sources :

Example 1 with HttpMappingRuleBase

use of io.fabric8.gateway.fabric.support.http.HttpMappingRuleBase in project fabric8 by jboss-fuse.

the class HttpMappingRuleConfiguration method updateConfiguration.

private void updateConfiguration(Map<String, ?> configuration) throws Exception {
    LOG.info("activating http mapping rule " + configuration);
    configurer.configure(configuration, this);
    LOG.info("activating http mapping rule " + zooKeeperPath + " on " + gateway.get().getPort());
    String zkPath = getZooKeeperPath();
    Objects.notNull(zkPath, "zooKeeperPath");
    Objects.notNull(getUriTemplate(), "uriTemplate");
    LoadBalancer loadBalancer = LoadBalancers.createLoadBalancer(loadBalancerType, stickyLoadBalancerCacheSize);
    LOG.info("activating http mapping ZooKeeper path: " + zkPath + " with URI template: " + uriTemplate + " enabledVersion: " + enabledVersion + " with load balancer: " + loadBalancer);
    if (httpMappingRuleBase != null) {
        gateway.get().removeMappingRuleConfiguration(httpMappingRuleBase);
    }
    httpMappingRuleBase = new HttpMappingRuleBase(new SimplePathTemplate(uriTemplate), gateway.get().getGatewayVersion(), enabledVersion, loadBalancer, reverseHeaders);
    mappingTree = new HttpMappingZooKeeperTreeCache(curator.get(), httpMappingRuleBase, zooKeeperPath);
    mappingTree.init();
    gateway.get().addMappingRuleConfiguration(httpMappingRuleBase);
}
Also used : HttpMappingZooKeeperTreeCache(io.fabric8.gateway.fabric.support.http.HttpMappingZooKeeperTreeCache) HttpMappingRuleBase(io.fabric8.gateway.fabric.support.http.HttpMappingRuleBase) SimplePathTemplate(io.fabric8.zookeeper.internal.SimplePathTemplate) LoadBalancer(io.fabric8.gateway.loadbalancer.LoadBalancer)

Example 2 with HttpMappingRuleBase

use of io.fabric8.gateway.fabric.support.http.HttpMappingRuleBase in project fabric8 by jboss-fuse.

the class MappingConfigurationTest method setUriTemplate.

protected void setUriTemplate(String uriTemplate, String version) {
    config = new HttpMappingRuleBase(new SimplePathTemplate(uriTemplate), version, enabledVersion, loadBalancer, reverseHeaders);
    httpGateway.addMappingRuleConfiguration(config);
}
Also used : HttpMappingRuleBase(io.fabric8.gateway.fabric.support.http.HttpMappingRuleBase) SimplePathTemplate(io.fabric8.zookeeper.internal.SimplePathTemplate)

Aggregations

HttpMappingRuleBase (io.fabric8.gateway.fabric.support.http.HttpMappingRuleBase)2 SimplePathTemplate (io.fabric8.zookeeper.internal.SimplePathTemplate)2 HttpMappingZooKeeperTreeCache (io.fabric8.gateway.fabric.support.http.HttpMappingZooKeeperTreeCache)1 LoadBalancer (io.fabric8.gateway.loadbalancer.LoadBalancer)1