commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Caramia" <a_cara...@hotmail.com>
Subject RE: [httpclient] session after autentication
Date Mon, 13 Oct 2003 13:05:14 GMT
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


Mime
View raw message