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
<url>ws://myhost:9999/ws</url>
</service>
</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><KNOX-HOME>/conf/gateway-site.xml</code>
file.</p>
+<pre><code> <property>
+ <name>gateway.servlet.async.supported</name>
+ <value>true</value>
+ <description>Enable/Disable async support.</description>
+ </property>
+</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><KNOX-HOME>/data/services/{myservice}/{version}/rewrite.xml</code>
where myservice = sservice and version = 0.1</p>
+<pre><code> <rules>
+ <rule dir="IN" name="SSERVICE/sservice/inbound"
pattern="*://*:*/**/sservice/*">
+ <rewrite template="{$serviceUrl[SSERVICE]}/sse"/>
+ </rule>
+ </rules>
+</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><KNOX-HOME>/data/services/{myservice}/{version}/service.xml</code>
where myservice = sservice and version = 0.1</p>
+<pre><code> <service role="SSERVICE" name="sservice"
version="0.1">
+ <routes>
+ <route path="/sservice/**"></route>
+ </routes>
+ <dispatch classname="org.apache.knox.gateway.sse.SSEDispatch"
ha-classname="org.apache.knox.gateway.ha.dispatch.SSEHaDispatch"/>
+ </service>
+</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><KNOX-HOME>/conf/{topology}.xml</code> with the backend service
URL</p>
+<pre><code> <service>
+ <role>SSERVICE</role>
+ <url>http://myhost:7435</url>
+ </service>
+</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’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>>