-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------

Andy,

you need to use the content-type: multipart/x-mixed-replace

I've rewritten your example so that it works. check it out:

    public void service(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    {


res.setContentType("multipart/x-mixed-replace;boundary=\"boundary\"");
        ServletOutputStream out = res.getOutputStream();

        out.println("--boundary");
        out.println("Content-Type: text/html\r");
        out.println("\r");
        out.println("Awaiting query results, please wait ...<br>\n");
        out.flush();
        try {
        Thread.sleep(3000);
        } catch (Exception e) {
            out.println("interrupted: " + e);
        }

        out.println("--boundary");
        out.println("Content-Type: text/html\r");
        out.println("\r");
        out.println("This is the end");
        out.println("--boundary--");
        out.flush();

    }


Andy Jefferson wrote:

> -----------------------------
> Please read the FAQ!
> <http://java.apache.org/faq/>
> -----------------------------
>
> Hi,
>
> not sure of the best place to ask this one. Anyway, I've got a servlet
> (running on Apache, with JServ 1.0 for what it matters) doing DB
> accesses, and some of these accesses take a while to complete. I want to
> give the user feedback while the DB query is being performed - something
> along the lines of
>
> 'Awaiting query results. Please wait ...'
>
> and then when the results are returned, repopulate the same frame with
> the results. I've heard that I can do this with MIME, by setting the
> ContentType to 'multipart/mixed', and sending several 'parts', but cant
> get it to work properly.
>
> For example, if I do
>
> response.setContentType("multipart/mixed;boundary=my_identifier");
> ServletOutputStream     out=response.getOutputStream();
> out.println("--my_identifier");
> out.println("Content-Type: text/html\r");
> out.println("\r");
> out.println("Awaiting query results, please wait ...");
> out.flush();
>
> <... perform DB query ...>
>
> out.println(--my_identifier");
> out.println("Content-Type: text/html\r");
> out.println("\r");
> <... DB results ...>
> out.println("--my_identifier--");
> out.flush();
>
> But I get the whole text including the MIME separators displayed by the
> browser (Netscape 4.*). Has anyone got a working example ?, or a
> reference I can look at ?
>
> TIA
> --
> Andy
>
> This message contains confidential information and is intended only
> for the individual named.  If you are not the named addressee you
> should not disseminate, distribute or copy this e-mail.  Please
> notify the sender immediately by e-mail if you have received this
> e-mail by mistake and delete this e-mail from your system.
>
> E-mail transmission cannot be guaranteed to be secure or error-free
> as information could be intercepted, corrupted, lost, destroyed,
> arrive late or incomplete, or contain viruses.  The sender therefore
> does not accept liability for any errors or omissions in the contents
> of this message which arise as a result of e-mail transmission.  If
> verification is required please request a hard-copy version.  This
> message is provided for informational purposes and should not be
> construed as a solicitation or offer to buy or sell any securities or
> related financial instruments.
>
> --
> --------------------------------------------------------------
> Please read the FAQ! <http://java.apache.org/faq/>
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Archives and Other:  <http://java.apache.org/main/mail.html>
> Problems?:           [EMAIL PROTECTED]

--

Wilfried Geis
ITM Research GmbH




--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to