Package org.mortbay.jetty.servlet

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


   */
  private void fixupLogsServletLocation() {
    // Must be same as up in hadoop.
    final String logsContextPath = "/logs";
    // Now, put my logs in place of hadoops... disable old one first.
    Context oldLogsContext = null;
    for (Map.Entry<Context, Boolean> e : defaultContexts.entrySet()) {
      if (e.getKey().getContextPath().equals(logsContextPath)) {
        oldLogsContext = e.getKey();
        break;
      }
    }
    if (oldLogsContext != null) {
      this.defaultContexts.put(oldLogsContext, Boolean.FALSE);
    }
    // Now do my logs.
    // Set up the context for "/logs/" if "hbase.log.dir" property is defined.
    String logDir = System.getProperty("hbase.log.dir");
    if (logDir != null) {
      // This is a little presumptious but seems to work.
      Context logContext =
        new Context((ContextHandlerCollection)this.webServer.getHandler(),
          logsContextPath);
      logContext.setResourceBase(logDir);
      logContext.addServlet(DefaultServlet.class, "/");
      HttpServerUtil.constrainHttpMethods(logContext);
      defaultContexts.put(logContext, true);
    }
  }
View Full Code Here


            "com.sun.jersey.api.core.PackagesResourceConfig");
    servletHolder.setInitParameter("com.sun.jersey.config.property.packages",
            jaxRsPackages.toString());

    // Create the server context and add the servlet
    Context root = new Context(jettyServer, "/rest/v1", Context.SESSIONS);
    root.setAttribute("ChukwaAgent", this);
    root.addServlet(servletHolder, "/*");
    root.setAllowNullPathInfo(false);

    // And finally, fire up the server
    jettyServer.start();
    jettyServer.setStopAtShutdown(true);

View Full Code Here

      ChukwaHttpSender sender = new ChukwaHttpSender(conf);
      ArrayList<String> collectorList = new ArrayList<String>();
      collectorList.add("http://localhost:9990/chukwa");
      sender.setCollectors(new RetryListOfCollectors(collectorList, conf));
      Server server = new Server(9990);
      Context root = new Context(server, "/", Context.SESSIONS);

      root.addServlet(new ServletHolder(new ServletCollector(conf)), "/*");
      server.start();
      server.setStopAtShutdown(false);
      Thread.sleep(1000);

      Chunk c = new ChunkImpl("data", "stream", 0,
View Full Code Here

      jettyConnector.setLowResourceMaxIdleTime(1500);
      jettyConnector.setPort(collectorPort);
     
      // Set up jetty server proper, using connector
      jettyCollector = new Server(collectorPort);
      Context root = new Context(jettyCollector, "/", Context.SESSIONS);
      root.addServlet(new ServletHolder(new ServletCollector(conf)), "/*");
      jettyCollector.start();
      jettyCollector.setStopAtShutdown(true);
      Thread.sleep(10000);
    } catch(Exception e) {
      fail("Fail to startup collector.");
View Full Code Here

    clist.add("http://localhost:"+PORTNO+"/chukwa");
    HttpConnector conn = new HttpConnector(agent);
    conn.setCollectors(clist);
    conn.start();
    Server server = new Server(PORTNO);
    Context root = new Context(server, "/", Context.SESSIONS);

    root.addServlet(new ServletHolder(new ServletCollector(conf)), "/*");
    server.start();
    server.setStopAtShutdown(false);
    Thread.sleep(1000);
    agent.processAddCommand("add adaptor_constSend = " + ConstRateAdaptor.class.getCanonicalName() +
        " testData "+ SEND_RATE + " 0");
View Full Code Here

  public static Server startCollectorOnPort(Configuration conf, int port,
      ServletCollector collector) throws Exception {
    Server server = new Server(port);
   
    Context root = new Context(server, "/", Context.SESSIONS);
    root.addServlet(new ServletHolder(collector), "/*");
    root.addServlet(new ServletHolder(new CommitCheckServlet(conf)), "/"+CommitCheckServlet.DEFAULT_PATH);

    server.start();
    server.setStopAtShutdown(false);
    return server;
  }
View Full Code Here

   * @param args
   */
  public static void main(String[] args) {
    try {
      Server server = new Server(9990);
      Context root = new Context(server, "/", Context.SESSIONS);

      Configuration conf =  new Configuration();
      ServletCollector collector = new ServletCollector(conf);
      collector.setWriter(new ConsoleWriter(true));
      root.addServlet(new ServletHolder(collector), "/*");
      server.start();
      server.setStopAtShutdown(false);

      Thread.sleep(1000);
      ChukwaAgent agent = new ChukwaAgent();
View Full Code Here

            "org.apache.hadoop.chukwa.datacollection.agent.rest");
    servletHolder.setServletHandler(new ServletHandler());

    jettyServer = new Server();

    Context root = new Context(jettyServer, "/foo/bar", Context.SESSIONS);
    root.setAttribute("ChukwaAgent", agent);
    root.addServlet(servletHolder, "/*");

    jettyServer.start();
    jettyServer.setStopAtShutdown(true);

    servlet = servletHolder.getServlet();
View Full Code Here

        camelServlet.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 Server createServer() throws Exception {
        camelServlet = new CamelContinuationServlet();

        Server server = new Server();
        Context context = new Context(Context.NO_SECURITY | Context.NO_SESSIONS);

        context.setContextPath("/");
        ServletHolder holder = new ServletHolder();
        holder.setServlet(camelServlet);
        context.addServlet(holder, "/*");
        server.setHandler(context);

        server.start();
        return server;
    }
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.