Package org.eclipse.jetty.webapp

Examples of org.eclipse.jetty.webapp.WebAppContext


    } ;
 
  @Override
  protected WebAppContext createWebAppContext(TreeLogger logger, File appRootDir)
  {
      WebAppContext webAppContext = super.createWebAppContext(logger, appRootDir);
      webAppContext.setConfigurationClasses(__dftConfigurationClasses);
      System.setProperty("java.naming.factory.url.pkgs", "org.mortbay.naming");
      System.setProperty("java.naming.factory.initial", "org.mortbay.naming.InitialContextFactory");
      try
        {
          initializeCruxBridge(webAppContext.getWebInf().getURL());
        }
        catch (IOException e)
        {
          throw new CruxLaunchException("Error starting crux launcher.", e);
        }
View Full Code Here


   public ProtocolMetaData deploy(final Archive<?> archive) throws DeploymentException
   {
      try
      {
         WebAppContext wctx = archive.as(ShrinkWrapWebAppContext.class);

         if(configurationClasses != null)
         {
            wctx.setConfigurationClasses(configurationClasses);
         }

         // possible configuration parameters
         wctx.setExtractWAR(true);
         wctx.setLogUrlOnStart(true);

         /*
          * ARQ-242 Without this set we result in failure on loading Configuration in container.
          * ServiceLoader finds service file from AppClassLoader, tried to load JettyContainerConfiguration from AppClassLoader
          * as a ContainerConfiguration from WebAppClassContext. ClassCastException.
          */
         wctx.setParentLoaderPriority(true);

         ((HandlerCollection) server.getHandler()).addHandler(wctx);
         wctx.start();
         webAppContextProducer.set(wctx);

         HTTPContext httpContext = new HTTPContext(containerConfig.getBindAddress(), containerConfig.getBindHttpPort());
         for(ServletHolder servlet : wctx.getServletHandler().getServlets())
         {
            httpContext.add(new Servlet(servlet.getName(), servlet.getContextPath()));
         }

         return new ProtocolMetaData()
View Full Code Here

      }
   }

   public void undeploy(Archive<?> archive) throws DeploymentException
   {
      WebAppContext wctx = webAppContextProducer.get();
      if (wctx != null)
      {
         try
         {
            wctx.stop();
         }
         catch (Exception e)
         {
            e.printStackTrace();
            log.severe("Could not stop context " + wctx.getContextPath() + ": " + e.getMessage());
         }
         ((HandlerCollection) server.getHandler()).removeHandler(wctx);
      }
   }
View Full Code Here

    System.out.println("Starting JFinal " + Const.JFINAL_VERSION);
    server = new Server();
    SelectChannelConnector connector = new SelectChannelConnector();
    connector.setPort(port);
    server.addConnector(connector);
    webApp = new WebAppContext();
    webApp.setContextPath(context);
    webApp.setResourceBase(webAppDir)// webApp.setWar(webAppDir);
    webApp.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
    webApp.setInitParameter("org.eclipse.jetty.servlet.Default.useFileMappedBuffer", "false")// webApp.setInitParams(Collections.singletonMap("org.mortbay.jetty.servlet.Default.useFileMappedBuffer", "false"));
    persistSession(webApp);
View Full Code Here

                context.addEventListener(new Listener());        
                context.addEventListener(new BeanManagerResourceBindingListener());
                context.addServlet(servletHolder, "/rest/*");
                server.setHandler(context);
            } else {       
                final WebAppContext context = new WebAppContext();
                context.setContextPath(contextPath);
                context.setWar(getClass().getResource(resourcePath).toURI().getPath());
                context.setServerClasses(new String[] {
                    "org.eclipse.jetty.servlet.ServletContextHandler.Decorator"
                });
       
                HandlerCollection handlers = new HandlerCollection();
                handlers.setHandlers(new Handler[] {context, new DefaultHandler()});
View Full Code Here

    connector.setIdleTimeout(1000 * 60 * 60);
    connector.setSoLingerTime(-1);
    connector.setPort(8080);
    server.setConnectors(new Connector[] {connector});

    WebAppContext bb = new WebAppContext();
    bb.setServer(server);
    bb.setContextPath("/");
    bb.setWar("src/main/webapp");

    server.setHandler(bb);

    try
    {
View Full Code Here

      System.out.println("SSL access to the quickstart has been enabled on port 8443");
      System.out.println("You can access the application using SSL on https://localhost:8443");
      System.out.println();
    }

    WebAppContext bb = new WebAppContext();
    bb.setServer(server);
    bb.setContextPath("/");
    bb.setWar("src/main/webapp");

    // START JMX SERVER
    // MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
    // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer);
    // server.getContainer().addEventListener(mBeanContainer);
View Full Code Here

            System.out.println("SSL access to the quickstart has been enabled on port 8443");
            System.out.println("You can access the application using SSL on https://localhost:8443");
            System.out.println();
        }

        WebAppContext bb = new WebAppContext();
        bb.setServer(server);
        bb.setContextPath("/");
        bb.setWar("src/main/webapp");

        // START JMX SERVER
        // MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
        // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer);
        // server.getContainer().addEventListener(mBeanContainer);
View Full Code Here

            System.out.println("SSL access to the quickstart has been enabled on port 8443");
            System.out.println("You can access the application using SSL on https://localhost:8443");
            System.out.println();
        }

        WebAppContext bb = new WebAppContext();
        bb.setServer(server);
        bb.setContextPath("/");
        bb.setWar("src/main/webapp");

        // START JMX SERVER
        // MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
        // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer);
        // server.getContainer().addEventListener(mBeanContainer);
View Full Code Here

            System.out.println("SSL access to the quickstart has been enabled on port 8443");
            System.out.println("You can access the application using SSL on https://localhost:8443");
            System.out.println();
        }

        WebAppContext bb = new WebAppContext();
        bb.setServer(server);
        bb.setContextPath("/");
        bb.setWar("src/main/webapp");

        // START JMX SERVER
        // MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
        // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer);
        // server.getContainer().addEventListener(mBeanContainer);
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.webapp.WebAppContext

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.