W3C home > Mailing lists > Public > ietf-http-wg-old@w3.org > January to April 2001

Problem with multipart/x-mixed replace

From: Seema P Kumar <2kseema@sun20.datamatics.com>
Date: Fri, 30 Mar 2001 17:11:10 +0530
Message-ID: <002201c0b90e$51ead8c0$524111cf@datamatics.com>
To: <http-wg@cuckoo.hpl.hp.com>
Hi all !

 Could anybody tell me about the "multipart/x-mixed-replace" content type ?
 I try to use thie content type for my HTTPServletResponse object in my Java servlet, to keep
 outputting messages to
 the browser, but however, the browser does not interpret the headers
 properly and all the tags are visible as
 part of the browser content (I use Internet Explorer 5.0).

The following is the Java code :
public class RefreshingServlet extends HttpServlet{
 
 
 public void init(ServletConfig config) throws ServletException{
  super.init(config);
        
 }

public void service(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
{
    res.setContentType("multipart/x-mixed-replace;boundary=\"boundary\"");
    
  PrintWriter out=res.getWriter();
    // Here is the first part
    out.print("\n\r--boundary\n\r");
    out.print("Content-Type: text/html\n\r");

    out.println("<H1>Waiting...</H1>");
    out.flush();

    // Here is the long work (here, a sleep)
    try {
         Thread.sleep(3000);
    }
    catch (Exception e) {
         // ignore
    }

    // Here is the second part
    out.print("\n\r--boundary\n\r");
    out.print("Content-Type: text/html\n\r");

    out.println("<H1>Done</H1>");

    out.print("\n\r--boundary--\n\r");
    out.flush();
}

}

Any loopholes for this ?

Regards,
Seema Kumar
Datamatics Technologies Ltd.,
(Tel: 8290829 (Ext:619))
Received on Friday, 30 March 2001 12:55:15 EST

This archive was generated by hypermail pre-2.1.9 : Wednesday, 24 September 2003 06:33:42 EDT