tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anantaneni Harish <anantaneni.har...@vertexsoft.com>
Subject RE: cannot read complete HTTP request body. It reads only 8192 characters
Date Tue, 01 Nov 2011 01:42:53 GMT

Any thoughts about this?

Thanks and Regards,
Harish
-----Original Message-----
From: Anantaneni Harish 
Sent: Monday, October 31, 2011 11:23 AM
To: Tomcat Users List
Subject: RE: cannot read complete HTTP request body. It reads only 8192 characters

String keyValuePair = null;
String[] arrKeyValue = null;
BufferedReader in = request.getReader();
while ((keyValuePair = in.readLine()) != null) {
arrKeyValue = keyValuePair.split("=");

Above code reads incomplete data(read only 8192 bytes) at my customer's environment, but reads
complete data in my environment.

String keyValuePair = null;
String[] arrKeyValue = null;
BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream()));
while ((keyValuePair = in.readLine()) != null) {
arrKeyValue = keyValuePair.split("=");

Above code reads complete data in both the environments. *no changes done to customer's environment.

I hope you can help me now by finding the reason for data lost at my customer's environment
when using request.getReader().

Thanks and Regards,
Harish

-----Original Message-----
From: André Warnier [mailto:aw@ice-sa.com] 
Sent: Friday, October 28, 2011 9:08 PM
To: Tomcat Users List
Subject: Re: cannot read complete HTTP request body. It reads only 8192 characters

Konstantin Kolinko wrote:
> 2011/10/27 Christopher Schultz <chris@christopherschultz.net>:
>> On 10/27/2011 4:58 AM, Anantaneni Harish wrote:
>>> Thanks for the directions the Rainer. Actually the issue is just
>>> solved.
>>>
>>> We have changed from BufferedReader in = request.getReader();
>>>
>>> to
>>>
>>> BufferedReader in = new BufferedReader(new
>>> InputStreamReader(request.getInputStream()));
>>>
>>> Now whole body has been read at my client's environment as well.
>>>
>>> But would like to know, what causes the issue. Do you have any
>>> idea, why same method can read whole data in my environment and
>>> does not read whole data at my customer's environment?
>> You'll have to provide more information, such as the code you are
>> using.
>>
>> I'm fairly sure Tomcat is not the source of the problem.
>>
> 
> +1.
> 
> I think you need to pay more attention on the documentation of the
> java.io.Reader#read() method, or maybe look for a tutorial.
> 
> See also documentation for java.io.InputStream#available().
> 
> In short:  the read() method returns a portion of data that is
> currently available. If you need more data you must call read()
> repeatedly in a loop until it returns -1.
> 

.. and the difference between two systems, may be that on one system, the network is 
faster (or the system slower, or the buffer bigger) and so by the time you do the read, 
there are more bytes available in the buffer.

> If you had provided some of your source code that performs reading, we
> would be able to point at the exact error in your code.
> 

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




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


Mime
View raw message