Skip to content
Advertisement

Create http and https endpoint using camel in the same server with jetty

I am trying to create HTTP and HTTPS endpoint in one of my web service. I want secure few endpoints with HTTPS and other endpoints with plain HTTP.

I am using the below code to do the same.

JavaScript

The https works fine with this setup but the http endpoint does not work. If I remove the method call to configure Jetty the HTTP endpoint works. How I can configure both in the same server? I can not use spring boot but only plain camel components.

I have created a github repository with the sample code. You can find it here. sample code

Advertisement

Answer

You can

  • create two distinct instances of jetty component, one for plain http, the other for https.
  • register each of them with a specific alias (“jetty” and “jettys”)
  • use appropriate alias in your endpoint uris “from(“jettys:…”)

CDI Example:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement