Package com.ads.services.webservice.rest

# Class FileResource

java.lang.Object
com.ads.services.webservice.rest.FileResource

@RestController @RequestMapping("/api/miscellaneous") public class FileResource extends Object
Contains the methods which performs the operations related to files.
All the REST methods have return type ResponseEntity.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `jakarta.servlet.http.HttpServletRequest`
  `request`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FileResource()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `org.springframework.http.ResponseEntity<org.springframework.core.io.Resource>`
  `downloadFile(String fileLocation)`
  Downloads the file from the given file location on the server, specifying the file location is mandatory, and the input file path should be relative path only.
  `org.springframework.http.ResponseEntity<RequestStatus>`
  `uploadFile(org.springframework.web.multipart.MultipartFile file)`
  This function is used to upload the specified file to the server and return the file's relative path.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### request

    @Autowired public jakarta.servlet.http.HttpServletRequest request

- ## Constructor Details

  - ### FileResource

    public FileResource()

- ## Method Details

  - ### uploadFile

    @PostMapping(path="/upload-file", consumes="multipart/form-data", produces={"application/json","application/xml"}) public org.springframework.http.ResponseEntity<RequestStatus> uploadFile(@RequestParam("file") org.springframework.web.multipart.MultipartFile file) throws Exception
    This function is used to upload the specified file to the server and return the file's relative path. The path will be accessible via the user object of the returned request status object.",
    Parameters:
      `file` - MultipartFile
    Returns:
      Response
    Throws:
      `Exception`
    Since:
      14.0

  - ### downloadFile

    @GetMapping(path="/download-file") public org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> downloadFile(@RequestParam("fileLocation") String fileLocation) throws Exception
    Downloads the file from the given file location on the server, specifying the file location is mandatory, and the input file path should be relative path only.
    Parameters:
      `fileLocation` - String
    Returns:
      Response
    Throws:
      `Exception`
    Since:
      14.0