Jetty

Jetty component

The Jetty component enables consuming or producing HTTP requests. Learn how to use the Jetty component. 

Library

Create a new library with the following jars (in this order):

See How to retrieve the Camel version of Decision Insight.

Connectors

SslContextParameters

To configure TLS, create a connector following the instructions at How to configure SSL on a component.

Routes

With TLS

Now it's possible to create a route that uses this component. Here the definition of the route:

<routes xmlns="http://camel.apache.org/schema/spring" xmlns:u="http://www.systar.com/aluminium/camel-util">
    <route>
        <from uri="jetty:https://localhost:8888/test?sslContextParameters=#sslContextParameters"/>
        <setBody>
            <simple>Hello ${headers[id]} !</simple>
        </setBody>
        <to uri="log:jetty-test?showHeaders=true"/>
    </route>
</routes>

Then open a navigator and type the following URL: https://localhost:8888/test?id=World

Without TLS

TLS configuration

Although it is not mandatory, we advise you to always configure TLS connection and forbid non encrypted communication. If not configured, data are not encrypted.


<routes xmlns="http://camel.apache.org/schema/spring" xmlns:u="http://www.systar.com/aluminium/camel-util">
    <route>
        <from uri="jetty:http://localhost:8888/test"/>
        <setBody>
            <simple>Hello ${headers[id]} !</simple>
        </setBody>
        <to uri="log:jetty-test?showHeaders=true"/>
    </route>
</routes>

Open a navigator and type the following URL: http://localhost:8888/test?id=World.

Related Links