users@jersey.java.net

Re: [Jersey] Bringing RESTful "connectedness" to my existing domain objects

From: Ross McDonald <rossajmcd_at_yahoo.co.uk>
Date: Fri, 27 Mar 2009 03:50:07 -0700 (PDT)

Hi Brett.

This is excellent, exactly what I am looking for. My domain objects however have an 'id' field which is of type 'Long'. The 'getResourceLinkFields' method in the filter is falling over on these with an NPE. I am having trouble working through how to adapt it to cope. Could you work through an example with domain objects with 'Long' id's ?

Thanks in advance for your help,

 - Ross


Hi Paul,

Well here is some sample code, named hateoas4legacy, it is really
rough in places, I'm almost embarrassed to put it up. But atleast it
gets it out there.

1 The sample enhances your model classes using AspectJ at compile time.
 - add a container for some Links
 - add Annotations that contain link templates around attributes or
methods or classes
2 Use a custom ContainerResponseFilter class of jersey to your
evaluate link templates at run time, using the data and any request
based information you may require.

I've posted about this with some instructions:
http://brettdargan.com/blog/2009/01/14/hateoas-for-legacy-object-models/

source code is available from here:
http://brettdargan.com/blog/wp-content/uploads/2009/01/hateoas4legacytar.bz2

mvn glassfish:run
./curl_test

cheers,
Brett.

PS. I've submitted a talk for this at java: S304410

 
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
For additional commands, e-mail: users-help_at_jersey.dev.java.net


-- 
View this message in context: http://n2.nabble.com/Bringing-RESTful-%22connectedness%22-to-my-existing-domain-objects-tp2151839p2543651.html
Sent from the Jersey mailing list archive at Nabble.com.