vertx访问html,Vert.x HTTP Client

connectTimeout (producer) The amount of time in milliseconds until a connection is established. A timeout value of zero is interpreted as an infinite timeout. 60000 int

cookieStore (producer) A custom CookieStore to use when session management is enabled. If this option is not set then an in-memory CookieStore is used InMemoryCookieStore CookieStore

headerFilterStrategy (producer) A custom org.apache.camel.spi.HeaderFilterStrategy to filter header to and from Camel message. VertxHttpHeaderFilterStrategy HeaderFilterStrategy

httpMethod (producer) The HTTP method to use. The HttpMethod header cannot override this option if set HttpMethod

lazyStartProducer (producer) Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. false boolean

okStatusCodeRange (producer) The status codes which are considered a success response. The values are inclusive. Multiple ranges can be defined, separated by comma, e.g. 200-204,209,301-304. Each range must be a single number or from-to with the dash included 200-299 String

responsePayloadAsByteArray (producer) Whether the response body should be byte or as io.vertx.core.buffer.Buffer true boolean

sessionManagement (producer) Enables session management via WebClientSession. By default the client is configured to use an in-memory CookieStore. The cookieStore option can be used to override this false boolean

throwExceptionOnFailure (producer) Disable throwing HttpOperationFailedException in case of failed responses from the remote server true boolean

timeout (producer) The amount of time in milliseconds after which if the request does not return any data within the timeout period a TimeoutException fails the request. Setting zero or a negative value disables the timeout. -1 long

transferException (producer) If enabled and an Exchange failed processing on the consumer side, and if the caused Exception was sent back serialized in the response as a application/x-java-serialized-object content type. On the producer side the exception will be deserialized and thrown as is, instead of HttpOperationFailedException. The caused exception is required to be serialized. This is by default turned off. If you enable this then be aware that Camel will deserialize the incoming data from the request to a Java object, which can be a potential security risk. false boolean

useCompression (producer) Set whether compression is enabled to handled compressed (E.g gzipped) responses false boolean

vertxHttpBinding (producer) A custom VertxHttpBinding which can control how to bind between Vert.x and Camel. VertxHttpBinding

webClientOptions (producer) Sets customized options for configuring the Vert.x WebClient WebClientOptions

proxyHost (proxy) The proxy server host address String

proxyPassword (proxy) The proxy server password if authentication is required String

proxyPort (proxy) The proxy server port Integer

proxyType (proxy) The proxy server type. There are 3 enums and the value can be one of: HTTP, SOCKS4, SOCKS5 ProxyType

proxyUsername (proxy) The proxy server username if authentication is required String

basicAuthPassword (security) The password to use for basic authentication String

basicAuthUsername (security) The user name to use for basic authentication String

bearerToken (security) The bearer token to use for bearer token authentication String

sslContextParameters (security) To configure security using SSLContextParameters SSLContextParameters

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Vert.x 是一个基于事件驱动、非阻塞的应用框架,它提供了一种简单且高性能的方式来构建分布式、并发的应用程序。Vert.x 还提供了一系列的扩展,以支持多种协议和通信方式。 Vert.x 提供了一个名为 Vert.x MQTT 的模块,用于构建 MQTT 服务器。MQTT(Message Queuing Telemetry Transport)是一种轻量级的消息传输协议,常用于物联网设备之间的通信。 使用 Vert.x MQTT 服务器,你可以轻松地构建基于 MQTT 协议的应用。你可以使用 Vert.x 提供的异步、非阻塞的特性来处理大量的并发连接,并且可以利用 Vert.x 的事件总线机制来实现消息的发布和订阅。 要使用 Vert.x MQTT 服务器,你需要导入相应的依赖,并编写相应的代码来配置和启动服务器。以下是一个简单的示例代码: ```java import io.vertx.core.Vertx; import io.vertx.mqtt.MqttServer; public class MqttServerExample { public static void main(String[] args) { Vertx vertx = Vertx.vertx(); MqttServer mqttServer = MqttServer.create(vertx); mqttServer.endpointHandler(endpoint -> { System.out.println("Client connected: " + endpoint.clientIdentifier()); endpoint.accept(false); // 拒绝连接 endpoint.disconnectHandler(h -> { System.out.println("Client disconnected: " + endpoint.clientIdentifier()); }); endpoint.subscribeHandler(subscribe -> { System.out.println("Client subscribed: " + endpoint.clientIdentifier()); subscribe.complete(true); // 接受订阅请求 }); endpoint.unsubscribeHandler(unsubscribe -> { System.out.println("Client unsubscribed: " + endpoint.clientIdentifier()); unsubscribe.complete(true); // 接受取消订阅请求 }); endpoint.publishHandler(publish -> { System.out.println("Received message from client: " + publish.payload().toString()); }); }); mqttServer.listen(1883, "0.0.0.0", ar -> { if (ar.succeeded()) { System.out.println("MQTT server started"); } else { System.out.println("MQTT server failed to start"); } }); } } ``` 以上示例代码创建了一个简单的 MQTT 服务器,监听在本地的 1883 端口。当有客户端连接、订阅、取消订阅或发布消息时,会打印相应的日志。你可以根据自己的需求来扩展代码,实现更复杂的功能。 希望以上信息对你有帮助!如果你有任何问题,可以继续提问。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值