camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dermoritz <tantea...@hotmail.com>
Subject rest dsl not working with restlet: "Component restlet is not a RestApiConsumerFactory"
Date Tue, 10 Nov 2015 17:55:09 GMT
I am trying to use Restlet component with rest dsl but i get "Component
restlet is not a RestApiConsumerFactory"

This route is working fine (camel 2.16):

    public void configure() throws Exception {
       
restConfiguration().component("restlet").apiContextPath("/").port(port);

        from(restEndpoint).process(sendFile);
    }

The rest endpoint is created this way:

RestEndpoint endpoint =
context.getEndpoint("rest:get:next/{"+HEADER_PARAMETER+"}",                              
                                                   
org.apache.camel.component.rest.RestEndpoint.class);

The problem with this is that the parameter is not optional. if i surf to
.../next i get 404. So i tried rest dsl:

    public void configure() throws Exception {
       
restConfiguration().component("restlet").apiContextPath("/").port(port);
        rest("/next")
                     .get().to(DIRECT_NEXT)
                    
.get("/{RestEndpointProvider.HEADER_PARAMETER}").to(DIRECT_NEXT);
        from(DIRECT_NEXT).process(sendFile);
    }

but with this i get 
"java.lang.IllegalArgumentException: Component restlet is not a
RestApiConsumerFactory
	at
org.apache.camel.component.rest.RestApiEndpoint.createConsumer(RestApiEndpoint.java:220)
	at
org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:68)
	at
org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:98)
	at org.apache.camel.impl.RouteService.warmUp(RouteService.java:158)
	at
org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:3440)
	at
org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3370)
	at
org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3147)
	at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3003)
	at
org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:172)
	at
org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2799)
	at
org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2795)
	at
org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2818)
	at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2795)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2764)
	at org.apache.camel.main.Main.doStart(Main.java:126)".

Is something wrong with my code or should i have to switch to another
component? (please suggest a component if necessary or explain differences
between them)




--
View this message in context: http://camel.465427.n5.nabble.com/rest-dsl-not-working-with-restlet-Component-restlet-is-not-a-RestApiConsumerFactory-tp5773579.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message