Class ConnectStrategy.Client.Result

    • Constructor Summary

      Constructors 
      Constructor Description
      Result​(java.io.InputStream inputStream, java.net.URI origin, java.io.Closeable closer)
      Creates an instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.Closeable getCloser()
      An object that EventSource can use to close the connection.
      java.io.InputStream getInputStream()
      The input stream that EventSource should read from.
      java.net.URI getOrigin()
      The origin URI that should be included in every MessageEvent.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Result

        public Result​(java.io.InputStream inputStream,
                      java.net.URI origin,
                      java.io.Closeable closer)
        Creates an instance.
        Parameters:
        inputStream - see getInputStream()
        origin - see getOrigin()
        closer - see getCloser()
    • Method Detail

      • getInputStream

        public java.io.InputStream getInputStream()
        The input stream that EventSource should read from.
        Returns:
        the input stream (must not be null)
      • getOrigin

        public java.net.URI getOrigin()
        The origin URI that should be included in every MessageEvent.

        The SSE specification dictates that every message should have an origin property representing the stream it came from. In the default HTTP implementation, this is simply the stream URI; other implementations of ConnectStrategy can set it to whatever they want.

        If this value is null, it defaults to the original URI that was returned by ConnectStrategy.Client.getOrigin() prior to making the connection attempt. This allows clients to modify the origin if necessary for each attempt, for instance, if using different query parameters.

        Returns:
        the stream URI
      • getCloser

        public java.io.Closeable getCloser()
        An object that EventSource can use to close the connection. If this is not null, its Closeable.close() method will be called whenever the current connection is stopped either due to an error or because the caller explicitly closed the stream.
        Returns:
        a Closeable object or null