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

@RestController @RequestMapping("/file") public class FileController extends ServiceConfig
Manage template request
  • Constructor Details

    • FileController

      @Autowired public FileController(FileService fileService, MaintainService maintainService, EncodeService encodeService)
      Autowired constructor
      Parameters:
      fileService - File service
      maintainService - Maintain service
      encodeService - 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 - Parameters
      targetId - 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 - Parameters
      targetId - 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