-2
4

1 回答 1

1

如果您使用的是 Tomcat,则可以在以下位置显式此文件的 mime 类型<tomcat-root>/conf/web.xml

<mime-mapping>
    <extension>oft</extension>
    <mime-type>application/vnd.ms-outlook</mime-type>
</mime-mapping>

搜了下,上面的配置我没有找到任何官方文档,好像可以设置进去一样<application-root>/WEB-INF/web.xml,可以试试自定义Filter:

@WebFilter(urlPatterns = "*.oft")
public class MimeTypeFilter implements Filter
{
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException
    {
        response.setContentType("application/vnd.ms-outlook");
        chain.doFilter(request, response);
    }

    public void init(FilterConfig filterConfig) throws ServletException {

    }

    public void destroy() {

    }
}
于 2013-06-09T19:17:04.120 回答