使用Struts2下载任何内容类型

时间:2014-01-16 10:51:10

标签: struts2

<action name="downloadFiles" method="downloadFiles" class="org.filemanager.action.SystemAction">
    <result name="success" type="stream">
        <param name="contentType">application/octet-stream</param>
        <param name="inputName">fileInputStream</param>
        <param name="contentDisposition">attachment;filename="${folderOrFileName}"</param>
        <param name="bufferSize">200000</param>
    </result>
</action>

如上所示的代码: 如何设置内容类型,以便可以下载任何内容类型?

1 个答案:

答案 0 :(得分:1)

请访问this link,按内容类型获取MIME类型的详细列表 这是一些主要类型

application/mac-binhex40    hqx
application/msword          doc
application/msword          dot
application/octet-stream    *
application/octet-stream    bin
application/octet-stream    class
application/octet-stream    dms
application/octet-stream    exe


您正在寻找的东西已被您application/octet-stream for *

使用