Package org.jaggeryjs.scriptengine.engine

Examples of org.jaggeryjs.scriptengine.engine.JavaScriptProperty


        String logLevel = (String) ctx.getAttribute(LogHostObject.LOG_LEVEL);
        if (logLevel != null) {
            sharedContext.addProperty(LogHostObject.LOG_LEVEL, logLevel);
        }
        ScriptableObject sharedScope = sharedContext.getScope();
        JavaScriptProperty application = new JavaScriptProperty("application");
        application.setValue(cx.newObject(sharedScope, "Application", new Object[]{ctx}));
        application.setAttribute(ScriptableObject.READONLY);
        RhinoEngine.defineProperty(sharedScope, application);
        ctx.setAttribute(SHARED_JAGGERY_CONTEXT, sharedContext);
    }
View Full Code Here


        return (String) obj;
    }

    private static void defineProperties(Context cx, JaggeryContext context, ScriptableObject scope) {

        JavaScriptProperty request = new JavaScriptProperty("request");
        HttpServletRequest servletRequest = (HttpServletRequest) context.getProperty(SERVLET_REQUEST);
        request.setValue(cx.newObject(scope, "Request", new Object[]{servletRequest}));
        request.setAttribute(ScriptableObject.READONLY);
        RhinoEngine.defineProperty(scope, request);

        JavaScriptProperty response = new JavaScriptProperty("response");
        HttpServletResponse servletResponse = (HttpServletResponse) context.getProperty(SERVLET_RESPONSE);
        response.setValue(cx.newObject(scope, "Response", new Object[]{servletResponse}));
        response.setAttribute(ScriptableObject.READONLY);
        RhinoEngine.defineProperty(scope, response);

        JavaScriptProperty session = new JavaScriptProperty("session");
        session.setValue(cx.newObject(scope, "Session", new Object[]{servletRequest.getSession()}));
        session.setAttribute(ScriptableObject.READONLY);
        RhinoEngine.defineProperty(scope, session);

        JavaScriptProperty application = new JavaScriptProperty("application");
        ServletContext servletConext = (ServletContext) context.getProperty(Constants.SERVLET_CONTEXT);
        application.setValue(cx.newObject(scope, "Application", new Object[]{servletConext}));
        application.setAttribute(ScriptableObject.READONLY);
        RhinoEngine.defineProperty(scope, application);

        if (isWebSocket(servletRequest)) {
            JavaScriptProperty websocket = new JavaScriptProperty("webSocket");
            websocket.setValue(cx.newObject(scope, "WebSocket", new Object[0]));
            websocket.setAttribute(ScriptableObject.READONLY);
            RhinoEngine.defineProperty(scope, websocket);
        }

    }
View Full Code Here

            CommonManager.setJaggeryContext(context);
        }
        RhinoEngine engine = context.getEngine();
        ScriptableObject clonedScope = context.getScope();

        JavaScriptProperty session = new JavaScriptProperty("session");
        session.setValue(cx.newObject(clonedScope, "Session", new Object[]{httpSessionEvent.getSession()}));
        session.setAttribute(ScriptableObject.READONLY);
        RhinoEngine.defineProperty(clonedScope, session);

        for (Object jsListener : jsListeners) {
            CommonManager.getCallstack(context).push((String) jsListener);
            try {
View Full Code Here

            CommonManager.setJaggeryContext(context);
        }
        RhinoEngine engine = context.getEngine();
        ScriptableObject clonedScope = context.getScope();

        JavaScriptProperty session = new JavaScriptProperty("session");
        session.setValue(cx.newObject(clonedScope, "Session", new Object[]{httpSessionEvent.getSession()}));
        session.setAttribute(ScriptableObject.READONLY);
        RhinoEngine.defineProperty(clonedScope, session);

        for (Object jsListener : jsListeners) {
            CommonManager.getCallstack(context).push((String) jsListener);
            try {
View Full Code Here

TOP

Related Classes of org.jaggeryjs.scriptengine.engine.JavaScriptProperty

Copyright © 2018 www.massapicom. 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.