gv天堂gv无码男同在线,欧美视频你懂的,毛片一级毛片毛片一级一级毛毛片,亚洲黄色视频免费播放,满18岁免费看的尤物视频,日本欧美三级片免费看,亚洲综合伊人影视在线播放

  • 首 頁
  • 采購市場
  • 企業(yè)查詢
  • 營銷建站
  • 營銷推廣
  • 行業(yè)資訊
  • 發(fā)布信息
  • java web中的過濾器

    懸賞分:20|
    如果要自定義一個過濾器,要實現(xiàn)接口Filter 其中有個方法是doFilter(..)
    一個請求發(fā)送到服務(wù)器然后服務(wù)器響應(yīng)回來 ,是否2次經(jīng)過過濾器的該方法?
    知識庫標簽: 過濾器   |列兵
    過濾器執(zhí)行的順序是
    //1.過濾器代碼
    .....
    //2.讓請求繼續(xù)執(zhí)行
    filterChain.doFilter(request,response)//這句代碼的意思是讓請求往下繼續(xù)執(zhí)行
    //3.執(zhí)行完后,繼續(xù)執(zhí)行過濾器代碼
    ....
    //響應(yīng)客戶
    為最佳答案評分?
    100% (1)
    不好 0% (0)
    (目前有 1 個人評價)

    其 他 回 答共2條

    1樓

    public class EncodingFilter implements Filter {
    private FilterConfig config;
    private String targetEncoding;
    public void init(FilterConfig config) {
    this.config = config;
    this.targetEncoding = this.config.getInitParameter("encoding");
    }
    public void doFilter(ServletRequest srequest, ServletResponse sresponse,
    FilterChain chain) throws IOException, ServletException {
    System.out.println("encoding=" + this.targetEncoding);
    HttpServletRequest request = (HttpServletRequest) srequest;
    request.setCharacterEncoding(this.targetEncoding);
    chain.doFilter(srequest, sresponse);
    }
    public void setFilterConfig(final FilterConfig filterConfig) {
    }
    public void destroy() {
    config = null;
    }
    知識庫標簽: |列兵

    我來回答這個問題

    立即登陸回答獲取會員積分,提高用戶級別
    友情鏈接:
    Copyright © 商名網(wǎng) All Rights Reserved.