Package org.eclipse.jetty.webapp

Examples of org.eclipse.jetty.webapp.WebAppContext$Context


        description = String.format("<Jetty7Runner: %s:%s/%s (%s)", contextPath, port, sslPort, expandedPath);

        jettyServer = new Server(port);

        WebAppContext webapp = new WebAppContext();
        webapp.setContextPath(contextPath);
        webapp.setWar(expandedPath);

        // SSL support
        File keystoreFile = new File(TapestryRunnerConstants.MODULE_BASE_DIR, "src/test/conf/keystore");

        if (keystoreFile.exists())
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

    connector.setSoLingerTime(0);

    Server server = new Server();
    server.addConnector(connector);

    WebAppContext webContext = new WebAppContext();
    webContext.setWar(appRootDir.getCanonicalPath());
    webContext.setParentLoaderPriority(true);
    webContext.setContextPath("/");
    webContext.setClassLoader(Thread.currentThread().getContextClassLoader());
    webContext.getInitParams().put("org.eclipse.jetty.servlet.Default.useFileMappedBuffer", "false");
   
    server.setHandler(webContext);
    if (addDevelopmentComponents)
    {
      webContext.addFilter(DeclarativeUIFilter.class, "*.html", EnumSet.allOf(DispatcherType.class));
      webContext.addServlet(ViewTester.class, "/viewTester/*");
      if (!webContext.getInitParams().containsKey(DevModeInitializerListener.OUTPUT_CHARSET))
      {
        webContext.setInitParameter(DevModeInitializerListener.OUTPUT_CHARSET, pageOutputCharset);
      }
      webContext.addEventListener(new InitializerListener());
      webContext.addEventListener(new DevModeInitializerListener());
    }
    try
    {
      server.start();
      server.join();
View Full Code Here

    } ;
 
  @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

TOP

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

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.