camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brad Johnson <brad.john...@mediadriver.com>
Subject Re: Return contents of a file in a route
Date Thu, 18 Aug 2016 18:51:05 GMT
Are you getting any errors?  How are you testing it?

The reason I ask is are you sure that it is finding the file at that
location?  Are you doing this as a test stub to deploy for others to use or
is this something you want to test during unit tests only?  You can use
mocks or other mechanism for that. If you put some .log("${body}") before
and after that .from what do you see?

Brad

On Thu, Aug 18, 2016 at 1:33 PM, Mark <elihusmails@gmail.com> wrote:

> I want to be able to simulate a system that I'm integrating with.  I'd like
> a route to return the contents of a file in a REST DSL route.  Is it
> possible to do this in Camel?  This is what I'd like to do:
>
> restConfiguration()
>    .component("jetty")
>    .host("localhost")
>    .port(1234)
>    .bindingMode(RestBindingMode.off);
>
>   rest().path("/mystuff")
>        .get("/testing").bindingMode(RestBindingMode.json)
>   .route()
> .setHeader(Exchange.CONTENT_TYPE).constant("application/json")
>
>          <!-- set body to contents of file -->
>           ???  .from("file:myfile.json");   ???
>
> I tried adding the "from("file:myfile.json")" to my route, but the results
> do not come back.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message