Package weibo4j

Examples of weibo4j.WeiboException


    public AccessToken getOAuthAccessToken(RequestToken token) throws WeiboException {
        try {
            this.oauthToken = token;
            this.oauthToken = new AccessToken(httpRequest(accessTokenURL, new PostParameter[0], true));
        } catch (WeiboException te) {
            throw new WeiboException("The user has not given access to the account.", te, te.getStatusCode());
        }
        return (AccessToken) this.oauthToken;
    }
View Full Code Here


        try {
            this.oauthToken = token;
            this.oauthToken = new AccessToken(httpRequest(accessTokenURL
                    , new PostParameter[]{new PostParameter("oauth_verifier", pin)}, true));
        } catch (WeiboException te) {
            throw new WeiboException("The user has not given access to the account.", te, te.getStatusCode());
        }
        return (AccessToken) this.oauthToken;
    }
View Full Code Here

        try {
            this.oauthToken = new OAuthToken(token, tokenSecret) {
            };
            this.oauthToken = new AccessToken(httpRequest(accessTokenURL, new PostParameter[0], true));
        } catch (WeiboException te) {
            throw new WeiboException("The user has not given access to the account.", te, te.getStatusCode());
        }
        return (AccessToken) this.oauthToken;
    }
View Full Code Here

            this.oauthToken = new OAuthToken(token, tokenSecret) {
            };
            this.oauthToken = new AccessToken(httpRequest(accessTokenURL,
                    new PostParameter[]{new PostParameter("oauth_verifier", oauth_verifier)}, true));
        } catch (WeiboException te) {
            throw new WeiboException("The user has not given access to the account.", te, te.getStatusCode());
        }
        return (AccessToken) this.oauthToken;
    }
View Full Code Here

        response.setStatusCode(post.getStatusCode());

        log("multPartURL URL:" + url + ", result:" + response + ", time:" + (System.currentTimeMillis() - t));
          return response;
      } catch (Exception ex) {
         throw new WeiboException(ex.getMessage(), ex, -1);
      } finally {
        post.releaseConnection();
      }
    }
View Full Code Here

        response.setStatusCode(post.getStatusCode());

        log("multPartURL URL:" + url + ", result:" + response + ", time:" + (System.currentTimeMillis() - t));
          return response;
      } catch (Exception ex) {
         throw new WeiboException(ex.getMessage(), ex, -1);
      } finally {
        post.releaseConnection();
        client=null;
      }
    }
View Full Code Here

                            }
                        }
                    }
                    if (responseCode != OK) {
                        if (responseCode < INTERNAL_SERVER_ERROR || retriedCount == retryCount) {
                            throw new WeiboException(getCause(responseCode) + "\n" + res.asString(), responseCode);
                        }
                        // will retry if the status code is INTERNAL_SERVER_ERROR
                    } else {
                        break;
                    }
                } finally {
                    try {
                        osw.close();
                    } catch (Exception ignore) {
                    }
                }
            } catch (IOException ioe) {
                // connection timeout or read timeout
                if (retriedCount == retryCount) {
                    throw new WeiboException(ioe.getMessage(), ioe, responseCode);
                }
            }
            try {
                if(DEBUG && null != res){
                    res.asString();
View Full Code Here

                stream.close();
                con.disconnect();
                streamConsumed = true;
            } catch (NullPointerException npe) {
                // don't remember in which case npe can be thrown
                throw new WeiboException(npe.getMessage(), npe);
            } catch (IOException ioe) {
                throw new WeiboException(ioe.getMessage(), ioe);
            }
        }
        return responseAsString;
    }
View Full Code Here

            try {
                // it should be faster to read the inputstream directly.
                // but makes it difficult to troubleshoot
                this.responseAsDocument = builders.get().parse(new ByteArrayInputStream(asString().getBytes("UTF-8")));
            } catch (SAXException saxe) {
                throw new WeiboException("The response body was not well-formed:\n" + responseAsString, saxe);
            } catch (IOException ioe) {
                throw new WeiboException("There's something with the connection.", ioe);
            }
        }
        return responseAsDocument;
    }
View Full Code Here

     */
    public JSONObject asJSONObject() throws WeiboException {
        try {
            return new JSONObject(asString());
        } catch (JSONException jsone) {
            throw new WeiboException(jsone.getMessage() + ":" + this.responseAsString, jsone);
        }
    }
View Full Code Here

TOP

Related Classes of weibo4j.WeiboException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.