I'm trying to create a service with jersey using twitter4j but when
accessing the service I get the following error:
A message body writer for Java type, class java.util.ArrayList, and
MIME media type, application/json, was not found
seems like it does not know how to serialize/deserialize tweets.

my resource class looks like this:

public class TweetResource {
        public List<Tweet> searchPhrase(@PathParam("phrase") String keyword)
                Twitter twitter = new TwitterFactory().getInstance();
                List<Tweet> tweets = new ArrayList<Tweet>();
                try {
                        Query q = new Query(keyword);
                        QueryResult result = twitter.search(q);
                        tweets = result.getTweets();
                        for (Tweet tweet : tweets) {
                                                " Geo:" + 
tweet.getProfileImageUrl() +
                                                " Loc:" + tweet.getLocation() + 
"\t - " +
                                                tweet.getCreatedAt() + "\t - " 
+ tweet.getText());
                } catch (TwitterException te) {
                        System.out.println("Failed to search tweets: " + 
                return tweets;

There is one concrete class, TweetJSONImpl  but I don't know how to
use it
any help or suggestions?

Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 

Reply via email to