aspose file tools*
The moose likes Servlets and the fly likes buffer size in page directive Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "buffer size in page directive" Watch "buffer size in page directive" New topic
Author

buffer size in page directive

Sharang Thorat
Greenhorn

Joined: Dec 07, 2000
Posts: 21
Hello
Consider following scenario:
My application is generating the xml file.I am writing that
xml file in jsp out stream thru a method of bean

queryBean.save( out );
where out is implicit object of jsp.
Now is file is very large I get IllegalStateException saying
response already been committed.
Now questions are
a) Can I increase buffer size in page directive
of jsp depending on the file size i want to write.

b) Is there any upper limit on the buffer size for jsp
regards
sharang
Sandeep Jain
Ranch Hand

Joined: Oct 25, 2000
Posts: 124
Hello,
Well,I cannot help u much . I dont know whether ur problem is related bcoz of buffer or not . but u can increase the size of buffer. By default what is avilable is 8 kb .If u want in the page directive u canmenthion the buffer =12
------------------
Sandeep Jain


Try and Try Till u succeed<br /> <br />Sandeep Jain
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Rather than increasing the buffer size and thereby the footprint of your application, why not move every statement that needs to set header fields is executed before you generate your data.
- Peter
Sharang Thorat
Greenhorn

Joined: Dec 07, 2000
Posts: 21
Hi
I think there is some flaw in my understanding.
What i understand is if there is very large data to be written
in stream of jsp and if buffer size is lesser than that then
moment buffer is full response will be sent to client and
further to that what ever u try to right will give IllegalState
Exception.
With this understanding Peter i am not able to get what u r
trying to say.
Will u please elaborate kindly.
regards
sharang
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Originally posted by Sharang Thorat:
What i understand is if there is very large data to be written in stream of jsp and if buffer size is lesser than that then moment buffer is full response will be sent to client and further to that what ever u try to right will give IllegalState Exception.

That's not quite how it works. When the output buffer is full, its contents are sent to the client, the buffer is emptied and ready to send as much data as you want.
The problem is that your servlet's or JSP's response consists of two parts. The first part is the header, which includes things like the response code, last modified date, content length, etcetera. The second part is your actual response (html or whatever). Once the buffer has been flushed, the header will have been sent (committed) to the client. If you then try to do anything which needs to get at the header fields, you will get an IllegalStateException: response already committed.
Operations which need the response header include a forward or redirect.
- Peter
 
 
subject: buffer size in page directive