RE: Buffering of servlet responses
I stand corrected. Since version 2.3 these are methods of the ServletResponseWrapper. Thank you for bringing this to my attention. Tomcat 3.2 uses a servlet.jar which was updated 11/29/2000 so the capabilities of this wrapper should be included. I tried your code and got the same result. This seems like something that could be very interesting. Perhaps it would be useful combined with innerHTML.? I see you have replied. I was using the old spec. We can wait for the bug fix then. Best Regards, Craig -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Sunday, January 21, 2001 11:04 AM To: [EMAIL PROTECTED] Subject: Re: Buffering of servlet responses I think they may be tomcat specific? thanks, - Dale $ export CLASSPATH=~/proj/jakarta-tomcat-3.2.1/lib/servlet.jar $ javap javax.servlet.ServletResponse Compiled from ServletResponse.java public interface javax.servlet.ServletResponse /* ACC_SUPER bit NOT set */ { public abstract void flushBuffer() throws java.io.IOException; public abstract int getBufferSize(); public abstract java.lang.String getCharacterEncoding(); public abstract java.util.Locale getLocale(); public abstract javax.servlet.ServletOutputStream getOutputStream() throws java.io.IOException; public abstract java.io.PrintWriter getWriter() throws java.io.IOException; public abstract boolean isCommitted(); public abstract void reset(); public abstract void setBufferSize(int); public abstract void setContentLength(int); public abstract void setContentType(java.lang.String); public abstract void setLocale(java.util.Locale); } On Sun, Jan 21, 2001 at 10:19:58AM -0800, Craig O'Brien wrote: > Excuse my confusion but, HttpServletResponse does not contain the methods > setBufferSize() or flushBuffer(). Did you leave these out of your example? > > Also, If you set a buffer size to 0 would there be anything there to flush? > > Regards, > Craig > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Sunday, January 21, 2001 9:41 AM > To: [EMAIL PROTECTED] > Subject: Buffering of servlet responses > > > Hi, > > Apologies if this has been asked before but the search on the mailing list > archive directs to port at the moment which I cannot access from behind > my firewall. > > I'm trying to get the small servlet 'push' example below working but tomcat > appears to ignore the requests to flush it's buffers. > > The content does not leave the server until the page is finished. > > I'm guessing that people must be already doing this sort of thing, so what > have > I missed? > > Tomcat: 3.2.1 > JDK: 1.2.2 > OS: Linux 2.2.18 > > thanks, > > - Dale > > import javax.servlet.*; > import javax.servlet.http.*; > import java.io.*; > > public class TestPushServlet extends HttpServlet { > public void doGet(HttpServletRequest req, HttpServletResponse resp) { > try { > resp.setBufferSize(0); > resp.setContentType("text/html"); > > PrintWriter out = resp.getWriter(); > > > out.println("TestPushServlet"); > > for (int i = 0; i < 10; i++) { > Thread.sleep(2000); > out.println(i + ""); > out.flush(); > resp.flushBuffer(); > } > out.println(""); > } catch (Exception ex) { > ex.printStackTrace(); > } > } > } > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, email: [EMAIL PROTECTED] > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Buffering of servlet responses
Sorry, my mistake, bug has been fixed in 3.3 dev. Just have to wait for the next stable version I suppose. Oh and the buffer calls are part of the 2.2 Servlet spec. thanks, - Dale On Sun, Jan 21, 2001 at 07:03:43PM +, [EMAIL PROTECTED] wrote: > I think they may be tomcat specific? > > thanks, > > - Dale > > $ export CLASSPATH=~/proj/jakarta-tomcat-3.2.1/lib/servlet.jar > $ javap javax.servlet.ServletResponse > Compiled from ServletResponse.java > public interface javax.servlet.ServletResponse > /* ACC_SUPER bit NOT set */ > { > public abstract void flushBuffer() throws java.io.IOException; > public abstract int getBufferSize(); > public abstract java.lang.String getCharacterEncoding(); > public abstract java.util.Locale getLocale(); > public abstract javax.servlet.ServletOutputStream getOutputStream() throws > java.io.IOException; > public abstract java.io.PrintWriter getWriter() throws java.io.IOException; > public abstract boolean isCommitted(); > public abstract void reset(); > public abstract void setBufferSize(int); > public abstract void setContentLength(int); > public abstract void setContentType(java.lang.String); > public abstract void setLocale(java.util.Locale); > } > > On Sun, Jan 21, 2001 at 10:19:58AM -0800, Craig O'Brien wrote: > > Excuse my confusion but, HttpServletResponse does not contain the methods > > setBufferSize() or flushBuffer(). Did you leave these out of your example? > > > > Also, If you set a buffer size to 0 would there be anything there to flush? > > > > Regards, > > Craig > > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > > Sent: Sunday, January 21, 2001 9:41 AM > > To: [EMAIL PROTECTED] > > Subject: Buffering of servlet responses > > > > > > Hi, > > > > Apologies if this has been asked before but the search on the mailing list > > archive directs to port at the moment which I cannot access from behind > > my firewall. > > > > I'm trying to get the small servlet 'push' example below working but tomcat > > appears to ignore the requests to flush it's buffers. > > > > The content does not leave the server until the page is finished. > > > > I'm guessing that people must be already doing this sort of thing, so what > > have > > I missed? > > > > Tomcat: 3.2.1 > > JDK: 1.2.2 > > OS: Linux 2.2.18 > > > > thanks, > > > > - Dale > > > > import javax.servlet.*; > > import javax.servlet.http.*; > > import java.io.*; > > > > public class TestPushServlet extends HttpServlet { > > public void doGet(HttpServletRequest req, HttpServletResponse resp) { > > try { > > resp.setBufferSize(0); > > resp.setContentType("text/html"); > > > > PrintWriter out = resp.getWriter(); > > > > > > out.println("TestPushServlet"); > > > > for (int i = 0; i < 10; i++) { > > Thread.sleep(2000); > > out.println(i + ""); > > out.flush(); > > resp.flushBuffer(); > > } > > out.println(""); > > } catch (Exception ex) { > > ex.printStackTrace(); > > } > > } > > } > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, email: [EMAIL PROTECTED] > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, email: [EMAIL PROTECTED] > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Buffering of servlet responses
I think they may be tomcat specific? thanks, - Dale $ export CLASSPATH=~/proj/jakarta-tomcat-3.2.1/lib/servlet.jar $ javap javax.servlet.ServletResponse Compiled from ServletResponse.java public interface javax.servlet.ServletResponse /* ACC_SUPER bit NOT set */ { public abstract void flushBuffer() throws java.io.IOException; public abstract int getBufferSize(); public abstract java.lang.String getCharacterEncoding(); public abstract java.util.Locale getLocale(); public abstract javax.servlet.ServletOutputStream getOutputStream() throws java.io.IOException; public abstract java.io.PrintWriter getWriter() throws java.io.IOException; public abstract boolean isCommitted(); public abstract void reset(); public abstract void setBufferSize(int); public abstract void setContentLength(int); public abstract void setContentType(java.lang.String); public abstract void setLocale(java.util.Locale); } On Sun, Jan 21, 2001 at 10:19:58AM -0800, Craig O'Brien wrote: > Excuse my confusion but, HttpServletResponse does not contain the methods > setBufferSize() or flushBuffer(). Did you leave these out of your example? > > Also, If you set a buffer size to 0 would there be anything there to flush? > > Regards, > Craig > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Sunday, January 21, 2001 9:41 AM > To: [EMAIL PROTECTED] > Subject: Buffering of servlet responses > > > Hi, > > Apologies if this has been asked before but the search on the mailing list > archive directs to port at the moment which I cannot access from behind > my firewall. > > I'm trying to get the small servlet 'push' example below working but tomcat > appears to ignore the requests to flush it's buffers. > > The content does not leave the server until the page is finished. > > I'm guessing that people must be already doing this sort of thing, so what > have > I missed? > > Tomcat: 3.2.1 > JDK: 1.2.2 > OS: Linux 2.2.18 > > thanks, > > - Dale > > import javax.servlet.*; > import javax.servlet.http.*; > import java.io.*; > > public class TestPushServlet extends HttpServlet { > public void doGet(HttpServletRequest req, HttpServletResponse resp) { > try { > resp.setBufferSize(0); > resp.setContentType("text/html"); > > PrintWriter out = resp.getWriter(); > > > out.println("TestPushServlet"); > > for (int i = 0; i < 10; i++) { > Thread.sleep(2000); > out.println(i + ""); > out.flush(); > resp.flushBuffer(); > } > out.println(""); > } catch (Exception ex) { > ex.printStackTrace(); > } > } > } > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, email: [EMAIL PROTECTED] > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Buffering of servlet responses
Excuse my confusion but, HttpServletResponse does not contain the methods setBufferSize() or flushBuffer(). Did you leave these out of your example? Also, If you set a buffer size to 0 would there be anything there to flush? Regards, Craig -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Sunday, January 21, 2001 9:41 AM To: [EMAIL PROTECTED] Subject: Buffering of servlet responses Hi, Apologies if this has been asked before but the search on the mailing list archive directs to port at the moment which I cannot access from behind my firewall. I'm trying to get the small servlet 'push' example below working but tomcat appears to ignore the requests to flush it's buffers. The content does not leave the server until the page is finished. I'm guessing that people must be already doing this sort of thing, so what have I missed? Tomcat: 3.2.1 JDK: 1.2.2 OS: Linux 2.2.18 thanks, - Dale import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class TestPushServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) { try { resp.setBufferSize(0); resp.setContentType("text/html"); PrintWriter out = resp.getWriter(); out.println("TestPushServlet"); for (int i = 0; i < 10; i++) { Thread.sleep(2000); out.println(i + ""); out.flush(); resp.flushBuffer(); } out.println(""); } catch (Exception ex) { ex.printStackTrace(); } } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]