Home arrow static arrow Java Programming [Archive] - [httpclient] Earn duke dollars easily ;-)
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - [httpclient] Earn duke dollars easily ;-)
10 Duke Stars available
This topic has 8 replies on 1 page.

Posts:7
Registered: 7/9/04
[httpclient] Earn duke dollars easily ;-)  
Jul 19, 2004 1:53 AM



 
Hello everybody,

How can I accept every cookie using the httpclient API ?

Here is the warning message I get when I download an Altavista source code :

19 juil. 2004 10:39:53 org.apache.commons.httpclient.HttpMethodBase processResponseHeaders
ATTENTION: Cookie rejected: "B=600d0a50fn273&b=2". Illegal domain attribute ".yahoo.com". Domain of origin: "fr.altavista.com"

Thank you for advance

Mathias
 

Posts:392
Registered: 3/7/03
Re: [httpclient] Earn duke dollars easily ;-)  
Jul 19, 2004 2:13 AM (reply 1 of 8)



 
http://www.innovation.ch/java/HTTPClient/advanced_info.html
try this :)
 

Posts:49
Registered: 6/17/04
Re: [httpclient] Earn duke dollars easily ;-)  
Jul 19, 2004 2:42 AM (reply 2 of 8)



 
Have you tried what he/she said above......... {:o))>
 

Posts:7
Registered: 7/9/04
Re: [httpclient] Earn duke dollars easily ;-)  
Jul 19, 2004 2:46 AM (reply 3 of 8)



 
I'm trying it

Here is my code :

System.getProperties().setProperty("httpclient.useragent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows XP)");
System.setProperty("apache.commons.httpclient.cookiespec", "COMPATIBILITY");
HttpClient client = new HttpClient();

HttpMethod method = new GetMethod(adresse);
method.setRequestHeader("Accept-Language","fr");
method.setRequestHeader("Accept-Charset", "UTF-8");

Where should I put setCookiePolicyHandler(null) ?
The class HttpClient.CookieModule seems not to be recognized :-(
 

Posts:7
Registered: 7/9/04
Re: [httpclient] Earn duke dollars easily ;-)  
Jul 19, 2004 3:11 AM (reply 4 of 8)



 
I've tryed this :

System.setProperty("httplient.cookies.hosts.accept", ".yahoo.com");

But I still have the same error message
 

Posts:319
Registered: 11/8/00
Re: [httpclient] Earn duke dollars easily ;-)  
Jul 19, 2004 3:44 AM (reply 5 of 8)



 
Have you read the info on Jakarta's site?
http://jakarta.apache.org/commons/httpclient/cookies.html

Note: HTTPClient does't currently support version 2 cookies, this might be your problem
 

Posts:2,830
Registered: 9/1/03
Re: [httpclient] Earn duke dollars easily ;-)  
Jul 19, 2004 3:45 AM (reply 6 of 8)



 
I've tryed this :

System.setProperty("httplient.cookies.hosts.accept",
".yahoo.com");

But I still have the same error message

It is not a valid cookie - it is trying to suggest it is from a domain that
it isn't really from.

What are you trying to do ? Are you writing the cookie or receiving it ?
Does your standard browser accept it ?

 

Posts:7
Registered: 7/9/04
Re: [httpclient] Earn duke dollars easily ;-)  
Jul 19, 2004 5:04 AM (reply 7 of 8)



 
It is not a valid cookie - it is trying to suggest it is from a domain that
it isn't really from.
What are you trying to do ? Are you writing the cookie or receiving it ?
Does your standard browser accept it ?

I'm trying to retreive an Altavista result page.
Altavista has recently been bought by Yahoo Corp.
That's why when you do a request on altavista.com, you're redirected to yahoo.com (who puts a cookie) and again to altavista.com (which is also defining a cookie)

No problem for a standard browser, but the "redirection+cookie" milkshake seems to be fatal for appache httpclient API.

Have you read the info on Jakarta's site?
http://jakarta.apache.org/commons/httpclient/cookies.html
Note: HTTPClient does't currently support version 2 cookies, this might be your problem

Yes, of course, but there's nothing about accepting any cookie without validation, and that's what I want to do.

Mathias
 

Posts:7
Registered: 7/9/04
Re: [httpclient] Earn duke dollars easily ;-)  
Jul 19, 2004 7:10 AM (reply 8 of 8)



 
Any idea ?
 
This topic has 8 replies on 1 page.