Examples of Tomcat


Examples of org.apache.catalina.startup.Tomcat

        private synchronized void init(boolean limited, boolean swallow)
                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.
            // Choose upload file size limit.
            if (limited) {
                w.setMultipartConfigElement(new MultipartConfigElement("",
                        limitSize, -1, -1));
            } else {
                w.setMultipartConfigElement(new MultipartConfigElement(""));
            }
            context.addServletMapping(URI, servletName);
            context.setSwallowAbortedUploads(swallow);

            tomcat.start();
            setPort(tomcat.getConnector().getLocalPort());

            init = true;
        }
View Full Code Here

Examples of org.apache.catalina.startup.Tomcat

        private synchronized void init(int status, boolean swallow)
                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);
            context.setSwallowAbortedUploads(swallow);

            tomcat.start();

            setPort(tomcat.getConnector().getLocalPort());

            init = true;
        }
View Full Code Here

Examples of org.apache.catalina.startup.Tomcat

*/
public class TestELInJsp extends TomcatBaseTest {

    @Test
    public void testBug36923() throws Exception {
        Tomcat tomcat = getTomcatInstance();

        File appDir = new File("test/webapp-3.0");
        // app dir is relative to server home
        tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

        tomcat.start();

        ByteChunk res = getUrl("http://localhost:" + getPort() +
                "/test/bug36923.jsp");

        String result = res.toString();
View Full Code Here

Examples of org.apache.catalina.startup.Tomcat

        assertEcho(result, "00-${hello world}");
    }

    @Test
    public void testBug42565() throws Exception {
        Tomcat tomcat = getTomcatInstance();

        File appDir = new File("test/webapp-3.0");
        // app dir is relative to server home
        tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

        tomcat.start();

        ByteChunk res = getUrl("http://localhost:" + getPort() +
                "/test/bug42565.jsp");

        String result = res.toString();
View Full Code Here

Examples of org.apache.catalina.startup.Tomcat

        assertEcho(result, "15-false");
    }

    @Test
    public void testBug44994() throws Exception {
        Tomcat tomcat = getTomcatInstance();

        File appDir =
            new File("test/webapp-3.0");
        // app dir is relative to server home
        tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

        tomcat.start();

        ByteChunk res = getUrl("http://localhost:" + getPort() +
                "/test/bug44994.jsp");

        String result = res.toString();
View Full Code Here

Examples of org.apache.catalina.startup.Tomcat

        "258EAFA5-E914-47DA-95CA-C5AB0DC85B11".getBytes(
                B2CConverter.ISO_8859_1);

    @Test
    public void testSimple() throws Exception {
        Tomcat tomcat = getTomcatInstance();
        // Must have a real docBase - just use temp
        Context ctx = tomcat.addContext("",
                System.getProperty("java.io.tmpdir"));
        ctx.addApplicationListener(new ApplicationListener(
                TesterEchoServer.Config.class.getName(), false));

        Tomcat.addServlet(ctx, "default", new DefaultServlet());
        ctx.addServletMapping("/", "default");

        tomcat.start();

        WebSocketClient client = new WebSocketClient(getPort());

        // Send the WebSocket handshake
        client.writer.write("GET " + TesterEchoServer.Config.PATH_BASIC + " HTTP/1.1" + CRLF);
View Full Code Here

Examples of org.apache.catalina.startup.Tomcat

        assertEcho(result, "02-many");
    }

    @Test
    public void testBug45427() throws Exception {
        Tomcat tomcat = getTomcatInstance();

        File appDir =
            new File("test/webapp-3.0");
        // app dir is relative to server home
        tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

        tomcat.start();

        ByteChunk res = getUrl("http://localhost:" + getPort() +
                "/test/bug45nnn/bug45427.jsp");

        String result = res.toString();
View Full Code Here

Examples of org.apache.catalina.startup.Tomcat

        client.close();
    }

    @Test
    public void testDetectWrongVersion() throws Exception {
        Tomcat tomcat = getTomcatInstance();
        // Must have a real docBase - just use temp
        Context ctx = tomcat.addContext("",
                System.getProperty("java.io.tmpdir"));
        ctx.addApplicationListener(new ApplicationListener(
                TesterEchoServer.Config.class.getName(), false));

        Tomcat.addServlet(ctx, "default", new DefaultServlet());
        ctx.addServletMapping("/", "default");

        tomcat.start();

        WebSocketClient client= new WebSocketClient(getPort());

        // Send the WebSocket handshake
        client.writer.write("GET " + TesterEchoServer.Config.PATH_BASIC + " HTTP/1.1" + CRLF);
View Full Code Here

Examples of org.apache.catalina.startup.Tomcat

        assertEcho(result, "17-hello \"world");
    }

    @Test
    public void testBug45451() throws Exception {
        Tomcat tomcat = getTomcatInstance();

        File appDir =
            new File("test/webapp-3.0");
        // app dir is relative to server home
        tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

        tomcat.start();

        ByteChunk res = getUrl("http://localhost:" + getPort() +
                "/test/bug45nnn/bug45451a.jsp");

        String result = res.toString();
View Full Code Here

Examples of org.apache.catalina.startup.Tomcat

        assertEcho(result, "13-\\\\#{1+1}");
    }

    @Test
    public void testBug45511() throws Exception {
        Tomcat tomcat = getTomcatInstance();

        File appDir =
            new File("test/webapp-3.0");
        // app dir is relative to server home
        tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

        tomcat.start();

        ByteChunk res = getUrl("http://localhost:" + getPort() +
                "/test/bug45nnn/bug45511.jsp");

        String result = res.toString();
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.