Package org.zkoss.zkmax.au.websocket
Class WSAuWriter
java.lang.Object
org.zkoss.zkmax.au.websocket.WSAuWriter
- All Implemented Interfaces:
AuWriter
An AuWriter that is based on WebSocket.
- Since:
- 8.5.0
- Author:
- wenninghsu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCloses the writer and flush the result to client.complete()Indicates the writing has been completed.Initializes the writer.voidResend the content of the previous request returned byAuWriter.complete().protected byte[]protected Objectsave(byte[] data) voidsetCompress(boolean compress) Sets whether to compress the output with GZIP.voidwrite(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.
-
Constructor Details
-
WSAuWriter
public WSAuWriter()
-
-
Method Details
-
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
Description copied from interface:AuWriterInitializes the writer.- Specified by:
openin interfaceAuWriter- Parameters:
websocketEndpoint- the request (HttpServletRequest if HTTP)response- the response (HttpServletResponse if HTTP)- Returns:
- this object
- Throws:
IOException
-
close
Description copied from interface:AuWriterCloses the writer and flush the result to client.- Specified by:
closein interfaceAuWriter- Parameters:
websocketEndpoint- the request (HttpServletRequest if HTTP)response- the response (HttpServletResponse if HTTP)- Throws:
IOException
-
complete
Description 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.- Specified by:
completein interfaceAuWriter- Throws:
IOException
-
resend
Description 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:
IOException
-
writeResponseId
Description copied from interface:AuWriterGenerates the response ID to the output.- Specified by:
writeResponseIdin interfaceAuWriter- Throws:
IOException- See Also:
-
write
Description copied from interface:AuWriterGenerates the specified the response to the output.- Specified by:
writein interfaceAuWriter- Throws:
IOException
-
write
Description copied from interface:AuWriterGenerates a list of responses to the output.- Specified by:
writein interfaceAuWriter- Throws:
IOException
-
restore
-
save
-