Search in sources :

Example 6 with HttpGatewayServer

use of io.fabric8.gateway.handlers.http.HttpGatewayServer in project fabric8 by jboss-fuse.

the class HttpGatewayTest method startHttpGateway.

@Override
public HttpGatewayServer startHttpGateway() {
    if (restEndpointServer != null) {
        LoadBalancer loadBalancer = new RoundRobinLoadBalancer();
        ServiceDTO serviceDetails = new ServiceDTO();
        serviceDetails.setContainer("local");
        serviceDetails.setVersion("1");
        mappedServices.put("/hello/world", new MappedServices("http://localhost:8181", serviceDetails, loadBalancer, false));
    }
    HttpGatewayHandler handler = new HttpGatewayHandler(vertx, new HttpGateway() {

        @Override
        public void addMappingRuleConfiguration(HttpMappingRule mappingRule) {
        }

        @Override
        public void removeMappingRuleConfiguration(HttpMappingRule mappingRule) {
        }

        @Override
        public Map<String, MappedServices> getMappedServices() {
            return mappedServices;
        }

        @Override
        public boolean isEnableIndex() {
            return true;
        }

        @Override
        public InetSocketAddress getLocalAddress() {
            return new InetSocketAddress("0.0.0.0", 8080);
        }

        @Override
        public void addCallDetailRecord(CallDetailRecord cdr) {
        }
    });
    httpGatewayServer = new HttpGatewayServer(vertx, handler, null, 8080);
    httpGatewayServer.setHost("localhost");
    httpGatewayServer.init();
    return httpGatewayServer;
}
Also used : HttpGatewayServer(io.fabric8.gateway.handlers.http.HttpGatewayServer) HttpGatewayHandler(io.fabric8.gateway.handlers.http.HttpGatewayHandler) HttpMappingRule(io.fabric8.gateway.handlers.http.HttpMappingRule) InetSocketAddress(java.net.InetSocketAddress) MappedServices(io.fabric8.gateway.handlers.http.MappedServices) RoundRobinLoadBalancer(io.fabric8.gateway.loadbalancer.RoundRobinLoadBalancer) LoadBalancer(io.fabric8.gateway.loadbalancer.LoadBalancer) RoundRobinLoadBalancer(io.fabric8.gateway.loadbalancer.RoundRobinLoadBalancer) HashMap(java.util.HashMap) MultiMap(org.vertx.java.core.MultiMap) Map(java.util.Map) HttpGateway(io.fabric8.gateway.handlers.http.HttpGateway)

Aggregations

LoadBalancer (io.fabric8.gateway.loadbalancer.LoadBalancer)5 RoundRobinLoadBalancer (io.fabric8.gateway.loadbalancer.RoundRobinLoadBalancer)5 InetSocketAddress (java.net.InetSocketAddress)5 HttpGatewayHandler (io.fabric8.gateway.handlers.http.HttpGatewayHandler)4 HttpGatewayServer (io.fabric8.gateway.handlers.http.HttpGatewayServer)4 HttpGateway (io.fabric8.gateway.handlers.http.HttpGateway)3 HttpMappingRule (io.fabric8.gateway.handlers.http.HttpMappingRule)3 MappedServices (io.fabric8.gateway.handlers.http.MappedServices)3 Map (java.util.Map)3 DetectingGateway (io.fabric8.gateway.handlers.detecting.DetectingGateway)1 DetectingGatewayWebSocketHandler (io.fabric8.gateway.handlers.detecting.DetectingGatewayWebSocketHandler)1 Protocol (io.fabric8.gateway.handlers.detecting.Protocol)1 AmqpProtocol (io.fabric8.gateway.handlers.detecting.protocol.amqp.AmqpProtocol)1 HttpProtocol (io.fabric8.gateway.handlers.detecting.protocol.http.HttpProtocol)1 MqttProtocol (io.fabric8.gateway.handlers.detecting.protocol.mqtt.MqttProtocol)1 OpenwireProtocol (io.fabric8.gateway.handlers.detecting.protocol.openwire.OpenwireProtocol)1 SslConfig (io.fabric8.gateway.handlers.detecting.protocol.ssl.SslConfig)1 SslProtocol (io.fabric8.gateway.handlers.detecting.protocol.ssl.SslProtocol)1 StompProtocol (io.fabric8.gateway.handlers.detecting.protocol.stomp.StompProtocol)1 File (java.io.File)1