You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Vikram Goyal <V....@cbit.uq.edu.au> on 2006/03/27 07:46:31 UTC

InputBuffer and Posting Data

Hi all,

 

I am trying to post some data via an applet to a JSP running on Tomcat
5.5.16. In my applet code, I am setting the following:

 

postConn.setRequestMethod("POST");

 

postConn.setRequestProperty("Content-Length", (buf.length) + "");

 

postConn.setRequestProperty("Content-Type", "application/octet-stream");

 

Now, on the server side, I am retrieving my actual data by using the
ServletInputStream gathered from request.getInputStream() method. The
connection also contains some query parameters, which I am retrieving on
the server side using request.getParameter().

 

Now, irrespective of the size of the data that I post, the
ServletInputStream is truncating the data to a size of 8K (for files
greater than that size, smaller files are the received correctly). I
understand, after going through the source code, that the Request class
uses the InputBuffer class for reading from this stream and the default
size of the buffer for this operation is 8K. However, I would have
expected this buffer to grow, if the data was larger than this default,
but this is not happening.

 

Is there a setting to increase this buffer automatically that I need to
set? Alternatively, is there a setting that I need to set that will set
the default to a larger value? I have searched and searched and cannot
find anything.

 

Thanks,

Vikram

 

 


Re: InputBuffer and Posting Data

Posted by Mike Sabroff <mi...@cygnusb2b.com>.
This IS a java question.....
If post.Conn is a URLConnection you opened from the applet (looks that 
way) then you need to call setDoInput()
and setDoOutput() methods (basically read/write) to make it a post. 
There is also a setUseCaches() (true or false)
to control caching, default is true (reload button). Most of my 
statement is from the Javadocs.



Vikram Goyal wrote:
>
> Hi all,
>
>
>
> I am trying to post some data via an applet to a JSP running on Tomcat
> 5.5.16. In my applet code, I am setting the following:
>
>
>
> postConn.setRequestMethod("POST");
>
>
>
> postConn.setRequestProperty("Content-Length", (buf.length) + "");
>
>
>
> postConn.setRequestProperty("Content-Type", "application/octet-stream");
>
>
>
> Now, on the server side, I am retrieving my actual data by using the
> ServletInputStream gathered from request.getInputStream() method. The
> connection also contains some query parameters, which I am retrieving on
> the server side using request.getParameter().
>
>
>
> Now, irrespective of the size of the data that I post, the
> ServletInputStream is truncating the data to a size of 8K (for files
> greater than that size, smaller files are the received correctly). I
> understand, after going through the source code, that the Request class
> uses the InputBuffer class for reading from this stream and the default
> size of the buffer for this operation is 8K. However, I would have
> expected this buffer to grow, if the data was larger than this default,
> but this is not happening.
>
>
>
> Is there a setting to increase this buffer automatically that I need to
> set? Alternatively, is there a setting that I need to set that will set
> the default to a larger value? I have searched and searched and cannot
> find anything.
>
>
>
> Thanks,
>
> Vikram
>
>
>
>
>

-- 
Mike Sabroff
Web Services
Developer
mike.sabroff@cygnusb2b.com
920-568-8379


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


Re: InputBuffer and Posting Data

Posted by Jon Wingfield <jo...@mkodo.com>.
What is buf.length? Is it the actual length of the data you want to post 
or is it 8k?
The data you receive on the Tomcat side may be truncated by the 
Connector if the body data is longer than the value set for the 
Content-Length header.

HTH,

Jon

Vikram Goyal wrote:
> Hi all,
> 
>  
> 
> I am trying to post some data via an applet to a JSP running on Tomcat
> 5.5.16. In my applet code, I am setting the following:
> 
>  
> 
> postConn.setRequestMethod("POST");
> 
>  
> 
> postConn.setRequestProperty("Content-Length", (buf.length) + "");
> 
>  
> 
> postConn.setRequestProperty("Content-Type", "application/octet-stream");
> 
>  
> 
> Now, on the server side, I am retrieving my actual data by using the
> ServletInputStream gathered from request.getInputStream() method. The
> connection also contains some query parameters, which I am retrieving on
> the server side using request.getParameter().
> 
>  
> 
> Now, irrespective of the size of the data that I post, the
> ServletInputStream is truncating the data to a size of 8K (for files
> greater than that size, smaller files are the received correctly). I
> understand, after going through the source code, that the Request class
> uses the InputBuffer class for reading from this stream and the default
> size of the buffer for this operation is 8K. However, I would have
> expected this buffer to grow, if the data was larger than this default,
> but this is not happening.
> 
>  
> 
> Is there a setting to increase this buffer automatically that I need to
> set? Alternatively, is there a setting that I need to set that will set
> the default to a larger value? I have searched and searched and cannot
> find anything.
> 
>  
> 
> Thanks,
> 
> Vikram
> 
>  
> 
>  
> 
> 



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