Package io.dropwizard.server

Examples of io.dropwizard.server.SimpleServerFactory


    }

    private class FakeApplication extends Application<Configuration> {
        @Override
        public void run(Configuration configuration, Environment environment) {
            final SimpleServerFactory serverConfig = new SimpleServerFactory();
            configuration.setServerFactory(serverConfig);
            final HttpConnectorFactory connectorConfig = (HttpConnectorFactory) serverConfig.getConnector();
            connectorConfig.setPort(0);

            environment.healthChecks().register("dummy", new DummyHealthCheck());

            for (Object resource : resources) {
View Full Code Here


    @Inject
    SingularityHostAndPortProvider(final SingularityConfiguration configuration, @Named(HOST_ADDRESS_PROPERTY) String hostAddress) {
      checkNotNull(configuration, "configuration is null");
      this.hostname = !Strings.isNullOrEmpty(configuration.getHostname()) ? configuration.getHostname() : JavaUtils.getHostName().or(hostAddress);

      SimpleServerFactory simpleServerFactory = (SimpleServerFactory) configuration.getServerFactory();
      HttpConnectorFactory httpFactory = (HttpConnectorFactory) simpleServerFactory.getConnector();

      this.httpPort = httpFactory.getPort();
    }
View Full Code Here

        super.setServerFactory(factory);
        _ensureDefaults();
    }
   
    private void _ensureDefaults() {
        SimpleServerFactory simpleSF = simpleServerFactory();
        if (simpleSF != null) {
            simpleSF.setApplicationContextPath(_appContext);
        }
        // and that gzip is not enabled by accident
        overrideGZIPEnabled(false);
    }
View Full Code Here

    public abstract SCONFIG getServiceConfig();

    public int getApplicationPort() {
        AbstractServerFactory sf = serverFactory();
        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();
        }
View Full Code Here

    }

    public int getAdminPort() {
        AbstractServerFactory sf = serverFactory();
        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();
        }
View Full Code Here

    @SuppressWarnings("unchecked")
    public THIS overrideHttpPort(int p) {
        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());
View Full Code Here

        AbstractServerFactory sf = serverFactory();
        return (sf instanceof SimpleServerFactory) ? (SimpleServerFactory) sf : null;
    }

    private void _overrideApplicationContextPath(String path) {
        SimpleServerFactory simpleSF = simpleServerFactory();
        if (simpleSF != null) {
            simpleSF.setApplicationContextPath(path);
        }
    }
View Full Code Here

TOP

Related Classes of io.dropwizard.server.SimpleServerFactory

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.