hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kalnichevski, Oleg" <oleg.kalnichev...@bearingpoint.com>
Subject RE: Slide and Jakarta-commons-httpClient
Date Tue, 10 Dec 2002 20:22:59 GMT
Thandra,

If you are absolutely positive that you need to hit that URL with HTTP POST, that is how it
should be

        HttpClient client = new HttpClient();
        client.getHostConfiguration().setHost("xyz.abc.com", 80, "http");
        PostMethod method = new PostMethod("/verifyuser.asp");
        method.setUseDisk(false);
        method.addParameter("language", "2");
        method.addParameter("trlrd", "jgjnbgjn");
        method.addParameter("password", "MI9970");
        method.setRequestContentLength(PostMethod.CONTENT_LENGTH_AUTO);
        try
        {
            client.executeMethod(method);
        } 
        catch (Exception e) {
            e.printStackTrace();
            fail("Unexpected exception: " + e.toString());
        }
        System.out.println(method.getResponseBodyAsString());
        assertEquals(200,method.getStatusCode());

Hope that helps

Oleg

Mime
View raw message