Package org.apache.commons.httpclient.methods

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


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

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


        } else {
            assertTrue(hostHeader.getValue().equals(ip + ":" + getPort()));
        }

        // reset
        get.recycle();
        get.setPath("/" + getWebappContext() + "/");

        // Open connection using Host.  Host header should
        // contain this value (this test will fail if DNS
        // is not available. Additionally, if the port is
View Full Code Here

        for(int i=0;i<10;i++) {
            assertEquals(200, client.executeMethod(getSlash));
            String data = getSlash.getResponseBodyAsString();
            assertTrue(null != data);
            assertTrue(data.length() > 0);
            getSlash.recycle();
            getSlash.setPath("/");
        }
    }

    public void testRecycle() {
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

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

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

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

        client.executeMethod(m);
        assertEquals(200, m.getStatusCode());
        assertEquals("12345", m.getResponseBodyAsString());

        m.recycle();

        client.executeMethod(m);
        assertEquals(200, m.getStatusCode());
        assertEquals("12345", m.getResponseBodyAsString());
        m.releaseConnection();
View Full Code Here

        client.executeMethod(m);
        assertEquals(200, m.getStatusCode());
        assertEquals("12345", m.getResponseBodyAsString());

        m.recycle();

        client.executeMethod(m);
        assertEquals(200, m.getStatusCode());

        InputStream in = m.getResponseBodyAsStream();
View Full Code Here

                    output.write(buffer, 0, length);
                }

                output.close();
                input.close();
                getMethod.recycle();
            }
            client.endSession();

        } catch (BuildException e) {
            log(e.getMessage());
View Full Code Here

                    output.write(buffer, 0, length);
                }

                output.close();
                input.close();
                getMethod.recycle();
            }
            client.endSession();

        } catch (BuildException e) {
            log(e.getMessage());
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

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.