Hi
Perhaps the following can help
On 11/09/12 11:52, Tim Emrich wrote:
hello,
i try to expose 2 or more resources using the cxfrs component (camel 2.10.1).
One is working fine, but i don't find a proper solution to expose more then one.
i tried several approaches but none of them worked as expected (at
least what i expect ;-)):
1) one rsServer with many serviceBeans
in the route i use something like
"cxfrs:bean:rsServer?resourceClass=net.code-poets.camel.endpoint.v01.ResourceEndpoint1";
-> all requests are routed to just one endpoint
2) many rsServer instances with one serviceClass each
- using the same address "/" attribute for all rsServer instances does
not work (the exposed resources have their own root @Path defined,
(e.g. Path("/resource1"))
- using the "/resource1" as address string in the rsServer and
removing it from the Resource definition does not work
+ using the "/resource1" as address string and leaving it in the
@Path("/resource1") public interface Resource1...
does work, but leads to an URL like .../resource1/resource1...
i'd like to know if i have a conceptional problem?
can someone pls provide me with a fragment how it should look like to
use many resources, where each of the resource have their own route
definition.
I believe the 2nd approach works, according to
http://camel.465427.n5.nabble.com/Apache-Camel-CXFRS-Server-Need-advice-for-Routing-td5699287.html
Every endpoint or individual service beans within a single endpoint
should have unique Path values, otherwise, as in JAX-RS 1.1, the first
matching resource gets selected. The case of multiple resources having
the same top-level Path is handled better in JAX-RS 2.0 but in meantime
top level Path values have to be unique.
The other possible workarounds:
- use a single root resource but introduce and delegate to subresource
locators
- use CXF specific comparator to resolve the ambiguous cases:
http://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-Customselectionbetweenmultipleresources
- consider using CXF jaxrs:endpoint directly, and using Camel transport
to delegate to it
HTH, Sergey
thx in advance,
tim
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com