You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Vaïsse-Lesteven Arthur <ar...@yahoo.fr> on 2015/01/21 11:20:41 UTC

[REST DSL]Camel 2.14.1 - Http parameters handling

Hi everyone.
Another question relative to the Camel Rest DSL.
I want to define a GET method that take parameters in order to return some
resources depending of parameters values.
My first attempt was to send parameters as a POJO Json Object in body. It
appears that this is not compliant with the HTTP specification that impose
that if a GET HTTP request contains a body, it must not have any semantic.
I.e. whatever body I put in the GET request it must not impact the content
of the response. If this is the correct behavior, maybe the rest DSL should
prevent users from specifying an input Type for GET request, but this is not
the point.
Other way to specify a parameter is so by using URL parameters. For example,
calling http://my/rest/api?param=foo results in having a camel header called
param whose the value is foo. That is great, but it would be better if the
rest DSL allow to impose some constraints on the URL parameters. Saying for
example that only certain parameter if any are allowed, and constraining
their values and type. With CXF RS it is possible to declare input
interceptor that define such constraints, so I was wondering if it is
possible to use such input interceptor at rest dsl level or any equivalent
process ? Something that look like :
&lt;get uri"http://my/rest/api"
interceptor="integer-positive-interceptor"&gt;
    ...
&lt;/get&gt;

&lt;interceptor id="integer-positive-interceptor"&gt;
    &lt;param name="param" class="java.lang.Integer"&gt;
        &lt;simple&gt;${param} >= 0 &lt;/simple&gt;
    &lt;/param&gt;
&lt;/interceptor&gt;
The detail of syntax do not matter, just the idea of the capacity to impose
parameters and impose constraint on their value matter.Should I look for
something I missed ? Should I create a Jira or should I also mention this in
this Jira ticket https://issues.apache.org/jira/browse/CAMEL-7936 ? It was
originally more related to the swager component
(http://camel.465427.n5.nabble.com/Query-paramteres-in-the-REST-DSL-Camel-2-14-td5757650.html)
Regards,
Arthur.




--
View this message in context: http://camel.465427.n5.nabble.com/REST-DSL-Camel-2-14-1-Http-parameters-handling-tp5761983.html
Sent from the Camel - Users mailing list archive at Nabble.com.