Class FileController

java.lang.Object
org.dynamoframework.rest.FileController

@RestController @RequestMapping("#{@\'dynamoframework-org.dynamoframework.configuration.DynamoConfigurationProperties\'.defaults.endpoints.file}") @CrossOrigin public class FileController extends Object
Generic controller for uploading and downloading files
  • Constructor Details

    • FileController

      public FileController()
  • Method Details

    • upload

      @PostMapping(value="/upload", consumes="multipart/form-data") @Transactional public <ID, T extends AbstractEntity<ID>> void upload(@RequestParam("file") org.springframework.web.multipart.MultipartFile file, @RequestParam("entityId") String id, @RequestParam("entityName") String entityName, @RequestParam("attributeName") String attributeName) throws IOException
      Uploads a file
      Type Parameters:
      ID - type parameter, type of the ID of the entity
      T - type parameter, type of the entity
      Parameters:
      file - the file to upload
      id - the ID of the entity on which to store the file
      entityName - the name of the entity
      attributeName - the name of the attribute in which to store the file
      Throws:
      IOException - if an exception occurs
    • clear

      @GetMapping("/clear") @Transactional public <ID, T extends AbstractEntity<ID>> void clear(@RequestParam("entityId") String id, @RequestParam("entityName") String entityName, @RequestParam("attributeName") String attributeName) throws IOException
      Throws:
      IOException
    • download

      @GetMapping(path="/download") @Transactional public <ID, T extends AbstractEntity<ID>> org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> download(@RequestParam("entityId") String entityId, @RequestParam("entityName") String entityName, @RequestParam("attributeName") String attributeName)
    • downloadBase64

      @GetMapping(path="/downloadBase64", produces="text/plain") @Transactional public <ID, T extends AbstractEntity<ID>> org.springframework.http.ResponseEntity<String> downloadBase64(@RequestParam("entityId") String entityId, @RequestParam("entityName") String entityName, @RequestParam("attributeName") String attributeName)
      Downloads a file as a Base64 string
      Type Parameters:
      ID - the type of the primary key
      T - the type of the entity
      Parameters:
      entityId - the entity ID
      entityName - the name of the entity
      attributeName - the name of
      Returns:
      the base 64 representation of the string