/*
Copyright (c) 2007-2009, Yusuke Yamamoto
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Yusuke Yamamoto nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY Yusuke Yamamoto ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL Yusuke Yamamoto BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package weibo4andriod;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import weibo4andriod.http.AccessToken;
import weibo4andriod.http.HttpClientWeibo;
import weibo4andriod.http.ImageItem;
import weibo4andriod.http.PostParameter;
import weibo4andriod.http.RequestToken;
import weibo4andriod.http.Response;
import weibo4andriod.org.json.JSONException;
import weibo4andriod.org.json.JSONObject;
/**
* A java reporesentation of the <a href="http://open.t.sina.com.cn/wiki/">Weibo API</a>
*/
public class Weibo extends WeiboSupport implements java.io.Serializable {
public static String CONSUMER_KEY = "1819166122";
public static String CONSUMER_SECRET = "cc2b9e78491f45019be9ea4d84d16b33";
// public static String CONSUMER_KEY = "1552112022";
// public static String CONSUMER_SECRET = "bd9e3b147ece106f9cee159758a28ec1";
private String baseURL = Configuration.getScheme() + "api.t.sina.com.cn/";
private String searchBaseURL = Configuration.getScheme() + "api.t.sina.com.cn/";
private static final long serialVersionUID = -1486360080128882436L;
public Weibo() {
super();
format.setTimeZone(TimeZone.getTimeZone("GMT"));
http.setRequestTokenURL(Configuration.getScheme() + "api.t.sina.com.cn/oauth/request_token");
http.setAuthorizationURL(Configuration.getScheme() + "api.t.sina.com.cn/oauth/authorize");
http.setAccessTokenURL(Configuration.getScheme() + "api.t.sina.com.cn/oauth/access_token");
}
/**
* Sets token information
* @param token
* @param tokenSecret
*/
public void setToken(String token, String tokenSecret) {
http.setToken(token, tokenSecret);
}
public Weibo(String baseURL) {
this();
this.baseURL = baseURL;
}
public Weibo(String id, String password) {
this();
setUserId(id);
setPassword(password);
}
public Weibo(String id, String password, String baseURL) {
this();
setUserId(id);
setPassword(password);
this.baseURL = baseURL;
}
/**
* Sets the base URL
*
* @param baseURL String the base URL
*/
public void setBaseURL(String baseURL) {
this.baseURL = baseURL;
}
/**
* Returns the base URL
*
* @return the base URL
*/
public String getBaseURL() {
return this.baseURL;
}
/**
* Sets the search base URL
*
* @param searchBaseURL the search base URL
* @since Weibo4J 1.1220
*/
public void setSearchBaseURL(String searchBaseURL) {
this.searchBaseURL = searchBaseURL;
}
/**
* Returns the search base url
* @return search base url
* @since Weibo4J 1.1220
*/
public String getSearchBaseURL(){
return this.searchBaseURL;
}
/**
*
* @param consumerKey OAuth consumer key
* @param consumerSecret OAuth consumer secret
* @since Weibo4J 1.1220
*/
public synchronized void setOAuthConsumer(String consumerKey, String consumerSecret){
this.http.setOAuthConsumer(consumerKey, consumerSecret);
}
/**
* Retrieves a request token
* @return generated request token.
* @throws WeiboException when Weibo service or network is unavailable
* @since Weibo4J 1.1220
* @see <a href="http://oauth.net/core/1.0/#auth_step1">OAuth Core 1.0 - 6.1. Obtaining an Unauthorized Request Token</a>
*/
public RequestToken getOAuthRequestToken() throws WeiboException {
return http.getOAuthRequestToken();
}
public RequestToken getOAuthRequestToken(String callback_url) throws WeiboException {
return http.getOauthRequestToken(callback_url);
}
/**
* Retrieves an access token assosiated with the supplied request token.
* @param requestToken the request token
* @return access token associsted with the supplied request token.
* @throws WeiboException when Weibo service or network is unavailable, or the user has not authorized
* @see <a href="http://open.t.sina.com.cn/wiki/index.php/Oauth/access_token">Oauth/access token </a>
* @see <a href="http://oauth.net/core/1.0/#auth_step2">OAuth Core 1.0 - 6.2. Obtaining User Authorization</a>
* @since Weibo4J 1.1220
*/
public synchronized AccessToken getOAuthAccessToken(RequestToken requestToken) throws WeiboException {
return http.getOAuthAccessToken(requestToken);
}
/**
* Retrieves an access token assosiated with the supplied request token and sets userId.
* @param requestToken the request token
* @param pin pin
* @return access token associsted with the supplied request token.
* @throws WeiboException when Weibo service or network is unavailable, or the user has not authorized
* @see <a href="http://open.t.sina.com.cn/wiki/index.php/Oauth/access_token">Oauth/access token </a>
* @see <a href="http://oauth.net/core/1.0/#auth_step2">OAuth Core 1.0 - 6.2. Obtaining User Authorization</a>
* @since Weibo4J 1.1220
*/
public synchronized AccessToken getOAuthAccessToken(RequestToken requestToken, String pin) throws WeiboException {
AccessToken accessToken = http.getOAuthAccessToken(requestToken, pin);
setUserId(accessToken.getScreenName());
return accessToken;
}
/**
* Retrieves an access token assosiated with the supplied request token and sets userId.
* @param token request token
* @param tokenSecret request token secret
* @return access token associsted with the supplied request token.
* @throws WeiboException when Weibo service or network is unavailable, or the user has not authorized
* @see <a href="http://open.t.sina.com.cn/wiki/index.php/Oauth/access_token">Oauth/access token </a>
* @see <a href="http://oauth.net/core/1.0/#auth_step2">OAuth Core 1.0 - 6.2. Obtaining User Authorization</a>
* @since Weibo4J 1.1220
*/
public synchronized AccessToken getOAuthAccessToken(String token, String tokenSecret) throws WeiboException {
AccessToken accessToken = http.getOAuthAccessToken(token, tokenSecret);
setUserId(accessToken.getScreenName());
return accessToken;
}
/**
* Retrieves an access token assosiated with the supplied request token.
* @param token requ
没有合适的资源?快使用搜索试试~ 我知道了~
好用android资源
共477个文件
class:266个
java:94个
png:66个
需积分: 5 23 下载量 85 浏览量
2011-08-23
14:10:41
上传
评论
收藏 3.45MB RAR 举报
温馨提示
好用android好用android好用android好用android好用android好用android好用,android好,用android
资源推荐
资源详情
资源评论
收起资源包目录
好用android资源 (477个子文件)
all-wcprops 711B
all-wcprops 661B
resources.ap_ 448KB
EsurfingClient.apk 768KB
proguard.cfg 1KB
Weibo.class 54KB
AsyncWeibo.class 33KB
HttpClientWeibo.class 26KB
Test.class 21KB
JSONObject.class 20KB
HTMLEntity.class 18KB
User.class 16KB
JSONArray.class 12KB
OAuth.class 10KB
Status.class 10KB
AbstractHttpApi.class 9KB
WeiboStream.class 9KB
ResponseClient.class 8KB
ListObject.class 8KB
Comment.class 8KB
Configuration.class 8KB
WeiboResponse.class 8KB
WeiboActivityMain.class 8KB
HttpRes.class 8KB
Response.class 7KB
ImageUtil.class 7KB
WeiboAdapter.class 7KB
XML.class 7KB
DirectMessage.class 7KB
JSONML.class 7KB
PostParameter.class 6KB
RetweetDetails.class 6KB
Trends.class 6KB
QueryResult.class 6KB
JSONTokener.class 6KB
MainActivity.class 5KB
XMLTokener.class 5KB
WeiboActivityMain$MyListAdapter.class 5KB
Tweet.class 5KB
Query.class 5KB
CDL.class 4KB
SavedSearch.class 4KB
Login.class 4KB
IDs.class 4KB
AsyncTaskXML$task.class 4KB
JSONWriter.class 4KB
WeiboActivityLogin.class 4KB
LoginAnim.class 4KB
FileType.class 4KB
FriendActivityAll$ExpandableAdapter.class 4KB
Utils.class 4KB
ExpandableAdapter1.class 4KB
WeiboSupport.class 3KB
WeiboStream$StreamHandlingThread.class 3KB
FriendActivityAll.class 3KB
RateLimitStatus.class 3KB
Cookie.class 3KB
Count.class 3KB
OAuthToken.class 3KB
Paging.class 3KB
AbstractParser.class 3KB
TextUtil.class 3KB
FriendActivity.class 3KB
ImageItem.class 3KB
WeiboActivityMain$2.class 3KB
ListUserCount.class 3KB
R$drawable.class 3KB
LoginAnim$getUserinfo.class 3KB
Dispatcher.class 3KB
LoginAnim$GetTask.class 3KB
HTTP.class 3KB
R$id.class 2KB
MainActivityDo.class 2KB
BareBonesBrowserLaunch.class 2KB
WeiboListener.class 2KB
RequestToken.class 2KB
MainActivityMain.class 2KB
HttpApiWithBasicAuth$1.class 2KB
AsyncImageLoader.class 2KB
LoginAnim$ClickListener.class 2KB
BASE64Encoder.class 2KB
WeiboActivityMain$1.class 2KB
Trend.class 2KB
CookieList.class 2KB
StatusStream.class 2KB
OAuthConstant.class 2KB
AsyncImageLoader$2.class 2KB
Test$1Obj.class 2KB
AsyncTaskXML.class 2KB
HttpApiWithBasicAuth.class 2KB
HttpClientWeibo$ByteArrayPart.class 2KB
AsyncImageLoader$1.class 1KB
ListObjectWapper.class 1KB
LoginAnim$ClickListener$2.class 1KB
Login$PasswordTextWatcher.class 1KB
Login$JidTextWatcher.class 1KB
UserWapper.class 1KB
AccessToken.class 1KB
AsyncWeibo$97.class 1KB
AsyncWeibo$94.class 1KB
共 477 条
- 1
- 2
- 3
- 4
- 5
资源评论
holemole
- 粉丝: 8
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功