Problem with multipart/x-mixed replace

Seema P Kumar (2kseema@sun20.datamatics.com)
Fri, 30 Mar 2001 17:11:10 +0530


This is a multi-part message in MIME format.

------=_NextPart_000_001F_01C0B93C.6AB81880
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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{
=20
=20
 public void init(ServletConfig config) throws ServletException{
  super.init(config);
       =20
 }

public void service(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
{
    =
res.setContentType("multipart/x-mixed-replace;boundary=3D\"boundary\"");
   =20
  PrintWriter out=3Dres.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))

------=_NextPart_000_001F_01C0B93C.6AB81880
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
Hi all !
 
 Could anybody tell me about the=20 "multipart/x-mixed-replace" content type ?
 I try to use thie = content=20 type for my HTTPServletResponse object in my Java servlet, to=20 keep
 outputting messages to
 the browser, but however, = the=20 browser does not interpret the headers
 properly and all the = tags are=20 visible as
 part of the browser content (I use Internet Explorer = 5.0).
 
The following is the Java code = :
public class RefreshingServlet extends=20 HttpServlet{
 
 
 public void init(ServletConfig = config)=20 throws=20 ServletException{
  super.init(config);
   = ;    =20
 }
 
public void service(HttpServletRequest = req,=20 HttpServletResponse res)
    throws ServletException,=20 IOException
{
   =20 res.setContentType("multipart/x-mixed-replace;boundary=3D\"boundary\"");<= BR>   =20
  PrintWriter out=3Dres.getWriter();
    = // Here=20 is the first part
   =20 out.print("\n\r--boundary\n\r");
    = out.print("Content-Type:=20 text/html\n\r");
 
   =20 out.println("<H1>Waiting...</H1>");
   =20 out.flush();
 
    // Here is the long = work (here,=20 a sleep)
    try=20 {
        =20 Thread.sleep(3000);
    }
    catch=20 (Exception e) {
         //=20 ignore
    }
 
    // Here is the = second=20 part
   =20 out.print("\n\r--boundary\n\r");
    = out.print("Content-Type:=20 text/html\n\r");
 
   =20 out.println("<H1>Done</H1>");
 
   =20 out.print("\n\r--boundary--\n\r");
   =20 out.flush();
}
 
}
Any loopholes for this = ?
Regards,
Seema Kumar
Datamatics = Technologies=20 Ltd.,
(Tel: 8290829 (Ext:619))
------=_NextPart_000_001F_01C0B93C.6AB81880--