package org.directwebremoting.dwrp; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.http.HttpServletResponse; import org.directwebremoting.ConversionException; import org.directwebremoting.ScriptBuffer; import org.directwebremoting.dwrp.BaseScriptConduit; import org.directwebremoting.extend.ConverterManager; import org.directwebremoting.extend.EnginePrivate; import org.directwebremoting.extend.ScriptBufferUtil; import org.directwebremoting.extend.Sleeper; public class Html4kScriptConduit extends BaseScriptConduit { protected static final String FOUR_K_FLUSH_DATA; public Html4kScriptConduit(Sleeper sleeper, HttpServletResponse response, String instanceId, String batchId, ConverterManager converterManager, boolean jsonOutput) throws IOException { super(sleeper, response, instanceId, batchId, converterManager, jsonOutput); } protected String getOutboundMimeType() { return "text/html"; } public void beginStream() { PrintWriter var1 = this.out; synchronized(this.out) { this.out.println("
");
         this.out.println("//#DWR-START#");
         this.out.print(EnginePrivate.remoteBeginWrapper(this.instanceId, false));
         this.out.println(EnginePrivate.remoteBeginIFrameResponse(this.batchId, false));
         this.out.print(EnginePrivate.remoteEndWrapper(this.instanceId, false));
         this.out.println("//#DWR-END#");
      }
   }

   public void endStream() {
      PrintWriter var1 = this.out;
      synchronized(this.out) {
         this.out.println("//#DWR-START#");
         this.out.print(EnginePrivate.remoteBeginWrapper(this.instanceId, false));
         this.out.println(EnginePrivate.remoteEndIFrameResponse(this.batchId, false));
         this.out.print(EnginePrivate.remoteEndWrapper(this.instanceId, false));
         this.out.println("//#DWR-END#");
         this.out.println("
"); } } public boolean addScript(ScriptBuffer scriptBuffer) throws IOException, ConversionException { String script = ScriptBufferUtil.createOutput(scriptBuffer, this.converterManager, this.jsonOutput); PrintWriter var3 = this.out; synchronized(this.out) { this.out.println("//#DWR-START#"); this.out.print(EnginePrivate.remoteBeginWrapper(this.instanceId, false)); this.out.println(script); this.out.print(EnginePrivate.remoteEndWrapper(this.instanceId, false)); this.out.println("//#DWR-END#"); this.out.print(FOUR_K_FLUSH_DATA); return this.flush(); } } static { StringBuffer buffer = new StringBuffer(409600); for(int i = 0; i < 4096; ++i) { buffer.append(" "); } FOUR_K_FLUSH_DATA = buffer.toString(); } }