org.zkoss.zkmax.au.http
Class SmartAuWriter

java.lang.Object
  extended by org.zkoss.zk.au.http.HttpAuWriter
      extended by org.zkoss.zkmax.au.http.SmartAuWriter
All Implemented Interfaces:
AuWriter

public class SmartAuWriter
extends HttpAuWriter

A smart AU writer that will generate some output to client first if the processing takes more than the time specified in the timeout argument of open(java.lang.Object, java.lang.Object, int).

Since:
3.0.1
Author:
tomyeh

Field Summary
 
Fields inherited from class org.zkoss.zk.au.http.HttpAuWriter
_out
 
Constructor Summary
SmartAuWriter()
           
 
Method Summary
protected  void flush(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Flushes the bufferred output (HttpAuWriter._out) to the client.
protected  ScalableTimer newTimer()
          Creates an instance of ScalableTimer.
 AuWriter open(java.lang.Object request, java.lang.Object response, int timeout)
          Opens the connection.
 
Methods inherited from class org.zkoss.zk.au.http.HttpAuWriter
close, getChannel, write, write, writeResponseId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmartAuWriter

public SmartAuWriter()
Method Detail

newTimer

protected ScalableTimer newTimer()
Creates an instance of ScalableTimer.

By default, it creates a scalable timer that will use at most 50 real timers (i.e., new ScalableTimer(50, 25)). If you want to change it, you can override this method.

Since:
3.0.4

open

public AuWriter open(java.lang.Object request,
                     java.lang.Object response,
                     int timeout)
              throws java.io.IOException
Opens the connection. It starts a timer and generate some output to client first if the processing take more than the time specified in the timeout argument.

Specified by:
open in interface AuWriter
Overrides:
open in class HttpAuWriter
Parameters:
request - the request (HttpServletRequest if HTTP)
response - the response (HttpServletResponse if HTTP)
timeout - the elapsed time (milliseconds) before sending a whitespace to the client to indicate the connection is alive. Ignored if non-positive, or the implementation doesn't support this feature.
Returns:
this object
Throws:
java.io.IOException

flush

protected void flush(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws java.io.IOException
Description copied from class: HttpAuWriter
Flushes the bufferred output (HttpAuWriter._out) to the client. It is called by HttpAuWriter.close(java.lang.Object, java.lang.Object).

Overrides:
flush in class HttpAuWriter
Throws:
java.io.IOException


Copyright © 2005-2009 Potix Corporation. All Rights Reserved.