Here is our "please wait" solution, using XSP:

sitemap entry:
---------------------
<map:match pattern="pleasewait/**">
        <map:generate type="serverpages" src="">
        <!-- our style and layout XSLT transforms here -->
        <map:serialize/>
</map:match>

pleasewait.xml:
-----------------------
<?xml version="1.0"?>
<xsp:page xmlns:xsp="http://apache.org/xsp">
        <page>
                <xsp:logic>
                        String thisURL = request.getRequestURI();
                        String query = request.getQueryString();
                        int start = thisURL.indexOf("/pleasewait");
                        String newURL = thisURL.substring(0, start) + thisURL.substring(start + "/pleasewait".length());
                        newURL = response.encodeURL(newURL);
                        if (query != null) {
                                newURL = newURL + "?" + query;
                        }
                        response.addHeader("refresh", "0;URL="" + newURL + "\"");
                       
                        String message = request.getParameter("pwmsg");
                </xsp:logic>
               
                <page-title>
                        Please Wait
                </page-title>
                <page-body>
                        <h1>Please Wait</h1>
                        <xsp:logic>
                                if (notEmpty(message)) {
                                        <h2><xsp:expr>message</xsp:expr></h2>
                                } else {
                                        <h2>We are processing your request...</h2>
                                }
                        </xsp:logic>
                </page-body>
        </page>
</xsp:page>

With this we just add "pleasewait/" to the front of any URL on our pages that are long running.  When the user clicks on one of these links, a simple page will show with the please wait message.  The page will tell the browser to immediately refresh to the actual URL, which we extracted from the pleasewait URL.  This is the same mechanism that websites use for those "This site has moved, you will be taken to the new site in 15 seconds..." except we use a timeout of zero seconds.  The browser keeps displaying the please wait page until it begins to get a response from the server on the new page.  Works great!

Oh, this please wait page also allows you to give the pwmsg request parameter to customize the message.  E.g.,
        href="">

HTH,

-Christopher



Tim Olson <[EMAIL PROTECTED]>

07/25/2003 03:01 PM
Please respond to users

       
        To:        "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
        cc:        
        Subject:        long-running requests



how might cocoon handle a long-running request where an interstitial ("please wait, processing...") page is returned?

Reply via email to