第 357 章 Undertow 组件

作为 Camel 版本 2.16 可用

undertow 组件提供 HTTP 和 WebSocket 型端点,以用于消耗和生成 HTTP/WebSocket 请求。

也就是说,Undertow 组件的行为是简单的 Web 服务器。Undertow 也可以用作 http 客户端,这意味着您还可将其用于 Camel 作为制作者。

提示

自 Camel 版本 2.21 起,undertow 组件还支持 WebSocket 连接,因此可以替代 Camel websocket 组件或开mosphere-websocket 组件。

Maven 用户需要将以下依赖项添加到其 pom.xml 中:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-undertow</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

357.1. URI 格式

undertow:http://hostname[:port][/resourceUri][?options]
undertow:https://hostname[:port][/resourceUri][?options]
undertow:ws://hostname[:port][/resourceUri][?options]
undertow:wss://hostname[:port][/resourceUri][?options]

您可以使用以下格式在 URI 中附加查询选项 ?option=value&option=value&…​