I am using AspectJ to apply aspects on methods of classes under packages org.apache.http, org.apache.http.entity, org.apache.http.impl, org.apache.http.io and similarly others.
I used the aspects as below but it is not applied.
public pointcut capturehttp():within(org.apache.http..*) && (call(public * *(..)) || call(private * *(..)));
after():capturehttp()
{
System.out.println("In test test test testy test http method set");
}
I also tried as suggested in Aspectj aspect for specifying multiple packages but it didn't work. Please suggest to me where I am wrong?
Use the following aspect:
The
captureHttp()pointcut above will capture method or constructor calls to any type in packageorg.apache.httpor any subpackage, called from any code within packagecom.my.pckgor any of its subpackages, excluding calls made from the aspectHttpCodeAspectitself (should you happen to invoke HttpCore from yourafter()advice, we don't want an infinite recursion to happen).