tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arieh Markel <Arieh.Mar...@Central.Sun.COM>
Subject Re: Help with Interceptors
Date Thu, 10 Feb 2000 18:37:18 GMT
Thanks for the responses so far.

I will try to clarify a bit more of what I am trying to do, as inspection
of the code indicates that the Interceptors do not accomplish what I 
think I need.

>
> From: costin@eng.sun.com
> To: tomcat-dev@jakarta.apache.org, Arieh Markel <Arieh.Markel@central.sun.com>
> Subject: Re: Help with Interceptors
> 
> > The idea I have in mind, is that the Interceptor will look at the Properties
> > of the HttpServletRequest, and depending on its finding, do things like:
> > 
> > 	. add a property to the request
> > 	. selectively perform a servlet redirection
> > 	. return an error message
> > 
> > Would ServiceInterceptor, or SecurityInterceptor be good starting points ?
> 
> RequestInterceptor if you want to process the request.
> ContextInterceptor if you want "container"-event notifications.
> 
> ( we are still working on this - but I think there are stable now, 
> except configuration and few small details )

The scenario is as follows:

a. a user should always access our web-enabled application through a
   '/login' servlet
   
   That servlet performs user validation, role association, session 
   establishment
   
b. If a request to a servlet arrives that indicates that the user has not 
   performed prior validation (determined by inspection of the HttpSession
   object), I would like to do a forward of the request to the '/login'
   servlet.
   

If the current scenario of execution is as follows (mostly taken from
the ServletWrapper.handleInvocation()):

	interceptor.preInvoke(context, servlet, req, res)
	
	servlet.service(req, res)
	
	interceptor.postInvoke(context, servlet, req, res)
	
	
I would like to have a scenario that would allow me to do the following.

	Servlet routed = interceptor.preInvoke(context, servlet, req, res)
	
	if (null != routed)
	   routed.service (req, res)
	else
	   servlet.service (req, res)
	   
	interceptor.postInvoke (context, servlet, req, res)
	
So, what I would like to have in place is an interceptor that optionally
perform re-routing of the request.

---

It should also be possible to re-evaluate the servlet to execute based on
modification of the request object:

	interceptor.preInvoke (context, servlet, req, res);
	
	Servlet newServlet = reEvaluate (req);

	newServlet.service(req, res);
	
	interceptor.postInvoke (context, servlet, req, res);
	
---

Perhaps I am missing something, and there is already a collection of
class methods that allows me to accomplish the same.
 
Ideas ??

Suggestions ??

---

Arieh
--
 Arieh Markel		                Sun Microsystems Inc.
 Network Storage                        500 Eldorado Blvd. MS UBRM11-194
 e-mail: arieh.markel@sun.COM           Broomfield, CO 80021
 Let's go Panthers !!!!                 Phone: (303) 272-8547 x78547
 (e-mail me with subject SEND PUBLIC KEY to get public key)


Mime
View raw message