本文整理匯總了Java中org.mozilla.javascript.Context.setWrapFactory方法的典型用法代碼示例。如果您正苦於以下問題:Java Context.setWrapFactory方法的具體用法?Java Context.setWrapFactory怎麽用?Java Context.setWrapFactory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.mozilla.javascript.Context
的用法示例。
在下文中一共展示了Context.setWrapFactory方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: afterPropertiesSet
import org.mozilla.javascript.Context; //導入方法依賴的package包/類
/**
* Pre initializes two scope objects (one secure and one not) with the standard objects preinitialised.
* This saves on very expensive calls to reinitialize a new scope on every web script execution. See
* http://www.mozilla.org/rhino/scopes.html
*
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
*/
public void afterPropertiesSet() throws Exception
{
// Initialize the secure scope
Context cx = Context.enter();
try
{
cx.setWrapFactory(wrapFactory);
this.secureScope = initScope(cx, false, true);
}
finally
{
Context.exit();
}
// Initialize the non-secure scope
cx = Context.enter();
try
{
cx.setWrapFactory(wrapFactory);
this.nonSecureScope = initScope(cx, true, true);
}
finally
{
Context.exit();
}
}
示例2: setupContext
import org.mozilla.javascript.Context; //導入方法依賴的package包/類
protected void setupContext(Context context) {
context.setOptimizationLevel(-1);
context.setLanguageVersion(Context.VERSION_ES6);
context.setLocale(Locale.getDefault());
context.setWrapFactory(new WrapFactory());
}