Results 1 to 3 of 3

Thread: REST + XStream Annotations

Hybrid View

  1. #1

    Default REST + XStream Annotations

    Hi

    I've built an application with ROO and have made use of ContentNegotiatingViewResolver and RESTFul URLs. I've picked XStream to serialize my domain objects to XML. I'd like to use XStream annotations to override the default names of properties in my domain objects, and I'd like to exclude the version and id fields from the XML; but because these are wrapped up in the aspects I can't add annotations. What would be the best approach here do you think?

    As a side-note; Spring 3.0.0.M3 (seems to have been addresses in trunk) doesn't support XStream's autoDetectAnnotation property so I've used a Customer Marshaller/Unmarshaller implementation and 'decorated' the Spring implmentation so that I can set this property.

    One more side-note: I have used a custom mime-type for my xml, because of problems with content-negotiation with Safarai and also IE. See http://jira.springframework.org/browse/SPR-5706

    Jon

  2. #2
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    Hi Jon,

    I have tested this just recently with Spring 3.0.0.M4 and the autoDetectAnnotation property worked there. You can then simply add the XStream annotations in the aspect. This will, however, be overwritten once you start the Roo shell on your project again so it may make more sense to push the fields into the actual Java sources.

    HTH
    -Stefan

  3. #3

    Default

    Hi Stefan

    Many thanks for the reply.

    It would be a shame to have to push the fields into the java source code, but probably is the only sensible way to achieve what I want to do. I had a quick stab at upgrading Spring to 3.0.0.M4 and all my tests failed so I guess I'd have to upgrade other dependencies too. I'd rather stick with what ROO gives me for now and wait for the next ROO upgrade instead.

    All the best

    Jon

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •