Package com.launchdarkly.eventsource
Class ConnectStrategy.Client.Result
- java.lang.Object
-
- com.launchdarkly.eventsource.ConnectStrategy.Client.Result
-
- Enclosing class:
- ConnectStrategy.Client
public static class ConnectStrategy.Client.Result extends java.lang.ObjectThe return type ofConnectStrategy.Client.connect(String).
-
-
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.CloseablegetCloser()An object thatEventSourcecan use to close the connection.java.io.InputStreamgetInputStream()The input stream thatEventSourceshould read from.java.net.URIgetOrigin()The origin URI that should be included in everyMessageEvent.
-
-
-
Constructor Detail
-
Result
public Result(java.io.InputStream inputStream, java.net.URI origin, java.io.Closeable closer)Creates an instance.- Parameters:
inputStream- seegetInputStream()origin- seegetOrigin()closer- seegetCloser()
-
-
Method Detail
-
getInputStream
public java.io.InputStream getInputStream()
The input stream thatEventSourceshould read from.- Returns:
- the input stream (must not be null)
-
getOrigin
public java.net.URI getOrigin()
The origin URI that should be included in everyMessageEvent.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
ConnectStrategycan 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 thatEventSourcecan use to close the connection. If this is not null, itsCloseable.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
-
-