The following example from O'Reilly Servlets book doesnt work
with Apache running on WindowsNT (its not strictly JServ problem
because it doesnt work with Apache-WebSphere on Win32 as well):
Any suggestions on how to make server push to work on Win32?
import java.awt.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class PushTest extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
ServletOutputStream out = res.getOutputStream(); // binary output
MultipartResponse multi = new MultipartResponse(res);
//
// with Apache-JServ on Unix browser will display countdown,
// and when Apache-JServ runs on Win32 browser will only
// display 19... after 20 seconds.
//
for(int i = 0; i < 20; i++) {
multi.startResponse("text/plain");
out.println(i + "...");
multi.endResponse();
try { Thread.sleep(1000); } catch(InterruptedException e) {}
}
multi.finish();
}
}
class MultipartResponse {
HttpServletResponse res;
ServletOutputStream out;
boolean endedLastResponse = true;
public MultipartResponse(HttpServletResponse response) throws
IOException {
res = response;
out = res.getOutputStream();
res.setContentType("multipart/x-mixed-replace;boundary=End");
out.println();
out.println("--End");
}
public void startResponse(String contentType) throws IOException {
if(!endedLastResponse) {
endResponse();
}
out.println("Content-Type: " + contentType);
out.println();
endedLastResponse = false;
}
public void endResponse() throws IOException {
out.println();
out.println("--End");
out.flush();
endedLastResponse = true;
}
public void finish() throws IOException {
out.println("--End--");
out.flush();
}
}
-- --------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
READ THE FAQ!!!! <http://java.apache.org/faq/>
Archives and Other: <http://java.apache.org/main/mail.html/>
Problems?: [EMAIL PROTECTED]