/** * Marshall a Script without worrying about MarshallExceptions */ public void addScriptHandleExceptions(ScriptConduit conduit, ScriptBuffer script) throws IOException { try { conduit.sendScript(ScriptBufferUtil.createOutput(script, converterManager, jsonOutput)); } catch (ConversionException ex) { log.warn("Error marshalling exception. Is the exception converter configured?", ex); } }
private void sendPollReply() throws ConversionException, IOException { ScriptBuffer script = EnginePrivate.getRemoteHandleCallbackScript(batchId, "0", disconnectedTime); conduit.sendScript(ScriptBufferUtil.createOutput(script, converterManager, jsonOutput)); }
private void beginStreamAndChunk() throws Exception { response.setContentType(conduit.getOutboundMimeType()); // If there is a runnable for beginning of response then run it RealScriptSession.Script script = scriptSession.getScript(nextScriptIndex); boolean beginningRunnable = false; if (script != null && script.getScript() instanceof Runnable) { try { ((Runnable) script.getScript()).run(); } catch(Exception ex) { log.error("Exception when executing Script Runnable.", ex); } beginningRunnable = true; } // Send stream prefix conduit.beginStreamAndChunk(); // Send confirmation for the runnable to client after stream prefix if (beginningRunnable) { conduit.sendScript(EnginePrivate.getRemoteHandleReverseAjaxScript(script.getIndex(), "")); nextScriptIndex = script.getIndex() + 1; } }
private void sendNewChunkScripts() throws Exception { // Scripts while(true) { RealScriptSession.Script script = scriptSession.getScript(nextScriptIndex); if (script != null && script.getScript() instanceof String) { conduit.sendScript(EnginePrivate.getRemoteHandleReverseAjaxScript(script.getIndex(), (String) script.getScript())); nextScriptIndex = script.getIndex() + 1; } else { break; } } }
conduit.sendScript(EnginePrivate.getRemoteHandleReverseAjaxScript(script.getIndex(), "")); nextScriptIndex = script.getIndex() + 1; script = scriptSession.getScript(nextScriptIndex); if (script != null && script.getScript() instanceof String) { conduit.sendScript(EnginePrivate.getRemoteHandleReverseAjaxScript(script.getIndex(), (String) script.getScript())); nextScriptIndex = script.getIndex() + 1; } else { scriptBuf = EnginePrivate.getRemoteHandleCallbackScript(batchId, callId, data); conduit.sendScript(ScriptBufferUtil.createOutput(scriptBuf, converterManager, jsonOutput));