Search in sources :

Example 11 with Context

use of org.mortbay.jetty.servlet.Context in project tests by datanucleus.

the class BasicTest method setUp.

protected void setUp() throws Exception {
    LOG.info("********** " + toString() + " [setUp] **********");
    super.setUp();
    server = new Server(PORT);
    Context root = new Context(server, "/", Context.SESSIONS);
    ServletHolder holder = new ServletHolder(new RestServlet());
    // TODO Set this based on which datastore in use
    holder.setInitParameter("persistence-context", "h2-backend");
    root.addServlet(holder, "/dn/*");
    server.start();
}
Also used : Context(org.mortbay.jetty.servlet.Context) Server(org.mortbay.jetty.Server) ServletHolder(org.mortbay.jetty.servlet.ServletHolder) RestServlet(org.datanucleus.api.rest.RestServlet)

Example 12 with Context

use of org.mortbay.jetty.servlet.Context in project tests by datanucleus.

the class JSONTestCase method setUp.

protected void setUp() throws Exception {
    super.setUp();
    if (storeMgr.getStoreManagerKey().equals("json")) {
        if (server == null) {
            server = new Server(21212);
            Context root = new Context(server, "/", Context.SESSIONS);
            Map params = new HashMap();
            params.put("com.sun.jersey.config.property.packages", "org.datanucleus.tests.rest");
            root.setInitParams(params);
            ServletHolder holder = new ServletHolder(ServletContainer.class);
            holder.setInitParameters(params);
            root.addServlet(holder, "/*");
            server.start();
            holder.start();
            while (!holder.isStarted()) {
                Thread.sleep(2000);
            }
        }
    }
}
Also used : Context(org.mortbay.jetty.servlet.Context) Server(org.mortbay.jetty.Server) HashMap(java.util.HashMap) ServletHolder(org.mortbay.jetty.servlet.ServletHolder) Map(java.util.Map) HashMap(java.util.HashMap)

Example 13 with Context

use of org.mortbay.jetty.servlet.Context in project onebusaway-application-modules by camsys.

the class DynamicFederatedServiceCollectionImplTest method addServiceServlet.

private SimpleFederatedServiceImpl addServiceServlet(Server server, String agencyId, CoordinateBounds bounds) {
    Map<String, List<CoordinateBounds>> agenciesA = new HashMap<String, List<CoordinateBounds>>();
    agenciesA.put(agencyId, Arrays.asList(bounds));
    SimpleFederatedServiceImpl serviceA = new SimpleFederatedServiceImpl(agenciesA, agencyId);
    HessianServlet servletA = new HessianServlet();
    servletA.setHome(serviceA);
    servletA.setHomeAPI(SimpleFederatedService.class);
    Context contextA = new Context(server, "/service-" + agencyId, Context.SESSIONS);
    contextA.addServlet(new ServletHolder(servletA), "/*");
    return serviceA;
}
Also used : Context(org.mortbay.jetty.servlet.Context) HashMap(java.util.HashMap) ServletHolder(org.mortbay.jetty.servlet.ServletHolder) List(java.util.List) HessianServlet(com.caucho.hessian.server.HessianServlet) CoordinateBounds(org.onebusaway.geospatial.model.CoordinateBounds)

Example 14 with Context

use of org.mortbay.jetty.servlet.Context in project ghostdriver by detro.

the class CallbackHttpServer method start.

public void start() throws Exception {
    server = new Server(0);
    Context context = new Context(server, "/");
    addServlets(context);
    server.start();
}
Also used : Context(org.mortbay.jetty.servlet.Context) Server(org.mortbay.jetty.Server)

Aggregations

Context (org.mortbay.jetty.servlet.Context)14 Server (org.mortbay.jetty.Server)11 ServletHolder (org.mortbay.jetty.servlet.ServletHolder)10 SelectChannelConnector (org.mortbay.jetty.nio.SelectChannelConnector)3 FilterHolder (org.mortbay.jetty.servlet.FilterHolder)3 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 QueuedThreadPool (org.mortbay.thread.QueuedThreadPool)2 VoldemortServer (voldemort.server.VoldemortServer)2 HessianServlet (com.caucho.hessian.server.HessianServlet)1 TearDown (com.google.common.testing.TearDown)1 List (java.util.List)1 Map (java.util.Map)1 ServletException (javax.servlet.ServletException)1 Configuration (org.apache.hadoop.conf.Configuration)1 WicketFilter (org.apache.wicket.protocol.http.WicketFilter)1 RestServlet (org.datanucleus.api.rest.RestServlet)1 AbstractConnector (org.mortbay.jetty.AbstractConnector)1 Connector (org.mortbay.jetty.Connector)1 SocketConnector (org.mortbay.jetty.bio.SocketConnector)1