i am looking for a way to intercept all method calls from JavaScript (Rhino/Java) to any and all Java-Objects (Java-Methods).
I want to:
- count them (by method name & arguments)
- be able to throw an exception if the method is disallowed
Is there a way to this inside the Rhino-Engine?
I know there are other options like Aspect-Oriented-Programming-Libraries, but i want to avoid those.
I also tried to replace the NativeJavaMethod
implementation in the Rhino engine, but is tied very deeply into the system and impossible to replace.
If there was only a factory for those (like with the ContextFactory) that would be great.
Or a method call interceptor like the ContextFactory.doTopCall(...)
, but for all JS-2-Java calls.