Package com.almis.awe.controller
Class FileController
java.lang.Object
com.almis.awe.config.ServiceConfig
com.almis.awe.controller.FileController
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
Manage template request
-
Constructor Summary
ConstructorDescriptionFileController
(FileService fileService, MaintainService maintainService, EncodeService encodeService) Autowired constructor -
Method Summary
Modifier and TypeMethodDescriptiondeleteFile
(com.fasterxml.jackson.databind.node.ObjectNode parameters) Retrieve file for downloadorg.springframework.http.ResponseEntity<byte[]>
downloadFile
(com.fasterxml.jackson.databind.node.ObjectNode parameters) Retrieve file for downloadorg.springframework.http.ResponseEntity<byte[]>
downloadFileMaintain
(com.fasterxml.jackson.databind.node.ObjectNode parameters, String targetId) Retrieve file for downloadorg.springframework.http.ResponseEntity<org.springframework.core.io.FileSystemResource>
getFileAsStream
(com.fasterxml.jackson.databind.node.ObjectNode parameters) Retrieve generic file streamorg.springframework.http.ResponseEntity<org.springframework.core.io.FileSystemResource>
getFileAsStreamPOST
(com.fasterxml.jackson.databind.node.ObjectNode parameters, String targetId) Retrieve generic file streamorg.springframework.http.ResponseEntity<String>
getFileAsText
(com.fasterxml.jackson.databind.node.ObjectNode parameters) Retrieve text filevoid
Handle errorMethods inherited from class com.almis.awe.config.ServiceConfig
containsBean, getApplicationContext, getBean, getBean, getElements, getLocale, getLocale, getProperty, getProperty, getRequest, getSession, setApplicationContext
-
Constructor Details
-
FileController
@Autowired public FileController(FileService fileService, MaintainService maintainService, EncodeService encodeService) Autowired constructor- Parameters:
fileService
- File servicemaintainService
- Maintain serviceencodeService
- Encode service
-
-
Method Details
-
getFileAsText
@PostMapping("/text") public org.springframework.http.ResponseEntity<String> getFileAsText(@RequestBody com.fasterxml.jackson.databind.node.ObjectNode parameters) throws AWException Retrieve text file- Parameters:
parameters
- Parameters- Returns:
- File content
- Throws:
AWException
- Error retrieving file
-
getFileAsStream
@PostMapping("/stream") public org.springframework.http.ResponseEntity<org.springframework.core.io.FileSystemResource> getFileAsStream(@RequestBody com.fasterxml.jackson.databind.node.ObjectNode parameters) throws AWException Retrieve generic file stream- Parameters:
parameters
- Parameters- Returns:
- File content
- Throws:
AWException
- Error retrieving file
-
getFileAsStreamPOST
@PostMapping("/stream/maintain/{targetId}") public org.springframework.http.ResponseEntity<org.springframework.core.io.FileSystemResource> getFileAsStreamPOST(@RequestBody com.fasterxml.jackson.databind.node.ObjectNode parameters, @PathVariable("targetId") String targetId) throws AWException Retrieve generic file stream- Parameters:
parameters
- ParameterstargetId
- Maintain target id- Returns:
- File content
- Throws:
AWException
- Error retrieving file
-
downloadFile
@PostMapping("/download") public org.springframework.http.ResponseEntity<byte[]> downloadFile(@RequestBody com.fasterxml.jackson.databind.node.ObjectNode parameters) throws AWException Retrieve file for download- Parameters:
parameters
- Parameters- Returns:
- File content
- Throws:
AWException
- Error retrieving file
-
downloadFileMaintain
@PostMapping("/download/maintain/{targetId}") public org.springframework.http.ResponseEntity<byte[]> downloadFileMaintain(@RequestBody com.fasterxml.jackson.databind.node.ObjectNode parameters, @PathVariable("targetId") String targetId) throws AWException Retrieve file for download- Parameters:
parameters
- ParameterstargetId
- Maintain target- Returns:
- File content
- Throws:
AWException
- Error retrieving file
-
deleteFile
@PostMapping("/delete") public ServiceData deleteFile(@RequestBody com.fasterxml.jackson.databind.node.ObjectNode parameters) throws AWException Retrieve file for download- Parameters:
parameters
- Parameters- Returns:
- File content
- Throws:
AWException
- Error retrieving file
-
handleAWException
@ExceptionHandler(AWException.class) @ResponseStatus(UNAUTHORIZED) public void handleAWException(AWException exc) Handle error- Parameters:
exc
- Exception to handle
-