惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
U
Unit 42
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
J
Java Code Geeks
D
DataBreaches.Net
B
Blog RSS Feed
D
Docker
L
LangChain Blog
aimingoo的专栏
aimingoo的专栏
F
Fortinet All Blogs
Y
Y Combinator Blog
A
About on SuperTechFans
V
V2EX
罗磊的独立博客
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
MongoDB | Blog
MongoDB | Blog
博客园 - 【当耐特】
Last Week in AI
Last Week in AI
S
SegmentFault 最新的问题
月光博客
月光博客
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
阮一峰的网络日志
阮一峰的网络日志

博客园 - 谁是菜鸟?

mysql数据区分大小写 css hack java 乱码 panic user 44/45 Lock wait timeout exceeded; try restarting transaction window.onbeforeunload(支持firefox,ie,Safari) 配置SFS2.x的调试环境 mysql异常处理 常用linux命令 x86_64-unknown-linux - 谁是菜鸟? - 博客园 mysql 动态sql memcached资料 js ping - 谁是菜鸟? - 博客园 mysql roll back 为没有自动增长列的表添加自动增长列并更新现有数据 SmartFox Server 控制pubMsg - 谁是菜鸟? mysql 命令 java.util.ConcurrentModificationException jxl read and write excel
RenRen应用接入样例 - 谁是菜鸟? - 博客园
谁是菜鸟? · 2009-11-17 · via 博客园 - 谁是菜鸟?

撒也不说直接上代码:

 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.xiaonei.api.*"%>
<%@ page import="java.net.*"%>
<%@ page import="com.xiaonei.api.schema.*,org.w3c.dom.Document"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
  <head>
    <base href="<%=basePath%>">
    <title>RenRen Test</title>
 <meta http-equiv="pragma" content="no-cache">
 <meta http-equiv="cache-control" content="no-cache">
 <meta http-equiv="expires" content="0">   
 <meta http-equiv="keywords" content="flash game">
 <meta http-equiv="description" content="This is Api Test.">
  </head>
 
  <body>
  <%
   String sessionKey=request.getParameter("xn_sig_session_key");
   //out.println("sessionKey:"+sessionKey);
   if(sessionKey==null)
   {
       //如果用户是第一次添加该应用则引导用户授权,否则无法获取sessionid
    String url="http://app.renren.com/apps/tos.do?v=1.0&api_key=63b91f609ad14388a0e1238fe8769d4f&next=http://apps.renren.com/****/";//***替换为你的应用地址
    response.sendRedirect(url);
    return;
   }
   XiaoneiRestClient client = new XiaoneiRestClient(appkey,secret key,sessionKey

 //client.friends_get();//获得好友列表
 //FriendsGetResponse resp = (FriendsGetResponse)client.getResponsePOJO();//处理返回结果
 //List<Integer> list = resp.getUid();
 //for (Integer uid : list) {
 //}
  int uid=client.users_getLoggedInUser();//当前用户ID
   out.println("uid:"+uid+"<br>");
   try{
    EnumSet<ProfileField> enumFields = EnumSet.of(ProfileField.NAME,   
                             ProfileField.HOMETOWN_LOCATION,ProfileField.BIRTHDAY,   
                             ProfileField.HEADURL,ProfileField.MAINURL,   
                             ProfileField.SEX,ProfileField.STAR,ProfileField.TINYURL,   
                             ProfileField.ZIDOU,ProfileField.UNIVERSITY_HISTORY,   
                             ProfileField.WORK_HISTORY);//声明所需用户属性   
        Document doc = client.users_getInfo(uid, enumFields);//获取指定ID用户的信息   
        UsersGetInfoResponse loggedUserGetInfoRes = (UsersGetInfoResponse) client.getResponsePOJO();//处理返回结果   
        List<User> lu=loggedUserGetInfoRes.getUser();
        for(User u:lu)
        {
         out.println(u.getName()+"<br>");
        }
     
 }catch(Exception e)
 {
 
  out.println("ERROR:"+e.toString());
 }
  %>
 
  </body>
</html>