users@jersey.java.net

[Jersey] Re: Twitter4j & Jersey: WebApplicationException

From: mahan_h <mahorad_at_gmail.com>
Date: Tue, 8 Mar 2011 08:21:14 -0800 (PST)

I tried both
@Produces("application/json")
and
@Produces(MediaType.APPLICATION_JSON)

gives me the following error:

HTTP Status 406 -
type Status report
message

description The resource identified by this request is only capable of
generating responses with characteristics not acceptable according to the
request "accept" headers ().

A message body writer for Java type, class twitter4j.TweetJSONImpl, and MIME
media type, application/json, was not found

service impl:
        @Produces(MediaType.APPLICATION_JSON)
        @GET
        @Path("{phrase}")
        public Tweet searchPhrase(@PathParam("phrase") String keyword) {
                Twitter twitter = new TwitterFactory().getInstance();
                List tweets = new ArrayList();
                ...
                get the tweets...
                ...
                return tweets.get(0);
        }

--
View this message in context: http://jersey.576304.n2.nabble.com/Twitter4j-Jersey-WebApplicationException-tp6095973p6129105.html
Sent from the Jersey mailing list archive at Nabble.com.