[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AspectJ with Servlets on Tomcat 5.x

 my 2 cents here..... for applying aspect to your code (no matter if it is servlet, standalone, ejb or anything) you'd need to weave your cod ebefore you deploy it
also, make sure you have aspectj on your classpath at runtime (either in WEB-INF/lib or your appserver lib directories)

i m applying aspectj to Actions in my webapplication, that was all i needed to do.....


On 8/20/06, Jordi Cabré < cabrejcr@xxxxxxxx> wrote:
I'm using AspectJ capabilities on my web application on Eclipse. I want
to add logging functionality. Concretelly, I've created a
ControllerServlet that receive all user requests and I want write or log
these user actions in my log file. So,  I've added an aspect that does it:

*package com.gmsoft.aspects;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public aspect LogAspect {
      pointcut doPostMethod (com.gmsoft.ControllerServlet controller,
HttpServletRequest request, HttpServletResponse response) : call (void
doPost(HttpServletRequest, HttpServletResponse)) && target(controller)
&& args(request,response);
            before ( com.gmsoft.ControllerServlet controller,
HttpServletRequest request, HttpServletResponse response) :
doPostMethod(controller,request,response) {

I think that I must modify web.xml configuration file to achieve Tomcat
works with Aspects.

Can you help me How I can do it?

Note: In my code I only use Aspects insede Servlets, so I don't use
Aspects inside JSP. I say it for help you if is necessary.

Thanks in advance.
aspectj-users mailing list