You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Raja Pandian <r....@verchaska.com> on 2006/01/09 07:18:39 UTC
RE : Problem in down loading page
Hello Roland
The code used for reading from the stream was pasted below, I hope
this is correct
InputStream in = method2.getResponseBodyAsStream();
try {
InputStreamReader inR = new InputStreamReader( in );
BufferedReader buf = new BufferedReader(inR);
String line = buf.readLine();
while ( ( line = buf.readLine() ) != null ) {
System.out.println( line );
}
} finally {
in.close();
}
If this is correct is there any possibility of not getting the expected
result.Thank you.
regards
rajapandian.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Problem in down loading page, solved, Thank You
Posted by Raja Pandian <r....@verchaska.com>.
dear Oleg, Roland and all.
I am able to get the expected response page by sending the request
parameters as a request body.
Thank you very much.
regards
rajapandian.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: RE : Problem in down loading page
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2006-01-11 at 13:19 +0530, Raja Pandian wrote:
> Dear Roland,
>
> I have pasted the source code and log file below, please have a
> look. The sample i have tried results in an unexpected page, please go
> through the log and source, give me the way to resolve this.
>
Try sending the request parameters as a request body instead of a URI
query.
Oleg
> Wire Log
> ************************************************************************************
> DEBUG [httpclient.wire.header] >> "POST
> /air/search_result.asp?txt_child=0&year1=2006&year0=2006&search_days=365&DepartDate=29%2F01%2F2006&depart_date=01%2F29%2F2006&mon_abbr.1=01&mon_abbr.0=01&flagfare=O§or_diff=14400000&schedule_period=3888000000&max_seats=180&cmb_originCity=BOM&return_date=&txt_infant=0&str_class=A&txt_adult=1&rd_trip=+O&cmb_destCity=GOI&date.1=11&date.0=29&booking_period=31536000000&ReturnDate=11%2F01%2F2006¤t_date=11%2F01%2F2006
> 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: 0[\r][\n]"
> DEBUG [httpclient.wire.header] >> "[\r][\n]"
> DEBUG [httpclient.wire.header] << "HTTP/1.1 100 Continue[\r][\n]"
> DEBUG [httpclient.wire.header] << "Date: Wed, 11 Jan 2006 07:24:55
> 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: Wed, 11 Jan 2006 07:25:26
> GMT[\r][\n]"
> DEBUG [httpclient.wire.header] << "Content-Length: 1675[\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=&pchild=&padus=&pclass=&preturndate=&pdepartdate=&pdestcity=&flagfare=&porigincity=&cookie=enabled;
> expires=Thu, 12-Jan-2006 07:25:04 GMT; path=/[\r][\n]"
> DEBUG [httpclient.wire.header] << "Set-Cookie:
> ASPSESSIONIDCQBSSATC=FDHAFHFCOAPDJLIMKCGPMKIC; path=/[\r][\n]"
> DEBUG [httpclient.wire.header] << "Via: 1.1 mum-cac01 (NetCache
> NetApp/6.0)[\r][\n]"
> DEBUG [httpclient.wire.content] << "<Script>[\r][\n]"
> DEBUG [httpclient.wire.content] << "[\r][\n]"
> DEBUG [httpclient.wire.content] << "if
> (navigator.appName=='Netscape'){browser='NS';} [\r][\n]"
> DEBUG [httpclient.wire.content] << "if (navigator.appName=='Microsoft
> Internet Explorer'){browser='MSIE';} [\r][\n]"
> DEBUG [httpclient.wire.content] << "[\r][\n]"
> DEBUG [httpclient.wire.content] << "function StatusBar_Hide(obj){ [\r][\n]"
> DEBUG [httpclient.wire.content] << " var loc , func;[\r][\n]"
> DEBUG [httpclient.wire.content] << "
> while(obj.tagName.toUpperCase()!="A") obj=obj.parentElement;[\r][\n]"
> DEBUG [httpclient.wire.content] << " func =
> obj.getAttribute("link");[\r][\n]"
> DEBUG [httpclient.wire.content] << " loc = func.search("http://");[\r][\n]"
> DEBUG [httpclient.wire.content] << " if(loc!=-1)[\r][\n]"
> DEBUG [httpclient.wire.content] << " window.navigate(func);[\r][\n]"
> DEBUG [httpclient.wire.content] << " else[\r][\n]"
> DEBUG [httpclient.wire.content] << " eval(func);[\r][\n]"
> DEBUG [httpclient.wire.content] << " return false;[\r][\n]"
> DEBUG [httpclient.wire.content] << "}[\r][\n]"
> DEBUG [httpclient.wire.content] << "</script>[\r][\n]"
> DEBUG [httpclient.wire.content] << "[\r][\n]"
> DEBUG [httpclient.wire.content] << "<script for="document"
> event="onreadystatechange">[\r][\n]"
> DEBUG [httpclient.wire.content] << "if(browser=='MSIE'){[\r][\n]"
> DEBUG [httpclient.wire.content] << "var colanchor="";[\r][\n]"
> DEBUG [httpclient.wire.content] << "if(readyState=="complete") {[\r][\n]"
> DEBUG [httpclient.wire.content] << " colanchor =
> document.getElementsByTagName("A");[\r][\n]"
> DEBUG [httpclient.wire.content] << "
> for(i=0;i<colanchor.length;i++){[\r][\n]"
> DEBUG [httpclient.wire.content] << "[0x9]anc = colanchor[i];[\r][\n]"
> DEBUG [httpclient.wire.content] <<
> "[0x9]href=anc.getAttribute("href");[\r][\n]"
> DEBUG [httpclient.wire.content] <<
> "[0x9]anc.setAttribute("link",href);[\r][\n]"
> DEBUG [httpclient.wire.content] <<
> "[0x9]anc.setAttribute("href","javascript:void(0);");[\r][\n]"
> DEBUG [httpclient.wire.content] <<
> "[0x9]anc.attachEvent("onmouseover",function
> hideit(){window.status="";return true;});[\r][\n]"
> DEBUG [httpclient.wire.content] <<
> "[0x9]anc.attachEvent("onmouseout",function
> hideit(){window.status="";return true;});[\r][\n]"
> DEBUG [httpclient.wire.content] <<
> "//[0x9]anc.attachEvent("onclick",function
> ctidy(){alert((window.event.srcElement).getAttribute("link"));return
> true;});[\r][\n]"
> DEBUG [httpclient.wire.content] <<
> "[0x9]anc.attachEvent("onclick",function
> tup(){return(StatusBar_Hide(window.event.srcElement));});[\r][\n]"
> DEBUG [httpclient.wire.content] << " }[\r][\n]"
> DEBUG [httpclient.wire.content] << " }[\r][\n]"
> DEBUG [httpclient.wire.content] << "}[\r][\n]"
> DEBUG [httpclient.wire.content] << "</script>[\r][\n]"
> DEBUG [httpclient.wire.content] << "[\r][\n]"
> DEBUG [httpclient.wire.content] << "[\r][\n]"
> DEBUG [httpclient.wire.content] << "<Script>[\r][\n]"
> DEBUG [httpclient.wire.content] << "if(browser=='NS'){[\r][\n]"
> DEBUG [httpclient.wire.content] << "
> document.captureEvents(Event.MOUSEOVER);[\r][\n]"
> DEBUG [httpclient.wire.content] << "
> document.onmouseover=function(event) {[\r][\n]"
> DEBUG [httpclient.wire.content] << " window.status = "";[\r][\n]"
> DEBUG [httpclient.wire.content] << " return(true);[\r][\n]"
> DEBUG [httpclient.wire.content] << " }[\r][\n]"
> DEBUG [httpclient.wire.content] << "}[\r][\n]"
> DEBUG [httpclient.wire.content] << "</script>[\r][\n]"
> DEBUG [httpclient.wire.content] << "<!--include
> file="../includes/onError.inc"-->[\r][\n]"
> DEBUG [httpclient.wire.content] << "<form name="form"
> method="post">[\r][\n]"
> DEBUG [httpclient.wire.content] << "[0x9]<input type="hidden"
> name="ErrorCode" value="AVAIL01">[\r][\n]"
> DEBUG [httpclient.wire.content] << "[0x9]<input type="hidden"
> name="ErrorDesc" value="No availibilty found">[\r][\n]"
> DEBUG [httpclient.wire.content] << "</form>[\r][\n]"
> DEBUG [httpclient.wire.content] << "[\r][\n]"
> DEBUG [httpclient.wire.content] << "[0x9]<script
> language="javascript">[\r][\n]"
> DEBUG [httpclient.wire.content] <<
> "[0x9][0x9]document.form.action="../air/ErrorScreen.asp";[\r][\n]"
> DEBUG [httpclient.wire.content] <<
> "[0x9][0x9]document.form.submit();[\r][\n]"
> DEBUG [httpclient.wire.content] << "[0x9]</script>[\r][\n]"
> *************************************************************************************************
> The source is
>
> package com.vtech.prod.robosurf.AirDeccan;
>
> import gnu.java.net.protocol.http.HTTPConnection;
> import gnu.java.net.protocol.http.Headers;
>
> import java.awt.HeadlessException;
> import java.io.BufferedReader;
> import java.io.FileInputStream;
> import java.io.FileOutputStream;
> import java.io.IOException;
> import java.io.InputStream;
> import java.io.InputStreamReader;
> import java.rmi.MarshalException;
>
> import org.apache.commons.httpclient.*;
> import org.apache.commons.httpclient.cookie.CookiePolicy;
> import org.apache.commons.httpclient.methods.GetMethod;
> import org.apache.commons.httpclient.methods.PostMethod;
> import org.apache.commons.httpclient.methods.PutMethod;
> import org.apache.commons.httpclient.params.HttpMethodParams;
>
> public class BackUp {
>
>
>
> public static void main(String[] args) throws IOException,
> HeadlessException {
>
> HttpClient client = new HttpClient();
>
>
> try{
>
>
> HttpMethod method2 = new
> PostMethod("http://www.airdeccan.net/air/search_result.asp");
>
> NameValuePair nvp1 = new NameValuePair("txt_child","0");
> NameValuePair nvp2 = new NameValuePair("year1","2006");
> NameValuePair nvp3 = new NameValuePair("year0","2006");
> NameValuePair nvp4 = new NameValuePair("search_days","365");
> NameValuePair nvp5 = new
> NameValuePair("DepartDate","29/01/2006");
> NameValuePair nvp6 = new
> NameValuePair("depart_date","01/29/2006");
> NameValuePair nvp7 = new NameValuePair("mon_abbr.1","01");
> NameValuePair nvp8 = new NameValuePair("mon_abbr.0","01");
> NameValuePair nvp9 = new NameValuePair("flagfare","O");
> NameValuePair nvp10 = new
> NameValuePair("sector_diff","14400000");
> NameValuePair nvp11 = new
> NameValuePair("schedule_period","3888000000");
> NameValuePair nvp12 = new NameValuePair("max_seats","180");
> NameValuePair nvp13 = new NameValuePair("cmb_originCity","BOM");
> NameValuePair nvp14 = new NameValuePair("return_date","");
> NameValuePair nvp15 = new NameValuePair("txt_infant","0");
> NameValuePair nvp16 = new NameValuePair("str_class","A");
> NameValuePair nvp17 = new NameValuePair("txt_adult","1");
> NameValuePair nvp18 = new NameValuePair("rd_trip"," O");
> NameValuePair nvp19 = new NameValuePair("cmb_destCity","GOI");
> NameValuePair nvp20 = new NameValuePair("date.1","11");
> NameValuePair nvp21 = new NameValuePair("date.0","29");
> NameValuePair nvp22 = new
> NameValuePair("booking_period","31536000000");
> NameValuePair nvp23 = new
> NameValuePair("ReturnDate","11/01/2006");
> NameValuePair nvp24 = new
> NameValuePair("current_date","11/01/2006");
>
> method2.setQueryString(new
> NameValuePair[]{nvp1,nvp2,nvp3,nvp4,nvp5,nvp6,nvp7,nvp8,nvp9,nvp10,
>
> nvp11,nvp12,nvp13,nvp14,nvp15,nvp16,nvp17,nvp18,nvp19,nvp20,
>
> nvp21,nvp22,nvp23,nvp24});
>
> int statusCode2 = client.executeMethod(method2);
>
> InputStream in = method2.getResponseBodyAsStream();
> try {
> InputStreamReader inR = new InputStreamReader( in );
> BufferedReader buf = new BufferedReader( inR );
> String line;
> while ( ( line = buf.readLine() ) != null ) {
> System.out.println( line );
> }
> } finally {
> in.close();
> }
>
> method2.releaseConnection();
> System.out.println(statusCode2);
> }
> catch(IOException e) {
> e.printStackTrace();
> }
>
> }
> }
> *****************************************************************
>
> thank you
>
> regards,
> rajapandian.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: RE : Problem in down loading page
Posted by Raja Pandian <r....@verchaska.com>.
Dear Roland,
I have pasted the source code and log file below, please have a
look. The sample i have tried results in an unexpected page, please go
through the log and source, give me the way to resolve this.
Wire Log
************************************************************************************
DEBUG [httpclient.wire.header] >> "POST
/air/search_result.asp?txt_child=0&year1=2006&year0=2006&search_days=365&DepartDate=29%2F01%2F2006&depart_date=01%2F29%2F2006&mon_abbr.1=01&mon_abbr.0=01&flagfare=O§or_diff=14400000&schedule_period=3888000000&max_seats=180&cmb_originCity=BOM&return_date=&txt_infant=0&str_class=A&txt_adult=1&rd_trip=+O&cmb_destCity=GOI&date.1=11&date.0=29&booking_period=31536000000&ReturnDate=11%2F01%2F2006¤t_date=11%2F01%2F2006
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: 0[\r][\n]"
DEBUG [httpclient.wire.header] >> "[\r][\n]"
DEBUG [httpclient.wire.header] << "HTTP/1.1 100 Continue[\r][\n]"
DEBUG [httpclient.wire.header] << "Date: Wed, 11 Jan 2006 07:24:55
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: Wed, 11 Jan 2006 07:25:26
GMT[\r][\n]"
DEBUG [httpclient.wire.header] << "Content-Length: 1675[\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=&pchild=&padus=&pclass=&preturndate=&pdepartdate=&pdestcity=&flagfare=&porigincity=&cookie=enabled;
expires=Thu, 12-Jan-2006 07:25:04 GMT; path=/[\r][\n]"
DEBUG [httpclient.wire.header] << "Set-Cookie:
ASPSESSIONIDCQBSSATC=FDHAFHFCOAPDJLIMKCGPMKIC; path=/[\r][\n]"
DEBUG [httpclient.wire.header] << "Via: 1.1 mum-cac01 (NetCache
NetApp/6.0)[\r][\n]"
DEBUG [httpclient.wire.content] << "<Script>[\r][\n]"
DEBUG [httpclient.wire.content] << "[\r][\n]"
DEBUG [httpclient.wire.content] << "if
(navigator.appName=='Netscape'){browser='NS';} [\r][\n]"
DEBUG [httpclient.wire.content] << "if (navigator.appName=='Microsoft
Internet Explorer'){browser='MSIE';} [\r][\n]"
DEBUG [httpclient.wire.content] << "[\r][\n]"
DEBUG [httpclient.wire.content] << "function StatusBar_Hide(obj){ [\r][\n]"
DEBUG [httpclient.wire.content] << " var loc , func;[\r][\n]"
DEBUG [httpclient.wire.content] << "
while(obj.tagName.toUpperCase()!="A") obj=obj.parentElement;[\r][\n]"
DEBUG [httpclient.wire.content] << " func =
obj.getAttribute("link");[\r][\n]"
DEBUG [httpclient.wire.content] << " loc = func.search("http://");[\r][\n]"
DEBUG [httpclient.wire.content] << " if(loc!=-1)[\r][\n]"
DEBUG [httpclient.wire.content] << " window.navigate(func);[\r][\n]"
DEBUG [httpclient.wire.content] << " else[\r][\n]"
DEBUG [httpclient.wire.content] << " eval(func);[\r][\n]"
DEBUG [httpclient.wire.content] << " return false;[\r][\n]"
DEBUG [httpclient.wire.content] << "}[\r][\n]"
DEBUG [httpclient.wire.content] << "</script>[\r][\n]"
DEBUG [httpclient.wire.content] << "[\r][\n]"
DEBUG [httpclient.wire.content] << "<script for="document"
event="onreadystatechange">[\r][\n]"
DEBUG [httpclient.wire.content] << "if(browser=='MSIE'){[\r][\n]"
DEBUG [httpclient.wire.content] << "var colanchor="";[\r][\n]"
DEBUG [httpclient.wire.content] << "if(readyState=="complete") {[\r][\n]"
DEBUG [httpclient.wire.content] << " colanchor =
document.getElementsByTagName("A");[\r][\n]"
DEBUG [httpclient.wire.content] << "
for(i=0;i<colanchor.length;i++){[\r][\n]"
DEBUG [httpclient.wire.content] << "[0x9]anc = colanchor[i];[\r][\n]"
DEBUG [httpclient.wire.content] <<
"[0x9]href=anc.getAttribute("href");[\r][\n]"
DEBUG [httpclient.wire.content] <<
"[0x9]anc.setAttribute("link",href);[\r][\n]"
DEBUG [httpclient.wire.content] <<
"[0x9]anc.setAttribute("href","javascript:void(0);");[\r][\n]"
DEBUG [httpclient.wire.content] <<
"[0x9]anc.attachEvent("onmouseover",function
hideit(){window.status="";return true;});[\r][\n]"
DEBUG [httpclient.wire.content] <<
"[0x9]anc.attachEvent("onmouseout",function
hideit(){window.status="";return true;});[\r][\n]"
DEBUG [httpclient.wire.content] <<
"//[0x9]anc.attachEvent("onclick",function
ctidy(){alert((window.event.srcElement).getAttribute("link"));return
true;});[\r][\n]"
DEBUG [httpclient.wire.content] <<
"[0x9]anc.attachEvent("onclick",function
tup(){return(StatusBar_Hide(window.event.srcElement));});[\r][\n]"
DEBUG [httpclient.wire.content] << " }[\r][\n]"
DEBUG [httpclient.wire.content] << " }[\r][\n]"
DEBUG [httpclient.wire.content] << "}[\r][\n]"
DEBUG [httpclient.wire.content] << "</script>[\r][\n]"
DEBUG [httpclient.wire.content] << "[\r][\n]"
DEBUG [httpclient.wire.content] << "[\r][\n]"
DEBUG [httpclient.wire.content] << "<Script>[\r][\n]"
DEBUG [httpclient.wire.content] << "if(browser=='NS'){[\r][\n]"
DEBUG [httpclient.wire.content] << "
document.captureEvents(Event.MOUSEOVER);[\r][\n]"
DEBUG [httpclient.wire.content] << "
document.onmouseover=function(event) {[\r][\n]"
DEBUG [httpclient.wire.content] << " window.status = "";[\r][\n]"
DEBUG [httpclient.wire.content] << " return(true);[\r][\n]"
DEBUG [httpclient.wire.content] << " }[\r][\n]"
DEBUG [httpclient.wire.content] << "}[\r][\n]"
DEBUG [httpclient.wire.content] << "</script>[\r][\n]"
DEBUG [httpclient.wire.content] << "<!--include
file="../includes/onError.inc"-->[\r][\n]"
DEBUG [httpclient.wire.content] << "<form name="form"
method="post">[\r][\n]"
DEBUG [httpclient.wire.content] << "[0x9]<input type="hidden"
name="ErrorCode" value="AVAIL01">[\r][\n]"
DEBUG [httpclient.wire.content] << "[0x9]<input type="hidden"
name="ErrorDesc" value="No availibilty found">[\r][\n]"
DEBUG [httpclient.wire.content] << "</form>[\r][\n]"
DEBUG [httpclient.wire.content] << "[\r][\n]"
DEBUG [httpclient.wire.content] << "[0x9]<script
language="javascript">[\r][\n]"
DEBUG [httpclient.wire.content] <<
"[0x9][0x9]document.form.action="../air/ErrorScreen.asp";[\r][\n]"
DEBUG [httpclient.wire.content] <<
"[0x9][0x9]document.form.submit();[\r][\n]"
DEBUG [httpclient.wire.content] << "[0x9]</script>[\r][\n]"
*************************************************************************************************
The source is
package com.vtech.prod.robosurf.AirDeccan;
import gnu.java.net.protocol.http.HTTPConnection;
import gnu.java.net.protocol.http.Headers;
import java.awt.HeadlessException;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.rmi.MarshalException;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.cookie.CookiePolicy;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.httpclient.params.HttpMethodParams;
public class BackUp {
public static void main(String[] args) throws IOException,
HeadlessException {
HttpClient client = new HttpClient();
try{
HttpMethod method2 = new
PostMethod("http://www.airdeccan.net/air/search_result.asp");
NameValuePair nvp1 = new NameValuePair("txt_child","0");
NameValuePair nvp2 = new NameValuePair("year1","2006");
NameValuePair nvp3 = new NameValuePair("year0","2006");
NameValuePair nvp4 = new NameValuePair("search_days","365");
NameValuePair nvp5 = new
NameValuePair("DepartDate","29/01/2006");
NameValuePair nvp6 = new
NameValuePair("depart_date","01/29/2006");
NameValuePair nvp7 = new NameValuePair("mon_abbr.1","01");
NameValuePair nvp8 = new NameValuePair("mon_abbr.0","01");
NameValuePair nvp9 = new NameValuePair("flagfare","O");
NameValuePair nvp10 = new
NameValuePair("sector_diff","14400000");
NameValuePair nvp11 = new
NameValuePair("schedule_period","3888000000");
NameValuePair nvp12 = new NameValuePair("max_seats","180");
NameValuePair nvp13 = new NameValuePair("cmb_originCity","BOM");
NameValuePair nvp14 = new NameValuePair("return_date","");
NameValuePair nvp15 = new NameValuePair("txt_infant","0");
NameValuePair nvp16 = new NameValuePair("str_class","A");
NameValuePair nvp17 = new NameValuePair("txt_adult","1");
NameValuePair nvp18 = new NameValuePair("rd_trip"," O");
NameValuePair nvp19 = new NameValuePair("cmb_destCity","GOI");
NameValuePair nvp20 = new NameValuePair("date.1","11");
NameValuePair nvp21 = new NameValuePair("date.0","29");
NameValuePair nvp22 = new
NameValuePair("booking_period","31536000000");
NameValuePair nvp23 = new
NameValuePair("ReturnDate","11/01/2006");
NameValuePair nvp24 = new
NameValuePair("current_date","11/01/2006");
method2.setQueryString(new
NameValuePair[]{nvp1,nvp2,nvp3,nvp4,nvp5,nvp6,nvp7,nvp8,nvp9,nvp10,
nvp11,nvp12,nvp13,nvp14,nvp15,nvp16,nvp17,nvp18,nvp19,nvp20,
nvp21,nvp22,nvp23,nvp24});
int statusCode2 = client.executeMethod(method2);
InputStream in = method2.getResponseBodyAsStream();
try {
InputStreamReader inR = new InputStreamReader( in );
BufferedReader buf = new BufferedReader( inR );
String line;
while ( ( line = buf.readLine() ) != null ) {
System.out.println( line );
}
} finally {
in.close();
}
method2.releaseConnection();
System.out.println(statusCode2);
}
catch(IOException e) {
e.printStackTrace();
}
}
}
*****************************************************************
thank you
regards,
rajapandian.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: RE : Problem in down loading page
Posted by Roland Weber <ht...@dubioso.net>.
Hello Rajapandian,
> InputStream in = method2.getResponseBodyAsStream();
> try {
>
> InputStreamReader inR = new InputStreamReader( in );
> BufferedReader buf = new BufferedReader(inR);
> String line = buf.readLine();
> while ( ( line = buf.readLine() ) != null ) {
> System.out.println( line );
> }
> } finally {
> in.close();
> }
That looks all right, except for the InputStreamReader which is created
with the default character set instead of the character set indicated by
the server for the document. Depending on the character set of the document
and your system default settings, this may or may not cause a problem in
detecting the end of the stream. Could there be an exception from a failed
character conversion that cancels your loop unexpectedly?
Have you tried to call method2.getResponseBodyAsString() for comparison?
If that returns what you expect, the problem is hidden somewhere within
your stack of readers. If it returns the same truncated result, we'll have
to dig into the HTTP communication. In that case, please provide a wire log
of the communication. See here for logging details:
http://jakarta.apache.org/commons/httpclient/logging.html
cheers,
Roland
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org