Caused by: java.util.zip.DataFormatException: incorrect data check

问题

        Caused by: java.util.zip.DataFormatException: incorrect data check

原因

        火狐浏览器与richfaces控件不兼容

解决

(1)创建工具类

package com.truesafer.common;

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 {

 
    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);
    }

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


    public void destroy() {
        // do nothing
    }

}

(2)在web.xml加入下面代码

    
        RichFacesFirefox11Filter
        com.truesafer.common.RichFacesFirefox11Filter
   

   
        RichFacesFirefox11Filter
        /a4j/*
   

你可能感兴趣的:(java-web)