Forums Register Login

Buffering in Jsp

+Pie Number of slices to send: Send
The JSP container buffers data (if the jsp directive specifies it using the buffer attribute) as it is sent from the server to the client. Headers are not sent to the client until the first flush method is invoked. Therefore, it is possible to call methods that modify the response header, such as setContentType, sendRedirect, or error methods,up until the flush method is executed and the headers are sent. After that point,
these methods become invalid, as per the Servlet specification.


Q1) What is use of buffering the jsp?

Q2) what is advantage of modifying reponse headers?
+Pie Number of slices to send: Send
For eg: you can have one scenario where you have a filter to modify the response header content type by zipping the response if its too large to send over the wire. Or for the same reason you want to buffer the JSP not to generate the jar file again and again to send but just buffer it.

Hope this hleps
Nileesha
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 810 times.
Similar Threads
Trying to generate Large PDF in servlet
Returning large PDF file causing the server to crash.
buffer
HF chapter 5 exam question
Response Headers
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 09:31:26.