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.void
void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.varhttp.ResponseStream
getOutputStream
-
Constructor Details
-
VarResponseStream
-
-
Method Details
-
getContentWriter
Description copied from interface:ResponseStream
Get writer that writes to response body in streaming way. This should trigger file download in browser.- Specified by:
getContentWriter
in 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:ResponseStream
Get the output-stream of the response. Used to write non-string content.- Specified by:
getOutputStream
in 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:
write
in interfaceResponseStream
-
write
- Specified by:
write
in interfaceResponseStream
-