Is it possible to serve the Swagger UI with a Camel route inside of Karaf, using the REST DSL?

时间:2019-04-08 13:27:00

标签: xml rest apache-camel swagger-ui apache-karaf

I'm setting up a REST API as a Camel route with it's REST DSL inside of Karaf. I want to document the REST API via Swagger and I want to visualize it via Swagger UI. Seeing as Swagger itself is already working, I want to know how I can enable Swagger UI without using a dedicated camel application or a java bean.

The dist folder of Swagger-UI is located in the root directory of my Karaf distribution. I tried to serve the index.html via camel. From the error messages I can see that I need a way to serve the resources that index.html needs somehow.

This is what I came up with so far:

<route>
  <from uri="direct:swagger"/>
  <setBody>
    <simple>resource:file:C:/Users/yeet/Downloads/apache-karaf-4.2.4/swagger-ui/index.html</simple>
  </setBody>
  <log message="${body}"/>
</route>

The route consumes from the REST DSL and is supposed to serve the Swagger UI.

I expected the route to just serve me the Swagger UI.

The actual result is a blank page with error messages saying that it can't find any of the resource files specified in the index.html.

0 个答案:

没有答案