Twitter              2011/7/28Twitter4J.orgCopyright(c) Yusuke Yamamoto All rights reserved.   1
http://twitter4j.org/            http://samuraism.jp/            @yusukeyCopyright(c) Yusuke Yamamoto All rights reserved....
• Twitter• Twitter API•              Twitter• JavaEE Twitter•             Copyright(c) Yusuke Yamamoto All rights reserved...
Twitter               TwitterCopyright(c) Yusuke Yamamoto All rights reserved.   4
•                                   • Twitter‣                                    ‣ 140    Copyright(c) Yusuke Yamamoto Al...
•                                         • Twitter    ‣                                        ‣              /    ‣     ...
API•                                    • Twitter‣   XML-RPC(Blogger API)                 ‣     REST API‣                 ...
•                                           • Twitter‣                                               ‣                    ...
Twitter••    ‣   mixi••        API               Copyright(c) Yusuke Yamamoto All rights reserved.   9
Twitter APICopyright(c) Yusuke Yamamoto All rights reserved.   10
Twitter API• REST API• Search API• Streaming API• Web                     API                  Copyright(c) Yusuke Yamamot...
REST API        • REST: REpresentational State Transfer        • HTTP APIGET /1/statuses/public_timeline.json HTTP/1.1Host...
Twitter                       REST API•    ‣    ‣    ‣    ‣        Copyright(c) Yusuke Yamamoto All rights reserved.   13
Search API•    ‣• search.twitter.com           Copyright(c) Yusuke Yamamoto All rights reserved.   14
Streaming API•••     Copyright(c) Yusuke Yamamoto All rights reserved.   15
Web                                                              API• Web Intents   ‣                                     ...
Copyright(c) Yusuke Yamamoto All rights reserved.   17
••    ‣    ‣        Copyright(c) Yusuke Yamamoto All rights reserved.   18
•    ‣                                            n••           http://fotopus.com/tough/news/c110304a/•       Copyright(c...
• Web•    ‣•    ‣   Web                              Web              Copyright(c) Yusuke Yamamoto All rights reserved.   20
•ASCII.jp       95           http://ascii.jp/elem/000/000/605/605027/              Copyright(c) Yusuke Yamamoto All rights...
••    ‣    ‣        Copyright(c) Yusuke Yamamoto All rights reserved.   22
••   /        Copyright(c) Yusuke Yamamoto All rights reserved.   23
• Twitter            Copyright(c) Yusuke Yamamoto All rights reserved.   24
:• Twitter• CoTweet• HootSuite                                                       :              Copyright(c) Yusuke Ya...
•                                                •    ‣                                               ‣      Twitter API  ...
JavaEE Twitter  Copyright(c) Yusuke Yamamoto All rights reserved.   27
JavaEE Twitter• Twitter4J ‣                       (Apache License 2.0) ‣ ‣   Twitter API ‣   Twitter API                  ...
Twitter4J• http://twitter4j.org/                 Copyright(c) Yusuke Yamamoto All rights reserved.   29
Twitter4J                                                   (1)• dev.twitter.com               Copyright(c) Yusuke Yamamot...
Twitter4J                                                       (2)•• twitter4j.properties                                ...
Twitter4J                                                     (3)  • Twitter                                              ...
Twitter4J                                               (4)•        Copyright(c) Yusuke Yamamoto All rights reserved.     ...
Twitter4J                                                      (5)•    : Twitter4J -        API http://twitter4j.org/ja/ap...
Copyright(c) Yusuke Yamamoto All rights reserved.   35
•••                       Twitter API    Copyright(c) Yusuke Yamamoto All rights reserved.   36
•    ‣        Twitter    ‣    ‣•    ‣   DM             Copyright(c) Yusuke Yamamoto All rights reserved.   37
• API‣   SSL‣   twitter4j.properties      useSSL    (Twitter4J                  HTTP)                                     ...
• Twitter API    ‣          API•    ‣   Twitter4J•    ‣   MDB    ‣                     Copyright(c) Yusuke Yamamoto All ri...
• Twitter4J•                                                            twitter4j.properties  http.retryCount=5  http.retr...
(1/2)• Message Driven Beanpackage twittermdb;import javax.jms.MessageListener;@MessageDriven(mappedName="jms/Queue")public...
(2/2)•                                                        5000    Copyright(c) Yusuke Yamamoto All rights reserved.   ...
Twitter API• Twitter API  ‣   afterCompletionimport javax.ejb.*;@Stateless(name = "tweet", mappedName = "tweet")public cla...
•    Twitter• Java(EE) Twitter API• Twitter API                                         JavaEE /    WebLogic              ...
Twitter API•        http://amzn.to/iUeXjm             Copyright(c) Yusuke Yamamoto All rights reserved.   45
Twitter API•      http://bit.ly/wls_twtr         #present_twtr_ref               Copyright(c) Yusuke Yamamoto All rights r...
Upcoming SlideShare
Loading in...5
×

