Examples of ContextFactory


Examples of org.mozilla.javascript.ContextFactory

     *
     * TODO: make the custom class loader work (at not loading all the Java classes).
     */
    @BeforeClass
    public static void messWithClassLoader() {
      ContextFactory.initGlobal(new ContextFactory() {
        @Override
        protected Context makeContext() {
          Context cx = super.makeContext();
          cx.setWrapFactory(new WrapFactory() {
            @Override
            public Object wrap(Context cx, Scriptable scope, Object obj, Class staticType) {
              return super.wrap(cx, scope, obj, staticType);
            }
            @Override
            public Scriptable wrapNewObject(Context cx, Scriptable scope, Object obj) {
              return super.wrapNewObject(cx, scope, obj);
            }
            @Override
            public Scriptable wrapAsJavaObject(Context cx, Scriptable scope, Object javaObject, Class staticType) {
              return new SandboxNativeJavaObject(scope, javaObject, staticType);
            }           
          });
          return cx;
        }       
      });
      ContextFactory factory = ContextFactory.getGlobal();
      factory.initApplicationClassLoader(new SandboxClassLoader(TurtleSpecSection2_1Test.class.getClassLoader()));   
    }
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory

   
    public void initialize() {
        if (!initialized) {
            if ("true".equals(getProperty(USE_INTERPRETER_SYSTEM_PROPERTY))) {
                if (!ContextFactory.hasExplicitGlobal()) {
                    ContextFactory.initGlobal(new ContextFactory() {
                        @Override
                        protected Context makeContext() {
                            Context cx = super.makeContext();
                            cx.setOptimizationLevel(-1);
                            return cx;
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory

        super(classpathReference);
    }

    public void initializeRhino() {

        rhinoContextFactory = new ContextFactory();
        if (System.getProperty("cxf.jsdebug") != null && !rhinoDebuggerUp) {
            Main.mainEmbedded(rhinoContextFactory, rhinoScope, "Debug embedded JavaScript.");
            rhinoDebuggerUp = true;
        }
View Full Code Here

Examples of org.mozilla.javascript.ContextFactory

        super(classpathReference);
    }

    public void initializeRhino() {

        rhinoContextFactory = new ContextFactory();
        if (System.getProperty("cxf.jsdebug") != null && !rhinoDebuggerUp) {
            try {
                Class<?> debuggerMain =
                            ClassLoaderUtils.loadClass("org.mozilla.javascript.tools.debugger.Main",
                                                                   getClass());
View Full Code Here

Examples of org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider.ContextFactory

        provider.contextFactory = createContextFactoryThrowing(new CommunicationException(msg));
        provider.authenticate(joe);
    }

    ContextFactory createContextFactoryThrowing(final NamingException e) {
        return new ContextFactory() {
            @Override
            DirContext createContext(Hashtable<?, ?> env) throws NamingException {
                throw e;
            }
        };
View Full Code Here

Examples of org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider.ContextFactory

        };
    }


    ContextFactory createContextFactoryReturning(final DirContext ctx) {
        return new ContextFactory() {
            @Override
            DirContext createContext(Hashtable<?, ?> env) throws NamingException {
                return ctx;
            }
        };
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.