Package org.dynamoframework.rest
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<ID,T extends AbstractEntity<ID>>
void<ID,T extends AbstractEntity<ID>>
org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> <ID,T extends AbstractEntity<ID>>
org.springframework.http.ResponseEntity<String> downloadBase64(String entityId, String entityName, String attributeName) Downloads a file as a Base64 string<ID,T extends AbstractEntity<ID>>
voidupload(org.springframework.web.multipart.MultipartFile file, String id, String entityName, String attributeName) Uploads a file
-
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 entityT- type parameter, type of the entity- Parameters:
file- the file to uploadid- the ID of the entity on which to store the fileentityName- the name of the entityattributeName- 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 keyT- the type of the entity- Parameters:
entityId- the entity IDentityName- the name of the entityattributeName- the name of- Returns:
- the base 64 representation of the string
-