Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Client-side AOP options for GWT apps

Tags:

java

aop

gwt

It would be nice to be able to define my own method interceptors (advice) and weave them in to my client-side GWT methods, and have GWT automagicallly compile them down into JavaScript with the rest of my app.

I checked out gwt-ent, but it doesn't look like there's been solid development on it since 2009 and there were quite a number of issues. I've also heard of gwt-tiny-aop but heard it was very limited.

Do I have any other options here? I know AOP requires dynamic bytecode generation, which in turn requires heavy reflection, and that GWT doesn't contain a lot of support (and seems to discourage) the practice of reflection, but I was wondering if there are any stable, well-known AOP libs out there for GWT. At least something that I could use for writing AOP Alliance-like interceptors:

public class MyInterceptor implements MethodInterceptor {
    @Override
    public void onIntercept(MethodInvocation mi) {
        // Do some stuff...

        // Let the method execute
        Object results = mi.proceed();

        // Analyze results...

        // Returns results
        return results;
}
like image 642
IAmYourFaja Avatar asked Aug 25 '12 02:08

IAmYourFaja


1 Answers

You could use GWT generators:

https://developers.google.com/web-toolkit/doc/latest/DevGuideCodingBasicsDeferred#generators

like image 184
logan Avatar answered Sep 21 '22 07:09

logan