You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Stuart Churchill <sc...@calsoftware.co.uk> on 2011/06/30 11:15:42 UTC
RestletBinding exception on startup
Morning folks,
Under Camel 2.7.2, I'm attempting to specify a custom RestletBinding on a route, but I don't seem to be having much luck. According to the docs[1], I should put an option on the URI of "restletBinding=" with a reference to a bean that is an instance of RestletBinding. When I do this, however, I get an IllegalArgumentException on startup when the RestletComponent tries to create the endpoint and set properties, as there's apparently no setter method. Using the old-style option of "restletBindingRef=" doesn't give the error, but doesn't invoke the binder either. Hopefully I'm just mis-understanding the docs, but if anyone can shed some light or suggest something else to try my config is as follows (it works perfectly without the option on the uri);
<bean id="QueryParamsBinding" class="mystuff.rs.QueryParamsRestletBinding"/>
<route id="RS_BOB">
<from uri="restlet:http://localhost:9080/mystuff/bob/{id}?restletBinding=QueryParamsBinding"/>
<to uri="log:rs_bob?level=INFO&showHeaders=true" />
<transform>
<simple>Request type : ${header.CamelHttpMethod} and ID : ${header.id}</simple>
</transform>
</route>
The exception thrown is;
Caused by: java.lang.IllegalArgumentException: Could not find a suitable setter for property: restletBinding 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: org.apache.camel.component.restlet.RestletBinding with value QueryParamsBinding
at org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:341)
at org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:291)
at org.apache.camel.util.EndpointHelper.setProperties(EndpointHelper.java:225)
at org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:200)
at org.apache.camel.component.restlet.RestletComponent.createEndpoint(RestletComponent.java:58)
at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:75)
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:432)
... 38 more
Cheers,
Stu
[1] http://camel.apache.org/restlet.html
**********************************************************************
CONFIDENTIALITY:
Cultura Technologies Ltd is a company registered in England and Wales at Rivington House, Drumhead Rd, Chorley, Lancs, PR6 7BX with the company number (1250877). The company VAT number is 732526544. This e-mail and any attachments are intended for the named recipient(s) only and may be confidential or legally privileged.
If you are not a named recipient, you should not access,
disclose, copy, forward or distribute this e-mail. Please delete
if obtained in error and e-mail confirmation to:
postmaster@calsoftware.co.uk
SECURITY:
Please note that this e-mail has been created in the
knowledge that Internet e-mail is not a 100% secure
communications medium. We advise that you understand
and observe this lack of security when e-mailing us.
VIRUSES:
Although Cultura Technologies Ltd has taken steps to ensure
that this e-mail and any attachments are free from any virus,
it advises that in keeping with good computing practice the
recipient should ensure they are actually virus free.
**********************************************************************
RE: RestletBinding exception on startup
Posted by Stuart Churchill <sc...@calsoftware.co.uk>.
> Try with restletBinding=#QueryParamsBinding to indicate a reference
> lookup.
>
> As its documented in the options table
> http://camel.apache.org/restlet
Doh! I spent far too long staring at that page and never saw the hash on the reference. Now working perfectly, thanks Claus.
Cheers,
Stu
**********************************************************************
CONFIDENTIALITY:
Cultura Technologies Ltd is a company registered in England and Wales at Rivington House, Drumhead Rd, Chorley, Lancs, PR6 7BX with the company number (1250877). The company VAT number is 732526544. This e-mail and any attachments are intended for the named recipient(s) only and may be confidential or legally privileged.
If you are not a named recipient, you should not access,
disclose, copy, forward or distribute this e-mail. Please delete
if obtained in error and e-mail confirmation to:
postmaster@calsoftware.co.uk
SECURITY:
Please note that this e-mail has been created in the
knowledge that Internet e-mail is not a 100% secure
communications medium. We advise that you understand
and observe this lack of security when e-mailing us.
VIRUSES:
Although Cultura Technologies Ltd has taken steps to ensure
that this e-mail and any attachments are free from any virus,
it advises that in keeping with good computing practice the
recipient should ensure they are actually virus free.
**********************************************************************
Re: RestletBinding exception on startup
Posted by Claus Ibsen <cl...@gmail.com>.
Try with restletBinding=#QueryParamsBinding to indicate a reference lookup.
As its documented in the options table
http://camel.apache.org/restlet
On Thu, Jun 30, 2011 at 11:15 AM, Stuart Churchill
<sc...@calsoftware.co.uk> wrote:
> Morning folks,
>
> Under Camel 2.7.2, I'm attempting to specify a custom RestletBinding on a route, but I don't seem to be having much luck. According to the docs[1], I should put an option on the URI of "restletBinding=" with a reference to a bean that is an instance of RestletBinding. When I do this, however, I get an IllegalArgumentException on startup when the RestletComponent tries to create the endpoint and set properties, as there's apparently no setter method. Using the old-style option of "restletBindingRef=" doesn't give the error, but doesn't invoke the binder either. Hopefully I'm just mis-understanding the docs, but if anyone can shed some light or suggest something else to try my config is as follows (it works perfectly without the option on the uri);
>
>
> <bean id="QueryParamsBinding" class="mystuff.rs.QueryParamsRestletBinding"/>
>
> <route id="RS_BOB">
> <from uri="restlet:http://localhost:9080/mystuff/bob/{id}?restletBinding=QueryParamsBinding"/>
> <to uri="log:rs_bob?level=INFO&showHeaders=true" />
> <transform>
> <simple>Request type : ${header.CamelHttpMethod} and ID : ${header.id}</simple>
> </transform>
> </route>
>
>
> The exception thrown is;
>
> Caused by: java.lang.IllegalArgumentException: Could not find a suitable setter for property: restletBinding 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: org.apache.camel.component.restlet.RestletBinding with value QueryParamsBinding
> at org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:341)
> at org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:291)
> at org.apache.camel.util.EndpointHelper.setProperties(EndpointHelper.java:225)
> at org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:200)
> at org.apache.camel.component.restlet.RestletComponent.createEndpoint(RestletComponent.java:58)
> at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:75)
> at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:432)
> ... 38 more
>
>
> Cheers,
>
> Stu
>
>
> [1] http://camel.apache.org/restlet.html
>
>
> **********************************************************************
> CONFIDENTIALITY:
> Cultura Technologies Ltd is a company registered in England and Wales at Rivington House, Drumhead Rd, Chorley, Lancs, PR6 7BX with the company number (1250877). The company VAT number is 732526544. This e-mail and any attachments are intended for the named recipient(s) only and may be confidential or legally privileged.
> If you are not a named recipient, you should not access,
> disclose, copy, forward or distribute this e-mail. Please delete
> if obtained in error and e-mail confirmation to:
> postmaster@calsoftware.co.uk
>
> SECURITY:
> Please note that this e-mail has been created in the
> knowledge that Internet e-mail is not a 100% secure
> communications medium. We advise that you understand
> and observe this lack of security when e-mailing us.
>
> VIRUSES:
> Although Cultura Technologies Ltd has taken steps to ensure
> that this e-mail and any attachments are free from any virus,
> it advises that in keeping with good computing practice the
> recipient should ensure they are actually virus free.
> **********************************************************************
>
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/