title: Spring REST API: download file and choose the name and location to save
body: <p>I am trying to make an immediate download for generated files without saving them in persistent storage.</p>
  <pre><code>@Operation(
        summary = &quot;Download csv.&quot;,
        description = &quot;Download csv.&quot;,
        responses = {@ApiResponse(content = @Content(
            mediaType = MediaType.APPLICATION_OCTET_STREAM_VALUE))}
    )
    @GetMapping(value = &quot;/download&quot;, produces = APPLICATION_OCTET_STREAM_VALUE)
    public Resource downloadFile(HttpServletRequest request) {
      String s =
          &quot;uuid1\tdata\n&quot; +
          &quot;uuid2\tdata\n&quot; +
          &quot;uuid3\tdata&quot;;
      ByteArrayResource resource = new ByteArrayResource(s.getBytes(), &quot;description&quot;);
      return resource;
    }
  </code></pre>
  <p>As a result I get a valid download link via Swagger or immediate download via direct request.</p>
  <p><strong>What I want to do:</strong></p>
  <ol>
  <li>To pre-set the name and extension for the file, that will be downloaded.</li>
  <li>I want to get a prompt and choose the place where to save it.</li>
  </ol>
  <p>Is it possible to do with the backend only?</p>