0

I have a controller which looks something like this:

@GetMapping("/downloadFile/{fileName}")
public ResponseEntity<Resource> downloadFile(@PathVariable String fileName, HttpServletRequest request) {

  //Some logic
}

This controller gets the path of the file from the file system but the problem is that the path might look like this: home/a/b/photo.png

The path is generated dynamically so i don't know how many slashes it might have and spring will see this as something like this: /downloadFile/home/a/b/photo.png and it's not the same get request..

I need somehow to tell it that whatever comes after /downloadFile/ is basically the whole {fileName}. Are there any ways to solve this?

Truica Sorin
  • 499
  • 2
  • 11
  • 24

0 Answers0