[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Need help in intercepting session.setAttribute() in tomcat
|
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