[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] AspectJ with Servlets on Tomcat 5.x
|
Hello,
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) {
System.out.println(request.getAttribute("action").toString);
}
}*
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.