Class HttpAuWriter
- java.lang.Object
-
- org.zkoss.zk.au.http.HttpAuWriter
-
-
Constructor Summary
Constructors Constructor Description HttpAuWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose(java.lang.Object request, java.lang.Object response)Closes the writer and flush the result to client.java.lang.Objectcomplete()Indicates the writing has been completed.protected voidflush(java.lang.Object request, java.lang.Object response, boolean bCompress)Flush the result of responses to client.booleanisCompress()Returns whether to compress the output.AuWriteropen(java.lang.Object request, java.lang.Object response)Opens the connection.voidresend(java.lang.Object prevContent)Resend the content of the previous request returned byAuWriter.complete().protected byte[]restore(java.lang.Object data)Called to decode the last response for repeated request before retrieving.protected java.lang.Objectsave(byte[] data)Called to encode the last response for repeated request before storing.voidsetCompress(boolean compress)Sets whether to compress the output with GZIP.voidwrite(java.util.Collection<AuResponse> responses)Generates a list of responses to the output.voidwrite(AuResponse response)Generates the specified the response to the output.voidwriteResponseId(int resId)Generates the response ID to the output.
-
-
-
Method Detail
-
isCompress
public boolean isCompress()
Returns whether to compress the output.- Since:
- 3.6.3
-
setCompress
public void setCompress(boolean compress)
Description copied from interface:AuWriterSets whether to compress the output with GZIP.Default: true.
- Specified by:
setCompressin interfaceAuWriter
-
open
public AuWriter open(java.lang.Object request, java.lang.Object response) throws java.io.IOException
Opens the connection.Default: it creates an object to store the responses.
-
close
public void close(java.lang.Object request, java.lang.Object response) throws java.io.IOExceptionDescription copied from interface:AuWriterCloses the writer and flush the result to client.
-
resend
public void resend(java.lang.Object prevContent) throws java.io.IOExceptionDescription copied from interface:AuWriterResend the content of the previous request returned byAuWriter.complete().The content is usually stored to a desktop by
DesktopCtrl.responseSent(java.lang.String, java.lang.Object), and retrieved byDesktopCtrl.getLastResponse(java.lang.String).Once this method is called, the caller shall not invoke any other write method nor
AuWriter.complete(). It shall invoke onlyAuWriter.close(java.lang.Object, java.lang.Object)to end the writer.- Specified by:
resendin interfaceAuWriter- Parameters:
prevContent- the previous content returned byAuWriter.close(java.lang.Object, java.lang.Object)of the previousAuWriter.- Throws:
java.io.IOException
-
complete
public java.lang.Object complete() throws java.io.IOExceptionDescription copied from interface:AuWriterIndicates the writing has been completed. Invokes this method beforeAuWriter.close(java.lang.Object, java.lang.Object), if the caller supports the resend mechanism. The caller usually stores the return value to a desktop byDesktopCtrl.responseSent(java.lang.String, java.lang.Object)).Unlike
AuWriter.close(java.lang.Object, java.lang.Object), this method must be called in an activated execution.Once this method is called, the caller shall not invoke any other write method. It shall invoke only
AuWriter.close(java.lang.Object, java.lang.Object)to end the writer.
-
flush
protected void flush(java.lang.Object request, java.lang.Object response, boolean bCompress) throws java.io.IOExceptionFlush the result of responses to client.- Parameters:
bCompress- whether to compress (if allowed).- Throws:
java.io.IOException- Since:
- 5.0.4
-
save
protected java.lang.Object save(byte[] data)
Called to encode the last response for repeated request before storing.Default: does nothing but return the input argument, data. The derived class might override this method to compress it.
- Since:
- 5.0.4
- See Also:
restore(java.lang.Object)
-
restore
protected byte[] restore(java.lang.Object data)
Called to decode the last response for repeated request before retrieving.Default: does nothing but return the input argument, data. The derived class might override this method to uncompress it.
- Parameters:
data- the data returned bysave(byte[])- Returns:
- the byte array that is passed to
save(byte[]). - Since:
- 5.0.4
-
writeResponseId
public void writeResponseId(int resId) throws java.io.IOExceptionDescription copied from interface:AuWriterGenerates the response ID to the output.- Specified by:
writeResponseIdin interfaceAuWriter- Throws:
java.io.IOException- See Also:
DesktopCtrl.getResponseId(boolean)
-
write
public void write(AuResponse response) throws java.io.IOException
Description copied from interface:AuWriterGenerates the specified the response to the output.
-
write
public void write(java.util.Collection<AuResponse> responses) throws java.io.IOException
Description copied from interface:AuWriterGenerates a list of responses to the output.
-
-