/** * Utility to add the given script to all known browsers. * @param script The Javascript to send to the browsers */ public void addScript(ScriptBuffer script) { for (ScriptSession scriptSession : scriptSessions) { scriptSession.addScript(script); } }
/** * Add a property to a JavaScript object. The type of the data must be * convertible by DWR. */ public void set(String propertyName, Object data) { ScriptBuffer script = EnginePrivate.getRemoteSetObjectScript(id, propertyName, data); session.addScript(script); }
public void execute(String methodName, Object... params) { ScriptBuffer script = EnginePrivate.getRemoteExecuteObjectScript(id, methodName, params); session.addScript(script); }
public void close() { ScriptBuffer script = EnginePrivate.getRemoteCloseFunctionScript(id); session.addScript(script); }
/** * Add a script to the list waiting for remote execution. * @param script The script to execute */ public static void addScript(ScriptBuffer script) { Collection<ScriptSession> sessions = Browser.getTargetSessions(); for (ScriptSession scriptSession : sessions) { scriptSession.addScript(script); } }
public void close() { ScriptBuffer script = EnginePrivate.getRemoteCloseFunctionScript(id); session.addScript(script); }
public void execute(Object... params) { ScriptBuffer script = EnginePrivate.getRemoteExecuteFunctionScript(id, params); session.addScript(script); }
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (method.getName().equals("equals") && args.length == 1) { return equals(args[0]); } if (method.getName().equals("hashCode") && (args == null || args.length == 0)) { return hashCode(); } if (method.getName().equals("toString") && (args == null || args.length == 0)) { return toString(); } ScriptBuffer script = EnginePrivate.getRemoteExecuteObjectScript(id, method.getName(), args); session.addScript(script); return null; }
public void onMessage(MessageEvent message) { ScriptBuffer script = new ScriptBuffer(); script.appendCall("dwr.hub._remotePublish", subscriptionId, message.getRawData()); session.addScript(script); }
public Object doFilter(Object obj, Method method, Object[] params, AjaxFilterChain chain) throws Exception { ScriptSession session = WebContextFactory.get().getScriptSession(); Long lastAccess = (Long) session.getAttribute(ATTRIBUTE_LAST_ACTION); // Free pass in if you've not done anything so far. if (lastAccess != null) { long now = System.currentTimeMillis(); if (now > lastAccess + actionTimeoutMillis) { session.addScript(new ScriptBuffer(onTimeout)); session.invalidate(); throw new DwrConvertedException("Your session has timed out"); } } Object reply = chain.doFilter(obj, method, params); session.setAttribute(ATTRIBUTE_LAST_ACTION, System.currentTimeMillis()); return reply; }