|
From: Ryan J. M. <ry...@da...> - 2008-07-30 12:43:46
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Now that I have my example code committed, you can see what I was
trying to do. Right now, the annotation code is commented out, but
have a look at the Contact entity in the ejb project. Ideally, what I
want to be able to do is have the ContactServiceBean return an a
Contact instance (which it does) and form there, the JAX-RS
annotations are read off of the entity. This way, I can easily
navigate to:
http://localhost:8080/addressbook/contacts/1/emailAddresses/3
And from there, I could view the EmailAddress entity with ID 3. Right
now, this doesn't work as expected and a 404 is returned.
Ryan-
On Jul 16, 2008, at 4:52 PM, Bill Burke wrote:
>
>
> Ryan J. McDonough wrote:
>> On Jul 15, 2008, at 9:22 AM, Bill Burke wrote:
>>> I don't see why you need a change to Resteasy to do this when the
>>> JAX-RS spec allows you to return any arbitrary object from a
>>> subresource locator. For example:
>>>
>>> @Path("/")
>>> public class CustomerDatabase {
>>>
>>> @Path("customers/{id}")
>>> public Object getCustomer() {
>>>
>>> Customer cust = jpa.find(...);
>>> return cust;
>>> }
>>> }
>>>
>>> public class Customer {
>>>
>>> @GET
>>> public String get() {...}
>>>
>>> @Path("/address")
>>> public String getAddress() {...}
>>> }
>>>
>>> So
>>>
>>> GET /customers/1
>>> GET /customer/1/address
>>>
>>> Would eventually route to Customer.
>> I've tried that, and it does not work. You can certainly get the
>> Contact entity, but any @Path annotations on the entity are not
>> processed. We don't have any unit tests which cover this sort of
>> behavior, so it maybe that we don't support this yet? (Or support
>> this with EJB's?) I was also taking a look at the Jersey "Bookmark"
>> example app, and they have created separate resource classes for
>> child entities. Ideally, I don't want to do this. You've got
>> similar patterns being repeated and we've got a lot of meta data on
>> the entity that we can use.
>
> You'll have to show me an example because I'm not sure exactly what
> you are doing here.
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
iD8DBQFIkGHyK/xjmUY6JwURAraYAJ9xNjpukovLJo9d8t9SyTbAn3Lx4wCgiRug
9Ad2Xa+ovRaIRWiw2tCNHCE=
=FE55
-----END PGP SIGNATURE-----
|