Package io.varhttp
Class VarResponseStream
java.lang.Object
io.varhttp.VarResponseStream
- All Implemented Interfaces:
ResponseStream
-
Constructor Summary
ConstructorsConstructorDescriptionVarResponseStream(ControllerContext controllerContext, Serializer serializer) -
Method Summary
Modifier and TypeMethodDescriptiongetContentWriter(String fileName, String contentType, Charset charset) Get writer that writes to response body in streaming way.getOutputStream(String contentType, Charset charset) Get the output-stream of the response.voidvoidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.varhttp.ResponseStream
getOutputStream
-
Constructor Details
-
VarResponseStream
-
-
Method Details
-
getContentWriter
Description copied from interface:ResponseStreamGet writer that writes to response body in streaming way. This should trigger file download in browser.- Specified by:
getContentWriterin interfaceResponseStream- Parameters:
fileName- Name of file for download eg. name.csvcontentType- File format eg. text/csv for csv filescharset- Character encoding of the file content eg. StandardCharsets.UTF-8 for UTF-8 encoding- Returns:
- writer that writes to response body
-
getOutputStream
Description copied from interface:ResponseStreamGet the output-stream of the response. Used to write non-string content.- Specified by:
getOutputStreamin interfaceResponseStream- Parameters:
contentType- Content format eg. image/png for PNG filescharset- Character encoding of the file content eg. StandardCharsets.UTF-8 for UTF-8 encoding- Returns:
- the output stream of the response.
-
write
- Specified by:
writein interfaceResponseStream
-
write
- Specified by:
writein interfaceResponseStream
-