hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "liu gang" <ggliu...@hotmail.com>
Subject RE: http status 400 error
Date Thu, 09 Jan 2003 10:48:51 GMT
hi Oleg

The following is the debug output of my httpclient program.
but I don't find any syntax error.

[DEBUG] wire - ->> "POST /admin/j_security_check HTTP/1.1" [\r\n]
[DEBUG] wire - ->> "Content-Type: application/x-www-form-urlencoded" [\r\n]
[DEBUG] wire - ->> "Content-Length: 33" [\r\n]
[DEBUG] wire - ->> "Host: 127.0.0.1:8080" [\r\n]
[DEBUG] wire - ->> "User-Agent: Jakarta Commons-HttpClient/2.0M1" [\r\n]
[DEBUG] wire - ->> [\r\n]
[DEBUG] wire - -<< "HTTP/1.1 400 Invalid direct reference to form login 
page" [\r\n]
[DEBUG] wire - -<< "Set-Cookie: 
JSESSIONID=726763315A35DE93134200B82C019ECC; Path=/admin" [\r\n]
[DEBUG] wire - -<< "Content-Type: text/html;charset=GB2312" [\r\n]
[DEBUG] wire - -<< "Content-Language: zh-CN" [\r\n]
[DEBUG] wire - -<< "Transfer-Encoding: chunked" [\r\n]
[DEBUG] wire - -<< "Date: Thu, 09 Jan 2003 09:52:51 GMT" [\r\n]
[DEBUG] wire - -<< "Server: Apache Coyote/1.0" [\r\n]
[DEBUG] wire - -<< 3
[DEBUG] wire - -<< 2
[DEBUG] wire - -<< d
[DEBUG] wire - -<<
[DEBUG] wire - -<< 

thanks.

liu gang





>From: "Kalnichevski, Oleg" <oleg.kalnichevski@bearingpoint.com>
>Reply-To: "Commons HttpClient Project" 
<commons-httpclient-dev@jakarta.apache.org>
>To: "Commons HttpClient Project" 
<commons-httpclient-dev@jakarta.apache.org>
>Subject: RE: http status 400 error
>Date: Wed, 8 Jan 2003 16:58:57 -0000
>
>Hi Liu
>
>Do you mind executing your code with the following VM parameters and 
sending us the resultant console output?
>
>-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
>-Dorg.apache.commons.logging.simplelog.log.httpclient=debug
>
>That might help us find out why the Tomcat or Tomcat's admin webapp deem 
HTTP POST request syntactically incorrect
>
>Cheers
>
>Oleg
>
>
>-----Original Message-----
>From: liu gang [mailto:ggliu123@hotmail.com]
>Sent: Wednesday, January 08, 2003 12:44 PM
>To: commons-httpclient-dev@jakarta.apache.org
>Subject: http status 400 error
>
>
>
>I am working with the nightly build commons httpclient on the 28th
>December.
>I want to write a program to logon on a website automatically and test it
>on the tomcat admin system.
>the code was as follows:
>
>  //---------------------------------------
>  URL url = new URL("http://127.0.0.1:8080/admin/j_security_check");
>
>  HttpClient client = new HttpClient();
>  client.setconnectionTimeout(5000);
>  HostConfiguration hc = new HostConfiguration();
>
>  //url is URL of a login servlet.
>  hc.setHost(new URI(url));
>  client.setHostConfiguration(hc);
>
>  PostMethod method = new PostMethod(url.getPath());
>  method.setFollowRedirects(true);
>  method.setStrictMode(false);
>
>  method.addParameter("j_username","admin");
>  method.addParameter("j_password","admin");
>  client.executeMethod(method);
>  byte[] responseBody = method.getResponseBody();
>  System.out.println(new String(responseBody));
>
>  method.releaseConnection();
>//-------------------------------------------
>
>but error of Http status 400 occured.
>part of the console output is as follows:
>
><h1>HTTP Status 400 - Invalid direct reference to form login page</h1><HR
>size="1" noshade><p><b>type</b> Status report</p><p><b>message</b>
><u>Invalid direct reference to form login 
page</u></p><p><b>description</b>
><u>Therequest sent by the client was syntactically incorrect (Invalid
>direct reference to form login page).
>
>Do some people know why?
>
>thanks in advance!
>
>liugang
>2003/1/8
>
>
>_________________________________________________________________
>与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn
>
>
>--
>To unsubscribe, e-mail:   
<mailto:commons-httpclient-dev-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: 
<mailto:commons-httpclient-dev-help@jakarta.apache.org>
>
>
>--
>To unsubscribe, e-mail:   
<mailto:commons-httpclient-dev-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: 
<mailto:commons-httpclient-dev-help@jakarta.apache.org>


_________________________________________________________________
免费下载 MSN Explorer:  http://explorer.msn.com/lccn/ 


Mime
View raw message