处理Richfaces 3.3.3控件a4j:outputMedia与Firefox11的兼容性问题

Hey Guys,

I have found some problem with richfaces 3.3.3 and firefox 11. It seems that the javascript has changed in firefox.

 

When I use a4j:outputMedia and rerender I got the following error:

ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/BPM-Process].[default]] Servlet.service() for servlet default threw exception: javax.faces.FacesException: Error decode resource data

at org.ajax4jsf.resource.ResourceBuilderImpl.decrypt(ResourceBuilderImpl.java:627) [:3.3.3.Final]

at org.ajax4jsf.resource.ResourceBuilderImpl.getResourceDataForKey(ResourceBuilderImpl.java:371) [:3.3.3.Final]

at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:156) [:3.3.3.Final]

at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:141) [:3.3.3.Final]

at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:508) [:3.3.3.Final]

at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) [:2.2.2.Final]

at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.2.Final]

at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) [:2.2.2.Final]

at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.2.Final]

at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73) [:2.2.2.Final]

at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [:2.2.2.Final]

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.1.0.Final]

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.1.0.Final]

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.1.0.Final]

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [:6.1.0.Final]

at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.1.0.Final]

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) [:6.1.0.Final]

at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]

at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]

at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.1.0.Final]

at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.1.0.Final]

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:159) [:6.1.0.Final]

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.1.0.Final]

at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.1.0.Final]

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.1.0.Final]

at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.1.0.Final]

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.1.0.Final]

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.1.0.Final]

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.1.0.Final]

at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.1.0.Final]

at java.lang.Thread.run(Unknown Source) [:1.6.0_31]

Caused by: java.util.zip.DataFormatException: invalid bit length repeat

at java.util.zip.Inflater.inflateBytes(Native Method) [:1.6.0_31]

at java.util.zip.Inflater.inflate(Unknown Source) [:1.6.0_31]

at java.util.zip.Inflater.inflate(Unknown Source) [:1.6.0_31]

at org.ajax4jsf.resource.ResourceBuilderImpl.decrypt(ResourceBuilderImpl.java:621) [:3.3.3.Final]

... 30 more

The Image does not get paint, but if i press f5, it works fine.

 

Also this error appears with rich:picklist:

10:34:38,856 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/BPM-Process].[default]] Servlet.service() for servlet default threw exception: javax.faces.FacesException: Error decode resource data at org.ajax4jsf.resource.ResourceBuilderImpl.decrypt(ResourceBuilderImpl.java:627) [:3.3.3.Final] at org.ajax4jsf.resource.ResourceBuilderImpl.getResourceDataForKey(ResourceBuilderImpl.java:371) [:3.3.3.Final] at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:156) [:3.3.3.Final] at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:141) [:3.3.3.Final] at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:508) [:3.3.3.Final] at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) [:2.2.2.Final] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.2.Final] at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) [:2.2.2.Final] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.2.Final] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73) [:2.2.2.Final] at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [:2.2.2.Final] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.1.0.Final] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.1.0.Final] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.1.0.Final] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [:6.1.0.Final] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.1.0.Final] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) [:6.1.0.Final] at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final] at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.1.0.Final] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.1.0.Final] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:159) [:6.1.0.Final] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.1.0.Final] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.1.0.Final] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.1.0.Final] at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.1.0.Final] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.1.0.Final] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.1.0.Final] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.1.0.Final] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.1.0.Final] at java.lang.Thread.run(Unknown Source) [:1.6.0_31] Caused by: java.util.zip.DataFormatException: incorrect data check at java.util.zip.Inflater.inflateBytes(Native Method) [:1.6.0_31] at java.util.zip.Inflater.inflate(Unknown Source) [:1.6.0_31] at java.util.zip.Inflater.inflate(Unknown Source) [:1.6.0_31] at org.ajax4jsf.resource.ResourceBuilderImpl.decrypt(ResourceBuilderImpl.java:621) [:3.3.3.Final] ... 30 more 
------------------
问题描述:
别的浏览器一切正常,最新版Firefox渲染失败.
解决办法:
1.增加一个工具类:
package com.singtel.tool;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

public class RichFacesFirefox11Filter implements Filter {

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
chain.doFilter(new HttpServletRequestWrapper((HttpServletRequest) request) {
@Override
public String getRequestURI() {
try {
return URLDecoder.decode(super.getRequestURI(), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("Cannot decode request URI.", e);
}
}
}, response);
}

@Override
public void init(FilterConfig filterConfig) throws ServletException {
// do nothing
}

@Override
public void destroy() {
// do nothing
}

}
2.web.xml增加一个filter
    <filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<!--增加如下filter,处理firefox11的兼容性-->
<filter>
<filter-name>RichFacesFirefox11Filter</filter-name>
<filter-class>com.singtel.tool.RichFacesFirefox11Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>RichFacesFirefox11Filter</filter-name>
<url-pattern>/a4j/*</url-pattern>
</filter-mapping>


你可能感兴趣的:(Richfaces)