Migrate stream-related RestconfStreamsConstants 93/90993/2
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 8 Jul 2020 13:06:05 +0000 (15:06 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 8 Jul 2020 13:47:28 +0000 (15:47 +0200)
These protocol constants are referenced from a single implementation
place, make sure to move them there.

Change-Id: I273ceb9f4cfed698bd856deb49edd5bef8264310
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/RestconfStreamsConstants.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/SubscribeToStreamUtil.java

index 047eea5bd333e1928bcd1ee6d00ef225a9d29053..607e23243e705b5bd0eab2134fca14f3b97c446e 100644 (file)
@@ -57,10 +57,6 @@ public final class RestconfStreamsConstants {
     public static final char EQUAL = ParserBuilderConstants.Deserializer.EQUAL;
     public static final String DS_URI = RestconfConstants.SLASH + DATASTORE_PARAM_NAME + EQUAL;
     public static final String SCOPE_URI = RestconfConstants.SLASH + SCOPE_PARAM_NAME + EQUAL;
-    public static final String SCHEMA_SUBSCRIBE_URI = "ws";
-    public static final String SCHEMA_SUBSCRIBE_SECURED_URI = "wss";
-    public static final String SCHEMA_UPGRADE_URI = "http";
-    public static final String SCHEMA_UPGRADE_SECURED_URI = "https";
 
     public static final String DATA_SUBSCRIPTION = "data-change-event-subscription";
     public static final String CREATE_DATA_SUBSCRIPTION = "create-" + DATA_SUBSCRIPTION;
index d1c4e159e167cb3ce7b859b6c52d9721eefbf056..3de6c2a2ee7323af3765dd0ab3510aae42e88e81 100644 (file)
@@ -288,12 +288,14 @@ public final class SubscribeToStreamUtil {
         final String scheme = uriInfo.getAbsolutePath().getScheme();
         final UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
         switch (scheme) {
-            case RestconfStreamsConstants.SCHEMA_UPGRADE_SECURED_URI:
-                uriBuilder.scheme(RestconfStreamsConstants.SCHEMA_SUBSCRIBE_SECURED_URI);
+            case "https":
+                // Secured HTTP goes to Secured WebSockets
+                uriBuilder.scheme("wss");
                 break;
-            case RestconfStreamsConstants.SCHEMA_UPGRADE_URI:
+            case "http":
             default:
-                uriBuilder.scheme(RestconfStreamsConstants.SCHEMA_SUBSCRIBE_URI);
+                // Unsecured HTTP and others go to unsecured WebSockets
+                uriBuilder.scheme("ws");
         }
         return uriBuilder.replacePath(RestconfConstants.BASE_URI_PATTERN + RestconfConstants.SLASH + streamName)
                 .build();