users@jersey.java.net

[Jersey] Re: Twitter4j & Jersey: WebApplicationException

From: Mark Petrovic <mspetrovic_at_gmail.com>
Date: Tue, 8 Mar 2011 08:39:07 -0800

Right off, I can't see why this wouldn't work. Try omitting
altogether the @XmlAccessorType annotation and see if that helps.

On Tue, Mar 8, 2011 at 8:21 AM, mahan_h <mahorad_at_gmail.com> wrote:
> 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.
>



-- 
Mark