users@jersey.java.net

Re: Generating urls and controlling rendering/serialization

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 04 Mar 2008 09:44:55 -0500

On Mar 3, 2008, at 7:55 PM, Jo Størset wrote:
>
> In our own resource centric web solution, we have the notion of
> services applied to resources in a content repository. These
> services, like jersey resources, are used both for mapping requests
> to funcionality and for generating urls to the service on specific
> resources (service.createLink(Resource resource) more or less). In
> this scenario all resources have a path (id), which I believe
> corresponds to your use of the @id and @ResourceClass annotations.
> Wouldn't this be very helpful for building clean, maintainable rest
> style apps?
>
> On JPA, I don't use JPA myself, and I don't know how clean it would
> be to use jpa @id annotations in a generalized way. But i guess it
> would be doable?
>
I was thinking that we could default to re-using the JPA @Id
annotation in the case that the model was a JPA entity bean but that
we'd define our own annotation for use elsewhere, e.g. @ResourceId.
That way it would be very easy to use an existing JPA entity as a
model but we'd provide a way to override the property used as the
identifier and a way to use other types of model classes.

Marc.


> I was also thinking about the possibility of rest annotating the
> model resources directly (since the annotations themselves
> constitutes a level above the resources), instead of making an
> explicit resource layer. But I guess this would be quite intrusive
> to the current way of doing layering of apps, since the access
> methods don't really belong in the resource. Maybe I should be
> looking to the seam way of building apps, since it seems geared
> towards this type of merging of the web and resource layer. Does
> anybody else have any ideas in this regard?
>
> Jo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.