produces = "application/pdf" not working on Spring Boot
<p>I have Spring Boot project and I am using Jasper Report. I posted some json data and response return to me this:</p>

<pre><code>%PDF-1.5
%����
1 0 obj
&lt;undefined&lt;/Filter/FlateDecode/Length 29&gt;&gt;stream
x�+�r
�26S�00SI�r
�
��13-
endstream
endobj
3 0 obj&lt;undefined&lt;/Tabs/S/Group&lt;undefined&lt;/S/Transparency/Type/Group/CS/DeviceRGB&gt;&gt;/Contents 1 0 R/Type/Page/Resources&lt;undefined&lt;/ColorSpace&lt;&lt;/CS/DeviceRGB&gt;&gt;/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]&gt;&gt;/Parent 2 0 R/MediaBox[0 0 595 842]&gt;&gt;
endobj
2 0 obj
&lt;undefined&lt;/Kids[3 0 R]/Type/Pages/Count 1/ITXT(2.1.7)&gt;&gt;
endobj
4 0 obj&lt;undefined&lt;/Type/Catalog/Pages 2 0 R/ViewerPreferences&lt;undefined&lt;/PrintScaling/AppDefault&gt;&gt;&gt;&gt;
endobj
5 0 obj&lt;undefined&lt;/ModDate(D:20160710203902+05'00')/Creator(JasperReports Library version 6.2.0)/CreationDate(D:20160710203902+05'00')/Producer(iText 2.1.7 by 1T3XT)&gt;&gt;
endobj
xref
0 6
0000000000 65535 f 
0000000015 00000 n 
0000000333 00000 n 
0000000110 00000 n 
0000000396 00000 n 
0000000487 00000 n 
trailer&lt;undefined&lt;/Info 5 0 R/ID [undefined&lt;07942c7c1b5b6068753ddc445ec60abf&gt;undefined&lt;c82bba08c068c3699915ac33668fef92&gt;]/Root 4 0 R/Size 6&gt;&gt;
startxref
654
%%EOF
</code></pre>

<p>On my rest controller I added to RequestMapping produces = "application/pdf" but it is not working.</p>

<pre><code>@RequestMapping(value = "/gMapReports", method = RequestMethod.POST, produces = "application/pdf")
public ResponseEntity&lt;InputStreamResource&gt; gMapReports(@RequestBody GMapReportRequest gMapReportRequest) {

    return reportService.prepareResponse(reportService.gMapReports(gMapReportRequest));

}
</code></pre>

<p>My prepareResponse method:</p>

<pre><code>public ResponseEntity&lt;InputStreamResource&gt; prepareResponse(File reportDocument) {
    FileInputStream fileInputStream = fileStreamConverter.getFileInputStream(reportDocument);

    return ResponseEntity
            .ok()
            .contentLength(reportDocument.length())
            .contentType(MediaType.APPLICATION_OCTET_STREAM)
            .header("content-disposition", "filename=report")
            .body(new InputStreamResource(fileInputStream));
}
</code></pre>