struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Schneider <k...@dotech.com>
Subject Re: tracking user activities: how to ignore action chaining (or server side forward)
Date Mon, 14 Jul 2003 15:13:11 GMT
Sorry, filters were introduced in Servlet 2.3. What you might try doing is using
a request attribute as a flag to indicate that you've already logged the
requested URI. Maybe something like:

if (request.getAttribute(MyConstants.URI_LOG_FLAG) == null) {
  request.setAttribute(MyConstants.URI_LOG_FLAG, Boolean.TRUE);
  logPage(request.getRequestURI());
}
super.processForwardConfig(request, response, forward);

If you get the chance to move to a Servlet 2.3 container, filters will work just
fine in combination with Struts.

Quoting david chan <david_tomcat@yahoo.com>:

> My company using Websphere 4.0.5, and it only supports
> servlet 2.2. Does filter only operate on the original
> client request for servlet 2.2 also? Can filter works
> well with Struts actionservlet?
> 
> Thanks.
> David
> 
> 
> 
> --- Kris Schneider <kris@dotech.com> wrote:
> > Seems like the easiest thing to do would be to write
> > a Filter mapped to "/*"
> > that uses HttpServletRequest.getRequestURI to
> > capture the requested URI. In a
> > conformant Servler 2.3 container, the Filter will
> > only operate on the original
> > client request, not forwards or includes.
> > 
> > Quoting david chan <david_tomcat@yahoo.com>:
> > 
> > > Hi,
> > >  I am writing a RequestProcessor that is a
> > subclass of
> > > Struts 1.1 RequestProcessor, the purpose is to
> > track
> > > user activities, i.e. which link the user clicked,
> > > which page the user requested etc.
> > >  I override the method processForwardConfig, and
> > put
> > > my tracking function first, here is how it looks:
> > > 
> > > //my code to log user request
> > > logPage(request.getRequestURI());
> > > super.processForwardConfig(request, response,
> > forward
> > > );
> > > 
> > > 
> > >  However, there is one problem with this approach,
> > 
> > > If there is action chaining (or server side
> > forward),
> > > that will be also logged, but that is not the user
> > > requested URI, and I don't need to log any of
> > chained
> > > action URI or server side forwarded URI. 
> > > 
> > >  Any suggestion how to deal with this problem?
> > > 
> > > Thanks.
> > > David
> > 
> > -- 
> > Kris Schneider <mailto:kris@dotech.com>
> > D.O.Tech       <http://www.dotech.com/>

-- 
Kris Schneider <mailto:kris@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message