On Fri, May 13, 2011 at 7:18 AM, Simon Laws <simonsl...@googlemail.com> wrote: > > A newby jax-rs question related to this. With the Tuscany jax-rs > integration how can I get two components to be part of the same URL > space when there is a variable part in the URL, for example, the > domain example from my previous post. Let's say I want my URL to be > > http://localhost:8080/sca/domain/{domainname}/XYZ > > where XYX could be contribution, composite etc. In this case if I want > a domain component mapped to > http://localhost:8080/sca/domain/{domainname} and a composite > component mapped to > http://localhost:8080/sca/domain/{domainname}/composite is that > possible. Or would I have to do > http://localhost:8080/sca/domain/{domainname} and > http://localhost:8080/sca/domain/composite/{domainname} which doesn't > seem right. > > This is where I ended up with me .composite. > > <component name="Domain"> > <implementation.java class="org.apache.tuscany.sca.domain.DomainImpl"/> > <service name="Domain"> > <tuscany:binding.rest uri="/sca/domain"> > <tuscany:operationSelector.jaxrs/> > </tuscany:binding.rest> > </service> > </component> > > <!-- > don't know how to map multiple components to a variable root > <component name="Composite"> > <implementation.java > class="org.apache.tuscany.sca.domain.CompositeImpl"/> > <service name="Composite"> > <tuscany:binding.rest uri="/sca/domain"> > <tuscany:operationSelector.jaxrs/> > </tuscany:binding.rest> > </service> > </component> > --> > > I can of course make it work using a single component, which is where > I started, but I wanted to learn more about the jax-rs integration. >
It looks like this fits very weel in the concept of JAX-RS resource/sub-resource http://incubator.apache.org/wink/1.1.1/html/JAX-RS%20Resources,%20HTTP%20Methods,%20and%20Paths.html The idea is that you define a top level resource, that "handles" the "domain" path, then it could redirect the "domain/composite" path to a different component. Please let me know if this helps, if you want I can build an example in the node-manager module. -- Luciano Resende http://people.apache.org/~lresende http://twitter.com/lresende1975 http://lresende.blogspot.com/