On Tue, Dec 28, 2010 at 10:59 AM, Willem Jiang <[email protected]> wrote:
> On 12/28/10 4:38 PM, Claus Ibsen wrote:
>>
>> On Tue, Dec 28, 2010 at 7:51 AM, Willem Jiang<[email protected]>
>>  wrote:
>>>
>>> On 12/28/10 12:21 PM, Dante Sun wrote:
>>>>
>>>> I am using the example cxf-jaxrs shipped with
>>>> apache-servicemix-4.3.0-fuse-03-00.tar.gz to investigate how to deploy
>>>> multiple bundles which provides different RESTful services. What I did
>>>> is
>>>> copied the cxf-jaxrs example into cxf-jaxrs-example-1, and modified the
>>>> pom.xml and beans.xml. The modifications are :
>>>>
>>>> 1. pom.xml
>>>> version: 4.3.0-2-fuse-03-00
>>>> name: Apache ServiceMix Example 2:: CXF JAX-RS OSGI
>>>> 2. beans.xml
>>>> <jaxrs:server id="customerService2" address="/crm2">
>>>>
>>>> Then I made two packages. The one is the original example package
>>>> cxf-jaxrs-4.3.0-fuse-03-00.jar and the other is the modified one
>>>> cxf-jaxrs-4.3.0-2-fuse-03-00.jar and I copied them into "deploy"
>>>> directory.
>>>>
>>>> After servicemix started, I see both bundles are active and started
>>>> succesfully.
>>>>
>>>> But, I am only able to access the RESTful services in one bundle. When I
>>>> type "http://localhost:8080/cxf/crm2/customerservice/customers/123";, I
>>>> got
>>>> "No service was found." error. And when I stop the other example
>>>> bundle(the
>>>> original one), I can access "
>>>> http://localhost:8080/cxf/crm2/customerservice/customers/123"; with no
>>>> problems.
>>>>
>>>> What I did wrong?? It is supposed to provides the RESTful services in
>>>> both
>>>> context path "/crm" and "/crm2".
>>>>
>>> Please change your second context patch to "/otherCRM" which is not start
>>> with first service.
>>>
>>> For the RESTful service, CXF will pass the request which url start with
>>> "/crm" to the first service.
>>>
>>
>> This does seem like a scary bug to me.
>>
>> Its common to use xxx2, xxx3 for a simple versioning scheme to support
>> multiple versions of the "same" service.
>>
>> Why doesn't it match equals on the context path name?
>>
>>
> The user is using "crm" and "crm2".
> Just like the camel-jetty if you set matchOnUriPrefix[1] option to be true
> and start two route with this context path will make the first route take
> all the response.
>
> Using "crm1" and "crm2" are total difference use case :)
>
> [1] http://camel.apache.org/how-do-i-let-jetty-match-wildcards.html
>>

Yeah but if you do NOT use matchOnUriPrefix, eg its
matchOnUriPrefix=false (as its default).
Then I would assume you should be able to deploy 2 different REST
bundles with different context path

Such as:

/foo
/foo2

And be able to access the correct service depending on the uri hit

localhost/foo/customer/123  -> will hit REST service exposed on /foo
localhost/foo2/order/456 --> will hit REST servie exposed on /foo2





>>
>>> --
>>> Willem
>>> ----------------------------------
>>> FuseSource
>>> Web: http://www.fusesource.com
>>> Blog:    http://willemjiang.blogspot.com (English)
>>>         http://jnn.javaeye.com (Chinese)
>>> Twitter: willemjiang
>>>
>>
>>
>>
>
>
> --
> Willem
> ----------------------------------
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>         http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to