Package org.apache.commons.httpclient.methods

Examples of org.apache.commons.httpclient.methods.GetMethod.recycle()


        } catch (Throwable t) {
            t.printStackTrace();
            fail("Unable to execute method : " + t.toString());
        }

        method.recycle();
        method.setPath("/index.html");
        method.setUseDisk(true);

        try {
            client.executeMethod(method);
View Full Code Here


            t.printStackTrace();
            fail("Unable to execute method : " + t.toString());
        }
        assertEquals(200,method.getStatusCode());

        method.recycle();
        method.setPath("/");

        try {
            client.executeMethod(method);
        } catch (Throwable t) {
View Full Code Here

        }
        assertEquals(200,method.getStatusCode());
        assertTrue(method.getResponseBodyAsString().indexOf("<title>BasicAuth Servlet: GET</title>") >= 0);
        assertTrue(method.getResponseBodyAsString().indexOf("<p>You have authenticated as \"jakarta:commons\"</p>") >= 0);

        method.recycle();
        method.setPath("/" + context + "/auth/basic");
        try {
            client.executeMethod(method);
        } catch (Throwable t) {
            t.printStackTrace();
View Full Code Here

        assertTrue(method.getResponseBodyAsString().indexOf("<title>BasicAuth Servlet: GET</title>") >= 0);
        assertTrue(method.getResponseBodyAsString().indexOf("<p>Not authorized.</p>") >= 0);

        client.getState().setCredentials("BasicAuthServlet",new UsernamePasswordCredentials("jakarta","commons"));

        method.recycle();
        method.setPath("/" + context + "/auth/basic");
        try {
            client.executeMethod(method);
        } catch (Throwable t) {
            t.printStackTrace();
View Full Code Here

        assertTrue(method.getResponseBodyAsString().indexOf("<title>BasicAuth Servlet: GET</title>") >= 0);
        assertTrue(method.getResponseBodyAsString().indexOf("<p>Not authorized.</p>") >= 0);

        client.getState().setCredentials("BasicAuthServlet",new UsernamePasswordCredentials("bad","creds"));

        method.recycle();
        method.setPath("/" + context + "/auth/basic");
        try {
            client.executeMethod(method);
        } catch (Throwable t) {
            t.printStackTrace();
View Full Code Here

        conn.open();
        GetMethod httpget = new GetMethod("/");
        httpget.execute(new HttpState(), conn);
        assertEquals(CHARSET_DEFAULT, httpget.getResponseCharSet());
        conn.close();
        httpget.recycle();
       
        String headers2 = "HTTP/1.1 200 OK\r\n"
                       +"Content-Type: text/plain\r\n"
                       +"Content-Length: 4\r\n";
        conn.addResponse(headers2, body);
View Full Code Here

        conn.open();
        httpget.setPath("/");
        httpget.execute(new HttpState(), conn);
        assertEquals(CHARSET_DEFAULT, httpget.getResponseCharSet());
        conn.close();
        httpget.recycle();

        String headers3 = "HTTP/1.1 200 OK\r\n"
                       +"Content-Type: text/plain; charset=" + CHARSET_UTF8 + "\r\n"
                       +"Content-Length: 4\r\n";
        conn.addResponse(headers3, body);
View Full Code Here

        conn.open();
        httpget.setPath("/");
        httpget.execute(new HttpState(), conn);
        assertEquals(CHARSET_UTF8, httpget.getResponseCharSet());
        conn.close();
        httpget.recycle();

    }


    private String constructString(int [] unicodeChars) {
View Full Code Here

        }
        assertEquals(200,method.getStatusCode());
        assertTrue(method.getResponseBodyAsString().indexOf("<title>BasicAuth Servlet: GET</title>") >= 0);
        assertTrue(method.getResponseBodyAsString().indexOf("<p>You have authenticated as \"jakarta:commons\"</p>") >= 0);

        method.recycle();
        method.setPath("/" + getWebappContext() + "/auth/basic");
        try {
            client.executeMethod(method);
        } catch (Throwable t) {
            t.printStackTrace();
View Full Code Here

        client.getState().setCredentials(
            new HttpAuthRealm(getHost(), getPort(), "BasicAuthServlet"),
            new UsernamePasswordCredentials("jakarta","commons"));

        method.recycle();
        method.setPath("/" + getWebappContext() + "/auth/basic");
        try {
            client.executeMethod(method);
        } catch (Throwable t) {
            t.printStackTrace();
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.