Package io.dropwizard.server

Examples of io.dropwizard.server.DefaultServerFactory


        if (sf instanceof SimpleServerFactory) {
            SimpleServerFactory ssf = (SimpleServerFactory) sf;
            return ((HttpConnectorFactory)ssf.getConnector()).getPort();
        }
        if (sf instanceof DefaultServerFactory) {
            DefaultServerFactory dsf = (DefaultServerFactory) sf;
            return ((HttpConnectorFactory)dsf.getApplicationConnectors().get(0)).getPort();
        }
        throw new IllegalStateException("Unrecognized ServerFactory: "+sf.getClass().getName());
    }
View Full Code Here


        if (sf instanceof SimpleServerFactory) {
            SimpleServerFactory ssf = (SimpleServerFactory) sf;
            return ((HttpConnectorFactory)ssf.getConnector()).getPort();
        }
        if (sf instanceof DefaultServerFactory) {
            DefaultServerFactory dsf = (DefaultServerFactory) sf;
            return ((HttpConnectorFactory)dsf.getAdminConnectors().get(0)).getPort();
        }
        throw new IllegalStateException("Unrecognized ServerFactory: "+sf.getClass().getName());
    }   
View Full Code Here

        AbstractServerFactory sf = serverFactory();
        if (sf instanceof SimpleServerFactory) {
            SimpleServerFactory ssf = (SimpleServerFactory) sf;
            ((HttpConnectorFactory)ssf.getConnector()).setPort(p);
        } else if (sf instanceof DefaultServerFactory) {
            DefaultServerFactory dsf = (DefaultServerFactory) sf;
            ((HttpConnectorFactory)dsf.getApplicationConnectors().get(0)).setPort(p);
        } else {
            throw new IllegalStateException("Unrecognized ServerFactory: "+sf.getClass().getName());
        }
        return (THIS) this;
    }
View Full Code Here

    public THIS overrideAdminPort(int p) {
        AbstractServerFactory sf = serverFactory();
        if (sf instanceof SimpleServerFactory) {
            // no admin port; just ignore
        } else if (sf instanceof DefaultServerFactory) {
            DefaultServerFactory dsf = (DefaultServerFactory) sf;
            ((HttpConnectorFactory)dsf.getAdminConnectors().get(0)).setPort(p);
        } else {
            throw new IllegalStateException("Unrecognized ServerFactory: "+sf.getClass().getName());
        }
        return (THIS) this;
    }
View Full Code Here

                                                         final int adminPort,
                                                         final boolean noHttp) {
    // TODO(drewc) be more flexible on the httpEndpoint -- make it a URI -- so if/when we support
    // SSL, it'll *just work*

    final DefaultServerFactory serverFactory = new DefaultServerFactory();
    if (noHttp) {
      serverFactory.setApplicationConnectors(Collections.<ConnectorFactory>emptyList());
      serverFactory.setAdminConnectors(Collections.<ConnectorFactory>emptyList());
    } else {
      final HttpConnectorFactory serviceConnector = new HttpConnectorFactory();
      serviceConnector.setPort(httpEndpoint.getPort());
      serviceConnector.setBindHost(httpEndpoint.getHostString());
      serverFactory.setApplicationConnectors(ImmutableList.<ConnectorFactory>of(serviceConnector));

      final HttpConnectorFactory adminConnector = new HttpConnectorFactory();
      adminConnector.setPort(adminPort);
      serverFactory.setAdminConnectors(ImmutableList.<ConnectorFactory>of(adminConnector));
    }
    return serverFactory;
  }
View Full Code Here

    environment.jersey().register(new HostsResource(model));
    environment.jersey().register(new MastersResource(model));
    environment.jersey().register(new VersionResource());
    environment.jersey().register(new UserProvider());

    final DefaultServerFactory serverFactory = ServiceUtil.createServerFactory(
        config.getHttpEndpoint(), config.getAdminPort(), false);

    final RequestLogFactory requestLog = new RequestLogFactory();
    requestLog.setAppenders(ImmutableList.<AppenderFactory>of());
    serverFactory.setRequestLogFactory(requestLog);

    this.server = serverFactory.build(environment);

    setUpRequestLogging();
  }
View Full Code Here

TOP

Related Classes of io.dropwizard.server.DefaultServerFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.