Author: pzampino
Date: Wed Apr  9 19:57:58 2025
New Revision: 1924974

URL: http://svn.apache.org/viewvc?rev=1924974&view=rev
Log:
Added KNOX-3127 content - SSE

Modified:
    knox/site/books/knox-2-1-0/user-guide.html
    knox/trunk/books/2.1.0/book.md
    knox/trunk/books/2.1.0/book_gateway-details.md

Modified: knox/site/books/knox-2-1-0/user-guide.html
URL: 
http://svn.apache.org/viewvc/knox/site/books/knox-2-1-0/user-guide.html?rev=1924974&r1=1924973&r2=1924974&view=diff
==============================================================================
--- knox/site/books/knox-2-1-0/user-guide.html (original)
+++ knox/site/books/knox-2-1-0/user-guide.html Wed Apr  9 19:57:58 2025
@@ -111,6 +111,7 @@
     </ul>
   </li>
   <li><a href="#Websocket+Support">Websocket Support</a></li>
+  <li><a href="#Server-Sent+Events+Support">Server-Sent Events Support</a></li>
   <li><a href="#Audit">Audit</a></li>
   <li><a href="#Client+Details">Client Details</a>
     <ul>
@@ -6907,6 +6908,60 @@ Content-Length: 2048
       &lt;url&gt;ws://myhost:9999/ws&lt;/url&gt;
   &lt;/service&gt;
 </code></pre>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       https://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<h2><a id="Server-Sent+Events+Support">Server-Sent Events Support</a> <a 
href="#Server-Sent+Events+Support"><img 
src="markbook-section-link.png"/></a></h2>
+<h3><a id="Introduction">Introduction</a> <a href="#Introduction"><img 
src="markbook-section-link.png"/></a></h3>
+<p>Server-Sent Events (SSE) allows a server to push updates to the browser 
over a single longlived HTTP connection. The media type is 
test/event-stream.</p>
+<h3><a id="Configuration">Configuration</a> <a href="#Configuration"><img 
src="markbook-section-link.png"/></a></h3>
+<p>Asynchronous behaviour and therefore SSE support is not enabled by default. 
Modify the <code>gateway.servlet.async.supported</code> property to 
<code>true</code> in <code>&lt;KNOX-HOME&gt;/conf/gateway-site.xml</code> 
file.</p>
+<pre><code>  &lt;property&gt;
+      &lt;name&gt;gateway.servlet.async.supported&lt;/name&gt;
+      &lt;value&gt;true&lt;/value&gt;
+      &lt;description&gt;Enable/Disable async support.&lt;/description&gt;
+  &lt;/property&gt;
+</code></pre>
+<p>Service and rewrite rules need the be updated as well. Both Ha and non Ha 
configurations work.</p>
+<h3><a id="Example">Example</a> <a href="#Example"><img 
src="markbook-section-link.png"/></a></h3>
+<p>In the following sample configuration we assume that the backend SSE 
service URL is <a href="http://myhost:7435";>http://myhost:7435</a>. And 
<code>gateway.servlet.async.supported</code> property is set to 
<code>true</code> as shown above.</p>
+<h3><a id="Rewrite">Rewrite</a> <a href="#Rewrite"><img 
src="markbook-section-link.png"/></a></h3>
+<p>Example code snippet from 
<code>&lt;KNOX-HOME&gt;/data/services/{myservice}/{version}/rewrite.xml</code> 
where myservice = sservice and version = 0.1</p>
+<pre><code>  &lt;rules&gt;
+      &lt;rule dir=&quot;IN&quot; name=&quot;SSERVICE/sservice/inbound&quot; 
pattern=&quot;*://*:*/**/sservice/*&quot;&gt;
+        &lt;rewrite template=&quot;{$serviceUrl[SSERVICE]}/sse&quot;/&gt;
+      &lt;/rule&gt;
+  &lt;/rules&gt;
+</code></pre>
+<h3><a id="Service">Service</a> <a href="#Service"><img 
src="markbook-section-link.png"/></a></h3>
+<p>Example code snippet from 
<code>&lt;KNOX-HOME&gt;/data/services/{myservice}/{version}/service.xml</code> 
where myservice = sservice and version = 0.1</p>
+<pre><code>  &lt;service role=&quot;SSERVICE&quot; name=&quot;sservice&quot; 
version=&quot;0.1&quot;&gt;
+    &lt;routes&gt;
+      &lt;route path=&quot;/sservice/**&quot;&gt;&lt;/route&gt;
+    &lt;/routes&gt;
+    &lt;dispatch classname=&quot;org.apache.knox.gateway.sse.SSEDispatch&quot; 
ha-classname=&quot;org.apache.knox.gateway.ha.dispatch.SSEHaDispatch&quot;/&gt;
+  &lt;/service&gt;
+</code></pre>
+<h3><a id="Topology">Topology</a> <a href="#Topology"><img 
src="markbook-section-link.png"/></a></h3>
+<p>Finally, update the topology file at 
<code>&lt;KNOX-HOME&gt;/conf/{topology}.xml</code> with the backend service 
URL</p>
+<pre><code>  &lt;service&gt;
+    &lt;role&gt;SSERVICE&lt;/role&gt;
+    &lt;url&gt;http://myhost:7435&lt;/url&gt;
+  &lt;/service&gt;
+</code></pre>
 <h3><a id="Audit">Audit</a> <a href="#Audit"><img 
src="markbook-section-link.png"/></a></h3>
 <p>The Audit facility within the Knox Gateway introduces functionality for 
tracking actions that are executed by Knox per user&rsquo;s request or that are 
produced by Knox internal events like topology deploy, etc. The Knox Audit 
module is based on <a href="http://logging.apache.org/log4j/1.2/";>Apache 
log4j</a>.</p>
 <h4><a id="Configuration+needed">Configuration needed</a> <a 
href="#Configuration+needed"><img src="markbook-section-link.png"/></a></h4>

Modified: knox/trunk/books/2.1.0/book.md
URL: 
http://svn.apache.org/viewvc/knox/trunk/books/2.1.0/book.md?rev=1924974&r1=1924973&r2=1924974&view=diff
==============================================================================
--- knox/trunk/books/2.1.0/book.md (original)
+++ knox/trunk/books/2.1.0/book.md Wed Apr  9 19:57:58 2025
@@ -88,6 +88,7 @@
     * #[HTTP Strict-Transport-Security - HSTS]
     * #[Rate limiting]
 * #[Websocket Support]
+* #[Server-Sent Events Support]
 * #[Audit]
 * #[Client Details]
     * #[Client Quickstart]

Modified: knox/trunk/books/2.1.0/book_gateway-details.md
URL: 
http://svn.apache.org/viewvc/knox/trunk/books/2.1.0/book_gateway-details.md?rev=1924974&r1=1924973&r2=1924974&view=diff
==============================================================================
--- knox/trunk/books/2.1.0/book_gateway-details.md (original)
+++ knox/trunk/books/2.1.0/book_gateway-details.md Wed Apr  9 19:57:58 2025
@@ -104,5 +104,6 @@ In the Hortonworks Sandbox, Apache Ambar
 <<config_mutual_authentication_ssl.md>>
 <<config_tls_client_certificate_authentication_provider.md>>
 <<websocket-support.md>>
+<<sse-support.md>>
 <<config_audit.md>>
 <<config_knoxauth_service.md>>


Reply via email to