Problem:
We have upgraded to JasperReports Server 7.9.x and are seeing a different behavior when accessing reports with PDF output.
In previous version of Jaspersoft, end user was able to open the report directly in the browser without downloading it but in the current version of JasperReports Server 7.9.x we are not able to open the report directly in the browser rather it is being downloaded.
This is seen with all web browsers (Edge, Chrome and FireFox).
Is there a Jaspersoft setting that control this behavior?
Cause:
The change in behavior was made on purpose because of a security aspect and there are no plans to change this behavior.
Solution:
As mentioned in the cause, the change in behavior was made on purpose because of a security aspect and there are no plans to change this behavior. To force the browser to do download the following code was added to applicationContext-webapp.xml file:
<bean p:method="GET" p:urlPattern="/fileview/fileview/.*"
class="com.jaspersoft.jasperserver.war.httpheaders.HeadersRule">
<property name="headers">
<list>
<bean class="org.apache.http.message.BasicHeader">
<constructor-arg value="Content-Disposition"/>
<constructor-arg value="attachment"/>
</bean>
</list>
</property>
</bean>
Changing "attachment" to "inline" will force the browser to open the content in the same window (not new tab) when Open option is selected (Open in new tab option is not available anymore). But this is not recommended from a security perspective.
_____________________________________________________________________________________________________________________________________________________________
Ref. Case #02211031
-
Opening PDF of the report in browser directly instead of downloading in 7.9.x
Table of contents
User Feedback
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now