You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ra...@enjekt.org on 2019/01/09 18:30:39 UTC

Implications of Netty vs REST configuration?

I have a bundle with a shared Netty server configured for port 8888 and it
works fine from a unit test or curl call. However, if I add the Swagger API
and then hit it with a browser, it doesn't show the port and the call from
the plugin in fails. If I add the .host().port() shown below, it all works
fine. My concern is that I'm double configuring and the possibility of
things getting out of synch is high. I also don't know if adding that
host/port to the restConfifugration is overriding or ignoring the use of the
shared Netty server. Obviously it would better if that were picked up
automatically somehow. In any case, the JavaDoc and documentation for this
is pretty scant so I really can't tell what the ramifications are. If it's
double configuration that's a pain but can be dealt with but it if it's
overriding or ignoring the Netty server altogether that's a no-go.

 

              restConfiguration().component("netty4-http")

 
.endpointProperty("nettySharedHttpServer","#sharedNettyHttpServer")

                    .bindingMode(RestBindingMode.json)

                    .dataFormatProperty("prettyPrint", "true")

                    //.host("0.0.0.0").port(8888) //Hast to be added for
Swagger to work.

                    .apiContextPath("/api-doc") 

                           .apiProperty("api.title", "Memeber ID API")

                           .apiProperty("api.version", "1.1")

                           // and enable CORS

                           .apiProperty("cors", "true");

 


Re: Implications of Netty vs REST configuration?

Posted by Zoran Regvart <zo...@regvart.com>.
Hi,
AFAIK unless specified in the Swagger specification the
scheme/host/port combination of the URL from which the Swagger
specification is fetched is used. In your tool of you can point to the
URL of the Swagger specification, perhaps that would help.

One approach would be to share the port number configuration between
netty4-http and REST DSL configuration, a simple global static field
or a property file used via property placeholder should do.

If you're running behind a reverse proxy, in 2.22.1 we had a nice
contribution that would configure those properties from the HTTP
headers reverse proxies usually set[1].

zoran

[1] https://issues.apache.org/jira/browse/CAMEL-12855

On Wed, Jan 9, 2019 at 7:30 PM <ra...@enjekt.org> wrote:
>
> I have a bundle with a shared Netty server configured for port 8888 and it
> works fine from a unit test or curl call. However, if I add the Swagger API
> and then hit it with a browser, it doesn't show the port and the call from
> the plugin in fails. If I add the .host().port() shown below, it all works
> fine. My concern is that I'm double configuring and the possibility of
> things getting out of synch is high. I also don't know if adding that
> host/port to the restConfifugration is overriding or ignoring the use of the
> shared Netty server. Obviously it would better if that were picked up
> automatically somehow. In any case, the JavaDoc and documentation for this
> is pretty scant so I really can't tell what the ramifications are. If it's
> double configuration that's a pain but can be dealt with but it if it's
> overriding or ignoring the Netty server altogether that's a no-go.
>
>
>
>               restConfiguration().component("netty4-http")
>
>
> .endpointProperty("nettySharedHttpServer","#sharedNettyHttpServer")
>
>                     .bindingMode(RestBindingMode.json)
>
>                     .dataFormatProperty("prettyPrint", "true")
>
>                     //.host("0.0.0.0").port(8888) //Hast to be added for
> Swagger to work.
>
>                     .apiContextPath("/api-doc")
>
>                            .apiProperty("api.title", "Memeber ID API")
>
>                            .apiProperty("api.version", "1.1")
>
>                            // and enable CORS
>
>                            .apiProperty("cors", "true");
>
>
>


-- 
Zoran Regvart