エンタープライズアプリケーション とTwitterの連携

2,391

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,391
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
8
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

エンタープライズアプリケーション とTwitterの連携

  1. 1. Twitter 2011/7/28Twitter4J.orgCopyright(c) Yusuke Yamamoto All rights reserved. 1
  2. 2. http://twitter4j.org/ http://samuraism.jp/ @yusukeyCopyright(c) Yusuke Yamamoto All rights reserved. 2
  3. 3. • Twitter• Twitter API• Twitter• JavaEE Twitter• Copyright(c) Yusuke Yamamoto All rights reserved. 3
  4. 4. Twitter TwitterCopyright(c) Yusuke Yamamoto All rights reserved. 4
  5. 5. • • Twitter‣ ‣ 140 Copyright(c) Yusuke Yamamoto All rights reserved. 5
  6. 6. • • Twitter ‣ ‣ / ‣ ‣ twitter.com ( ) ‣ ‣ ( ) 7 ‣ RSS ‣ ‣ Copyright(c) Yusuke Yamamoto All rights reserved. 6
  7. 7. API• • Twitter‣ XML-RPC(Blogger API) ‣ REST API‣ ‣‣ Copyright(c) Yusuke Yamamoto All rights reserved. 7
  8. 8. • • Twitter‣ ‣ (140 ) 140 ( ) ) ( )‣ ‣ ‣ (TypePad,Blogger ) ‣ ‣ CAPTHA ‣ CAPTHA Copyright(c) Yusuke Yamamoto All rights reserved. 8
  9. 9. Twitter•• ‣ mixi•• API Copyright(c) Yusuke Yamamoto All rights reserved. 9
  10. 10. Twitter APICopyright(c) Yusuke Yamamoto All rights reserved. 10
  11. 11. Twitter API• REST API• Search API• Streaming API• Web API Copyright(c) Yusuke Yamamoto All rights reserved. 11
  12. 12. REST API • REST: REpresentational State Transfer • HTTP APIGET /1/statuses/public_timeline.json HTTP/1.1Host: api.twitter.comHTTP/1.1 200 OKDate: Tue, 08 Feb 2011 07:52:51 GMTServer: hiStatus: 200 OKContent-Type: application/json; charset=utf-8Vary: Accept-EncodingConnection: close[{"source": "<a href="http://foursquare.com" rel="nofollow">foursquare</a>", "text": "Im at IKEA ( 2-2-2, ) [pic]: http://4sq.com/eOHZdS", ... "user": { "description": "Java rn Java rn#twitter4j#samurai", "name": " ", ...} }, ...] Copyright(c) Yusuke Yamamoto All rights reserved. 12
  13. 13. Twitter REST API• ‣ ‣ ‣ ‣ Copyright(c) Yusuke Yamamoto All rights reserved. 13
  14. 14. Search API• ‣• search.twitter.com Copyright(c) Yusuke Yamamoto All rights reserved. 14
  15. 15. Streaming API••• Copyright(c) Yusuke Yamamoto All rights reserved. 15
  16. 16. Web API• Web Intents ‣ Twitter ‣• @Anywhere ‣ JavaScript Twitter ‣ Copyright(c) Yusuke Yamamoto All rights reserved. 16
  17. 17. Copyright(c) Yusuke Yamamoto All rights reserved. 17
  18. 18. •• ‣ ‣ Copyright(c) Yusuke Yamamoto All rights reserved. 18
  19. 19. • ‣ n•• http://fotopus.com/tough/news/c110304a/• Copyright(c) Yusuke Yamamoto All rights reserved. 19
  20. 20. • Web• ‣• ‣ Web Web Copyright(c) Yusuke Yamamoto All rights reserved. 20
  21. 21. •ASCII.jp 95 http://ascii.jp/elem/000/000/605/605027/ Copyright(c) Yusuke Yamamoto All rights reserved. 21
  22. 22. •• ‣ ‣ Copyright(c) Yusuke Yamamoto All rights reserved. 22
  23. 23. •• / Copyright(c) Yusuke Yamamoto All rights reserved. 23
  24. 24. • Twitter Copyright(c) Yusuke Yamamoto All rights reserved. 24
  25. 25. :• Twitter• CoTweet• HootSuite : Copyright(c) Yusuke Yamamoto All rights reserved. 25
  26. 26. • • ‣ ‣ Twitter API ‣ api.twitter.com:443 ‣ SLA outbound ‣ inbout ‣ ‣ (C) Yiying Lu API ‣ Copyright(c) Yusuke Yamamoto All rights reserved. 26
  27. 27. JavaEE Twitter Copyright(c) Yusuke Yamamoto All rights reserved. 27
  28. 28. JavaEE Twitter• Twitter4J ‣ (Apache License 2.0) ‣ ‣ Twitter API ‣ Twitter API Twitter4J http://twitter4j.org/ Copyright(c) Yusuke Yamamoto All rights reserved. 28
  29. 29. Twitter4J• http://twitter4j.org/ Copyright(c) Yusuke Yamamoto All rights reserved. 29
  30. 30. Twitter4J (1)• dev.twitter.com Copyright(c) Yusuke Yamamoto All rights reserved. 30
  31. 31. Twitter4J (2)•• twitter4j.properties twitter4j.properties oauth.consumerKey=[ ] oauth.consumerSecret=[ ] oauth.accessToken=[ ] oauth.accessTokenSecret=[ ] : Twitter4J - http://twitter4j.org/ja/configuration.html Copyright(c) Yusuke Yamamoto All rights reserved. 31
  32. 32. Twitter4J (3) • Twitter APIimport twitter4j.*;import javax.servet.*;import javax.servet.http.*;public class HelloTwitterServlet extends HTTPServlet{ protected void doGet(ServletRequest req, ServletResponse res){ Twitter twitter = new TwitterFactory().getInstance(); twitter.updateStatus(“Hello World!”); req.getRequestDispatcher().forward(“WEB-INF/jsps/index.jsp”); }} : Twitter4J - http://twitter4j.org/ja/code-examples.html Copyright(c) Yusuke Yamamoto All rights reserved. 32
  33. 33. Twitter4J (4)• Copyright(c) Yusuke Yamamoto All rights reserved. 33
  34. 34. Twitter4J (5)• : Twitter4J - API http://twitter4j.org/ja/api-support.html Copyright(c) Yusuke Yamamoto All rights reserved. 34
  35. 35. Copyright(c) Yusuke Yamamoto All rights reserved. 35
  36. 36. ••• Twitter API Copyright(c) Yusuke Yamamoto All rights reserved. 36
  37. 37. • ‣ Twitter ‣ ‣• ‣ DM Copyright(c) Yusuke Yamamoto All rights reserved. 37
  38. 38. • API‣ SSL‣ twitter4j.properties useSSL (Twitter4J HTTP) twitter4j.properties http.useSSL=true Copyright(c) Yusuke Yamamoto All rights reserved. 38
  39. 39. • Twitter API ‣ API• ‣ Twitter4J• ‣ MDB ‣ Copyright(c) Yusuke Yamamoto All rights reserved. 39
  40. 40. • Twitter4J• twitter4j.properties http.retryCount=5 http.retryIntervalSecs=10 Copyright(c) Yusuke Yamamoto All rights reserved. 40
  41. 41. (1/2)• Message Driven Beanpackage twittermdb;import javax.jms.MessageListener;@MessageDriven(mappedName="jms/Queue")public class TwitterMDB implements MessageListener { Twitter twitter = new TwitterFactory().getInstance(); public void onMessage(javax.jms.Message msg) { try{ twitter.updateStatus(((TextMessage)msg).getText()); }catch(TwitterException te){ throw new EJBException(te); } }} Copyright(c) Yusuke Yamamoto All rights reserved. 41
  42. 42. (2/2)• 5000 Copyright(c) Yusuke Yamamoto All rights reserved. 42
  43. 43. Twitter API• Twitter API ‣ afterCompletionimport javax.ejb.*;@Stateless(name = "tweet", mappedName = "tweet")public class TweetSLSB { public void sayHello(){ System.out.println("hello"); } @AfterCompletion public void afterCompletion(boolean committed){ if(committed){ try{ twitter.updateStatus(((TextMessage)msg).getText()); }catch(TwitterException te){ throw new EJBException(te); } } }} Copyright(c) Yusuke Yamamoto All rights reserved. 43
  44. 44. • Twitter• Java(EE) Twitter API• Twitter API JavaEE / WebLogic Copyright(c) Yusuke Yamamoto All rights reserved. 44
  45. 45. Twitter API• http://amzn.to/iUeXjm Copyright(c) Yusuke Yamamoto All rights reserved. 45
  46. 46. Twitter API• http://bit.ly/wls_twtr #present_twtr_ref Copyright(c) Yusuke Yamamoto All rights reserved. 46
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×