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

推荐订阅源

WordPress大学
WordPress大学
V
Visual Studio Blog
P
Privacy International News Feed
月光博客
月光博客
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
L
Lohrmann on Cybersecurity
N
News and Events Feed by Topic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Apple Machine Learning Research
Apple Machine Learning Research
阮一峰的网络日志
阮一峰的网络日志
Webroot Blog
Webroot Blog
T
Threatpost
宝玉的分享
宝玉的分享
The Last Watchdog
The Last Watchdog
小众软件
小众软件
L
LINUX DO - 最新话题
C
Cisco Blogs
T
Troy Hunt's Blog
Schneier on Security
Schneier on Security
酷 壳 – CoolShell
酷 壳 – CoolShell
www.infosecurity-magazine.com
www.infosecurity-magazine.com
雷峰网
雷峰网
G
GRAHAM CLULEY
有赞技术团队
有赞技术团队
Know Your Adversary
Know Your Adversary
博客园 - 叶小钗
罗磊的独立博客
V
V2EX
博客园 - Franky
P
Proofpoint News Feed
SecWiki News
SecWiki News
腾讯CDC
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
博客园 - 三生石上(FineUI控件)
S
Secure Thoughts
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
PCI Perspectives
PCI Perspectives
V2EX - 技术
V2EX - 技术
Google DeepMind News
Google DeepMind News
Last Week in AI
Last Week in AI
aimingoo的专栏
aimingoo的专栏
Cisco Talos Blog
Cisco Talos Blog
N
News and Events Feed by Topic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
SegmentFault 最新的问题

博客园 - 谁是菜鸟?

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>