[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-dev] Load-time weaving with applets?
|
I am trying to do load-time weaving in a Java Applet. Is it possible in any way?
I do not know how to configure the AspectJ weaver in order to run aspects, in particular, I do not know how to specify the AspectJ weaver as javaagent.
I have tried (1) using aop.xml files and specifing the -javaagent:pathto/aspectjweaver.jar option to the JVM in the server (TomCat), including the aspectjrt.jar library in the applet tag; (2) using the Java Web Start and specifying the aspectjrt.jar in the .jnlp file, but how must the aspectjweaver.jar be specified?; and (3) with another applet that wrappers the original applet and uses the WeavingURLClassLoader class.
In the last case, I get the following applet wrapping the original applet:
URL[] cpath = getClasspath("FactorialApplet.jar", "FactorialTrace.jar");
URL[] apath = getClasspath("FactorialTrace.jar");
WeavingURLClassLoader wucl = new WeavingURLClassLoader(cpath, apath, Thread.currentThread().getContextClassLoader());
Class mainApplet = wucl.loadClass("AppletFactorial");
Object applet = mainApplet.newInstance();
if (mainApplet != null) {
Class[] args = null;
Method init = mainApplet.getMethod("init", args);
init.invoke(applet, (Object[])null);
this.add((Component)applet);