Changes for page TwitterGroovy

Last modified by Ludovic Dubost on 2010/02/11 15:14

From version 2.1
edited by Ludovic Dubost
on 2008/12/31 09:57
Change comment: Upload new attachment <a href="/xwiki/bin/downloadrev/Test/TwitterGroovy/twitter4j%2D1.1.3.jar?rev=1.1">twitter4j-1.1.3.jar</a>
To version 5.1
edited by Ludovic Dubost
on 2009/01/02 14:23
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -4,7 +4,20 @@
4 4  import twitter4j.Twitter;
5 5  
6 6  public class TwitterGroovy {
7 - public List getTwitter(twitterID, twitterPassword) {
8 - return new Twitter(twitterID,twitterPassword);
7 + TWitter twitter;
8 +
9 + public Twitter getTwitter(twitterID, twitterPassword) {
10 + if (twitter!=null)
11 + return twitter;
12 +
13 + twitter = new Twitter(twitterID,twitterPassword);
14 + return twitter;
9 9   }
16 +
17 + public Document search(String text) {
18 + String url = "http://search.twitter.com/search.atom?q=" + text;
19 + def resp = twitter.get(url, true);
20 + def doc = resp.asDocument();
21 + return doc;
22 + }
10 10  }