Examples of WebAppContext


Examples of org.eclipse.jetty.webapp.WebAppContext

            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

Examples of org.eclipse.jetty.webapp.WebAppContext

        // Ensure we have a "work" directory for the webapp
        if (System.getProperty("jetty.home") != null) {
            new File(System.getProperty("jetty.home"), "work").mkdirs();
        }

        WebAppContext webapp = new WebAppContext();
        webapp.setContextPath("/");
        webapp.setExtractWAR(true);
        webapp.setWar(args[0]);
        webapp.setDefaultsDescriptor(webdefaultPath());

        Server server = new Server();
        Connector connector = new SelectChannelConnector();
        connector.setPort(Integer.getInteger("jetty.port",8080).intValue());
        server.setConnectors(new Connector[]{connector});
View Full Code Here

Examples of org.eclipse.jetty.webapp.WebAppContext

    SelectChannelConnector connector = new SelectChannelConnector();
    connector.setHost(SERVER_HOST);
    connector.setPort(SERVER_PORT);
    server.addConnector(connector);

    context = new WebAppContext("src/test/webapp", "/");
    context.setParentLoaderPriority(true);
   
    // Add support for JSP
    ServletHolder jsp = context.addServlet(JspServlet.class, "*.jsp");
    jsp.setInitParameter("classpath", context.getClassPath());
View Full Code Here

Examples of org.eclipse.jetty.webapp.WebAppContext

    //TODO: move embedded war stuff to isolated autoconfig
    @Bean
    @ConditionalOnExpression("${application.embeddedWar.enabled:false}")
    WebAppContext webAppContext () {
        WebAppContext webapp = new WebAppContext();
        //webapp.setContextPath(properties.getEmbeddedWar().getPath());
        webapp.setContextPath("/"); //TODO: does this matter?
        //TODO: if embedded in fat jar, extract
        webapp.setWar(halfpipeProperties().getEmbeddedWar().getLocation());
        webapp.setExtractWAR(false);
        return webapp;
    }
View Full Code Here

Examples of org.eclipse.jetty.webapp.WebAppContext

        connector.setMaxIdleTime(1000 * 60 * 60);
        connector.setPort(8080);
        server.setConnectors(new Connector[] {connector});

        final WebAppContext context = new WebAppContext();
        context.setServer(server);
        context.setContextPath("/BraveRestEasyIntegration");
        context.setWar("src/test/webapp");

        server.setHandler(context);

        try {
            server.start();
View Full Code Here

Examples of org.eclipse.jetty.webapp.WebAppContext

        SelectChannelConnector connector = new SelectChannelConnector();
        connector.setPort(8080);
        server.addConnector(connector);

        WebAppContext context = new WebAppContext("webapp", "/");

        if (System.getProperty("os.name").toLowerCase().contains("windows")) {
            // fix for Windows, so Jetty doesn't lock files
            context.getInitParams().put("org.eclipse.jetty.servlet.Default.useFileMappedBuffer", "false");
        }

        server.setHandler(context);
        server.start();
    }
View Full Code Here

Examples of org.eclipse.jetty.webapp.WebAppContext

    private static WebAppContext buildContext() throws IOException {
        ProtectionDomain protectionDomain = Startup.class.getProtectionDomain();
        URL location = protectionDomain.getCodeSource().getLocation();

        WebAppContext context = new WebAppContext();
        WebAppClassLoader webAppClassLoader = new WebAppClassLoader(Startup.class.getClassLoader(),context);
        context.setClassLoader(webAppClassLoader);
        context.setContextPath(URIUtil.SLASH);
        context.setWar(location.toExternalForm());

        if( tempDir != null ) {
            File tempDirectory = new File(tempDir);
            context.setTempDirectory(tempDirectory);
        }
        return context;
    }
View Full Code Here

Examples of org.eclipse.jetty.webapp.WebAppContext

    public static void main(String[] args) throws Exception {

        setThreadClassLoader();
        processOptions();
        WebAppContext context = buildContext();

        if( tempDir != null ) {
            File tempDirectory = new File(tempDir);
            context.setTempDirectory(tempDirectory);
        }

        Server server = new Server();
        if( usingSSL ) {
            server.setConnectors(new Connector[]{buildConnector(),buildSslConnector()});
View Full Code Here

Examples of org.eclipse.jetty.webapp.WebAppContext

        if(webPort == null || webPort.isEmpty()) {
            webPort = "8080";
        }

        Server server = new Server(Integer.valueOf(webPort));
        WebAppContext root = new WebAppContext();

        root.setContextPath("/");
        root.setDescriptor(webappDirLocation+"/WEB-INF/web.xml");
        root.setResourceBase(webappDirLocation);

        // Add the status servlet
        ServletHolder servletHolder = new ServletHolder(new StatusServlet(pushBot));
        root.addServlet(servletHolder, "/status");

        //Parent loader priority is a class loader setting that Jetty accepts.
        //By default Jetty will behave like most web containers in that it will
        //allow your application to replace non-server libraries that are part of the
        //container. Setting parent loader priority to true changes this behavior.
        //Read more here: http://wiki.eclipse.org/Jetty/Reference/Jetty_Classloading
        root.setParentLoaderPriority(true);

        server.setHandler(root);

        server.start();
        server.join();
View Full Code Here

Examples of org.eclipse.jetty.webapp.WebAppContext

    @BeforeClass
    public static void beforeClass() throws Exception {
        //创建一个server
        server = new Server(8080);
        WebAppContext context = new WebAppContext();
        String webapp = "shiro-example-chapter20/src/main/webapp";
        context.setDescriptor(webapp + "/WEB-INF/web.xml")//指定web.xml配置文件
        context.setResourceBase(webapp)//指定webapp目录
        context.setContextPath("/");
        context.setParentLoaderPriority(true);

        server.setHandler(context);
        server.start();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.