blob: e25f59e74a0f8451da19e7281a3b15231000fc82 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.2) on Wed Sep 23 17:36:24 GMT 2020 -->
<title>SseEventSource (jakarta.ws.rs-api 3.0.0 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2020-09-23">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
<script type="text/javascript" src="../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../jquery/jquery-3.3.1.js"></script>
<script type="text/javascript" src="../../../../jquery/jquery-migrate-3.0.1.js"></script>
<script type="text/javascript" src="../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="SseEventSource (jakarta.ws.rs-api 3.0.0 API)";
}
}
catch(err) {
}
//-->
var data = {"i0":18,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":1};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],16:["t5","Default Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/SseEventSource.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">jakarta.ws.rs.sse</a></div>
<h2 title="Interface SseEventSource" class="title">Interface SseEventSource</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html?is-external=true" title="class or interface in java.lang" class="externalLink">AutoCloseable</a></code></dd>
</dl>
<hr>
<pre>public interface <span class="typeNameLabel">SseEventSource</span>
extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html?is-external=true" title="class or interface in java.lang" class="externalLink">AutoCloseable</a></pre>
<div class="block">Client for reading and processing <a href="InboundSseEvent.html" title="interface in jakarta.ws.rs.sse"><code>incoming Server-Sent Events</code></a>.
<p>
SSE event source instances of this class are thread safe. To build a new instance, you can use the
<a href="#target(jakarta.ws.rs.client.WebTarget)"><code>SseEventSource.target(endpoint)</code></a> factory method to get a new event
source builder that can be further customised and eventually used to create a new SSE event source.
<p>
Once a <a href="SseEventSource.html" title="interface in jakarta.ws.rs.sse"><code>SseEventSource</code></a> is created, it can be used to <a href="#open()"><code>open a connection</code></a> to the associated
<a href="../client/WebTarget.html" title="interface in jakarta.ws.rs.client"><code>web target</code></a>. After establishing the connection, the event source starts processing any incoming
inbound events. Whenever a new event is received, an <a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/Consumer.html?is-external=true#accept(T)" title="class or interface in java.util.function" class="externalLink"><code>Consumer&lt;InboundSseEvent&gt;#accept(InboundSseEvent)</code></a> method is invoked on any registered event consumers.
<h2>Reconnect support</h2>
<p>
The <code>SseEventSource</code> supports automated recuperation from a connection loss, including
negotiation of delivery of any missed events based on the last received SSE event <code>id</code> field value, provided
this field is set by the server and the negotiation facility is supported by the server. In case of a connection loss,
the last received SSE event <code>id</code> field value is sent in the
<code><a href="../core/HttpHeaders.html#LAST_EVENT_ID_HEADER">"Last-Event-ID"</a></code> HTTP
request header as part of a new connection request sent to the SSE endpoint. Upon a receipt of such reconnect request, the SSE
endpoint that supports this negotiation facility is expected to replay all missed events. Note however, that this is a
best-effort mechanism which does not provide any guaranty that all events would be delivered without a loss. You should
therefore not rely on receiving every single event and design your client application code accordingly.
<p>
By default, when a connection to the SSE endpoint is lost, the event source will wait 500&nbsp;ms
before attempting to reconnect to the SSE endpoint. The SSE endpoint can however control the client-side retry delay
by including a special <code>retry</code> field value in any sent event. JAX-RS <code>SseEventSource</code> tracks any
received SSE event <code>retry</code> field values set by the endpoint and adjusts the reconnect delay accordingly,
using the last received <code>retry</code> field value as the reconnect delay.
<p>
In addition to handling the standard connection loss failures, JAX-RS <code>SseEventSource</code> behaves differently to various
HTTP response status codes and headers:
<ul>
<li>200 - with <code><a href="../core/HttpHeaders.html#CONTENT_TYPE">"Content-Type"</a></code> header of "text/event-stream": This is normal
operation. <code>onEvent</code> is invoked for each event. <code>onComplete</code> is invoked when there are no more
events. <code>onError</code> is invoked only if an unrecoverable error occurs during processing.</li>
<li>200 - with unsupported or missing <code><a href="../core/HttpHeaders.html#CONTENT_TYPE">"Content-Type"</a></code> header: This is an
error condition. <code>onError</code> is invoked.</li>
<li>204 - This indicates that server has no events to send. Only <code>onComplete</code> is invoked.</li>
<li>503 - with <code><a href="../core/HttpHeaders.html#RETRY_AFTER">"Retry-After"</a></code> header set to a valid value: This indicates
that the server is unavailable, but that the client should reconnect later. No consumers are invoked unless the client
event source is closed, prior to reconnecting (resulting in <code>onComplete</code> invocation). After the specified
delay, the client should automatically attempt to reconnect which will result in a new response.</li>
<li>503 - with invalid or missing <code><a href="../core/HttpHeaders.html#RETRY_AFTER">"Retry-After"</a></code> header: This is an error
condition. <code>onError</code> is invoked.</li>
<li>Any other status code: This is an error condition. <code>onError</code> is invoked.</li>
</ul>
<p>
In the case of an error condition response, the <code>Throwable</code> passed to the <code>onError</code> consumer
<i>should</i> be a WebApplicationException containing the invalid <code>Response</code> object.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>2.1</dd>
<dt><span class="simpleTagLabel">Author:</span></dt>
<dd>Marek Potociar</dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Interface</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="SseEventSource.Builder.html" title="class in jakarta.ws.rs.sse">SseEventSource.Builder</a></span></code></th>
<td class="colLast">
<div class="block">JAX-RS <a href="SseEventSource.html" title="interface in jakarta.ws.rs.sse"><code>SseEventSource</code></a> builder class.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t5" class="tableTab"><span><a href="javascript:show(16);">Default Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>default void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#close()">close</a></span>()</code></th>
<td class="colLast">
<div class="block">Close this event source.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#close(long,java.util.concurrent.TimeUnit)">close</a></span>&#8203;(long&nbsp;timeout,
<a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/TimeUnit.html?is-external=true" title="class or interface in java.util.concurrent" class="externalLink">TimeUnit</a>&nbsp;unit)</code></th>
<td class="colLast">
<div class="block">Close this event source and wait for the internal event processing task to complete for up to the specified amount of
wait time.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isOpen()">isOpen</a></span>()</code></th>
<td class="colLast">
<div class="block">Check if this event source instance has already been <a href="#open()"><code>opened</code></a>.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#open()">open</a></span>()</code></th>
<td class="colLast">
<div class="block">Open the connection to the supplied SSE underlying <a href="../client/WebTarget.html" title="interface in jakarta.ws.rs.client"><code>web target</code></a> and start processing incoming
<a href="InboundSseEvent.html" title="interface in jakarta.ws.rs.sse"><code>events</code></a>.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#register(java.util.function.Consumer)">register</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/Consumer.html?is-external=true" title="class or interface in java.util.function" class="externalLink">Consumer</a>&lt;<a href="InboundSseEvent.html" title="interface in jakarta.ws.rs.sse">InboundSseEvent</a>&gt;&nbsp;onEvent)</code></th>
<td class="colLast">
<div class="block">Register a <a href="InboundSseEvent.html" title="interface in jakarta.ws.rs.sse"><code>InboundSseEvent</code></a> consumer.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#register(java.util.function.Consumer,java.util.function.Consumer)">register</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/Consumer.html?is-external=true" title="class or interface in java.util.function" class="externalLink">Consumer</a>&lt;<a href="InboundSseEvent.html" title="interface in jakarta.ws.rs.sse">InboundSseEvent</a>&gt;&nbsp;onEvent,
<a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/Consumer.html?is-external=true" title="class or interface in java.util.function" class="externalLink">Consumer</a>&lt;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Throwable</a>&gt;&nbsp;onError)</code></th>
<td class="colLast">
<div class="block">Register <a href="InboundSseEvent.html" title="interface in jakarta.ws.rs.sse"><code>InboundSseEvent</code></a> and <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink"><code>Throwable</code></a> consumers.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#register(java.util.function.Consumer,java.util.function.Consumer,java.lang.Runnable)">register</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/Consumer.html?is-external=true" title="class or interface in java.util.function" class="externalLink">Consumer</a>&lt;<a href="InboundSseEvent.html" title="interface in jakarta.ws.rs.sse">InboundSseEvent</a>&gt;&nbsp;onEvent,
<a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/Consumer.html?is-external=true" title="class or interface in java.util.function" class="externalLink">Consumer</a>&lt;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Throwable</a>&gt;&nbsp;onError,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Runnable</a>&nbsp;onComplete)</code></th>
<td class="colLast">
<div class="block">Register <a href="InboundSseEvent.html" title="interface in jakarta.ws.rs.sse"><code>InboundSseEvent</code></a> and <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink"><code>Throwable</code></a> consumers and onComplete callback.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>static <a href="SseEventSource.Builder.html" title="class in jakarta.ws.rs.sse">SseEventSource.Builder</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#target(jakarta.ws.rs.client.WebTarget)">target</a></span>&#8203;(<a href="../client/WebTarget.html" title="interface in jakarta.ws.rs.client">WebTarget</a>&nbsp;endpoint)</code></th>
<td class="colLast">
<div class="block">Create a new <a href="SseEventSource.Builder.html" title="class in jakarta.ws.rs.sse"><code>event source builder</code></a> that provides convenient way how to configure and
fine-tune various aspects of a newly prepared event source instance.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="register(java.util.function.Consumer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>register</h4>
<pre class="methodSignature">void&nbsp;register&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/Consumer.html?is-external=true" title="class or interface in java.util.function" class="externalLink">Consumer</a>&lt;<a href="InboundSseEvent.html" title="interface in jakarta.ws.rs.sse">InboundSseEvent</a>&gt;&nbsp;onEvent)</pre>
<div class="block">Register a <a href="InboundSseEvent.html" title="interface in jakarta.ws.rs.sse"><code>InboundSseEvent</code></a> consumer.
<p>
Given consumer is invoked once per each received event.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>onEvent</code> - event consumer.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalArgumentException</a></code> - when the provided parameter is <code>null</code>.</dd>
</dl>
</li>
</ul>
<a id="register(java.util.function.Consumer,java.util.function.Consumer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>register</h4>
<pre class="methodSignature">void&nbsp;register&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/Consumer.html?is-external=true" title="class or interface in java.util.function" class="externalLink">Consumer</a>&lt;<a href="InboundSseEvent.html" title="interface in jakarta.ws.rs.sse">InboundSseEvent</a>&gt;&nbsp;onEvent,
<a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/Consumer.html?is-external=true" title="class or interface in java.util.function" class="externalLink">Consumer</a>&lt;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Throwable</a>&gt;&nbsp;onError)</pre>
<div class="block">Register <a href="InboundSseEvent.html" title="interface in jakarta.ws.rs.sse"><code>InboundSseEvent</code></a> and <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink"><code>Throwable</code></a> consumers.
<p>
Event consumer is invoked once per each received event, <code>Throwable</code> consumer is invoked invoked upon a
unrecoverable error encountered by a <a href="SseEventSource.html" title="interface in jakarta.ws.rs.sse"><code>SseEventSource</code></a>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>onEvent</code> - event consumer.</dd>
<dd><code>onError</code> - error consumer.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalArgumentException</a></code> - when the any of the provided parameters is <code>null</code>.</dd>
</dl>
</li>
</ul>
<a id="register(java.util.function.Consumer,java.util.function.Consumer,java.lang.Runnable)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>register</h4>
<pre class="methodSignature">void&nbsp;register&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/Consumer.html?is-external=true" title="class or interface in java.util.function" class="externalLink">Consumer</a>&lt;<a href="InboundSseEvent.html" title="interface in jakarta.ws.rs.sse">InboundSseEvent</a>&gt;&nbsp;onEvent,
<a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/Consumer.html?is-external=true" title="class or interface in java.util.function" class="externalLink">Consumer</a>&lt;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Throwable</a>&gt;&nbsp;onError,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Runnable</a>&nbsp;onComplete)</pre>
<div class="block">Register <a href="InboundSseEvent.html" title="interface in jakarta.ws.rs.sse"><code>InboundSseEvent</code></a> and <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink"><code>Throwable</code></a> consumers and onComplete callback.
<p>
Event consumer is invoked once per each received event, <code>Throwable</code> consumer is invoked invoked upon a
unrecoverable error encountered by a <a href="SseEventSource.html" title="interface in jakarta.ws.rs.sse"><code>SseEventSource</code></a>, onComplete callback is invoked after a successful
connection and when there are no further events to be received. Note that the onComplete callback will not be
invoked if the onError callback has been invoked.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>onEvent</code> - event consumer.</dd>
<dd><code>onError</code> - error consumer.</dd>
<dd><code>onComplete</code> - onComplete handler.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalArgumentException</a></code> - when the any of the provided parameters is <code>null</code>.</dd>
</dl>
</li>
</ul>
<a id="target(jakarta.ws.rs.client.WebTarget)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>target</h4>
<pre class="methodSignature">static&nbsp;<a href="SseEventSource.Builder.html" title="class in jakarta.ws.rs.sse">SseEventSource.Builder</a>&nbsp;target&#8203;(<a href="../client/WebTarget.html" title="interface in jakarta.ws.rs.client">WebTarget</a>&nbsp;endpoint)</pre>
<div class="block">Create a new <a href="SseEventSource.Builder.html" title="class in jakarta.ws.rs.sse"><code>event source builder</code></a> that provides convenient way how to configure and
fine-tune various aspects of a newly prepared event source instance.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>endpoint</code> - SSE streaming endpoint. Must not be <code>null</code>.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a builder of a new event source instance pointing at the specified SSE streaming endpoint.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang" class="externalLink">NullPointerException</a></code> - in case the supplied web target is <code>null</code>.</dd>
</dl>
</li>
</ul>
<a id="open()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>open</h4>
<pre class="methodSignature">void&nbsp;open()</pre>
<div class="block">Open the connection to the supplied SSE underlying <a href="../client/WebTarget.html" title="interface in jakarta.ws.rs.client"><code>web target</code></a> and start processing incoming
<a href="InboundSseEvent.html" title="interface in jakarta.ws.rs.sse"><code>events</code></a>.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalStateException</a></code> - in case the event source has already been opened earlier.</dd>
</dl>
</li>
</ul>
<a id="isOpen()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isOpen</h4>
<pre class="methodSignature">boolean&nbsp;isOpen()</pre>
<div class="block">Check if this event source instance has already been <a href="#open()"><code>opened</code></a>.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if this event source is open, <code>false</code> otherwise.</dd>
</dl>
</li>
</ul>
<a id="close()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>close</h4>
<pre class="methodSignature">default&nbsp;void&nbsp;close()</pre>
<div class="block">Close this event source.
<p>
The method will wait up to 5 seconds for the internal event processing tasks to complete.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html?is-external=true#close()" title="class or interface in java.lang" class="externalLink">close</a></code>&nbsp;in interface&nbsp;<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html?is-external=true" title="class or interface in java.lang" class="externalLink">AutoCloseable</a></code></dd>
</dl>
</li>
</ul>
<a id="close(long,java.util.concurrent.TimeUnit)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>close</h4>
<pre class="methodSignature">boolean&nbsp;close&#8203;(long&nbsp;timeout,
<a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/TimeUnit.html?is-external=true" title="class or interface in java.util.concurrent" class="externalLink">TimeUnit</a>&nbsp;unit)</pre>
<div class="block">Close this event source and wait for the internal event processing task to complete for up to the specified amount of
wait time.
<p>
The method blocks until the event processing task has completed execution after a shutdown request, or until the
timeout occurs, or the current thread is interrupted, whichever happens first.
<p>
In case the waiting for the event processing task has been interrupted, this method restores the
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html?is-external=true#interrupted()" title="class or interface in java.lang" class="externalLink"><code>interrupt</code></a> flag on the thread before returning <code>false</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>timeout</code> - the maximum time to wait.</dd>
<dd><code>unit</code> - the time unit of the timeout argument.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if this executor terminated and <code>false</code> if the timeout elapsed before termination or the
termination was interrupted.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/SseEventSource.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small><p align="left">Copyright &#169; 2018, 2020 Eclipse Foundation.<br>Use is subject to <a href="../../../../resources/EFSL.html" target="_top">license terms</a>.</small></p>
</footer>
</body>
</html>