Rhino: restrict Java packages that can be accessed from JavaScript

前端 未结 2 1529
轻奢々
轻奢々 2021-02-07 20:34

When embedding a JavaScript interpreter (Rhino) into a Java application (to be able to script that application), how would one go about restricting the Java packages that are av

相关标签:
2条回答
  • 2021-02-07 21:07

    A method for blocking access to certain packages and classes (including through reflection) in Rhino is described here. The important interface is ClassShutter which provides access control for Rhino's LiveConnect support.

    0 讨论(0)
  • 2021-02-07 21:27

    how about just saying:

    java = undefined; com = undefined; Packages = undefined;

    in an initial script which is loaded first.

    0 讨论(0)
提交回复
热议问题