Package org.mortbay.jetty.servlet

Examples of org.mortbay.jetty.servlet.Context$SContext


      org.mortbay.jetty.Server server = new org.mortbay.jetty.Server();
      Connector connector = new SelectChannelConnector();
      connector.setHost(host);
      connector.setPort(port);
      server.addConnector(connector);
      context = new Context(server, "/", Context.SESSIONS);
      context.setInitParams(Collections.singletonMap("resteasy.resources", "org.infinispan.rest.Server"));
      context.addEventListener(new ResteasyBootstrap());
      context.addServlet(HttpServletDispatcher.class, "/rest/*");
      ServletContext servletContext = context.getServletContext();
      ServerBootstrap.setCacheManager(servletContext, cacheManager);
View Full Code Here


   protected void removeServers() {
      servers.clear();
   }

   protected EmbeddedCacheManager getCacheManager(String name) {
      Context ctx = servers.get(name);
      if (ctx == null) {
         return null;
      }
      return ServerBootstrap.getCacheManager(ctx.getServletContext());
   }
View Full Code Here

      }
      return ServerBootstrap.getCacheManager(ctx.getServletContext());
   }

   protected ManagerInstance getManagerInstance(String name) {
      Context ctx = servers.get(name);
      if (ctx == null) {
         return null;
      }
      return ServerBootstrap.getManagerInstance(ctx.getServletContext());
   }
View Full Code Here

      }
      return ServerBootstrap.getManagerInstance(ctx.getServletContext());
   }

   protected Context createRESTEndpoint(int port, EmbeddedCacheManager cacheManager, RestServerConfiguration configuration) {
      Context ctx = new Context(new org.mortbay.jetty.Server(port), "/", Context.SESSIONS);
      ctx.setInitParams(Collections.singletonMap("resteasy.resources", "org.infinispan.rest.Server"));
      ctx.addEventListener(new ResteasyBootstrap());
      ctx.addServlet(HttpServletDispatcher.class, "/rest/*");
      ServletContext servletContext = ctx.getServletContext();
      ServerBootstrap.setCacheManager(servletContext, cacheManager);
      ServerBootstrap.setConfiguration(servletContext, configuration);
      return ctx;
   }
View Full Code Here

    client.postJson("http://localhost:4224/jstd/gateway", gatewayConfig);
    SocketConnector connector = new SocketConnector();
    connector.setPort(8888);
    org.mortbay.jetty.Server dummy = new org.mortbay.jetty.Server();
    dummy.addConnector(connector);
    Context context = new Context(dummy, "/", Context.SESSIONS);
    DummyServlet servlet = new DummyServlet();
    context.addServlet(new ServletHolder(servlet), "/");
    dummy.start();
    final PrintStream out = System.out;
    final int N = 100;
    Thread[] threads = new Thread[2*N];
    final AtomicInteger a = new AtomicInteger(0);
View Full Code Here

            connectorRef.servlet.connect(consumer);
        }
    }

    private void enableSessionSupport() throws Exception {
        Context context = (Context)getServer().getChildHandlerByClass(Context.class);
        if (context.getSessionHandler() == null) {
            SessionHandler sessionHandler = new SessionHandler();
            context.setSessionHandler(sessionHandler);
            if (context.isStarted()) {
                // restart the context
                context.stop();
                context.start();
            }
        }

    }
View Full Code Here

    }

    protected CamelServlet createServletForConnector(Connector connector) throws Exception {
        CamelServlet camelServlet = new CamelContinuationServlet();
       
        Context context = new Context(server, "/", Context.NO_SECURITY | Context.NO_SESSIONS);
        context.setConnectorNames(new String[] {connector.getName()});

        ServletHolder holder = new ServletHolder();
        holder.setServlet(camelServlet);
        context.addServlet(holder, "/*");
        connector.start();
        context.start();
       

        return camelServlet;
    }
View Full Code Here

                                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();
View Full Code Here

  protected void addDefaultApps(ContextHandlerCollection parent,
      final String appDir) throws IOException {
    // set up the context for "/logs/" if "hadoop.log.dir" property is defined.
    String logDir = System.getProperty("hadoop.log.dir");
    if (logDir != null) {
      Context logContext = new Context(parent, "/logs");
      logContext.setResourceBase(logDir);
      logContext.addServlet(DefaultServlet.class, "/");
      defaultContexts.put(logContext, true);
    }
    // set up the context for "/static/*"
    Context staticContext = new Context(parent, "/static");
    staticContext.setResourceBase(appDir + "/static");
    staticContext.addServlet(DefaultServlet.class, "/*");
    defaultContexts.put(staticContext, true);
  }
View Full Code Here

    final String[] USER_FACING_URLS = { "*.html", "*.jsp" };
    defineFilter(webAppContext, name, classname, parameters, USER_FACING_URLS);
    final String[] ALL_URLS = { "/*" };
    for (Map.Entry<Context, Boolean> e : defaultContexts.entrySet()) {
      if (e.getValue()) {
        Context ctx = e.getKey();
        defineFilter(ctx, name, classname, parameters, ALL_URLS);
        LOG.info("Added filter " + name + " (class=" + classname
            + ") to context " + ctx.getDisplayName());
      }
    }
    filterNames.add(name);
  }
View Full Code Here

TOP

Related Classes of org.mortbay.jetty.servlet.Context$SContext

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.