Class ResponseEntityHelper
java.lang.Object
com.flowable.core.common.rest.response.ResponseEntityHelper
Helper class for working with
ResponseEntity.- Author:
- Filip Hrisafov
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasByteArrayResponseEntity(InputStream inputStream, String mimeType, String name, Boolean download) protected StringdispositionType(Boolean download, MediaType mediaType) voidsetCharset(Charset charset)
-
Field Details
-
autoInlineMediaTypes
-
charset
-
-
Constructor Details
-
ResponseEntityHelper
-
-
Method Details
-
asByteArrayResponseEntity
public ResponseEntity<Resource> asByteArrayResponseEntity(InputStream inputStream, String mimeType, String name, Boolean download) Create aResponseEntitywith abyte[]body based on theinputStream.When the
mimeTypeis provided and is a knownMediaTypethen it would be used as theContent-Typeheader for theResponseEntity. Otherwise,application/octet-streamwould be used.If the
nameis provided then aContent-Dispositionheader would be added with that as a file name.The
downloadflag is used to indicate whether theinputStreamshould be displayed inside the Web page (inlinewhendownloadisfalse) or downloaded (attachmentwhendownloadistrue). In case it isnullthe value would be created based on themimeType.NB: Callers of this method are responsible for appropriately closing the
inputStream- Parameters:
inputStream- The input stream that should be used as the body (the caller is responsible for closing it)mimeType- the mime type for theContent-Typeheadername- the filename for theContent-Dispositionheaderdownload- flag indicating the type for theContent-Dispositionheader- Returns:
- the
ResponseEntitywith a statusHttpStatus.OK
-
dispositionType
-
setCharset
-