[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Need help in intercepting session.setAttribute() in tomcat

If the implementing class really is
org.apache.jasper.runtime.PageContextImpl then your include clause
should be fine.  Have you tried turning on the diagnostics for load
time weaving to check the configuration is processed correctly and
types are being passed to the weaver for weaving?
The '-debug' option I described in
http://andrewclement.blogspot.com/2009/02/load-time-weaving-basics.html
might be useful for you.  At least it can help get to the bottom of
whether it is the type not getting processed by the weaver or the
weaver seeing it and not actually weaving it.

Andy

2009/5/14 Tahir Akhtar <tahir@xxxxxxxxxxxxxxxxxxx>:
> Hi,
> I am using load time weaving in tomcat to weave an around advice on
> session attribute get/set methods.
> It is working as expected, except for the jsp:useBean tags like below.
>
> <jsp:useBean id="list" class="java.util.ArrayList" scope="session"/>
>
> My pointcut is:
>
> pointcut setSessionAttribute(HttpSession session,String name, Object
> value) :   target(session) && call(public void setAttribute(String,
> Object)) && !within(HttpSessionScopeAspect) && args(name,value);
>
> I have tried several combinations in aop.xml including following
>
>   <include within="com..*" />
>   <include within="javax..*" />
>   <include within="org..*" />
>   <include within="org.apache.jasper..*" />
>
> But still haven't found a clue.
>
> I have noticed that Tomcat's jsp compiler generates code like this for
> <jsp:useBean>, where _jspx_page_context is an instance of
> org.apache.jasper.runtime.PageContextImpl
>
>     java.util.ArrayList list= null;
>     synchronized (session) {
>       list = (java.util.ArrayList)
> _jspx_page_context.getAttribute("list", PageContext.SESSION_SCOPE);
>       if (list == null){
>         list = new java.util.ArrayList();
>         _jspx_page_context.setAttribute("list", list,
> PageContext.SESSION_SCOPE);
>       }
>     }
>
>
> Any help will be highly appreciated.
>
> Regards
> Tahir Akhtar
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>