You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2014/09/16 16:11:34 UTC

[jira] [Commented] (CAMEL-7827) Wen using CXFRS with simple HTTP api, variable replacement should be available

    [ https://issues.apache.org/jira/browse/CAMEL-7827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14135492#comment-14135492 ] 

ASF GitHub Bot commented on CAMEL-7827:
---------------------------------------

GitHub user larochef opened a pull request:

    https://github.com/apache/camel/pull/266

    [CAMEL-7827] Add possibility to specify parameters to URLs using http api.

    Added the replacement in CxfRsProducer + unit test to validate it

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/larochef/camel master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/camel/pull/266.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #266
    
----
commit ebf5c2e1767b759e20467db7a23b5d3ebe7f29b0
Author: larochef <fl...@gmail.com>
Date:   2014-09-16T12:50:03Z

    Add possibility to specify parameters to URLs using http api. For example : have a URI like /service/{id} and have an array to merge the parameters

----


> Wen using CXFRS with simple HTTP api, variable replacement should be available
> ------------------------------------------------------------------------------
>
>                 Key: CAMEL-7827
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7827
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-cxf
>            Reporter: François LAROCHE
>            Priority: Minor
>
> I am calling an endpoint using cxfrs client with the http api. So I have 
> something like that in the DSL : 
> .... 
> .setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API, constant(true)) 
> .setHeader(Exchange.HTTP_PATH, simple("/endpoint/${header.myHeader}")) 
> .setHeader(Exchange.HTTP_METHOD, constant(POST)) 
> .to("cxfrs:bean:myClient") 
> .... 
> This usually works fine. 
> I had a somewhat nasty error when someone did a copy paste of my server, 
> with the variable substitution style (something like /endpoint/{myVariable}) 
> at that point, ${header.myHeader} resolved to {myVariable}, thus the url the 
> client will try to resolve is  /endpoint/{myVariable}. When trying to parse 
> this URL, CXF will not be happy, since there is no value to replace what it 
> thinks to be a variable, and will throw an IllegalArgumentException with 
> message Unresolved variables; only 0 value(s) given for 1 unique 
> variable(s). 
> After looking a bit in the code, I understood better what happens. 
> In order to avoid that, it would be nice to use the mechanism of CXF to 
> replace variables in URI. 
> In the DSL, we would have something like : 
> .... 
> .setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API, constant(true)) 
> .setHeader(CxfConstants.CAMEL_CXF_RS_VAR_VALUES, 
> simple("[${header.myHeader}]")) 
> .setHeader(Exchange.HTTP_PATH, constant("/endpoint/{myVariable}")) 
> .setHeader(Exchange.HTTP_METHOD, constant("POST")) 
> .to("cxfrs:bean:myClient") 
> .... 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)