Package org.apache.catalina.startup

Examples of org.apache.catalina.startup.Tomcat.addContext()


        // Configure a context with digest auth and a single protected resource
        Tomcat tomcat = getTomcatInstance();
       
        // Must have a real docBase - just use temp
        Context ctxt = tomcat.addContext(CONTEXT_PATH,
                System.getProperty("java.io.tmpdir"));
       
        // Add protected servlet
        Tomcat.addServlet(ctxt, "TesterServlet", new TesterServlet());
        ctxt.addServletMapping(URI, "TesterServlet");
View Full Code Here


    }

   
    private synchronized void init() throws Exception {
        Tomcat tomcat = getTomcatInstance();
        Context root = tomcat.addContext("", SimpleHttpClient.TEMP_DIR);
        Tomcat.addServlet(root, "Simple", new SimpleServlet());
        root.addServletMapping("/test", "Simple");
        tomcat.getConnector().setProperty("maxKeepAliveRequests", "1");
        tomcat.getConnector().setProperty("maxThreads", "10");
        tomcat.getConnector().setProperty("soTimeout", "20000");
View Full Code Here

                throws Exception {
            if (init)
                return;

            Tomcat tomcat = getTomcatInstance();
            context = tomcat.addContext("", TEMP_DIR);
            Wrapper w;
            w = Tomcat.addServlet(context, servletName,
                                  new AbortedUploadServlet());
            // Tomcat.addServlet does not respect annotations, so we have
            // to set our own MultipartConfigElement.
View Full Code Here

                throws Exception {
            if (init)
                return;

            Tomcat tomcat = getTomcatInstance();
            context = tomcat.addContext("", TEMP_DIR);
            AbortedPOSTServlet servlet = new AbortedPOSTServlet();
            servlet.setStatus(status);
            Tomcat.addServlet(context, servletName,
                              servlet);
            context.addServletMapping(URI, servletName);
View Full Code Here

        File foo = new File(docBase, "foo");
        if (!foo.exists() && !foo.mkdirs()) {
            fail("Unable to create foo directory in docBase");
        }
       
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());

        Tomcat.addServlet(ctx, "servlet", new PathParamServlet());
        ctx.addServletMapping("/", "servlet");

        tomcat.start();
View Full Code Here

        // Setup Tomcat instance
        Tomcat tomcat = getTomcatInstance();

        // Must have a real docBase - just use temp
        Context ctx =
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));

        Tomcat.addServlet(ctx, "servlet", new PathParamServlet());
        ctx.addServletMapping("/", "servlet");

        tomcat.start();
View Full Code Here

        // Setup Tomcat instance
        Tomcat tomcat = getTomcatInstance();

        // Must have a real docBase - just use temp
        Context ctx =
            tomcat.addContext("/testapp", System.getProperty("java.io.tmpdir"));

        Tomcat.addServlet(ctx, "servlet", new PathParamServlet());
        ctx.addServletMapping("*.txt", "servlet");

        tomcat.start();
View Full Code Here

        // Setup Tomcat instance
        Tomcat tomcat = getTomcatInstance();
       
        // Must have a real docBase - just use temp
        Context ctx =
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));

        // Add the Servlet
        CharsetServlet servlet = new CharsetServlet(mode);
        Tomcat.addServlet(ctx, "servlet", servlet);
        ctx.addServletMapping("/", "servlet");
View Full Code Here

        // Setup Tomcat instance
        Tomcat tomcat = getTomcatInstance();
       
        // Must have a real docBase - just use temp
        Context ctx =
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));

        // Add the Servlet
        Tomcat.addServlet(ctx, "servlet", new EchoQueryStringServlet());
        ctx.addServletMapping("/", "servlet");
       
View Full Code Here

        // Setup Tomcat instance
        Tomcat tomcat = getTomcatInstance();
       
        // Must have a real docBase - just use temp
        Context ctx =
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));

        LoginConfig config = new LoginConfig();
        config.setAuthMethod("BASIC");
        ctx.setLoginConfig(config);
        ctx.getPipeline().addValve(new BasicAuthenticator());
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.