本文整理汇总了Java中weibo4j.util.WeiboConfig类的典型用法代码示例。如果您正苦于以下问题:Java WeiboConfig类的具体用法?Java WeiboConfig怎么用?Java WeiboConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WeiboConfig类属于weibo4j.util包,在下文中一共展示了WeiboConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: suggestionsUsersByStatus
import weibo4j.util.WeiboConfig; //导入依赖的package包/类
public UserWapper suggestionsUsersByStatus(String content, int num)
throws WeiboException {
return User.constructWapperUsers(client.get(
WeiboConfig.getValue("baseURL")
+ "suggestions/users/by_status.json",
new PostParameter[] { new PostParameter("content", content),
new PostParameter("num", num) }, access_token));
}
示例2: parseSignedRequest
import weibo4j.util.WeiboConfig; //导入依赖的package包/类
public String parseSignedRequest(String signed_request) throws IOException,
InvalidKeyException, NoSuchAlgorithmException {
String[] t = signed_request.split("\\.", 2);
// 为了和 url encode/decode 不冲突,base64url 编码方式会将
// '+','/'转换成'-','_',并且去掉结尾的'='。 因此解码之前需要还原到默认的base64编码,结尾的'='可以用以下算法还原
int padding = (4 - t[0].length() % 4);
for (int i = 0; i < padding; i++)
t[0] += "=";
String part1 = t[0].replace("-", "+").replace("_", "/");
SecretKey key = new SecretKeySpec(WeiboConfig
.getValue("client_SERCRET").getBytes(), "hmacSHA256");
Mac m;
m = Mac.getInstance("hmacSHA256");
m.init(key);
m.update(t[1].getBytes());
String part1Expect = BASE64Encoder.encode(m.doFinal());
// sun.misc.BASE64Decoder decode = new sun.misc.BASE64Decoder();
// String s = new String(decode.decodeBuffer(t[1]));
String s = new String(java.util.Base64.getUrlDecoder().decode(t[1]));
if (part1.equals(part1Expect)) {
return ts(s);
} else {
return null;
}
}
示例3: getBilateralTimeline
import weibo4j.util.WeiboConfig; //导入依赖的package包/类
public StatusWapper getBilateralTimeline(Integer base_app, Integer feature)
throws WeiboException {
return Status.constructWapperStatus(client.get(
WeiboConfig.getValue("baseURL")
+ "statuses/bilateral_timeline.json",
new PostParameter[] { new PostParameter("base_app", base_app),
new PostParameter("feature", feature) }, access_token));
}
示例4: suggestionsUsersMayInterested
import weibo4j.util.WeiboConfig; //导入依赖的package包/类
public JSONArray suggestionsUsersMayInterested(int count, int page)
throws WeiboException {
return client.get(
WeiboConfig.getValue("baseURL")
+ "suggestions/users/may_interested.json",
new PostParameter[] { new PostParameter("count", count),
new PostParameter("page", page) }, access_token)
.asJSONArray();
}
示例5: getFriendsTimelineIds
import weibo4j.util.WeiboConfig; //导入依赖的package包/类
public JSONObject getFriendsTimelineIds(Integer baseAPP, Integer feature,
Paging paging) throws WeiboException {
return client.get(
WeiboConfig.getValue("baseURL")
+ "statuses/friends_timeline/ids.json",
new PostParameter[] {
new PostParameter("base_app", baseAPP.toString()),
new PostParameter("feature", feature.toString()) },
paging, access_token).asJSONObject();
}
示例6: authorize
import weibo4j.util.WeiboConfig; //导入依赖的package包/类
public String authorize(String response_type, String state, String scope)
throws WeiboException {
return WeiboConfig.getValue("authorizeURL").trim() + "?client_id="
+ WeiboConfig.getValue("client_ID").trim() + "&redirect_uri="
+ WeiboConfig.getValue("redirect_URI").trim()
+ "&response_type=" + response_type + "&state=" + state
+ "&scope=" + scope;
}
示例7: getUserTimelineIdsByName
import weibo4j.util.WeiboConfig; //导入依赖的package包/类
public JSONObject getUserTimelineIdsByName(String screen_name)
throws WeiboException {
return client.get(
WeiboConfig.getValue("baseURL")
+ "statuses/user_timeline/ids.json",
new PostParameter[] { new PostParameter("screen_name",
screen_name) }, access_token).asJSONObject();
}
示例8: getUnreadCountOfRemind
import weibo4j.util.WeiboConfig; //导入依赖的package包/类
public JSONObject getUnreadCountOfRemind(String callback)
throws WeiboException {
return client
.get(WeiboConfig.getValue("baseURL")
+ "remind/unread_count.json",
new PostParameter[] { new PostParameter("callback",
callback) }, access_token).asJSONObject();
}
示例9: getUserTimelineByName
import weibo4j.util.WeiboConfig; //导入依赖的package包/类
public StatusWapper getUserTimelineByName(String screen_name)
throws WeiboException {
return Status
.constructWapperStatus(client.get(
WeiboConfig.getValue("baseURL")
+ "statuses/user_timeline.json",
new PostParameter[] { new PostParameter("screen_name",
screen_name) }, access_token));
}
示例10: suggestionsStatusesReorder
import weibo4j.util.WeiboConfig; //导入依赖的package包/类
public StatusWapper suggestionsStatusesReorder(int section, int count,
Paging page) throws WeiboException {
return Status
.constructWapperStatus(client.get(
WeiboConfig.getValue("baseURL")
+ "suggestions/statuses/reorder.json",
new PostParameter[] {
new PostParameter("section", section),
new PostParameter("count", count) }, page,
access_token));
}
示例11: getTrendsHourly
import weibo4j.util.WeiboConfig; //导入依赖的package包/类
public List<Trends> getTrendsHourly(Integer base_app) throws WeiboException {
return Trends.constructTrendsList(client.get(
WeiboConfig.getValue("baseURL") + "trends/hourly.json",
new PostParameter[] { new PostParameter("base_app", base_app
.toString()) }, access_token));
}
示例12: getCommentById
import weibo4j.util.WeiboConfig; //导入依赖的package包/类
/**
* 根据微博ID返回某条微博的评论列表
*
* @param id
* 需要查询的微博ID
* @param count
* 单页返回的记录条数,默认为50。
* @param page
* 返回结果的页码,默认为1。
* @param filter_by_author
* 作者筛选类型,0:全部、1:我关注的人、2:陌生人,默认为0。
* @return list of Comment
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.1
* @see http://open.weibo.com/wiki/2/comments/show
* @since JDK 1.5
*/
public CommentWapper getCommentById(String id, Paging page,
Integer filter_by_author) throws WeiboException {
return Comment.constructWapperComments(client.get(
WeiboConfig.getValue("baseURL") + "comments/show.json",
new PostParameter[] {
new PostParameter("id", id),
new PostParameter("filter_by_author", filter_by_author
.toString()) }, page, access_token));
}
示例13: searchPoisByGeoByCenname
import weibo4j.util.WeiboConfig; //导入依赖的package包/类
/**
* 根据中心点关键字查询周边poi
*
* @param q
* 查询的关键词,必须进行URLencode
* @param cenname
* 中心点名称
* @return
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.2
* @see http://open.weibo.com/wiki/2/location/pois/search/by_geo
* @since JDK 1.5
*/
public JSONObject searchPoisByGeoByCenname(String q, String cenname)
throws WeiboException {
return client.get(
WeiboConfig.getValue("baseURL")
+ "location/pois/search/by_geo.json",
new PostParameter[] { new PostParameter("q", q),
new PostParameter("cenname", cenname) }, access_token)
.asJSONObject();
}
示例14: getCommentByMe
import weibo4j.util.WeiboConfig; //导入依赖的package包/类
/**
* 获取当前登录用户所发出的评论列表
*
* @param count
* 单页返回的记录条数,默认为50
* @param page
* 返回结果的页码,默认为1
* @param filter_by_source
* 来源筛选类型,0:全部、1:来自微博的评论、2:来自微群的评论,默认为0
* @return list of Comment
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.1
* @see http://open.weibo.com/wiki/2/comments/by_me
* @since JDK 1.5
*/
public CommentWapper getCommentByMe(Paging page, Integer filter_by_source)
throws WeiboException {
return Comment.constructWapperComments(client.get(
WeiboConfig.getValue("baseURL") + "comments/by_me.json",
new PostParameter[] { new PostParameter("filter_by_author",
filter_by_source.toString()) }, page, access_token));
}
示例15: trendsFollow
import weibo4j.util.WeiboConfig; //导入依赖的package包/类
/**
* 关注某话题
*
* @param trend_name
* 要关注的话题关键词。
* @return UserTrend
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.1
* @throws JSONException
* @see http://open.weibo.com/wiki/2/trends/follow
* @since JDK 1.5
*/
public UserTrend trendsFollow(String trend_name) throws WeiboException {
return new UserTrend(client.post(WeiboConfig.getValue("baseURL")
+ "trends/follow.json",
new PostParameter[] { new PostParameter("trend_name",
trend_name) }, access_token));
}