Spring - display PDF-file in browser instead of downloading
<p>i am trying to display a pdf in my browser with spring.
my problem is that the browser downloads the file instead of displaying it.
this is my code:</p>

<pre><code>@RequestMapping(value="/getpdf1", method=RequestMethod.GET)
public ResponseEntity&lt;byte[]&gt; getPDF1() {


    HttpHeaders headers = new HttpHeaders();

    headers.setContentType(MediaType.parseMediaType("application/pdf"));
    String filename = "pdf1.pdf";

    headers.add("content-disposition", "inline;filename=" + filename);

    headers.setContentDispositionFormData(filename, filename);
    headers.setCacheControl("must-revalidate, post-check=0, pre-check=0");
    ResponseEntity&lt;byte[]&gt; response = new ResponseEntity&lt;byte[]&gt;(pdf1Bytes, headers, HttpStatus.OK);
    return response;
}
</code></pre>

<p>i am looking forward to your answers!
thanks</p>