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);
}
}