Here is a getting started guide:
http://jersey.java.net/nonav/documentation/latest/index.html
To serialize is to put the Tweet into a form that Jersey can put into
the HTTP response body. For anything but simple Strings and ints,
Jersey needs to be told how to represent your Tweet as a String so it
can be returned to the client in the response. What String
representation you cast the Tweet into is up to you, but it seems it
will likely contain the Tweet sender, the tweet message, the time it
was tweeted, etc. So you have to either manually extract that
information from the Tweet and concatenate it into a String and return
that, or you have to provide some indication of how you want Jersey to
handle the serialization. Meaning create a JAXB object like the
TweetBag I mentioned, and place select parts of the Tweet in it, then
return the TweetBag from your Jersey resource method. E.g.
@XmlRootElement(name = "sometweet")
@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
public class TweetBag {
private String sender;
public String getSender() {
return sender;
}
public void setSender(String s) {
this.sender = sender;
}
}
...
TweetBag bag = new TweetBag();
bag.setSender(tweet.getSender());
...
return bag;
On Sun, Mar 6, 2011 at 7:17 PM, mahan_h <mahorad_at_gmail.com> wrote:
> you need to serialize Tweet yourself, and have your resource method return it
> as a String
> How should I serialize it exactly, could you please give me more hints on
> this one
>
> provide a means for Jersey to serialize it using a MessageBodyWriter.
> I'm completely newbie in jersey, is there a link, tutorial or documentation
> to address this exact problem clearly.
>
> Regards
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/Twitter4j-Jersey-WebApplicationException-tp6095973p6096030.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
--
Mark