hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <http-as...@dubioso.net>
Subject Re: unable to find line starting with "HTTP"
Date Wed, 23 Aug 2006 15:46:30 GMT
Hi Chaohua,

> The code is simple:
> HttpClient client = new HttpClient();
> GetMethod method = new GetMethod( myURL );
> byte[]  responseBody = method.getResponseBody();

I assume there's also a call to HttpClient.execute somewhere :-)

> When I sent a short a url string with few parameters , it works fine.
> But when I sent a very long url string with too many parameters, 

There are practical limits to the length of a URL, which are
(server) implementation dependent. That's why you send long
or many parameters in the message body, either form-url-encoded
or as multipart-mime. If the server application is a Servlet,
it won't make any difference.

> org.apache.commons.httpclient.HttpRecoverableException:
> org.apache.commons.httpclient.HttpRecoverableException
> : Error in parsing the status  line from the response: unable to find
> line starting with "HTTP"
>         at

This indicates that the server is sending nonsense. Since you
know the reason, there is no point in further analysis.

> For example these following parameters I need to contains them in url.
> If cut them to half, it works fine. But if not, I got "unable to find
> line starting with "HTTP" " 
> (tblCase.CaseTypeCode = '210000' OR tblCase.CaseTypeCode = '210001' OR
> tblCase.CaseTypeCode = '210002' OR tblCase.CaseTypeCode = '210003' OR
> [...]
> tblCase.CaseTypeCode = '250005' OR tblCase.CaseTypeCode = '262601' OR
> tblCase.CaseTypeCode = '264001' OR tblCase.CaseTypeCode = '274002' OR
> tblCase.CaseTypeCode = '276501')

These are not parameters. Parameters look like "?n1=v1&n2=v2".
Don't put that stuff in the URL, it is way too big. There is no
way you can get that across reliably with a GET request. The
primer has a few short paragraphs about creating POST requests
and the two primary options for encoding parameters:

Here are some starters in the JavaDoc:

Decide on one of the two. You can't mix a multipart request entity
with parameters added directly to the PostMethod.

hope that helps,

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

View raw message