本文介绍了错误:application/pdf不是受支持的mime类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Struts2和Liferay开发应用程序.
I am using Struts2 and Liferay for developing an application.
我的struts.xml
如下:
<action name="download" class="com.stp.portal.view.DownloadAction">
<result name="success" type="stream">
<param name="contentType">application/pdf</param>
<param name="inputName">fileInputStream</param>
<param name="contentDisposition">attachment;filename="abc.pdf"</param>
<param name="bufferSize">1024</param>
</result>
</action>
我基本上想从服务器下载pdf文件.但是我收到以下错误:
I basically want to download a pdf file from the server. But I get the following error:
不知道该如何解决.非常感谢某人的帮助.确实需要这样做.
Don't know how to resolve this. Would really appreciate someone's help. Really need this to be done.
推荐答案
将portletUrlType="resource"
放入用于创建下载链接的<s:url>
标记.
Put portletUrlType="resource"
to the <s:url>
tag which you use to create download link.
<s:url var="downloadUrl" action="download" portletUrlType="resource" />
这篇关于错误:application/pdf不是受支持的mime类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!