I have a problem with glassfish to serve swf files. In my application there is a little swf file to use TableTools plugin on datatable and when I try to open this page with any browser everything goes fine, but with IE the behaviour is quite different the swf is not loaded and if I try to reach it with direct url an alert ask me to choice what the browser has to do with the file (Open, Save, Save as), I click on open but nothing is shown.. This problem appear only with IE. it seems a content-type error because chrome show me this warning: "Resource interpreted as document but transferred with MIME type application/x-shockwave-flash."
but I don't know how I can setup the correct content-type my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>ManagementConsole</display-name>
<filter>
<filter-name>jersey</filter-name>
<filter-class>com.sun.jersey.spi.container.servlet.ServletContainer</filter-class>
<init-param>
<param-name>com.sun.jersey.config.property.WebPageContentRegex</param-name>
<param-value>/(img|js|css)/.*</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.config.property.JSPTemplatesBasePath</param-name>
<param-value>/WEB-INF/jsp</param-value>
</init-param>
</filter>
<filter>
<filter-name>RedirectWrongRequest</filter-name>
<filter-class>com.italtel.patchfinder.filters.RedirectWrongRequest</filter-class>
<init-param>
<param-name>exclude</param-name>
<param-value>/LoginServlet</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>RedirectWrongRequest</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>jersey</filter-name>
<url-pattern>/admin/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>LoginServlet</servlet-name>
<jsp-file>/WEB-INF/jsp/login.jsp</jsp-file>
</servlet>
<servlet>
<servlet-name>LoginError</servlet-name>
<jsp-file>/WEB-INF/jsp/loginError.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/LoginServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>LoginError</servlet-name>
<url-pattern>/LoginError</url-pattern>
</servlet-mapping>
<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
</jsp-config>
<security-constraint>
<display-name>AdminPages</display-name>
<web-resource-collection>
<web-resource-name>admin</web-resource-name>
<description/>
<url-pattern>/admin/*</url-pattern>
<http-m开发者_开发问答ethod>GET</http-method>
<http-method>POST</http-method>
<http-method>HEAD</http-method>
<http-method>PUT</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
<http-method>DELETE</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
<!--<role-name>USERS</role-name>-->
</auth-constraint>
<user-data-constraint>
<!--None in http mode, Confidential in https mode-->
<!--<transport-guarantee>NONE</transport-guarantee>-->
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/LoginServlet</form-login-page>
<form-error-page>/LoginError</form-error-page>
</form-login-config>
<!--<realm-name>userauth</realm-name>-->
</login-config>
<security-role>
<description/>
<role-name>admin</role-name>
<!--<role-name>USERS</role-name>-->
</security-role>
<welcome-file-list>
<welcome-file>Menu</welcome-file>
</welcome-file-list>
</web-app>
from the image below you can see last 3 rows with the error loading swf file (with correct content-type)
http://i.stack.imgur.com/Jh98S.png
I found a solution! problem was a bug in IE 6/7/8/9 and maybe older version, where when using a secure connection ssl, loading of swf file doesn't succeed because a bug in IE. I've solved this problem by overriding the cache with a filter in my application:
hresponse.setDateHeader("Expires", -1);
hresponse.setDateHeader("Last-Modified", System.currentTimeMillis());
hresponse.setHeader("Pragma", "");
hresponse.setHeader("cache-control", "must-revalidate");
hope will be useful for someone else! Thanks
精彩评论