netty5/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt
Ameya Lokare 11255c6602 Add constants for fixed-header only MQTT messages (#9749)
Motivation:

Currently, the only way to create fixed-header only messages PINGREQ,
PINGRESP and DISCONNECT is to explicitly instantiate a `MqttFixedHeader` like:
```
MqttFixedHeader disconnectFixedHeader = new MqttFixedHeader(MqttMessageType.DISCONNECT,
    false, MqttQoS.AT_MOST_ONCE, false, 0);
MqttMessage disconnectMessage = new MqttMessage(disconnectFixedHeader);
```

According to the MQTT spec
(http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718077),
the fixed-header flags for these messages are reserved and  must be set to zero, otherwise
the receiver must close the connection. It's easy to mess this up when
you're creating the header explicitly, for e.g by setting the QoS bit to
`AT_LEAST_ONCE`.

As such, provide static constants for PINGREQ, PINGRESP and
DISCONNECT messages that will set the flags correctly for the developer.

Modification:

Add static constants to MqttMessage class to construct PINGREQ, PINGRESP and
DISCONNECT messages that will set the fixed-header flags correctly to 0.

Result:

Easier usage.
2019-11-08 10:17:16 +01:00
..
MqttCodecUtil.java Cleanup of codec-mqtt 2016-03-24 11:02:24 +01:00
MqttConnAckMessage.java Overall clean-up on codec-mqtt 2014-06-21 16:52:28 +09:00
MqttConnAckVariableHeader.java Cleanup of codec-mqtt 2016-03-24 11:02:24 +01:00
MqttConnectMessage.java Add MQTT protocol codec 2014-06-21 16:52:10 +09:00
MqttConnectPayload.java MqttConnectPayload.toString() should use Arrays.toString() instead of [].toString() (#9292) 2019-06-27 21:55:28 +02:00
MqttConnectReturnCode.java Java 8 migration: Use diamond operator (#8749) 2019-01-22 16:07:26 +01:00
MqttConnectVariableHeader.java Cleanup of codec-mqtt 2016-03-24 11:02:24 +01:00
MqttDecoder.java Java 8 migration: Use diamond operator (#8749) 2019-01-22 16:07:26 +01:00
MqttEncoder.java MQTT encode doesn't complain if password is set but username not 2017-09-14 09:37:37 -07:00
MqttFixedHeader.java migrate java8: use requireNonNull (#8840) 2019-02-04 10:32:25 +01:00
MqttIdentifierRejectedException.java Cleanup of codec-mqtt 2016-03-24 11:02:24 +01:00
MqttMessage.java Add constants for fixed-header only MQTT messages (#9749) 2019-11-08 10:17:16 +01:00
MqttMessageBuilders.java Java 8 migration: Use diamond operator (#8749) 2019-01-22 16:07:26 +01:00
MqttMessageFactory.java Add headers to MqttMessage returned by MqttDecoder in case of DecoderException (#8219) 2018-08-31 15:06:09 +02:00
MqttMessageIdVariableHeader.java Small performance improvements 2014-11-20 00:10:06 -05:00
MqttMessageType.java Overall clean-up on codec-mqtt 2014-06-21 16:52:28 +09:00
MqttPubAckMessage.java Cleanup of codec-mqtt 2016-03-24 11:02:24 +01:00
MqttPublishMessage.java Make retained derived buffers recyclable 2016-05-17 11:16:13 +02:00
MqttPublishVariableHeader.java Issue №6802. Not specified field in MQTT codec (#6807) 2017-06-05 13:21:49 -07:00
MqttQoS.java Add supporting MQTT 3.1.1 2014-11-15 09:07:12 +01:00
MqttSubAckMessage.java Cleanup of codec-mqtt 2016-03-24 11:02:24 +01:00
MqttSubAckPayload.java migrate java8: use requireNonNull (#8840) 2019-02-04 10:32:25 +01:00
MqttSubscribeMessage.java Cleanup of codec-mqtt 2016-03-24 11:02:24 +01:00
MqttSubscribePayload.java Fixed toString() exception in MqttSubscribePayload and MqttUnsubscribePayload (#9202) 2019-05-31 06:48:21 +02:00
MqttTopicSubscription.java Cleanup of codec-mqtt 2016-03-24 11:02:24 +01:00
MqttUnacceptableProtocolVersionException.java Cleanup of codec-mqtt 2016-03-24 11:02:24 +01:00
MqttUnsubAckMessage.java Cleanup of codec-mqtt 2016-03-24 11:02:24 +01:00
MqttUnsubscribeMessage.java Cleanup of codec-mqtt 2016-03-24 11:02:24 +01:00
MqttUnsubscribePayload.java Fixed toString() exception in MqttSubscribePayload and MqttUnsubscribePayload (#9202) 2019-05-31 06:48:21 +02:00
MqttVersion.java migrate java8: use requireNonNull (#8840) 2019-02-04 10:32:25 +01:00
package-info.java Add MQTT protocol codec 2014-06-21 16:52:10 +09:00