Hi, I have an applet which users log into, which is set in the database by
a flag (0 or 1) updated by a servlet, and if by chance they forget to log
out, which also tells the database they've logged out, and just close the
browser I want the applet's destroy method to call the servlet which logs
them out. But when I tried this I got the following exception:
java.io.IOException: Broken pipe
        at java.net.SocketOutputStream.socketWrite(Native Method)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:83)
        at
sun.servlet.http.HttpOutputStream.writeOut(HttpOutputStream.java:483)
        at
sun.servlet.http.HttpOutputStream.flushBytes(HttpOutputStream.java:35
7)
        at
sun.servlet.http.HttpOutputStream.flush(HttpOutputStream.java:343)
        at java.io.ObjectOutputStream.flush(ObjectOutputStream.java:1214)
        at java.io.ObjectOutputStream.close(ObjectOutputStream.java:1245)
        at UserLogoutServlet.doPost(UserLogoutServlet.java:47)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:521)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
        at
sun.servlet.http.HttpServerHandler.sendResponse(HttpServerHandler.jav
a:165)
        at
sun.servlet.http.HttpServerHandler.handleConnection(HttpServerHandler
.java:121)
        at
sun.servlet.http.HttpServerHandler.run(HttpServerHandler.java:90)
        at java.lang.Thread.run(Thread.java:475)
java.io.IOException: Broken pipe
        at java.net.SocketOutputStream.socketWrite(Native Method)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:83)
        at
sun.servlet.http.HttpOutputStream.writeOut(HttpOutputStream.java:483)
        at
sun.servlet.http.HttpOutputStream.flushBytes(HttpOutputStream.java:35
7)
        at
sun.servlet.http.HttpOutputStream.flush(HttpOutputStream.java:343)
        at
sun.servlet.http.HttpOutputStream.finish(HttpOutputStream.java:181)
        at
sun.servlet.http.HttpOutputStream.close(HttpOutputStream.java:421)
        at sun.servlet.http.HttpResponse.finish(HttpResponse.java:338)
        at
sun.servlet.http.HttpServerHandler.handleConnection(HttpServerHandler
.java:133)
        at
sun.servlet.http.HttpServerHandler.run(HttpServerHandler.java:90)
        at java.lang.Thread.run(Thread.java:475)

The line in my servlet (UserLogoutServlet) where it dies is the last line
of code which is just closing my output and input streams. The database
call does get excuted and 'logs them out'

Is there a better way to do what I want to do or am I not doing something
to make this work correctly? The destroy method is:
 public void destroy()
    {
        if(onlineFlag == 1)
        {
            try {
                String loggedOut = db.logoutUser(username);
            } catch(Exception e) {}
        }
    }

which is basically the exact method used when the user clicks the logout
button.
Should I just catch the exception and ignore it?
Any suggestions or corrections are greatly appreaciated! :)
Thanks
Sohaila

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to