Class UploadController

java.lang.Object
com.almis.awe.config.ServiceConfig
com.almis.awe.controller.UploadController
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

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

    • UploadController

      @Autowired public UploadController(FileService fileService, BroadcastService broadcastService, com.fasterxml.jackson.databind.ObjectMapper mapper, BaseConfigProperties baseConfigProperties)
      Autowired constructor
      Parameters:
      fileService - File service
      broadcastService - Broadcast service
      mapper - Object mapper
      baseConfigProperties - Base config properties
  • Method Details

    • handleFileUpload

      @PostMapping(value="/upload", consumes="multipart/form-data") @ResponseStatus(OK) public void handleFileUpload(@RequestHeader("Authorization") String token, @RequestParam("file") org.springframework.web.multipart.MultipartFile file, @RequestParam("address") String address, @RequestParam("destination") String destination, @RequestParam("u") String uploadIdentifier) throws AWException, IOException
      Upload a file
      Parameters:
      token - Request token
      file - File to upload
      address - Component address
      destination - Destination folder
      uploadIdentifier - Uploader identifier
      Throws:
      AWException - Error uploading file
      IOException
    • handleAWException

      @ExceptionHandler(AWException.class) @ResponseStatus(NOT_ACCEPTABLE) public String handleAWException(AWException exc)
      Handle upload error
      Parameters:
      exc - Exception to handle
      Returns:
      Response error
    • handleMaxSizeException

      @ExceptionHandler(org.springframework.web.multipart.MaxUploadSizeExceededException.class) @ResponseStatus(PAYLOAD_TOO_LARGE) public String handleMaxSizeException(org.springframework.web.multipart.MaxUploadSizeExceededException exc)
      Handle upload error
      Parameters:
      exc - Exception to handle
      Returns:
      Response error
    • handleIOException

      @ExceptionHandler({org.springframework.web.multipart.MultipartException.class,org.apache.commons.fileupload2.core.FileUploadException.class,java.lang.Exception.class}) @ResponseStatus(NOT_ACCEPTABLE) public String handleIOException(Exception exc)
      Handle upload error
      Parameters:
      exc - Exception to handle
      Returns:
      Response error