what are the best APIs of java for Http web login? see my problem please.

my question is, what are the best APIs for http web login?

my problem is, i have developed an applet which connects to different websites and log me in, through https. i am using org.apache.commons.httpclient package and some other packages by apache, my code is working fine and i am successfull in the most websites, but in few i got problems, i want to dicuss it here and also i m sending my code and warnings i recieve.... here is my code.

HttpClient client = new HttpClient();

client.getState().setCredentials(

new AuthScope("http://www.cigna.com",443),

new UsernamePasswordCredentials( "adfafda", "dfdfdfdf" ) );

///////////////////////// First Request ///////////////////////////////////////

PostMethod req1 = new PostMethod("https://sso.corp.cigna.com/corp/sso/dlgprovider/forms/providerlogin.fcc?");

NameValuePair[] loginData = {

new NameValuePair("USERNAME", "avx"),

new NameValuePair("PASSWORD", "ssssss"),

new NameValuePair("TARGET", "https%3A%2F%2Fsso.corp.cigna.com%2Fcorp%2Fsso%2Fdlg%2Fprovider%2Fsecure%2Fcontroller%3Fcommand%3Dhomepage")

};

req1.setRequestBody();

try {

client.executeMethod(req1);

InputStream responseInputStream=req1.getResponseBodyAsStream();

BufferedReader rd = new BufferedReader(new InputStreamReader(responseInputStream));

String line;

StringBuffer response = new StringBuffer();

while ((line = rd.readLine()) != null) {

response.append(line);

}

rd.close();

File myFile = new File("D:/cignaResult1.html");

BufferedWriter fileOut = new BufferedWriter(new FileWriter(myFile));

fileOut.write(response.toString());

fileOut.close();

}

catch(HttpException he){ System.err.println("Exception:....."+he);}

catch(IOException ieo){ System.err.println("Exception:....."+ieo);}

catch(Exception e){System.err.println("Exception:....."+e);}

req1.releaseConnection();

***************************************

and i am getting these warning, that i did'nt seen in other weblogins.

WARNING: Cookie rejected: "$Version=0; FORMCRED=9z2ShgRx2pHuXYKdFvCSlVqskWULxxKu

M9qawtchAvg2A8K3CPz1kXWFX92wqerz3MQWFOa0KzuUd9Tjmn5WJ/obzk5UrdeKEWrbQBvg9fnAocmD

XHhgBF4D7iL/zZICggI0UMAVzgKzjNLpFPFYgQ==; $Path=/; $Domain=.cigna.com". Domain a

ttribute ".cigna.com" violates RFC 2109: host minus domain may not contain any dots

please tell me where i am wrong, and what should i do for this?

[2547 byte] By [iftikhar-4w-programmer-J2EEa] at [2007-10-3 4:25:47]
# 1

I dont think that the problem is in your code

That server is giving you a cookie that is not supporting the RFC specification

Are you able to login to cigna using a standard browser (not IE)?

Are you using the latest version of the apache api? When was this released?

Maybe it is not new and the RFC specification changed since that

Hope this helps

aranzugliaa at 2007-7-14 22:28:23 > top of Java-index,Core,Core APIs...
# 2

thanks aranzuglia for reply,

well i can login to cigna by using browser i tried so far (Mozila firefoz, IE both successfull).

And i am using the version releazed in 26 june 2006, that is 3.1-alpha1 .

and in docs i have read this support RFC 2109, but don't support RFC 2965, my warnings about RFC 2109.

i am recieving that warnings in some other website login, but there i am successfull , maybe the serverside code maintain the session using HttpSession or something like this and don't use cookies, but in cigna is i think different,

i am still worry about that problem, that is why i asked for anyother APIs, besides this i love these APIs and it works very fine, and i manage it very easily, any other suggestion? please tell me.

iftikhar-4w-programmer-J2EEa at 2007-7-14 22:28:23 > top of Java-index,Core,Core APIs...