Code example for DefaultHttpClient

Methods: addRequestInterceptor, addResponseInterceptor, setHttpRequestRetryHandler

0
     * 校验cookie的有效性 
     * <p> 
     * 手机和pc都登陆之后,pc退出,会导致手机中的cookie失效 
     * </p> 
     *  
     * @param url 
     */ 
    public void verificateCookie(Context context, String url) {
        Connection conn = JsoupFactory.getInstance(context).newJsoupConnection(url);
        if (conn != null) {
            try { 
                Document doc = conn.get();
                Elements elements = doc.select("a:matches(logout)");
                if (elements.size() < 1) {
                    // cookie无效 
                    SessionManager.getInstance(context).clear();
                } 
            } catch (IOException e) {
                EasyTracker.getTracker().sendException(e.getMessage(), e, false);
            } 
 
        } 
 
    } 
 
}