Bug 2699 - websocket does not implement the ws:// protocol defined in 25/15925/2
authorJan Hajnar <[email protected]>
Mon, 2 Mar 2015 15:16:34 +0000 (16:16 +0100)
committerJan Hajnar <[email protected]>
Mon, 2 Mar 2015 15:27:24 +0000 (16:27 +0100)
the URI scheme in rfc6455

* modified returned location header entry on get stream to use "ws" protocol

Change-Id: I0b7a6e572a917545371276f09c5949e9b66e4e73
Signed-off-by: Jan Hajnar <[email protected]>
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/websockets/WebSocketServerHandler.java

index a5e041f51529ad1e6b8fc5111a0bd459250572e1..d0653409c8f23249d3a4de9f8629649ab0689884 100644 (file)
@@ -1037,8 +1037,8 @@ public class RestconfImpl implements RestconfService {
         } catch (NullPointerException e) {
             WebSocketServer.createInstance(NOTIFICATION_PORT);
         }
-        UriBuilder port = uriBuilder.port(notificationPort);
-        final URI uriToWebsocketServer = port.replacePath(streamName).build();
+        final UriBuilder uriToWebsocketServerBuilder = uriBuilder.port(notificationPort).scheme("ws");
+        final URI uriToWebsocketServer = uriToWebsocketServerBuilder.replacePath(streamName).build();
 
         return Response.status(Status.OK).location(uriToWebsocketServer).build();
     }
index ce12d34e083f2ca440c754ab736aed1834276e0f..5ce6b0ee012649483cb429c160c041e6d4910971 100644 (file)
@@ -162,7 +162,7 @@ public class WebSocketServerHandler extends SimpleChannelInboundHandler<Object>
      * @return String representation of web socket location.
      */
     private static String getWebSocketLocation(final HttpRequest req) {
-        return "http://" + req.headers().get(HOST) + req.getUri();
+        return "ws://" + req.headers().get(HOST) + req.getUri();
     }
 
 }