Class HttpAuWriter
- All Implemented Interfaces:
AuWriter
- Since:
- 3.0.1
- Author:
- tomyeh
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCloses the writer and flush the result to client.complete()Indicates the writing has been completed.protected voidFlush the result of responses to client.booleanReturns whether to compress the output.Opens the connection.voidResend the content of the previous request returned byAuWriter.complete().protected byte[]Called to decode the last response for repeated request before retrieving.protected 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(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
-
HttpAuWriter
public HttpAuWriter()
-
-
Method Details
-
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
Opens the connection.Default: it creates an object to store the responses.
- Specified by:
openin interfaceAuWriter- Parameters:
request- 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:
request- the request (HttpServletRequest if HTTP)response- the response (HttpServletResponse if HTTP)- 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
-
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
-
flush
Flush the result of responses to client.- Parameters:
bCompress- whether to compress (if allowed).- Throws:
IOException- Since:
- 5.0.4
-
save
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
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
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
-