How about overriding the service method, make it final, and do the
authentication there, calling super.service() when done?
The only catch is that doesn't allow you to pass the session object to the
subclasses.
Our approach was to override the doGet and doPost methods and define similar
abstract methods which get called after authentication completes, which have the
session as one of the parameters for convenience.
Bill
Bruce Bantos <[EMAIL PROTECTED]> on 05/21/99 03:53:06 PM
Please respond to "A mailing list for discussion about Sun Microsystem's Java
Servlet API Technology." <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc: (bcc: Bill Kayser/Worldstreet)
Subject: Subclassing an Authentication Servlet
I am trying to subclass a base servlet that handles authentication, to make
sure that any servlet that subclasses the base servlet is forced to log in
if a session object is not found. Can anyone give me an example, even a very
general one? I have tried to do this previously, but the way I did it was to
pass the HttpServlet Request, Response, and my session object to an
authentication method in my base class. This meant that I had to call the
authentication method in my doGet, doPost for every servlet. I want do find
a way to do this automatically, so there is no chance of forgetting to put
that call to the base class in. Thanks!
-Bruce
___________________________________________________________________________
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
___________________________________________________________________________
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