NIFI-5991 Added WebSockets schemes to the broker URI Validator

MQTT over websockets uses ws (and wss for secure websocket connections) schemes in the broker URI.
Added support for the same.

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #3289.
This commit is contained in:
Sujesh Menon 2019-02-04 05:47:32 +05:30 committed by Pierre Villard
parent ad1f2fb666
commit 2c2b47ab85
No known key found for this signature in database
GPG Key ID: BEE1599F0726E9CD
1 changed files with 3 additions and 3 deletions

View File

@ -87,8 +87,8 @@ public abstract class AbstractMQTTProcessor extends AbstractSessionFactoryProces
if (!"".equals(brokerURI.getPath())) {
return new ValidationResult.Builder().subject(subject).valid(false).explanation("the broker URI cannot have a path. It currently is:" + brokerURI.getPath()).build();
}
if (!("tcp".equals(brokerURI.getScheme()) || "ssl".equals(brokerURI.getScheme()))) {
return new ValidationResult.Builder().subject(subject).valid(false).explanation("only the 'tcp' and 'ssl' schemes are supported.").build();
if (!("tcp".equals(brokerURI.getScheme()) || "ssl".equals(brokerURI.getScheme()) || "ws".equals(brokerURI.getScheme()) || "wss".equals(brokerURI.getScheme()))) {
return new ValidationResult.Builder().subject(subject).valid(false).explanation("only the 'tcp', 'ssl', 'ws' and 'wss' schemes are supported.").build();
}
} catch (URISyntaxException e) {
return new ValidationResult.Builder().subject(subject).valid(false).explanation("it is not valid URI syntax.").build();
@ -113,7 +113,7 @@ public abstract class AbstractMQTTProcessor extends AbstractSessionFactoryProces
public static final PropertyDescriptor PROP_BROKER_URI = new PropertyDescriptor.Builder()
.name("Broker URI")
.description("The URI to use to connect to the MQTT broker (e.g. tcp://localhost:1883). The 'tcp' and 'ssl' schemes are supported. In order to use 'ssl', the SSL Context " +
.description("The URI to use to connect to the MQTT broker (e.g. tcp://localhost:1883). The 'tcp', 'ssl', 'ws' and 'wss' schemes are supported. In order to use 'ssl', the SSL Context " +
"Service property must be set.")
.required(true)
.addValidator(BROKER_VALIDATOR)