<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    176142998

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      116 Posts :: 0 Stories :: 45 Comments :: 0 Trackbacks

    import org.apache.commons.httpclient.methods.PostMethod;


    public class UTF8PostMethod extends PostMethod
    {
       
        public static final String ENCODE_UTF8 = "UTF-8";
       
        /**
         * 默認構造函數
         * @param url    地址
         */
        public UTF8PostMethod(String url)
        {
            super(url);
        }

        /* (non-Javadoc)
         * @see org.apache.commons.httpclient.methods.EntityEnclosingMethod#getRequestCharSet()
         */
        @Override
        public String getRequestCharSet()
        {
            return ENCODE_UTF8;
        }

        /* (non-Javadoc)
         * @see org.apache.commons.httpclient.HttpMethodBase#getResponseCharSet()
         */
        @Override
        public String getResponseCharSet()
        {
            return ENCODE_UTF8;
        }
    }


    package com.org.softwore;

    import org.apache.commons.httpclient.methods.GetMethod;

    public class UTF8GetMethod extends GetMethod {
     public static final String ENCODE_UTF8 = "UTF-8";

     /**
      * 默認構造函數
      *
      * @param url
      *            地址
      */
     public UTF8GetMethod(String url) {
      super(url);
     }

     /*
      * (non-Javadoc)
      *
      * @see
      * org.apache.commons.httpclient.methods.EntityEnclosingMethod#getRequestCharSet
      * ()
      */
     @Override
     public String getRequestCharSet() {
      return ENCODE_UTF8;
     }

     /*
      * (non-Javadoc)
      *
      * @see org.apache.commons.httpclient.HttpMethodBase#getResponseCharSet()
      */
     @Override
     public String getResponseCharSet() {
      return ENCODE_UTF8;
     }
    }




    測試使用!

    HttpMethod method = null;
            try {
                HttpClient client = new HttpClient();
                method = new UTF8PostMethod(
                        "http://.........");
                client.executeMethod(method);
                if (method.getStatusCode() == HttpStatus.SC_OK) {
                    String response = method.getResponseBodyAsString();
                    System.out.println(response);
                }

            } catch (HttpException e1) {
                e1.printStackTrace();
            } catch (IOException e1) {
                e1.printStackTrace();
            } finally {
                if (method != null) {
                    method.releaseConnection();
                }
            }

    posted on 2011-04-22 11:00 飛飛 閱讀(1062) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 亚洲αⅴ无码乱码在线观看性色 | 少妇亚洲免费精品| 毛片大全免费观看| 亚洲乱码在线卡一卡二卡新区| 精品亚洲成α人无码成α在线观看| 亚洲精品无码不卡在线播放| 18禁超污无遮挡无码免费网站国产| 亚洲中文字幕乱码熟女在线| 国产一精品一AV一免费孕妇| 亚洲狠狠成人综合网| 永久在线毛片免费观看| WWW亚洲色大成网络.COM| www国产亚洲精品久久久| 久久精品国产亚洲77777| 最近高清中文字幕免费| 亚洲videos| 国产小视频在线免费| 思思久久99热免费精品6| 亚洲无人区午夜福利码高清完整版| 精品亚洲AV无码一区二区三区| 97在线观免费视频观看| 亚洲AV无码久久精品蜜桃| 香蕉视频在线观看免费| 久久亚洲高清综合| 99视频在线免费看| 亚洲日本在线电影| 久久久青草青青国产亚洲免观 | 日产久久强奸免费的看| 亚洲日产韩国一二三四区| 99久久综合精品免费| 亚洲色在线无码国产精品不卡 | 在线免费一区二区| 久草免费福利在线| 亚洲黄色在线视频| 四虎影在线永久免费观看| 怡红院免费全部视频在线视频| 亚洲成a人片在线观| 俄罗斯极品美女毛片免费播放| 成全动漫视频在线观看免费高清版下载 | 久久精品国产亚洲网站| 无码免费午夜福利片在线|