Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Specifying pointcuts in aop.xml

Hi,

Is it possible to specify pointcuts such as the following coded pointcuts in the aop.xml:

    public pointcut loggedGetOperations (HttpServletRequest request, HttpServletResponse response) : args (request, response)
        && (execution (void com.sun.bookstore1.servlets.BookStoreServlet.doGet(HttpServletRequest, HttpServletResponse)) ||
                execution (void com.sun.bookstore1.servlets.CatalogServlet.doGet(HttpServletRequest, HttpServletResponse)) ||
                execution (void com.sun.bookstore1.servlets.ShowCartServlet.doGet(HttpServletRequest, HttpServletResponse)) ||
                execution (void com.sun.bookstore1.servlets.ShowCartServlet.doGet(HttpServletRequest, HttpServletResponse)) ||
                execution (void com.sun.bookstore1.servlets.CashierServlet.doGet(HttpServletRequest, HttpServletResponse)) ||
                execution (void com.sun.bookstore1.servlets.ReceiptServlet.doPost(HttpServletRequest, HttpServletResponse)));
   

My use case is the following.  I want to provide a library of useful aspects (for instance, HttpServlet logging).  I want to give the user a tool that allows them to choose the servlets to which this aspect should be applied.  What I don't want to have to do is have the user code the aspects in any way.  Once the user has selected the servlets to which the aspect should be applied, I'd like to jar up the aspect code and put their selected pointcuts in the aop.xml within the jar file.

I saw the other message about specifying the pointcuts in an external file, but the answer (use a pointcut library) wasn't really satisfying because then I'd have to include a build step for my users (true, I could do the build for them, but it's more complicated that way).

Is there a solution for me?  Has anyone thought about the need for this if not?

Cheers,
Craig

Back to the top