Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ajdt-dev] Query related to aspectJ

Hi Dimple,

The access rules are by default the same as in Java, although you can
declare the aspect as "privileged" if required:

http://www.eclipse.org/aspectj/doc/released/progguide/semantics-aspects.html#aspect-privilege

Also, for future reference, this mailing list is for developers
working on the implementation of AJDT. You're more likely to get a
faster/better response from the aspectj-users list instead.

Regards,

Matt.

On 14/08/06, Kaul, Dimple <dimple.kaul@xxxxxxxxxxxxxx> wrote:
Hi all,
   I have this problem in my code. I am doing some stuff with AspectJ.

Following is the class for which i am implementing aspectj.

-----------------------------------------------------------------
import java.sql.Connection;
import java.util.Vector;
import org.myproj.net.Request;
import org.myproj.net.RequestHandler;

public class MyMethodRequestHandler extends RequestHandler {

     public void HandleRequest() throws Exception {
        Vector<String> results;
        try {
                String dirToList = req.getAttribute("directory");
                //
                //
                //
                //
        }
        finally {
        }
                Request res = getBaseResponse();
                if (results != null)
                        res.setData(new Value(results).toBytes());

                res.write(this.getOutputStream());

        }
}

-----------------------------------------------------------------

In this class req is the protected memember of RequestHandler and is of
type Request.
Now i want to access req in my aspect so that i can access different
values in my aspect

-----------------------------------------------------------------
pointcut HandlePointcut(Request req): execution(public *
org.lstore.lserver.MyMethodRequestHandler.HandleRequest(..)) &&
target(req);
// I tried this(req) also here but that too is not working
Object around(Request req):lsHandle(req){
        Object res = null;
        System.out.printlne("Before   "+thisJoinPoint.getSignature()  ");
        String user_id = req.getAttribute("username");
        return proceed(req);
}

-----------------------------------------------------------------
In this advice it is not able to resolve Requesthandler. Also it never
goes into this pointcut
then for seeing if my pointcut is good or not i tried something like this

-----------------------------------------------------------------
pointcut lsHandle1(): execution(public *
org.lstore.lserver.MyMethodRequestHandler.HandleRequest(..));

before():lsHandle1(){

        System.out.printlne("Before   "+thisJoinPoint.getSignature()  ");
}

-----------------------------------------------------------------
This is working fine.

Can you please help me how i can have advice with request handler. do you
think i am missing something?


Thanks in advance,
Dimple


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



Back to the top