Commit ec9d37f9 authored by Adrien's avatar Adrien

try to change method signature

parent 696e2e8b
...@@ -39,28 +39,23 @@ class CodeSigningRestController { ...@@ -39,28 +39,23 @@ class CodeSigningRestController {
var macCodeSign = MacCodeSign() var macCodeSign = MacCodeSign()
@PostMapping("/test") @PostMapping("/test")
fun signProduct(response: HttpServletResponse): StreamingResponseBody { fun test(response: HttpServletResponse) {
val file : File = File("/Users/codesign/Downloads/BonitaStudioCommunity-7.8.9-SNAPSHOT-x86.exe") val file : File = File("/Users/codesign/Downloads/BonitaStudioCommunity-7.8.0-SNAPSHOT-x86.exe")
response.setContentType("application/octet-stream") response.setContentType("application/octet-stream")
response.setHeader("Content-Disposition", "attachment; filename='${file.name}'") response.setHeader("Content-Disposition", "attachment; filename='${file.name}'")
logger.info("returning file " + file.name +"...") logger.info("returning file " + file.name +"...")
return StreamingResponseBody { outputStream ->
FileInputStream(file.canonicalFile).use { inputStream -> FileInputStream(file.canonicalFile).use { inputStream ->
try { try {
val bytesCopied: Int = IOUtils.copy(inputStream, outputStream) val bytesCopied: Int = IOUtils.copy(inputStream, response.outputStream)
logger.info(bytesCopied.toString() + " have been copied") logger.info(bytesCopied.toString() + " have been copied")
} catch (e: Exception) { } catch (e: Exception) {
logger.error("An error occured during stream copy", e) logger.error("An error occured during stream copy", e)
} catch (e: RuntimeException) { } catch (e: RuntimeException) {
logger.error("An error occured during stream copy", e) logger.error("An error occured during stream copy", e)
} }
outputStream.flush()
outputStream.close()
} }
}
} }
@PostMapping("/sign") @PostMapping("/sign")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment