String renrenUserId = request.getParameter("xn_sig_user");
if (sessionKey != null && renrenUserId != null) {
request.getSession().setAttribute("session_key", sessionKey);
RenrenApiClient apiClient = RenrenApiClient.getInstance();
JSONArray userInfo = apiClient.getUserService().getInfo(renrenUserId, "name,headurl",new SessionKey(sessionKey));
if (userInfo != null && userInfo.size() > 0) {
JSONObject currentUser = (JSONObject) userInfo.get(0);
if (currentUser != null) {
String userName = (String) currentUser.get("name");
String userHead = (String) currentUser.get("headurl");
request.getSession().setAttribute("userName", userName);
request.getSession().setAttribute("userHead", userHead);
}
}
//获取好友列表数据
JSONArray friendsList = apiClient.getFriendsService().getFriends(1, 30,new SessionKey(sessionKey));//最多取30个好友
//获得安装了该应用的列表
JSONArray appuserList=apiClient.getFriendsService().getAppUsers("tinyurl",new SessionKey(sessionKey));
request.setAttribute("friendsList", friendsList);
request.setAttribute("appUsersList", appuserList);
}
request.setAttribute("appId", RenrenApiConfig.renrenAppID);
RequestDispatcher welcomeDispatcher = request.getRequestDispatcher("/views/home.jsp");