From: Logan H. <lo...@gm...> - 2008-12-27 20:10:09
|
I have a third party class that I am using in my REST service. I built a @Provider that implements StringConverter. I am also interested in providing XML and JSON support as well as basic string support. From the RestEASY documentation, it sounds like this is practically out of the box functionality, but am unclear as to exactly what I need to do... It would seem that XML and JSON support are automatic as long as my class is annotated with JAXB annotations. Alas, since the class I am using is a third-party class (LocalDate from Joda-time), I am unable to annotate it using JAXB. (Or is there a trick here?) I think what I need to do is to implement MessageBodyWriter<LocalDate> and MessageBodyReader<LocalDate> in my @Provider class... Can someone point me to an example? I am unclear if I need to provide support for both json and xml, or just xml and then json is inferred. Finally, is there a way to leverage the XmlSchemaType in my rest service definition? Truthfully, I am using LocalDate just because I want to avoid time information with Date objects. If I can declare that my Java Date object is truly just a Date (and not a Timestamp), perhaps this is functionality available out of the box? Can I declare the parameter or response is XmlSchemaType(name="date")? |