Search in sources :

Example 26 with Server

use of org.mortbay.jetty.Server in project nhin-d by DirectProject.

the class RoutingResolverImplTest method startService.

private void startService() throws Exception {
    /*
         * Setup the configuration service server
         */
    server = new Server();
    SocketConnector connector = new SocketConnector();
    HTTPPort = AvailablePortFinder.getNextAvailable(1024);
    connector.setPort(HTTPPort);
    WebAppContext context = new WebAppContext();
    context.setContextPath("/config");
    context.setServer(server);
    context.setWar("war/config-service.war");
    server.setSendServerVersion(false);
    server.addConnector(connector);
    server.addHandler(context);
    server.start();
    configServiceURL = "http://localhost:" + HTTPPort + "/config/ConfigurationService";
    proxy = new ConfigurationServiceProxy(configServiceURL);
    cleanConfig();
}
Also used : WebAppContext(org.mortbay.jetty.webapp.WebAppContext) Server(org.mortbay.jetty.Server) SocketConnector(org.mortbay.jetty.bio.SocketConnector) ConfigurationServiceProxy(org.nhind.config.ConfigurationServiceProxy)

Example 27 with Server

use of org.mortbay.jetty.Server in project nhin-d by DirectProject.

the class ServiceRunner method startServices.

public static synchronized void startServices() throws Exception {
    if (server == null) {
        /*
			 * Setup the configuration service server
			 */
        server = new Server();
        SocketConnector connector = new SocketConnector();
        HTTPPort = AvailablePortFinder.getNextAvailable(1024);
        connector.setPort(HTTPPort);
        WebAppContext context = new WebAppContext("src/test/resources/webapp", "/");
        server.setSendServerVersion(false);
        server.addConnector(connector);
        server.addHandler(context);
        server.start();
        txsServiceURL = "http://localhost:" + HTTPPort + "/";
    }
}
Also used : WebAppContext(org.mortbay.jetty.webapp.WebAppContext) Server(org.mortbay.jetty.Server) SocketConnector(org.mortbay.jetty.bio.SocketConnector)

Example 28 with Server

use of org.mortbay.jetty.Server in project nhin-d by DirectProject.

the class MonitorServiceRunner method startMonitorService.

public static synchronized void startMonitorService() throws Exception {
    if (server == null) {
        /*
			 * Setup the configuration service server
			 */
        server = new Server();
        SocketConnector connector = new SocketConnector();
        HTTPPort = AvailablePortFinder.getNextAvailable(8090);
        connector.setPort(HTTPPort);
        // certificate service
        WebAppContext context = new WebAppContext("src/test/resources/webapp-liverun", "/");
        server.setSendServerVersion(false);
        server.addConnector(connector);
        server.addHandler(context);
        server.start();
        serviceURL = "http://localhost:" + HTTPPort + "/";
    }
}
Also used : WebAppContext(org.mortbay.jetty.webapp.WebAppContext) Server(org.mortbay.jetty.Server) SocketConnector(org.mortbay.jetty.bio.SocketConnector)

Example 29 with Server

use of org.mortbay.jetty.Server in project roboguice by roboguice.

the class Main method main.

public static void main(String[] args) throws Exception {
    Server server = new Server();
    Connector connector = new SelectChannelConnector();
    connector.setPort(8080);
    server.setConnectors(new Connector[] { connector });
    WebAppContext webapp = new WebAppContext("./root", "/example");
    server.addHandler(webapp);
    server.start();
    server.join();
}
Also used : Connector(org.mortbay.jetty.Connector) SelectChannelConnector(org.mortbay.jetty.nio.SelectChannelConnector) WebAppContext(org.mortbay.jetty.webapp.WebAppContext) SelectChannelConnector(org.mortbay.jetty.nio.SelectChannelConnector) Server(org.mortbay.jetty.Server)

Example 30 with Server

use of org.mortbay.jetty.Server in project jackrabbit by apache.

the class LitmusTest method testLitmus.

public void testLitmus() throws Exception {
    File dir = new File("target", "litmus");
    String litmus = System.getProperty("litmus", "litmus");
    if (Boolean.getBoolean("jackrabbit.test.integration") && isLitmusAvailable(litmus)) {
        final Repository repository = JcrUtils.getRepository("jcr-jackrabbit://" + Text.escapePath(dir.getCanonicalPath()));
        // for the TransientRepository
        Session session = repository.login();
        try {
            SocketConnector connector = new SocketConnector();
            connector.setHost("localhost");
            connector.setPort(Integer.getInteger("litmus.port", 0));
            Server server = new Server();
            server.addConnector(connector);
            ServletHolder holder = new ServletHolder(new SimpleWebdavServlet() {

                @Override
                public Repository getRepository() {
                    return repository;
                }
            });
            holder.setInitParameter("resource-config", "/config.xml");
            Context context = new Context(server, "/");
            context.setResourceBase("src/test/resources");
            context.addServlet(holder, "/*");
            server.addHandler(context);
            server.start();
            try {
                int port = connector.getLocalPort();
                String url = "http://localhost:" + port + "/default";
                ProcessBuilder builder = new ProcessBuilder(litmus, url, "admin", "admin");
                builder.directory(dir);
                builder.redirectErrorStream();
                assertLitmus(builder, "basic", 0);
                assertLitmus(builder, "http", 0);
                assertLitmus(builder, "props", 0);
                // FIXME: JCR-2637: WebDAV shallow copy test failure
                assertLitmus(builder, "copymove", 1);
                // FIXME: JCR-2638: Litmus locks test failures
                assertLitmus(builder, "locks", 1);
            } finally {
                server.stop();
            }
        } finally {
            session.logout();
        }
    }
}
Also used : Context(org.mortbay.jetty.servlet.Context) Repository(javax.jcr.Repository) Server(org.mortbay.jetty.Server) ServletHolder(org.mortbay.jetty.servlet.ServletHolder) File(java.io.File) SocketConnector(org.mortbay.jetty.bio.SocketConnector) Session(javax.jcr.Session)

Aggregations

Server (org.mortbay.jetty.Server)37 SocketConnector (org.mortbay.jetty.bio.SocketConnector)16 WebAppContext (org.mortbay.jetty.webapp.WebAppContext)14 SelectChannelConnector (org.mortbay.jetty.nio.SelectChannelConnector)11 Context (org.mortbay.jetty.servlet.Context)10 ServletHolder (org.mortbay.jetty.servlet.ServletHolder)9 Connector (org.mortbay.jetty.Connector)8 IOException (java.io.IOException)5 DefaultHandler (org.mortbay.jetty.handler.DefaultHandler)5 Configuration (org.apache.hadoop.conf.Configuration)4 Handler (org.mortbay.jetty.Handler)4 ContextHandler (org.mortbay.jetty.handler.ContextHandler)4 HandlerList (org.mortbay.jetty.handler.HandlerList)4 ResourceHandler (org.mortbay.jetty.handler.ResourceHandler)3 SslSocketConnector (org.mortbay.jetty.security.SslSocketConnector)3 ServletHandler (org.mortbay.jetty.servlet.ServletHandler)3 ArrayList (java.util.ArrayList)2 Repository (javax.jcr.Repository)2 ServletException (javax.servlet.ServletException)2 Before (org.junit.Before)2