Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unable to find line starting with "HTTP"

 
chaohua wang
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Folks,

I am using Apache HttpClient 3.1, to send the resuest to a servlet server.

The code is simple:

HttpClient client = new HttpClient();
GetMethod method = new GetMethod( myURL ); byte[] responseBody = method.getResponseBody();

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,

I got this exception:

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
org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase
.java:1965)
at
org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBa
se.java:2659)
at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java
:1093)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:6
75)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:5
29)


I think that a heavy load in servlet server site, so servlet refuse the request. How to increase load for servlet.

Thank you very much, Please help.

Chwang


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 = '210004' OR tblCase.CaseTypeCode = '210005' OR tblCase.CaseTypeCode = '210006' OR tblCase.CaseTypeCode = '210007' OR tblCase.CaseTypeCode = '210008' OR tblCase.CaseTypeCode = '210009' OR tblCase.CaseTypeCode = '210010' OR tblCase.CaseTypeCode = '210011' OR tblCase.CaseTypeCode = '210012' OR tblCase.CaseTypeCode = '210013' OR tblCase.CaseTypeCode = '210014' OR tblCase.CaseTypeCode = '210015' OR tblCase.CaseTypeCode = '210016' OR tblCase.CaseTypeCode = '210017' OR tblCase.CaseTypeCode = '210018' OR tblCase.CaseTypeCode = '210019' OR tblCase.CaseTypeCode = '210020' OR tblCase.CaseTypeCode = '210026' OR tblCase.CaseTypeCode = '210030' OR tblCase.CaseTypeCode = '210099' OR tblCase.CaseTypeCode = '210500' OR tblCase.CaseTypeCode = '210501' OR tblCase.CaseTypeCode = '210502' OR tblCase.CaseTypeCode = '211000' OR tblCase.CaseTypeCode = '211001' OR tblCase.CaseTypeCode = '212002' OR tblCase.CaseTypeCode = '212009' OR tblCase.CaseTypeCode = '213000' OR tblCase.CaseTypeCode = '213001' OR tblCase.CaseTypeCode = '213002' OR tblCase.CaseTypeCode = '213700' OR tblCase.CaseTypeCode = '213701' OR tblCase.CaseTypeCode = '214000' OR tblCase.CaseTypeCode = '214001' OR tblCase.CaseTypeCode = '214002' OR tblCase.CaseTypeCode = '214100' OR tblCase.CaseTypeCode = '214101' OR tblCase.CaseTypeCode = '215000' OR tblCase.CaseTypeCode = '215001' OR tblCase.CaseTypeCode = '215002' OR tblCase.CaseTypeCode = '215003' OR tblCase.CaseTypeCode = '215005' OR tblCase.CaseTypeCode = '216001' OR tblCase.CaseTypeCode = '218000' OR tblCase.CaseTypeCode = '218001' OR tblCase.CaseTypeCode = '218002' OR tblCase.CaseTypeCode = '218003' OR tblCase.CaseTypeCode = '218004' OR tblCase.CaseTypeCode = '218005' OR tblCase.CaseTypeCode = '218006' OR tblCase.CaseTypeCode = '218007' OR tblCase.CaseTypeCode = '218008' OR tblCase.CaseTypeCode = '218009' OR tblCase.CaseTypeCode = '218010' OR tblCase.CaseTypeCode = '218011' OR tblCase.CaseTypeCode = '218012' OR tblCase.CaseTypeCode = '218013' OR tblCase.CaseTypeCode = '218014' OR tblCase.CaseTypeCode = '218015' OR tblCase.CaseTypeCode = '218016' OR tblCase.CaseTypeCode = '218017' OR tblCase.CaseTypeCode = '218018' OR tblCase.CaseTypeCode = '218019' OR tblCase.CaseTypeCode = '218020' OR tblCase.CaseTypeCode = '218021' OR tblCase.CaseTypeCode = '218022' OR tblCase.CaseTypeCode = '218023' OR tblCase.CaseTypeCode = '218024' OR tblCase.CaseTypeCode = '218025' OR tblCase.CaseTypeCode = '218030' OR tblCase.CaseTypeCode = '218035' OR tblCase.CaseTypeCode = '218040' OR tblCase.CaseTypeCode = '218050' OR tblCase.CaseTypeCode = '218060' OR tblCase.CaseTypeCode = '218065' OR tblCase.CaseTypeCode = '218070' OR tblCase.CaseTypeCode = '218071' OR tblCase.CaseTypeCode = '218080' OR tblCase.CaseTypeCode = '218090' OR tblCase.CaseTypeCode = '218091' OR tblCase.CaseTypeCode = '250005' OR tblCase.CaseTypeCode = '262601' OR tblCase.CaseTypeCode = '264001' OR tblCase.CaseTypeCode = '274002' OR tblCase.CaseTypeCode = '276501')
 
Paul Clapham
Sheriff
Posts: 21316
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may suspect the server load. But there is a fairly small limit on the number of bytes you can send in a GET request, and your experiments tend to show that you are exceeding that limit.

Unfortunately the limit is not precisely specified, but it tends to be about 2000 bytes.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Paul Clapham:
Unfortunately the limit is not precisely specified, but it tends to be about 2000 bytes.[/QB]


256 characters (approx.)
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Passing so much information as url parameters is probably not a good solution.
You probably should think of another way to do it.
 
chaohua wang
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much, ALL.
I have to use som many paramters depending on customers' request.
There is any way to fix this issue?

Chaohua
 
Paul Clapham
Sheriff
Posts: 21316
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The POST method has no limit on the number of bytes you can upload.
 
chaohua wang
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul,

I also tried to use post method. still does't work. I am confused. POST should work fine. Any idea? Thank you very much.

Chaohua
 
Paul Clapham
Sheriff
Posts: 21316
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should start by finding out more precisely what "doesn't work" means. Then you would have some information you could work with.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic