搜索

第 282 章 restlet 组件

download PDF

从 Camel 版本 2.0 开始提供

Restlet 组件为消耗和生成 RESTful 资源提供基于 Restlet 的端点。

Maven 用户需要将以下依赖项添加到这个组件的 pom.xml 中:

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

另外,您需要在 pom.xml 文件中添加对 restlet maven 存储库的依赖关系:

<repository>
   <id>maven-restlet</id>
   <name>Public online Restlet repository</name>
   <url>https://maven.restlet.com</url>
</repository>

282.1. URI 格式

restlet:restletUrl[?options]

restletUrl 格式:

protocol://hostname[:port][/resourcePattern]

restlet 促进了协议和应用程序顾虑的分离。Restlet Engine 的参考实现支持很多协议。但是,我们只测试了 HTTP 协议。默认端口为端口 80。我们还没有根据协议自动切换默认端口。

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

INFO :在了解标头时,看似 Restlet 区分大小写。例如,要使用 content-type,使用 Content-Type,对于 location 使用 Location 等。

警告

在 Camel 2.14.0 和 2.14.1 中,我们收到有关在 camel-restlet 中丢弃性能的报告。我们在 问题 996 中报告给 Restlet 团队。为了解决这个问题,从 Camel 2.14.2 开始,您可以在 endpoint uris 上将 synchronous=true 设置为选项,或者在 RestletComponent 上将其设置为全局选项,以便所有端点都继承此选项。

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.