Hello Raja,
> i tried by sending a single cookie header,this time the response code
> is HTTP/1.1 302 Object moved
THat's what you need. Get the value of the Location header, if necessary
resolve the relative URL to an absolute one, and fetch the document with
a GET request.
> i also tried the sam with GetMethod , the redirect page was
What do you mean, "the same"? You can't send a request entity with a
GET request.
> /air/Index.asp and the status code was HTTP/1.1 404 Object Not Found
> I am not able to get the expected page., I paste the code and the log
> file.please have a look.
>
> String str1 = new String();
> String headervalue =
> method2.getResponseHeader("Set-Cookie").toExternalForm() ;
> StringTokenizer headervalue1 = new
> StringTokenizer(headervalue);
> while(headervalue1.hasMoreElements())
>
> PostMethod method3 = new
> PostMethod("http://www.airdeccan.net/air/Select_Flight.asp");
> method3.addRequestHeader("Content-Type","text/html");
> method3.addRequestHeader("charset","iso-8859-1");
>
> method3.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
> //method3.setRequestHeader("Cookie", str1);
> method3.setRequestHeader("Cookie",
>
"igtsAirDeccan=pinfant=0&pchild=0&padus=1&pclass=A&preturndate=&pdepartdate=01%
> 2F29%2F2006&pdestcity=GOI&flagfare=O&porigincity=BOM&cookie=enabled");
> int statueCode3 = client.executeMethod(method3);
Do NOT set Cookie headers, nor try to parse Set-Cookie headers!
HttpClient handles cookies. If there are problems with cookies
set an appropriate Cookie Spec ("browser compatibility").
>
===================================================================================================================
> WIRE LOG; When using PostMethod
>
==============================================================================================================
> DEBUG [httpclient.wire.header] >> "POST /air/search_result.asp
> HTTP/1.1[\r][\n]"
> DEBUG [httpclient.wire.header] >> "User-Agent: Jakarta
> Commons-HttpClient/3.0[\r][\n]"
> DEBUG [httpclient.wire.header] >> "Host: www.airdeccan.net[\r][\n]"
> DEBUG [httpclient.wire.header] >> "Content-Length: 401[\r][\n]"
> DEBUG [httpclient.wire.header] >> "Content-Type:
> application/x-www-form-urlencoded[\r][\n]"
> DEBUG [httpclient.wire.header] >> "[\r][\n]"
> DEBUG [httpclient.wire.header] << "HTTP/1.1 100 Continue[\r][\n]"
> DEBUG [httpclient.wire.header] << "Date: Tue, 17 Jan 2006 14:00:37
> GMT[\r][\n]"
> DEBUG [httpclient.wire.header] << "Server: Microsoft-IIS/5.0[\r][\n]"
> DEBUG [httpclient.wire.header] << "X-Powered-By: ASP.NET[\r][\n]"
> DEBUG [httpclient.wire.header] << "Via: 1.1 mum-cac01 (NetCache
> NetApp/6.0)[\r][\n]"
> DEBUG [httpclient.wire.header] << "HTTP/1.1 200 OK[\r][\n]"
> DEBUG [httpclient.wire.header] << "Date: Tue, 17 Jan 2006 14:00:37
> GMT[\r][\n]"
> DEBUG [httpclient.wire.header] << "Content-Length: 16780[\r][\n]"
> DEBUG [httpclient.wire.header] << "Content-Type: text/html[\r][\n]"
> DEBUG [httpclient.wire.header] << "Cache-Control: private[\r][\n]"
> DEBUG [httpclient.wire.header] << "Server: Microsoft-IIS/5.0[\r][\n]"
> DEBUG [httpclient.wire.header] << "X-Powered-By: ASP.NET[\r][\n]"
> DEBUG [httpclient.wire.header] << "Set-Cookie:
>
igtsAirDeccan=pinfant=0&pchild=0&padus=1&pclass=A&preturndate=&pdepartdate=01%
> 2F29%2F2006&pdestcity=GOI&flagfare=O&porigincity=BOM&cookie=enabled;
> expires=Wed, 18-Jan-2006 14:01:30 GMT; path=/[\r][\n]"
> DEBUG [httpclient.wire.header] << "Set-Cookie:
> ASPSESSIONIDQQRCDTDS=MLPHMAABKHFGNOAGNOMOPDIL; path=/[\r][\n]"
> DEBUG [httpclient.wire.header] << "Via: 1.1 mum-cac01 (NetCache
> NetApp/6.0)[\r][\n]"
> DEBUG [httpclient.wire.header] >> "POST /air/Select_Flight.asp
> HTTP/1.1[\r][\n]"
> DEBUG [httpclient.wire.header] >> "Content-Type: text/html[\r][\n]"
> DEBUG [httpclient.wire.header] >> "charset: iso-8859-1[\r][\n]"
> DEBUG [httpclient.wire.header] >> "Cookie:
>
igtsAirDeccan=pinfant=0&pchild=0&padus=1&pclass=A&preturndate=&pdepartdate=01%
>
2F29%2F2006&pdestcity=GOI&flagfare=O&porigincity=BOM&cookie=enabled[\r][\n]"
> DEBUG [httpclient.wire.header] >> "User-Agent: Jakarta
> Commons-HttpClient/3.0[\r][\n]"
> DEBUG [httpclient.wire.header] >> "Host: www.airdeccan.net[\r][\n]"
> DEBUG [httpclient.wire.header] >> "Content-Length: 824[\r][\n]"
> DEBUG [httpclient.wire.header] >> "[\r][\n]"
> DEBUG [httpclient.wire.header] << "HTTP/1.1 100 Continue[\r][\n]"
> DEBUG [httpclient.wire.header] << "Date: Tue, 17 Jan 2006 14:00:38
> GMT[\r][\n]"
> DEBUG [httpclient.wire.header] << "Server: Microsoft-IIS/5.0[\r][\n]"
> DEBUG [httpclient.wire.header] << "X-Powered-By: ASP.NET[\r][\n]"
> DEBUG [httpclient.wire.header] << "Via: 1.1 mum-cac01 (NetCache
> NetApp/6.0)[\r][\n]"
> DEBUG [httpclient.wire.header] << "HTTP/1.1 302 Object moved[\r][\n]"
> DEBUG [httpclient.wire.header] << "Date: Tue, 17 Jan 2006 14:00:38
> GMT[\r][\n]"
> DEBUG [httpclient.wire.header] << "Content-Length: 121[\r][\n]"
> DEBUG [httpclient.wire.header] << "Content-Type: text/html[\r][\n]"
> DEBUG [httpclient.wire.header] << "Cache-Control: private[\r][\n]"
> DEBUG [httpclient.wire.header] << "Server: Microsoft-IIS/5.0[\r][\n]"
> DEBUG [httpclient.wire.header] << "X-Powered-By: ASP.NET[\r][\n]"
> DEBUG [httpclient.wire.header] << "Set-Cookie:
> ASPSESSIONIDQQRCDTDS=OLPHMAABIBGCKGDEEMEKFDEC; path=/[\r][\n]"
> DEBUG [httpclient.wire.header] << "Location: Index.asp[\r][\n]"
> DEBUG [httpclient.wire.header] << "Via: 1.1 mum-cac01 (NetCache
> NetApp/6.0)[\r][\n]"
Send a GET to http://whatever.your.host/Index.asp
hope that helps,
Roland
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]