Package formflow.library
Class FileController
java.lang.Object
formflow.library.FormFlowController
formflow.library.FileController
-
Field Summary
Fields inherited from class formflow.library.FormFlowController
flowConfigurations, SUBMISSION_MAP_NAME, submissionRepositoryService, userFileRepositoryService -
Constructor Summary
ConstructorsConstructorDescriptionFileController(UserFileRepositoryService userFileRepositoryService, CloudFileRepository cloudFileRepository, FileVirusScanner fileVirusScanner, SubmissionRepositoryService submissionRepositoryService, List<FlowConfiguration> flowConfigurations, org.springframework.context.MessageSource messageSource, FileValidationService fileValidationService, Integer maxFiles, boolean blockIfClammitUnreachable) -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.web.servlet.view.RedirectViewdelete(UUID fileId, String returnPath, String dropZoneInstanceName, String flow, jakarta.servlet.http.HttpSession httpSession, jakarta.servlet.http.HttpServletRequest request) org.springframework.http.ResponseEntity<org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody>downloadAllFiles(String submissionId, String flow, jakarta.servlet.http.HttpSession httpSession, jakarta.servlet.http.HttpServletRequest request) org.springframework.http.ResponseEntity<org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody>downloadSingleFile(String submissionId, String fileId, String flow, jakarta.servlet.http.HttpSession httpSession, jakarta.servlet.http.HttpServletRequest request) org.springframework.http.ResponseEntity<?>upload(org.springframework.web.multipart.MultipartFile file, String flow, String inputName, String thumbDataUrl, jakarta.servlet.http.HttpSession httpSession, jakarta.servlet.http.HttpServletRequest request, Locale locale) File upload endpoint.Methods inherited from class formflow.library.FormFlowController
doesFlowExist, findOrCreateSubmission, getFlowConfigurationByName, getSubmissionFromSession, getSubmissionIdForFlow, saveToRepository, saveToRepository, setSubmissionInSession, throwNotFoundError
-
Constructor Details
-
FileController
public FileController(UserFileRepositoryService userFileRepositoryService, CloudFileRepository cloudFileRepository, FileVirusScanner fileVirusScanner, SubmissionRepositoryService submissionRepositoryService, List<FlowConfiguration> flowConfigurations, org.springframework.context.MessageSource messageSource, FileValidationService fileValidationService, @Value("${form-flow.uploads.max-files:20}") Integer maxFiles, @Value("${form-flow.uploads.virus-scanning.block-if-unreachable:false}") boolean blockIfClammitUnreachable)
-
-
Method Details
-
upload
@PostMapping(value="/file-upload", consumes="multipart/form-data") @ResponseStatus(OK) public org.springframework.http.ResponseEntity<?> upload(@RequestParam("file") org.springframework.web.multipart.MultipartFile file, @RequestParam("flow") String flow, @RequestParam("inputName") String inputName, @RequestParam("thumbDataURL") String thumbDataUrl, jakarta.servlet.http.HttpSession httpSession, jakarta.servlet.http.HttpServletRequest request, Locale locale) File upload endpoint.- Parameters:
file- A MultipartFile fileflow- The current flow nameinputName- The current inputNamethumbDataUrl- The thumbnail URL generated from the uploadhttpSession- The current HTTP session- Returns:
- ON SUCCESS: ResponseEntity with a body containing the id of a file. body.
ON FAILURE: ResponseEntity with an error message and a status code.
-
delete
@PostMapping("/file-delete") public org.springframework.web.servlet.view.RedirectView delete(@RequestParam("id") UUID fileId, @RequestParam("returnPath") String returnPath, @RequestParam("inputName") String dropZoneInstanceName, @RequestParam("flow") String flow, jakarta.servlet.http.HttpSession httpSession, jakarta.servlet.http.HttpServletRequest request) - Parameters:
fileId- The id of an uploaded file that should be deletedreturnPath- The path to the page that they came fromdropZoneInstanceName- The drop zone instance used to get the user file nameflow- The name of the current (active) flowhttpSession- The current HTTP session- Returns:
- ON SUCCESS: Returns a RedirectView to the returnPath
ON FAILURE: Returns a RedirectView to the 'error' page
-
downloadSingleFile
@GetMapping("/file-download/{flow}/{submissionId}/{fileId}") public org.springframework.http.ResponseEntity<org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody> downloadSingleFile(@PathVariable String submissionId, @PathVariable String fileId, @PathVariable String flow, jakarta.servlet.http.HttpSession httpSession, jakarta.servlet.http.HttpServletRequest request) - Parameters:
submissionId- The submissionId of the file to be downloadedfileId- The UUID of the file to be downloaded.flow- The name of the current (active) flowhttpSession- The current HTTP sessionrequest- The HttpServletRequest- Returns:
- ON SUCCESS: ResponseEntity with a response body that includes the file.
ON FAILURE: A ResponseEntity returns an HTTP error code
-
downloadAllFiles
@GetMapping("/file-download/{flow}/{submissionId}") public org.springframework.http.ResponseEntity<org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody> downloadAllFiles(@PathVariable String submissionId, @PathVariable String flow, jakarta.servlet.http.HttpSession httpSession, jakarta.servlet.http.HttpServletRequest request) - Parameters:
submissionId- The submissionId of the all the files that you would like to download.httpSession- The current HTTP session.flow- The name of the current (active) flowrequest- The HttpServletRequest- Returns:
- ON SUCCESS: ResponseEntity with a zip file containing all the files in a submission.
ON FAILURE: ResponseEntity with a HTTP error message
-