hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juanjo" <juanjog...@telefonica.net>
Subject RE: redirection in 4.0
Date Tue, 10 Nov 2009 17:36:20 GMT
Hi Oleg, thanks for your answer.

These are the diferences
Number 2 under windows is running fine. 
The code is the same in boths environment but in the log, there is a
diference in the order that postparams are sent.

┬┐any ideas?

Thanks


STACK NUMBER 1- LINUX

DEBUG http-8080-17 org.apache.http.impl.client.DefaultRequestDirector -
Attempt 1 to execute request
DEBUG http-8080-17 org.apache.http.impl.conn.DefaultClientConnection -
Sending request: POST /posturl HTTP/1.1
DEBUG http-8080-17 org.apache.http.wire - >> "POST /posturl HTTP/1.1[EOL]"
DEBUG http-8080-17 org.apache.http.wire - >> "Content-Length: 474[EOL]"
DEBUG http-8080-17 org.apache.http.wire - >> "Content-Type:
application/x-www-form-urlencoded[EOL]"
DEBUG http-8080-17 org.apache.http.wire - >> "Host: www.web.com[EOL]"
DEBUG http-8080-17 org.apache.http.wire - >> "Connection: Keep-Alive[EOL]"
DEBUG http-8080-17 org.apache.http.wire - >> "User-Agent:
Apache-HttpClient/4.0 (java 1.5)[EOL]"
DEBUG http-8080-17 org.apache.http.wire - >> "Expect: 100-Continue[EOL]"
DEBUG http-8080-17 org.apache.http.wire - >> "Cookie:
JSESSIONID=0001G-b2dgLkoDiImRI5ktlH-RV:12kcoiifm; systemKey=www.web.com;
DC-Cookie=DC2[EOL]"
DEBUG http-8080-17 org.apache.http.wire - >> "Cookie2: $Version=1[EOL]"
DEBUG http-8080-17 org.apache.http.wire - >> "[EOL]"
DEBUG http-8080-17 org.apache.http.headers - >> POST /posturl HTTP/1.1
DEBUG http-8080-17 org.apache.http.headers - >> Content-Length: 474
DEBUG http-8080-17 org.apache.http.headers - >> Content-Type:
application/x-www-form-urlencoded
DEBUG http-8080-17 org.apache.http.headers - >> Host: www.web.com
DEBUG http-8080-17 org.apache.http.headers - >> Connection: Keep-Alive
DEBUG http-8080-17 org.apache.http.headers - >> User-Agent:
Apache-HttpClient/4.0 (java 1.5)
DEBUG http-8080-17 org.apache.http.headers - >> Expect: 100-Continue
DEBUG http-8080-17 org.apache.http.headers - >> Cookie:
JSESSIONID=0001G-b2dgLkoDiImRI5ktlH-RV:12kcoiifm; systemKey=www.web.com;
DC-Cookie=DC2
DEBUG http-8080-17 org.apache.http.headers - >> Cookie2: $Version=1
DEBUG http-8080-17 org.apache.http.wire - << "HTTP/1.1 100 Continue[EOL]"
DEBUG http-8080-17 org.apache.http.wire - << "[EOL]"
DEBUG http-8080-17 org.apache.http.impl.conn.DefaultClientConnection -
Receiving response: HTTP/1.1 100 Continue
DEBUG http-8080-17 org.apache.http.headers - << HTTP/1.1 100 Continue
DEBUG http-8080-17 org.apache.http.wire - >> "...postparams...."
DEBUG http-8080-17 org.apache.http.wire - << "HTTP/1.1 302 Found[EOL]"
DEBUG http-8080-17 org.apache.http.wire - << "Date: Tue, 10 Nov 2009
16:59:56 GMT[EOL]"
DEBUG http-8080-17 org.apache.http.wire - << "Server: Web Server 1.0[EOL]"




STACK NUMBER 2 - WINDOWS

