com.sina.weibo.sdk.net.AsyncWeiboRunner Java Examples

The following examples show how to use com.sina.weibo.sdk.net.AsyncWeiboRunner. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbsOpenAPI.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
/**
 * HTTP 异步请求。
 * 
 * @param url        请求的地址
 * @param params     请求的参数
 * @param httpMethod 请求方法
 * @param listener   请求后的回调接口
 */
protected void requestAsync(String url, WeiboParameters params, String httpMethod, RequestListener listener) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)
            || null == listener) {
        LogUtil.e(TAG, "Argument error!");
        return;
    }
    
    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    new AsyncWeiboRunner(mContext).requestAsync(url, params, httpMethod, listener);
}
 
Example #2
Source File: AbsOpenAPI.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
/**
 * HTTP 同步请求。
 * 
 * @param url        请求的地址
 * @param params     请求的参数
 * @param httpMethod 请求方法
 * 
 * @return 同步请求后,服务器返回的字符串。
 */
protected String requestSync(String url, WeiboParameters params, String httpMethod) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)) {
        LogUtil.e(TAG, "Argument error!");
        return "";
    }
    
    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    return new AsyncWeiboRunner(mContext).request(url, params, httpMethod);
}
 
Example #3
Source File: WeiboSdkBrowser.java    From letv with Apache License 2.0 5 votes vote down vote up
private void startShare() {
    LogUtil.d(TAG, "Enter startShare()............");
    final ShareRequestParam req = this.mRequestParam;
    if (req.hasImage()) {
        LogUtil.d(TAG, "loadUrl hasImage............");
        new AsyncWeiboRunner(this).requestAsync(ShareRequestParam.UPLOAD_PIC_URL, req.buildUploadPicParam(new WeiboParameters(req.getAppKey())), "POST", new RequestListener() {
            public void onWeiboException(WeiboException e) {
                LogUtil.d(WeiboSdkBrowser.TAG, "post onWeiboException " + e.getMessage());
                req.sendSdkErrorResponse(WeiboSdkBrowser.this, e.getMessage());
                WeiboSdkBrowser.this.finish();
            }

            public void onComplete(String response) {
                LogUtil.d(WeiboSdkBrowser.TAG, "post onComplete : " + response);
                UploadPicResult result = UploadPicResult.parse(response);
                if (result == null || result.getCode() != 1 || TextUtils.isEmpty(result.getPicId())) {
                    req.sendSdkErrorResponse(WeiboSdkBrowser.this, "upload pic faild");
                    WeiboSdkBrowser.this.finish();
                    return;
                }
                WeiboSdkBrowser.this.openUrl(req.buildUrl(result.getPicId()));
            }
        });
        return;
    }
    openUrl(this.mUrl);
}
 
Example #4
Source File: AbsOpenAPI.java    From Simpler with Apache License 2.0 5 votes vote down vote up
/**
 * HTTP 异步请求。
 * 
 * @param url        请求的地址
 * @param params     请求的参数
 * @param httpMethod 请求方法
 * @param listener   请求后的回调接口
 */
protected void requestAsync(String url, WeiboParameters params, String httpMethod, RequestListener listener) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)
            || null == listener) {
        LogUtil.e(TAG, "Argument error!");
        return;
    }
    
    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    new AsyncWeiboRunner(mContext).requestAsync(url, params, httpMethod, listener);
}
 
Example #5
Source File: AbsOpenAPI.java    From Simpler with Apache License 2.0 5 votes vote down vote up
/**
 * HTTP 同步请求。
 * 
 * @param url        请求的地址
 * @param params     请求的参数
 * @param httpMethod 请求方法
 * 
 * @return 同步请求后,服务器返回的字符串。
 */
protected String requestSync(String url, WeiboParameters params, String httpMethod) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)) {
        LogUtil.e(TAG, "Argument error!");
        return "";
    }
    
    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    return new AsyncWeiboRunner(mContext).request(url, params, httpMethod);
}
 
Example #6
Source File: AbsOpenAPI.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
/**
 * HTTP 异步请求。
 * 
 * @param url        请求的地址
 * @param params     请求的参数
 * @param httpMethod 请求方法
 * @param listener   请求后的回调接口
 */
protected void requestAsync(String url, WeiboParameters params, String httpMethod, RequestListener listener) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)
            || null == listener) {
        LogUtil.e(TAG, "Argument error!");
        return;
    }
    
    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    new AsyncWeiboRunner(mContext).requestAsync(url, params, httpMethod, listener);
}
 
Example #7
Source File: AbsOpenAPI.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
/**
 * HTTP 同步请求。
 * 
 * @param url        请求的地址
 * @param params     请求的参数
 * @param httpMethod 请求方法
 * 
 * @return 同步请求后,服务器返回的字符串。
 */
protected String requestSync(String url, WeiboParameters params, String httpMethod) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)) {
        LogUtil.e(TAG, "Argument error!");
        return "";
    }
    
    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    return new AsyncWeiboRunner(mContext).request(url, params, httpMethod);
}
 
Example #8
Source File: AbsOpenAPI.java    From ESSocialSDK with Apache License 2.0 5 votes vote down vote up
/**
 */
protected void requestAsync(String url, WeiboParameters params, String httpMethod, RequestListener listener) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)
            || null == listener) {
        LogUtil.e(TAG, "Argument error!");
        return;
    }

    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    new AsyncWeiboRunner(mContext).requestAsync(url, params, httpMethod, listener);
}
 
Example #9
Source File: AbsOpenAPI.java    From ESSocialSDK with Apache License 2.0 5 votes vote down vote up
/**
 */
protected String requestSync(String url, WeiboParameters params, String httpMethod) {
    if (null == mAccessToken
            || TextUtils.isEmpty(url)
            || null == params
            || TextUtils.isEmpty(httpMethod)) {
        LogUtil.e(TAG, "Argument error!");
        return "";
    }

    params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
    return new AsyncWeiboRunner(mContext).request(url, params, httpMethod);
}