tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dale+tom...@88.net
Subject Re: Buffering of servlet responses
Date Sun, 21 Jan 2001 19:03:43 GMT
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: dale+tomcat@88.net [mailto:dale+tomcat@88.net]
> Sent: Sunday, January 21, 2001 9:41 AM
> To: tomcat-user@jakarta.apache.org
> Subject: Buffering of servlet responses
> 
> 
> Hi,
> 
> Apologies if this has been asked before but the search on the mailing list
> archive directs to port 9999 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("<html><head><title>TestPushServlet</title></head><body>");
> 
>             for (int i = 0; i < 10; i++) {
>                 Thread.sleep(2000);
>                 out.println(i + "<br>");
>                 out.flush();
>                 resp.flushBuffer();
>             }
>             out.println("</body></html>");
>         } catch (Exception ex) {
>             ex.printStackTrace();
>         }
>     }
> }
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, email: tomcat-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, email: tomcat-user-help@jakarta.apache.org

Mime
View raw message