DEBUG http-8080-2 org.apache.http.impl.client.DefaultRequestDirector -
Attempt 1 to execute request
DEBUG http-8080-2 org.apache.http.impl.conn.DefaultClientConnection -
Sending request: POST /posturl HTTP/1.1
DEBUG http-8080-2 org.apache.http.wire - >> "POST /posturl HTTP/1.1[EOL]"
DEBUG http-8080-2 org.apache.http.wire - >> "Content-Length: 474[EOL]"
DEBUG http-8080-2 org.apache.http.wire - >> "Content-Type:
application/x-www-form-urlencoded[EOL]"
DEBUG http-8080-2 org.apache.http.wire - >> "Host: www.web.com[EOL]"
DEBUG http-8080-2 org.apache.http.wire - >> "Connection: Keep-Alive[EOL]"
DEBUG http-8080-2 org.apache.http.wire - >> "User-Agent:
Apache-HttpClient/4.0 (java 1.5)[EOL]"
DEBUG http-8080-2 org.apache.http.wire - >> "Expect: 100-Continue[EOL]"
DEBUG http-8080-2 org.apache.http.wire - >> "Cookie:
JSESSIONID=0001509uExGX_9cx6bxRHps1kpj:12vigpo4n; systemKey=www.web.com;
DC-Cookie=DC2[EOL]"
DEBUG http-8080-2 org.apache.http.wire - >> "Cookie2: $Version=1[EOL]"
DEBUG http-8080-2 org.apache.http.wire - >> "[EOL]"
DEBUG http-8080-2 org.apache.http.headers - >> POST /postrul HTTP/1.1
DEBUG http-8080-2 org.apache.http.headers - >> Content-Length: 474
DEBUG http-8080-2 org.apache.http.headers - >> Content-Type:
application/x-www-form-urlencoded
DEBUG http-8080-2 org.apache.http.headers - >> Host: www.web.com
DEBUG http-8080-2 org.apache.http.headers - >> Connection: Keep-Alive
DEBUG http-8080-2 org.apache.http.headers - >> User-Agent:
Apache-HttpClient/4.0 (java 1.5)
DEBUG http-8080-2 org.apache.http.headers - >> Expect: 100-Continue
DEBUG http-8080-2 org.apache.http.headers - >> Cookie:
JSESSIONID=0001509uExGX_9cx6bxRHps1kpj:12vigpo4n; systemKey=www.web.com;
DC-Cookie=DC2
DEBUG http-8080-2 org.apache.http.headers - >> Cookie2: $Version=1
DEBUG http-8080-2 org.apache.http.wire - >> "...postparams..."
DEBUG http-8080-2 org.apache.http.wire - << "HTTP/1.1 100 Continue[EOL]"
DEBUG http-8080-2 org.apache.http.wire - << "[EOL]"
DEBUG http-8080-2 org.apache.http.impl.conn.DefaultClientConnection -
Receiving response: HTTP/1.1 100 Continue
DEBUG http-8080-2 org.apache.http.headers - << HTTP/1.1 100 Continue
DEBUG http-8080-2 org.apache.http.wire - << "HTTP/1.1 302 Found[EOL]"
DEBUG http-8080-2 org.apache.http.wire - << "Date: Tue, 10 Nov 2009 16:51:53
GMT[EOL]"
DEBUG http-8080-2 org.apache.http.wire - << "Server: Web Server 1.0[EOL]" 

-----Mensaje original-----
De: Oleg Kalnichevski [mailto:olegk@apache.org] 
Enviado el: martes, 10 de noviembre de 2009 14:08
Para: HttpClient User Discussion
Asunto: RE: redirection in 4.0

On Tue, 2009-11-10 at 12:13 +0100, Juanjo wrote:
> The environment was updated to:
>  
> Linux 2.6.18
> JDK 1.6.0_16-b01
> Tomcat 6.0.20
>  
> and the programs doesn't run.
> The same error.
>  
> Juanjo
>  
> 

Use context / wire logging to examine the HTTP session and find out why your
application behaves differently in different environments.

http://hc.apache.org/httpcomponents-client/logging.html

Oleg


> 
> 
> 
> 
> Hi,
>  
>     In windows using tomcat 6.0 and jdk 1.6, my program runs properly. 
> It connect to a website by post, sending parameters, that return a 
> 302. Then, It reads the Location head an makes a Get call.
>  
>     When I deploy this program in linux with tomcat 5, the location 
> head returns the home url, not the right one.
>  
>     This is the code:
>  
>     HttpClient client = new DefaultHttpClient();
>     HttpPost req = new HttpPost(http://www.theweb.com);
>     List<NameValuePair> formparams = new ArrayList<NameValuePair>();
>     formparams.add(new BasicNameValuePair("aaa","sss"));
>     ...
>     UrlEncodedFormEntity param = new UrlEncodedFormEntity(formparams);
>     req.setEntity(param)
>     HttpResponse res = client.execute(req)
>     entity =res.getEntity();
>     Header loc = res.getFirstHeader("Location");
>  
>     ....
>  
> 
>     Another program that do the same but no redirection and using 
> BasicResponseHandler runs properly in both systems.
>  
> 
> Please help,
>  
> Tanks
>  
> Juanjo



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message