国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

Encoding Filter實現

2019-11-18 11:33:43
字體:
來源:轉載
供稿:網友

public class CharacterEncodingFilter implements Filter {


    // ----------------------------------------------------- Instance Variables


    /**
     * The default character encoding to set for requests that pass through
     * this filter.
     */
    PRotected String encoding = null;


    /**
     * The filter configuration object we are associated with.  If this value
     * is null, this filter instance is not currently configured.
     */
    protected FilterConfig filterConfig = null;


    /**
     * Should a character encoding specified by the client be ignored?
     */
    protected boolean ignore = true;


    // --------------------------------------------------------- Public Methods


    /**
     * Take this filter out of service.
     */
    public void destroy() {

        this.encoding = null;
        this.filterConfig = null;

    }


    /**
     * Select and set (if specified) the character encoding to be used to
     * interpret request parameters for this request.
     *
     * @param request The servlet request we are processing
     * @param result The servlet response we are creating
     * @param chain The filter chain we are processing
     *
     * @exception IOException if an input/output error occurs
     * @exception ServletException if a servlet error occurs
     */
    public void doFilter(ServletRequest request, ServletResponse response,
                         FilterChain chain) throws IOException,
            ServletException {

        // Conditionally select and set the character encoding to be used
        if (ignore (request.getCharacterEncoding() == null)) {
            String encoding = selectEncoding(request);
            if (encoding != null) {
                request.setCharacterEncoding(encoding);
            }
        }



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 灵丘县| 巨鹿县| 平利县| 宜君县| 都昌县| 乐亭县| 班戈县| 化德县| 洪湖市| 普兰县| 宜兰市| 新疆| 阳曲县| 余姚市| 新津县| 九台市| 临潭县| 上思县| 大同县| 古蔺县| 昭苏县| 黄山市| 绥江县| 大荔县| 宜兴市| 英超| 西华县| 合水县| 涟水县| 迭部县| 合山市| 孝昌县| 苍梧县| 鄢陵县| 濉溪县| 搜索| 读书| 石河子市| 浑源县| 岫岩| 五华县|