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

Hello,
 try to replace call with execution and see how it goes...

because, call will intercept any code that CALLS your servlet.
more likely it is tomcat which is calling ur serlvet, so you'd need to weave tomcat jars...
i have never done something like that before...

i think execution will solveyour problem

regards
 marco

On 8/21/06, Jordi Cabré < cabrejcr@xxxxxxxx> wrote:
I've included my ControllerServlet and my LogAspect files.

Thanks for all.


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 com.gmsoft.ControllerServlet.doPost(HttpServletRequest request, HttpServletResponse response)) && target(controller) && args(request,response);
        pointcut sets (com.gmsoft.ControllerServlet controller, String name) : call (void com.gmsoft.ControllerServlet.set* (String)) && target(controller) && args(name);

        before (com.gmsoft.ControllerServlet controller, HttpServletRequest request, HttpServletResponse response) : doPostMethod(controller,request,response) {
                System.out.println("merda");
                request.getSession().getServletContext().log("merda");
                try {
                        response.getWriter().write("aspect");
                }catch (Exception ex) {
                        ex.printStackTrace();
                }
        }

        before (com.gmsoft.ControllerServlet controller, String name) : sets(controller, name) {
                System.out.println(name);
        }
}


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users