package filter;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

/**
 * Servlet Filter implementation class Encooding
 */
public class Encooding implements Filter {

    /**
     * Default constructor. 
     */
    public Encooding() {
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see Filter#destroy()
	 */
	public void destroy() {
		// TODO Auto-generated method stub
	}

	/**
	 * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
	 */
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
		String encooding=context.getInitParameter("encooding");
		request.setCharacterEncoding(encooding);
		response.setContentType("text/html;charset="+encooding);
		chain.doFilter(request, response);
	}

	/**
	 * @see Filter#init(FilterConfig)
	 */
	ServletContext context;
	public void init(FilterConfig fConfig) throws ServletException {
		context=fConfig.getServletContext();
	}

}
最近下载更多
abcdljw  LV20 2022年12月16日
lulululuping  LV1 2022年11月8日
liweb 010928  LV1 2022年10月31日
cqbscxh  LV11 2022年9月19日
ming_123_9715  LV23 2022年5月3日
李田所  LV1 2021年12月20日
儿童游戏机  LV9 2021年6月25日
928477320  LV1 2020年12月30日
dengge123  LV13 2020年9月14日
张信哲  LV8 2020年6月27日
最近浏览更多
cab123123  LV8 4月9日
LHLHBBA 3月19日
暂无贡献等级
微信网友_6786215447367680  LV4 2023年12月20日
2385649653  LV7 2023年12月12日
qxzcxas  LV1 2023年11月26日
zhaozhiqi  LV5 2023年10月21日
EFWAGGFAWGR 2023年10月19日
暂无贡献等级
Chuiwaitim  LV2 2023年10月18日
微信网友_6680567232876544  LV8 2023年10月10日
2036495585  LV9 2023年9月26日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友