I bet you don't really want to have a dummy ping method to burden your server load.  
If the current implementation will throw java.rmi.NoSuchObjectException when session 
beans timeout, you could define in your war archive configuration to redirect to a 
particular page automatically if this error is thrown unhandled.  Hence you don't need 
to remember to put handling code everywhere in your pages.

Conrad

-----Original Message-----
From: Thomas Munro [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 04, 2000 9:37 AM
To: Orion-Interest
Subject: Stateful Session timeout, JSPs

Hello

I have a design question.

I have a (1) JSP session which stores a reference to (2) a stateful
session EJB.  If either times out, I want the user to be bounced to a page
where they have to log in (again).  The problem is that the JSP session
and the session EJB time out under different conditions -- that is to say,
merely surfing around the web application will keep the JSP session alive,
but the EJB is only kept alive by accessing it, which doesn't necessarily
happen on every page.  Otherwise, I could simply set the EJB to timeout
after a longer time than the JSP session.

I have a <%@ include file="/system/bouncer.jsp" %> at the top of all my
JSP pages, which tests whether the JSP session has timed out (among other
things), and if so, it bounces to the log-in page.

However, for the session EJB, I have to catch
"java.rmi.NoSuchObjectException: Session has timed out" to know that the
EJB has expired.

In the interests of tidiness, I am inclined to try to put this test in the
same included file.

Which is the better design?  (A) to make a dummy method "ping()"  on my
EJB, and then try to call it inside a try block from the included JSP (=
extra network hit per page view), or (B) make each JSP page which uses the
EJB capable of redirecting to the log-in page if the Exception is thrown
(thus coding the same thing in many places, and potentially introducing
the need to buffer everything, in order to be able to
response.sendRedirect()).

Or perhaps (C), I'm way off the mark (I'm not using JavaBeans or a taglib
to access the EJB, for example, which might well be the source of my
vexation).

Opinions, solutions, experiences much appreciated.


--
Thomas Munro <[EMAIL PROTECTED]>  "Travelling through hyperspace
 http://www.gi-technology.com/           isn't like dusting crops, boy."
 GI Technology (Paris)

Reply via email to