Clean up SSE stream name handling 12/108812/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 1 Nov 2023 23:19:41 +0000 (00:19 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 1 Nov 2023 23:22:59 +0000 (00:22 +0100)
We are using JAX-RS to extract the stream name for the request URL. This
means we should not be talking to createStreamNameFromUri(), as it is
either a no-op or it actively corrupts the input.

Also ditch @Encoded, as we do not perform any decoding -- and hence the
container should deal with decoding the URL.

JIRA: NETCONF-1102
Change-Id: If06a0bf6e7af65bb7d58c9cc7c972c162c53b82a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfDataStreamServiceImpl.java

index ab89cfecfdcbaee3a302b364b50afb8e116ebe3b..958f745127fe0fb8ad532f08aed3d4cbe360edf4 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.restconf.nb.rfc8040.rests.services.impl;
 import static java.util.Objects.requireNonNull;
 
 import java.util.concurrent.ScheduledExecutorService;
-import javax.ws.rs.Encoded;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
@@ -49,16 +48,15 @@ public final class RestconfDataStreamServiceImpl {
     }
 
     /**
-     * Get target data resource.
+     * Attach to a particular notification stream.
      *
-     * @param identifier path to target
+     * @param streamName path to target
      */
     @GET
-    @Path("/{identifier:.+}")
+    @Path("/{streamName:.+}")
     @Produces(MediaType.SERVER_SENT_EVENTS)
-    public void getSSE(@Encoded @PathParam("identifier") final String identifier, @Context final SseEventSink sink,
+    public void getSSE(@PathParam("streamName") final String streamName, @Context final SseEventSink sink,
             @Context final Sse sse) {
-        final var streamName = ListenersBroker.createStreamNameFromUri(identifier);
         final var listener = listenersBroker.listenerFor(streamName);
         if (listener == null) {
             LOG.debug("Listener for stream with name {} was not found.", streamName);