here are 2 articles speaking about the pushlet

http://www.javaworld.com/javaworld/jw-03-2000/jw-03-pushlet.html

http://www.javaworld.com/javaworld/jw-03-2000/jw-03-pushlet-2.html

here is a very simple sample pushlet :


import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class SimplePushlet extends HttpServlet
{
    public void doGet(HttpServletRequest request, HttpServletResponse response)  
throws ServletException, IOException {

        ObjectOutputStream out = new ObjectOutputStream (response.getOutputStream());
        response.setContentType("text/plain");   
        
        String start = "Http connection opened";
        
        out.write(start.getBytes());
        out.flush();
   
        try {
            for (int cnt=1; cnt > 0; cnt++) {
                Thread.sleep(1000);
                
                String iter = "event=" + cnt + "\n";
                out.write(iter.getBytes());
                out.flush();
                System.out.println("event=" + cnt + "pushed.\n");
            }
        } catch (Exception e) {
            System.out.println("error:"+e);
        }
        
        out.close();
    }
}

You may use netscape as browser or ie if you don't care about waiting 15 pushes.

Thank you for your help.







> >-----Original Message-----
> >From: Jestin Jean-Francois 
> >[mailto:[EMAIL PROTECTED]]
> >Sent: Monday, March 26, 2001 4:01 PM
> >To: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]'
> >Subject: apache 1.3.12 and tomcat 3.3-m2 connection problem ??
> >
> >
> >Hello,
> >
> >I'm currently using apache 1.3.12(mod_jk) and tomcat 3.3-m2 
> >under solaris 2.6 talking ajp13
> >
> >Everything works fine except that I encounter sometime an 
> >Internal Server Error if I don't restart Apache each time I 
> >restart tomcat. Is there a fix for that problem ?
> >
> >On the other hand I use a server push mechanism (called 
> >pushlet) - that's why I use milestone build of 3.3 (not 
> >working under 3.2.1)- it works also fine (what a beautiful 
> >life !) except that sometime (!!??) the servlet (pushlet) 
> >doesn't detect the end of the connection (Browser killed) 
> >between tomcat and apache
> >
> >looking at the mod_jk log gives the following :
> >
> >[jk_ajp13_worker.c (325)]: Error ajp13_process_callback - write failed
> >[jk_ajp13_worker.c (325)]: Error ajp13_process_callback - write failed
> >[jk_ajp13_worker.c (325)]: Error ajp13_process_callback - write failed
> >[jk_ajp13_worker.c (203)]: connection_tcp_get_message: Error - 
> >jk_tcp_socket_recvfull failed
> >[jk_ajp13_worker.c (623)]: Error reading request
> >[jk_ajp13_worker.c (203)]: connection_tcp_get_message: Error - 
> >jk_tcp_socket_recvfull failed
> >[jk_ajp13_worker.c (623)]: Error reading request
> >[jk_ajp13_worker.c (325)]: Error ajp13_process_callback - write failed
> >[jk_ajp13_worker.c (325)]: Error ajp13_process_callback - write failed
> >[jk_ajp13_worker.c (325)]: Error ajp13_process_callback - write failed
> >[jk_ajp13_worker.c (325)]: Error ajp13_process_callback - write failed
> >[jk_ajp13_worker.c (325)]: Error ajp13_process_callback - write failed
> >
> >Is there also a fix for that or these problems ?
> >
> >Thank you very for your answer and your great job !
> >
> >
> >****************************************************
> >Jean-Fran> çois JESTIN
> >****************************************************
> >
> >
> >

Reply via email to