• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
エンタープライズアプリケーション とTwitterの連携
 

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

on

  • 2,453 views

 

Statistics

Views

Total Views
2,453
Views on SlideShare
2,089
Embed Views
364

Actions

Likes
2
Downloads
7
Comments
0

4 Embeds 364

http://samuraism.jp 354
http://webcache.googleusercontent.com 6
http://131.253.14.98 3
http://twitter.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

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

    • 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. 2
    • • Twitter• Twitter API• Twitter• JavaEE Twitter• Copyright(c) Yusuke Yamamoto All rights reserved. 3
    • Twitter TwitterCopyright(c) Yusuke Yamamoto All rights reserved. 4
    • • • Twitter‣ ‣ 140 Copyright(c) Yusuke Yamamoto All rights reserved. 5
    • • • Twitter ‣ ‣ / ‣ ‣ twitter.com ( ) ‣ ‣ ( ) 7 ‣ RSS ‣ ‣ Copyright(c) Yusuke Yamamoto All rights reserved. 6
    • API• • Twitter‣ XML-RPC(Blogger API) ‣ REST API‣ ‣‣ Copyright(c) Yusuke Yamamoto All rights reserved. 7
    • • • Twitter‣ ‣ (140 ) 140 ( ) ) ( )‣ ‣ ‣ (TypePad,Blogger ) ‣ ‣ CAPTHA ‣ CAPTHA Copyright(c) Yusuke Yamamoto All rights reserved. 8
    • 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 Yamamoto All rights reserved. 11
    • 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
    • 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 ‣ Twitter ‣• @Anywhere ‣ JavaScript Twitter ‣ Copyright(c) Yusuke Yamamoto All rights reserved. 16
    • 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) Yusuke Yamamoto All rights reserved. 19
    • • 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 reserved. 21
    • •• ‣ ‣ 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 Yamamoto All rights reserved. 25
    • • • ‣ ‣ Twitter API ‣ api.twitter.com:443 ‣ SLA outbound ‣ inbout ‣ ‣ (C) Yiying Lu API ‣ Copyright(c) Yusuke Yamamoto All rights reserved. 26
    • 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. 28
    • Twitter4J• http://twitter4j.org/ Copyright(c) Yusuke Yamamoto All rights reserved. 29
    • Twitter4J (1)• dev.twitter.com Copyright(c) Yusuke Yamamoto All rights reserved. 30
    • 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
    • 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
    • Twitter4J (4)• Copyright(c) Yusuke Yamamoto All rights reserved. 33
    • Twitter4J (5)• : Twitter4J - API http://twitter4j.org/ja/api-support.html Copyright(c) Yusuke Yamamoto All rights reserved. 34
    • 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) twitter4j.properties http.useSSL=true Copyright(c) Yusuke Yamamoto All rights reserved. 38
    • • Twitter API ‣ API• ‣ Twitter4J• ‣ MDB ‣ Copyright(c) Yusuke Yamamoto All rights reserved. 39
    • • Twitter4J• twitter4j.properties http.retryCount=5 http.retryIntervalSecs=10 Copyright(c) Yusuke Yamamoto All rights reserved. 40
    • (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
    • (2/2)• 5000 Copyright(c) Yusuke Yamamoto All rights reserved. 42
    • 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
    • • Twitter• Java(EE) Twitter API• Twitter API JavaEE / WebLogic Copyright(c) Yusuke Yamamoto All rights reserved. 44
    • 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 reserved. 46