Re: <restconfiguration> swagger.json generation without host set to 0.0.0.0
We can possible look at allowing to plugin a custom host name
resolver, so you can use your own implementation, or we can provide a
"none" that dont set one, and then possible swagger wont output it.
For getting port number from servlet then AFAIR its not easy. Not sure
if you can get some details from ENV or JMX to find out which servlet
engine is running and get details to get port number. Or use some kind
of initial http request that calls the servlet and then you can maybe
get the port via some servlet request information. Its been a while
since I was working with the servlet api, so cant remember on top of
But for making camel-swagger not output hostname then we can maybe add
a "none" implementation. You are welcome to log a JIRA and attempt to
implement this and provide a PR. We love contributions
On Tue, Jul 17, 2018 at 9:08 PM, Martin Lichtin
> Thanks Rafael and Daniel
> Both of your <restConfiguration> examples don't quite solve the 0.0.0.0
> issue, setting an empty "host" unfortunately does not help.
> However, I learned about "hostNameResolver", so at least I can provide an
> actual IP address.
> <restConfiguration component="servlet" bindingMode="json"
> contextPath="/rest" apiContextPath="doc" enableCORS="true"
> Still the problem is with the port number. Ideally the RestConfiguration
> would get the port from the servlet, but not sure how that could work.
> - Martin
> On 12.07.2018 22:10, Rafael Soares wrote:
>> Try the following conf:
>> * <restConfiguration apiContextPath="api-docs" component="servlet"
>> enableCORS="true" host=""> <camel:apiProperty
>> key="api.title" value="myAPI"/> <camel:apiProperty
>> key="api.version" value="1.0.0"/> <camel:apiProperty key="cors"
>> value="true"/> <camel:apiProperty key="host" value=""/>
>> Rafael Torres Coelho Soares
>> On Thu, Jul 12, 2018 at 4:55 PM Martin Lichtin <firstname.lastname@example.org>
>>> Anyone know how I can configure <restconfiguration> so the generated
>>> swagger.json does not set host: "0.0.0.0"?
>>> With this 0.0.0.0 I cannot, for example, import the Swagger directly into
>>> Postman and make calls to the API.
>>> https://swagger.io/docs/specification/2-0/api-host-and-base-path/ says
>>> the "host" can be omitted for a more dynamic association.
Camel in Action 2: https://www.manning.com/ibsen2