camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Chaffee <jchaf...@shopzilla.com>
Subject Re: camel-cxfrs: Handling of Subresources
Date Thu, 27 Dec 2012 22:34:27 GMT
I am using camel-cxfrs quite successfully and I am seeing my path and
query params in the body, which a MessageContentList.  The method
parameters are inserted in the order they defined in the method.


I am using 2.10.3.

Jason


On 12/27/12 4:07 AM, "Raul Kripalani" <raul@evosent.com> wrote:

>After a detail look in the source code, the issue lies in the Camel
>CxfRsInvoker level. It's no so much of an "issue", but more of a concept
>discussion.
>
>In an ordinary JAX-RS application, the Subresource Locator would use any
>path parameters, query params, etc. when building the resource to return.
>So these parameters are "volatile" and only relevant at that layer. They
>would "perpetuate" as instance variables of the new Resource, probably.
>
>However, with Camel, the user's logic typically executes at the end of the
>resource chain, when the final resource is hit. So as a Camel user, I
>would
>expect to find all @PathParams, @HeaderParams, @QueryParams, etc. found
>along the way compiled and injected as headers in my IN message (or in a
>MessageContentsList body).
>
>But that doesn't happen. The Camel CxfRsInvoker does indeed invoke the
>Subresource locators (line 52 in 2.10.3), but to cling to the param values
>one would have to write a method body (to "perpetuate" them in some way),
>which is contradictory to the philosophy of camel-cxfrs. The component
>page
>states: "This class is used to configure the JAXRS properties ONLY. The
>methods will NOT be executed during the routing of messages to the
>endpoint, the route itself is responsible for ALL processing instead.".
>(this is actually inaccurate, because Subresource methods are truly
>executed).
>
>Anyway, for my use case I will create a custom binding to process
>all org.apache.cxf.jaxrs.model.OperationResourceInfoStack in the CXF
>Exchange, to extract all params and place them as IN message headers. I
>may
>commit it sooner or later just in case someone else finds it useful ;)
>
>Regards,
>
>*Raúl Kripalani*
>Apache Camel Committer
>Enterprise Architect, Program Manager, Open Source Integration specialist
>http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
>http://blog.raulkr.net | twitter: @raulvk <http://twitter.com/raulvk>
>
>On Thu, Dec 27, 2012 at 10:45 AM, Sergey Beryozkin
><sberyozkin@gmail.com>wrote:
>
>> On 27/12/12 10:25, Raul Kripalani wrote:
>>
>>> Hi Willem,
>>>
>>> Thanks for the quick response. Is there an interceptor we can
>>>implement to
>>> capture intermediate method invocations?
>>> I found CXF-2709, which is somewhat related. Basically, I'm interested
>>>in
>>> exploring all Methods and Param Arrays along the path to the final
>>> resource.
>>>
>>> Right now, if there was a query or path parameter along the way, it
>>> doesn't
>>> appear in the ultimate MessageContentsList.
>>>
>>>
>> If the final resource method, be it part of the sub-resource or root
>> resource, has the parameters annotated as Path or Query parameters, then
>> the final list of parameters should be complete,
>>
>>
>>  If you want we can switch this conversation to the CXF User forum. I
>>> didn't
>>> want to cross-post.
>>>
>>>  Perhaps it's better be discussed at the CXF list indeed, but I wonder,
>> may be I'm misunderstanding the issue :-), and may be the issue belongs
>>at
>> the Camel CXFRsInvoker level ? Can you please prototype some example
>>root &
>> sub resource code - can quickly confirm if it's a CXF level issue or not
>>
>> Cheers, Sergey
>>
>>
>>  Regards,
>>>
>>> *Raúl Kripalani*
>>> Apache Camel Committer
>>> Enterprise Architect, Program Manager, Open Source Integration
>>>specialist
>>> http://about.me/raulkripalani | http://www.linkedin.com/in/**
>>> raulkripalani <http://www.linkedin.com/in/raulkripalani>
>>> http://blog.raulkr.net | twitter:
>>>@raulvk<http://twitter.com/**raulvk<http://twitter.com/raulvk>
>>> >
>>>
>>> On Thu, Dec 27, 2012 at 10:19 AM, Willem
>>>jiang<willem.jiang@gmail.com>**
>>> wrote:
>>>
>>>  Hi Raul
>>>>
>>>> The cxfrs component only hit the final resource. As camel don't know
>>>>what
>>>> to do sub resource.
>>>> You can find the code in the performInvocation method of the
>>>> CxfRsInvoker.
>>>>
>>>>
>>>> --
>>>> Willem Jiang
>>>>
>>>> Red Hat, Inc.
>>>> FuseSource is now part of Red Hat
>>>> Web: http://www.fusesource.com | http://www.redhat.com
>>>> Blog: 
>>>>http://willemjiang.blogspot.**com<http://willemjiang.blogspot.com>(
>>>> http://willemjiang.blogspot.**com/ <http://willemjiang.blogspot.com/>)
>>>> (English)
>>>>            http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
>>>> Twitter: willemjiang
>>>> Weibo: 姜宁willem
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Thursday, December 27, 2012 at 6:08 PM, Raul Kripalani wrote:
>>>>
>>>>  Hi all,
>>>>>
>>>>> I have a quick question about the CXF-RS consumers. How are
>>>>>Subresources
>>>>> and Resource Locators handled?
>>>>>
>>>>> Does the CXF Binding get invoked each time per Subresource? Or only
>>>>>when
>>>>> the final resource is hit? If the latter happens, we may have lost a
>>>>>lot
>>>>>
>>>> of
>>>>
>>>>> context, as we never got the chance to process the params, methods,
>>>>>etc.
>>>>> along the path, only the last ones.
>>>>>
>>>>> I imagine this question could belong in the CXF forum. After all, I
>>>>> guess
>>>>> it boils down to: when does CXF invoke the Custom Invoker? But maybe
>>>>> someone can help...
>>>>>
>>>>> Regards,
>>>>>
>>>>> *Raúl Kripalani*
>>>>> Apache Camel Committer
>>>>> Enterprise Architect, Program Manager, Open Source Integration
>>>>> specialist
>>>>> http://about.me/raulkripalani | http://www.linkedin.com/in/**
>>>>> raulkripalani <http://www.linkedin.com/in/raulkripalani>
>>>>> http://blog.raulkr.net | twitter:
>>>>>@raulvk<http://twitter.com/**raulvk<http://twitter.com/raulvk>
>>>>> >
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>

Mime
View raw message