tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apu Shah <>
Subject please wait page?
Date Thu, 27 Jun 2002 19:16:49 GMT

i was wondering if anyone else has had problems with
RequestDispatcher.include() and flush() or is it just me? (see below)

i request someone to please deploy the code and see if it works at all,
or whether it's a setup/configuration thing from my end, though i don't
think so since all my other jsp/servlets are running fine. or whether i
am completely off the ball when it comes to implementing the concept.

or alternatively, does anyone have any other ideas for a "please wait
page"? the requirement is that the page displaying the wait is a jsp,
it's served out of a front controller. would not like to inline all the
code of the wait page into controller (can't anyways, right? jsp needs
to execute somewhere...)

the code below illustrates the concept i am trying to achieve. (this
code works in iplanet....)


i tried using the following code over http and it still didn't work.

any ideas would be appreciated.

tia, apu

i am using tomcat 4.0.3, apache 2.0.34 over ssl with the warp connector.
i have set the connector allowChunking to false.

the problem that i see is that after i use
getRequestDispatcher(page).include(req,resp) and flush the resp.out, the
page does not get flushed to the browser. essentially i am trying to
simulate a "please wait" page while my server does something that takes
a longish time.

am i missing something? i have explicitly flushed the buffer (using both
resp.flushBuffer() and out.flush()), set autoFlush="true", made
allowChunking="false".... anything else i can try or is this a
legitimate bug?

or does it have something to do with ssl? i haven't tried this without

here is sample code to illustrate

======== CODE START =============

import javax.servlet.*;
import javax.servlet.http.*;

public class test extends HttpServlet {

    public void doGet(HttpServletRequest req, HttpServletResponse resp)
	throws IOException, ServletException {
	// Set content type, et all
	// Include waitpage, flush response.
	String waitPage = "/wait.jsp";
 	log("Flushed " + waitPage,null);

	// Sleep for a minute. The client browser should be viewing the 
	// wait page by now.
	try {
	catch(InterruptedException ie) {

	// Ok, we're ready to show the next page. Send a redirect.
	PrintWriter out = resp.getWriter();
	String uri = "";
	out.println("<meta http-equiv=\"Refresh\" content=\"0; url=" + 
		    uri +"\">");
	log("Sent refresh to " + uri,null);


    // Logging, for illustrative purposes only.
    public void log(String msg, Throwable t) {
	StringBuffer buf = new StringBuffer();
	buf.append("> ");

	ServletContext ctx = this.getServletConfig().getServletContext();
	if(t != null)


======== CODE END =============

wait.jsp can be any jsp page, for example

<%@page language="java" autoFlush="true"%>

i see the logs showing me that the wait page has been flushed. :
2002-06-25 12:52:07 jsp: init
2002-06-25 12:52:14 test> Flushed wait page /wait.jsp
2002-06-25 12:52:47 test> Sent refresh to

but the browser never renders the wait page, instead it just waits for a
minute, and refreshes to i tried with different user agents
(netscape 6.2, mozilla 1.0 on linux and ie 6 on xp) to eliminate the
browser from the picture.



To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message