Thanks for your answer. (Reading it today, I see I didn't succeed in
making that much sense :)
Den 8. juli. 2008 kl. 09.55 skrev Stephan Koops:
>> 1) If I wanted to have a Keywords and a Keyword class I can
>> - use a sub resource locator, but then I have to give up all
>> support for DI or 'pollute' the parent with the child's dependencies?
>> - duplicate the path in the two classes?
>>
>> How should I model this effectively?
> Yes, that is right. Dependencies are only injeced in classes
> instantieated by the runtime. Marc answered a reason I think, but I
> didn't know the reason yet. I also think it is useful to allow this
> injection.
I guess it simply is a necessary trade off that had to be made?
>> 2) When I want to supply a representation of a researcher's
>> keywords, I want to give out url's to them (after all, it's the
>> web :)
>>
>> If I use sub resource locators, there is no way of doing this
>> except hard coding the concatenated path elements (or something
>> equivalent) in the representation rendering logic? Does this mean
>> i'm stuck with not using sub resource locators?
>>
>> I am thinking that effective means of using the same mechanism for
>> request mapping and url generation must be important for a rest
>> api? But maybe it's to difficult or to early days?
> You could get a UriInfo from the runtime in a resource method, if
> you annotate it with @Context. Does this solve your issue?
I do use the UriInfo/UriBuilder, and it is useful.
What I am trying to do is make a framework for the app developers, so
they don't have to manually create the representations (and put
together each url manually), mixed into and partially duplicating the
"controller logic" the resource (with annotations) represents.
I get a root resource url by something like uriBuilder.path(clazz).
But if a resource is a sub resource, there's no way to ask what urls
(since it might be multiple) it is available on.
This information is available to the container through the jax-rs
annotations, so it would be nice to be able to get them, or maybe to
annotate one of them as primary or something.
> BTW: you could join this mailing list to get all replies.
I'm here :)
Jo