You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by cdryst <cd...@gmail.com> on 2014/07/24 02:01:00 UTC
Set providers property on uri for cxfrs endpoint
Hello I'm trying to set the providers property for the endpoint of my rest
service:
<route id="restEndpoint">
<from
uri="cxfrs:///restEp?resourceClasses=com.services.RestServiceInt&bindingStyle=SimpleConsumer&providers=#corsProvider"/>
.
.
.
</route>
I've defined a bean to enable Cors on the service:
<bean id="#corsProvider"
class="org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter" />
When I run the application it gives me the error:
Caused By: java.lang.IllegalArgumentException: Could not find a suitable
setter for property: providers as there isn't a setter method with same
type: java.lang.String nor type conversion possible: No type converter
available to convert from type: java.lang.String to the required type:
java.util.List with value #corsProvider
at
org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:560)
at
org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:570)
at
org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:454)
at
org.apache.camel.util.EndpointHelper.setProperties(EndpointHelper.java:249)
at
org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:272)
Truncated. see log file for complete stacktrace
>
I already notice that I must put a List instead a Cors bean but it always
read it as a String so it has the same effect,
How do I inject it then? will it fix my Cors problem anyway?
Thanks
--
View this message in context: http://camel.465427.n5.nabble.com/Set-providers-property-on-uri-for-cxfrs-endpoint-tp5754319.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Set providers property on uri for cxfrs endpoint
Posted by Willem Jiang <wi...@gmail.com>.
Provides can only takes a list as the parameter, if you just have one provider you can use provider option instead of providers option.
I also find something wrong in your spring configuration file. Please don’t set the bean id with the string which starts with “#”. Camel treats the string which starts with “#” as a object instance reference, it uses the rest part of the string to look up the instance from camel registry.
--
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On July 24, 2014 at 8:01:27 AM, cdryst (cdryst@gmail.com) wrote:
> Hello I'm trying to set the providers property for the endpoint of my rest
> service:
>
>
> > uri="cxfrs:///restEp?resourceClasses=com.services.RestServiceInt&bindingStyle=SimpleConsumer&providers=#corsProvider"/>
> .
> .
> .
>
>
> I've defined a bean to enable Cors on the service:
>
> > class="org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter"
> />
>
> When I run the application it gives me the error:
>
> Caused By: java.lang.IllegalArgumentException: Could not find a suitable
> setter for property: providers as there isn't a setter method with same
> type: java.lang.String nor type conversion possible: No type converter
> available to convert from type: java.lang.String to the required type:
> java.util.List with value #corsProvider
> at
> org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:560)
> at
> org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:570)
> at
> org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:454)
> at
> org.apache.camel.util.EndpointHelper.setProperties(EndpointHelper.java:249)
> at
> org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:272)
> Truncated. see log file for complete stacktrace
> >
>
> I already notice that I must put a List instead a Cors bean but it always
> read it as a String so it has the same effect,
>
> How do I inject it then? will it fix my Cors problem anyway?
>
> Thanks
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Set-providers-property-on-uri-for-cxfrs-endpoint-tp5754319.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: Set providers property on uri for cxfrs endpoint
Posted by cdryst <cd...@gmail.com>.
Hi Claus, I was using 2.12.2 and upgraded to 2.13.2
--
View this message in context: http://camel.465427.n5.nabble.com/Set-providers-property-on-uri-for-cxfrs-endpoint-tp5754319p5754403.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Set providers property on uri for cxfrs endpoint
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
What version of Camel do you use?
On Thu, Jul 24, 2014 at 2:01 AM, cdryst <cd...@gmail.com> wrote:
> Hello I'm trying to set the providers property for the endpoint of my rest
> service:
>
> <route id="restEndpoint">
> <from
> uri="cxfrs:///restEp?resourceClasses=com.services.RestServiceInt&bindingStyle=SimpleConsumer&providers=#corsProvider"/>
> .
> .
> .
> </route>
>
> I've defined a bean to enable Cors on the service:
>
> <bean id="#corsProvider"
> class="org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter" />
>
> When I run the application it gives me the error:
>
> Caused By: java.lang.IllegalArgumentException: Could not find a suitable
> setter for property: providers as there isn't a setter method with same
> type: java.lang.String nor type conversion possible: No type converter
> available to convert from type: java.lang.String to the required type:
> java.util.List with value #corsProvider
> at
> org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:560)
> at
> org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:570)
> at
> org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:454)
> at
> org.apache.camel.util.EndpointHelper.setProperties(EndpointHelper.java:249)
> at
> org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:272)
> Truncated. see log file for complete stacktrace
>>
>
> I already notice that I must put a List instead a Cors bean but it always
> read it as a String so it has the same effect,
>
> How do I inject it then? will it fix my Cors problem anyway?
>
> Thanks
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Set-providers-property-on-uri-for-cxfrs-endpoint-tp5754319.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/