Package gov.niem.tools.api.core.utils
Class ResponseUtils
java.lang.Object
gov.niem.tools.api.core.utils.ResponseUtils
HTTP response-related utility functions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.http.ResponseEntity
<byte[]> getResponseFile
(byte[] bytes, String filename) Returns a response entity with the given filename set in the header and bytes set in the body.static org.springframework.http.ResponseEntity
<byte[]> getResponseFile
(byte[] bytes, String filename, org.springframework.http.MediaType mediaType) Returns a response entity with the given filename set in the header, bytes set in the body, and the content type set to the given media type.static org.springframework.http.ResponseEntity
<byte[]> getResponseFileCsv
(String data, String filename) Returns a response entity for a CSV file.static org.springframework.http.ResponseEntity
<byte[]> getResponseFileJson
(byte[] bytes, String filename) Returns a response entity for a JSON file.static org.springframework.http.ResponseEntity
<byte[]> getResponseFileText
(byte[] bytes, String filename) Returns a response entity for a text file.static org.springframework.http.ResponseEntity
<byte[]> getResponseFileXml
(byte[] bytes, String filename) Returns a response entity for an XML file.static org.springframework.http.ResponseEntity
<byte[]> getResponseFileZip
(byte[] bytes, String filename) Returns a response entity for a zip file.
-
Constructor Details
-
ResponseUtils
public ResponseUtils()
-
-
Method Details
-
getResponseFile
public static org.springframework.http.ResponseEntity<byte[]> getResponseFile(byte[] bytes, String filename) Returns a response entity with the given filename set in the header and bytes set in the body. -
getResponseFile
public static org.springframework.http.ResponseEntity<byte[]> getResponseFile(byte[] bytes, String filename, org.springframework.http.MediaType mediaType) Returns a response entity with the given filename set in the header, bytes set in the body, and the content type set to the given media type. -
getResponseFileZip
public static org.springframework.http.ResponseEntity<byte[]> getResponseFileZip(byte[] bytes, String filename) Returns a response entity for a zip file. -
getResponseFileJson
public static org.springframework.http.ResponseEntity<byte[]> getResponseFileJson(byte[] bytes, String filename) Returns a response entity for a JSON file. -
getResponseFileText
public static org.springframework.http.ResponseEntity<byte[]> getResponseFileText(byte[] bytes, String filename) Returns a response entity for a text file. -
getResponseFileXml
public static org.springframework.http.ResponseEntity<byte[]> getResponseFileXml(byte[] bytes, String filename) Returns a response entity for an XML file. -
getResponseFileCsv
public static org.springframework.http.ResponseEntity<byte[]> getResponseFileCsv(String data, String filename) Returns a response entity for a CSV file.
-