What about extending or the FileWriter class, with overriding the methods
which you want to exclude (unless they are final ) with { /* do nothing */}
code - or wrappinng the FileWriter in your own class - then the wrapper can
call the selected methods .
--- On Fri, 11/21/08, Ruland Kevin-BHP637 <[EMAIL PROTECTED]> wrote:
From: Ruland Kevin-BHP637 <[EMAIL PROTECTED]>
Subject: Contributing to rhino
To: [email protected]
Date: Friday, November 21, 2008, 2:22 PM
Hi all,
I need a way to prevent certain Java functions from being accessible to
JavaScript. For example:
var a = new java.io.FileWriter("AAA");
a.wait(); // wait is undefined!
I want to allow access to FileWriter, but I don't want to allow access
to wait() (and certain other functions). The only way I see to do this
is to modify the JavaMembers.reflect() method. What I am considering
is, expanding the ClassShutter interface to provide a method boolean
visibleToScript( String fullClassName, String methodName ) which would
be called during the discoverAccessibleMethods recursion. An
alternative is to have this method accept a single argument of type
Member which should also be adequate.
Are there any other suggestions to getting this functionality? Should
some FEATURE flag be used in addition to ClassShutter?
I realize that changing the ClassShutter interface would effect existing
classes which implement ClassShutter. An alternative would be to extend
the ClassShutter interface with a new interface. Then the JavaMembers
class could test the result of cx.getClassShutter to see if the object
implements this new interface as well before using it.
Finally are there any immediately visible red flags which could prevent
such a change from eventually becoming mainline? An answer to the
negative does not commit the maintainers from accepting it, of course.
Thanks for the help.
Kevin
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino