代码之家  ›  专栏  ›  技术社区  ›  Berlin Brown

Java Servlet MIME类型和Internet Explorer MIME类型处理错误

  •  2
  • Berlin Brown  · 技术社区  · 16 年前

    我有一个servlet,可以返回文本/html或应用程序/pdf内容。显然,Internet Explorer(IE7)似乎无法正确处理应用程序/pdf。

    http://web/Servlet

    Expires=0
    Cache-Control=max-age=1, must-revalidate, no-cache, post-check=0, pre-check=0
    Pragma=public
    Content-Disposition=inline; filename=filename_1257804404940.pdf
    Content-Length=457834
    Connection=Keep-Alive
    Content-Type=application/pdf
    Content-Language=en-US
    

    以上是firefox的输出。在IE下,我可能会得到:

    Content-Length=0
    Connection=Keep-Alive
    Content-Type=text/html
    Content-Language=en-US
    

    1 回复  |  直到 16 年前
        1
  •  3
  •   Carl Smotricz    16 年前

    我们在工作中也遇到了类似的问题。你可以通过在你要访问的URL中包含一个具有正确扩展名的文件名来扭转浏览器的局面。