tree: 805f0b4916f63a49d4f42464db951c1e809e4a06 [path history] [tgz]
  1. NettySecureServer.java
  2. NettyServer.java
  3. PlatformHttpServer.java
  4. PlatformHttpsServer.java
  5. README.md
generic-examples/http/README.md

Examples showing how to interact with HTTP/HTTPS protocol

Find useful examples about how to develop a Camel K integration leveraging Http/Https protocol.

You can find more information about Apache Camel and Apache Camel K on the official Camel website.

Before you begin

Read the general instructions in the root README.md file for setting up your environment and the Kubernetes cluster before looking at this example.

Make sure you've read the installation instructions for your specific cluster before starting the example.

Understanding the Examples

  • Using HTTP with SSL/TLS layer

    • NettySecureServer.java: Uses HTTPS protocol. The route uses Netty HTTP as a HTTP server.
    • PlatformHttpsServer.java: Uses HTTPS protocol. The route uses the platform-http component which allows the use of the runtime's existing HTTP server.
  • Using HTTP

Running the Examples

Run the Integration in NettySecureServer.java:

This integration requires a Keystore and a Truststore. Open NettySecureServer.java to find instructions on how to generate a required keystore.jks and truststore.jks file. For this example, keystore and trustore password is changeit

Run the integration:

kamel run NettySecureServer.java -t mount.resources=secret:http-keystore/keystore.jks@/etc/ssl/keystore.jks \
        -t mount.resources=secret:http-truststore/truststore.jks@/etc/ssl/truststore.jks \
        -t container.port=8443 -t service.type=NodePort --dev

Get the service location. If you're running on minikube, run minikube service netty-secure-server --url=true --https=true
Visit https://<service-location>/hello. You should see “Hello Secure World” displayed on the web page.
Alternatively, you could run: curl -k https://<service-location>/hello.

Run the other Integrations: