Package com.ads.services.webservice.rest
Class FileResource
java.lang.Object
com.ads.services.webservice.rest.FileResource
Contains the methods which performs the operations related to files.
All the REST methods have return type ResponseEntity.
All the REST methods have return type ResponseEntity.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.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.
-
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
-