commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@bluewin.ch
Subject RE: [httpclient] session after autentication
Date Mon, 13 Oct 2003 13:32:11 GMT
Hi Albert,
HttpClient force-closes the connection because the response content length
is missing. This behaviour is OK.

Now on the main problem. It is likely that the server has got issues with
RFC2109 compliant cookies used per default. Give compatibility cookie policy
a try. That may do the trick.

HttpClient client = new HttpClient();
client.getState().setCookiePolicy(CookiePolicy.COMPATIBILITY);

Oleg

>-- Original Message --
>Reply-To: "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
>From: "Albert Caramia" <a_caramia@hotmail.com>
>To: commons-user@jakarta.apache.org
>Subject: RE: [httpclient] session after autentication
>Date: Mon, 13 Oct 2003 15:05:14 +0200
>
>
>Hi Oleg, Michael
>
>my code is in attach and is very simple. I don't have subclassed PostMethod
>
>in my application.
>
>Michael, the missing 'u' in the log is cut&paste problem, when I clear the
>
>user/pass from the log. Sorry
>
>I change the user/pass because the system is a production system and I don't
>
>have a test environment
>
>Maybe the ISA proxy can generate the problem?
>
>Albert
>----------------------------
>package getpost;
>
>import org.apache.commons.httpclient.*;
>import org.apache.commons.httpclient.methods.*;
>import java.io.*;
>
>public class SMSHTTP {
>
>  public void test5() throws Exception {
>
>    System.setProperty("org.apache.commons.logging.Log", 
>"org.apache.commons.logging.impl.SimpleLog");
>    System.setProperty("org.apache.commons.logging.simplelog.showdatetime",
>
>"true");
>    
>System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire",
>
>"debug");
>    
>System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient",
>
>"debug");
>
>    HttpClient httpclient = new HttpClient();
>    httpclient.getHostConfiguration().setHost("www.smsexecutive.it", 80,
>
>"http");
>
>    PostMethod post = new PostMethod("/new/index1.php");
>    NameValuePair[] data = {
>        new NameValuePair("username", "xxx"),
>        new NameValuePair("password", "xxx")
>    };
>
>    post.setRequestBody(data);
>    httpclient.executeMethod(post);
>    System.out.println(post.getResponseBodyAsString());
>    System.out.println("result POST: " + post.getStatusLine().toString());
>
>    GetMethod get = new GetMethod("/new/sx.php");
>    httpclient.executeMethod(get);
>    System.out.println("result GET: " + get.getStatusLine().toString());
>
>    System.err.println(get.getResponseBodyAsString());
>
>    httpclient.endSession();
>
>  }
>
>  public static void main(String[] args) throws Exception {
>    SMSHTTP s = new SMSHTTP();
>    s.test5();
>  }
>
>}
>
>_________________________________________________________________
>Add photos to your messages with MSN 8. Get 2 months FREE*. 
>http://join.msn.com/?page=features/featuredemail
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message