cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r1030074 - in /websites/production/cxf/content: cache/docs.pageCache docs/sse.html
Date Sat, 19 May 2018 16:57:04 GMT
Author: buildbot
Date: Sat May 19 16:57:04 2018
New Revision: 1030074

Log:
Production update by buildbot for cxf

Modified:
    websites/production/cxf/content/cache/docs.pageCache
    websites/production/cxf/content/docs/sse.html

Modified: websites/production/cxf/content/cache/docs.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/cxf/content/docs/sse.html
==============================================================================
--- websites/production/cxf/content/docs/sse.html (original)
+++ websites/production/cxf/content/docs/sse.html Sat May 19 16:57:04 2018
@@ -118,7 +118,55 @@ Apache CXF -- SSE
          <td height="100%">
            <!-- Content -->
            <div class="wiki-content">
-<div id="ConfluenceContent"><h2 id="SSE-Introduction">Introduction</h2><p>The
<a shape="rect" class="external-link" href="https://jcp.org/en/jsr/detail?id=370" rel="nofollow">JAX-RS
2.1</a> introduced the support of server-sent events (SSE). Although SSE in general
works on top of HTTP transport, the SSE implementation in CXF uses the dedicated one, based
on <a shape="rect" class="external-link" href="https://github.com/Atmosphere/atmosphere"
rel="nofollow">Atmosphere</a> framework. This transport only required on the server-side
(client side works over normal HTTP) and is fully compatible with HTTP transport.</p><h2
id="SSE-Configuration">Configuration</h2><p>There are several ways to configure
SSE transport (and as the consequence, SSE support). The most straightforward one is to pass
the init parameter&#160;<strong>"transportId"</strong> to the CXF servlet
in question, for example:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl"
 >
+<div id="ConfluenceContent"><h2 id="SSE-/*&lt;![CDATA[*/div.rbtoc1526748985916{padding:0px;}div.rbtoc1526748985916ul{list-style:disc;margin-left:0px;}div.rbtoc1526748985916li{margin-left:0px;padding-left:0px;}/*]]&gt;*/#SSE-Introduction#SSE-IntroductionSince3.2.5release#SSE-Since3.2.5releaseConfi"><style
type="text/css">/*<![CDATA[*/
+div.rbtoc1526748985916 {padding: 0px;}
+div.rbtoc1526748985916 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1526748985916 li {margin-left: 0px;padding-left: 0px;}
+
+/*]]>*/</style></h2><div class="toc-macro rbtoc1526748985916">
+<ul class="toc-indentation"><li><a shape="rect" href="#SSE-"></a></li><li><a
shape="rect" href="#SSE-Introduction">Introduction</a></li><li><a
shape="rect" href="#SSE-Since3.2.5release">Since 3.2.5 release</a>
+<ul class="toc-indentation"><li><a shape="rect" href="#SSE-Configuration">Configuration</a></li><li><a
shape="rect" href="#SSE-OSGi">OSGi</a></li></ul>
+</li><li><a shape="rect" href="#SSE-Before3.2.5release">Before 3.2.5 release</a>
+<ul class="toc-indentation"><li><a shape="rect" href="#SSE-Configuration.1">Configuration</a></li><li><a
shape="rect" href="#SSE-AdvancedConfiguration">Advanced Configuration</a></li><li><a
shape="rect" href="#SSE-OSGi.1">OSGi</a></li></ul>
+</li></ul>
+</div><h2 id="SSE-Introduction">Introduction</h2><p>The <a shape="rect"
class="external-link" href="https://jcp.org/en/jsr/detail?id=370" rel="nofollow">JAX-RS
2.1</a> introduced the support of server-sent events (SSE).</p><h2 id="SSE-Since3.2.5release">Since
3.2.5 release</h2><p>Thanks to the community contribution, the SSE implementation
has been revamped significantly in <strong>3.2.5</strong> release and does not
depend on any additional transport or/and library.</p><h3 id="SSE-Configuration">Configuration</h3><p>In
most cases the SSE providers are going to be activated automatically, either though <strong>SseProvidersExtension</strong>
or <strong>SseTransportCustomizationExtension</strong>. However, in case there
is a need to manually add SSE support, it could be done by including <strong>SseFeature</strong>,
for example:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">final
JAXRSServerFactoryBean factory = RuntimeDelegate.getInstance().createEndpoint(&lt;application&gt;,
JAXRSServerFactoryBean.class);
+factory.setFeatures(Arrays.asList(new SseFeature()));
+...
+return factory.create();</pre>
+</div></div><h3 id="SSE-OSGi">OSGi</h3><p>For the deployments
inside OSGi containers (like Apache Karaf), <strong>Apache CXF</strong> provides
a dedicated <strong>cxf-sse</strong> feature (which depends on <strong>cxf-http</strong>
and <strong>cxf-jaxrs</strong>).</p><div class="preformatted panel" style="border-width:
1px;"><div class="preformattedContent panelContent">
+<pre>karaf@root()&gt; feature:install cxf-sse </pre>
+</div></div><p>&#160;Once installed, the dependent bundles could benefit
from SSE capabilities by specifying desired transport in the Blueprint configuration, for
example.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">&lt;blueprint
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:cxf="http://cxf.apache.org/blueprint/core"
+       xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
+
+       xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
+                           http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
+                           http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd"&gt;
+
+    &lt;bean id="sseFeature" class="org.apache.cxf.jaxrs.sse.SseFeature" /&gt;
+
+   &#160;&lt;cxf:bus&gt;
+        &lt;cxf:features&gt;
+            &lt;cxf:logging /&gt;
+        &lt;/cxf:features&gt;
+    &lt;/cxf:bus&gt;
+
+    &lt;jaxrs:server id="sseSampleService" address="/"&gt;
+        &lt;jaxrs:serviceBeans&gt;
+            &lt;ref component-id="..." /&gt;
+        &lt;/jaxrs:serviceBeans&gt;
+        &lt;jaxrs:providers&gt;
+            &lt;ref component-id="..." /&gt;
+        &lt;/jaxrs:providers&gt;
+        &lt;jaxrs:features&gt;
+            &lt;ref component-id="sseFeature" /&gt;
+        &lt;/jaxrs:features&gt;
+&#160;&lt;/jaxrs:server&gt;
+&lt;/blueprint&gt;</pre>
+</div></div><h2 id="SSE-Before3.2.5release">Before 3.2.5 release</h2><p>Although
SSE in general works on top of HTTP transport, the SSE implementation in CXF uses the dedicated
one, based on <a shape="rect" class="external-link" href="https://github.com/Atmosphere/atmosphere"
rel="nofollow">Atmosphere</a> framework. This transport only required on the server-side
(client side works over normal HTTP) and is fully compatible with HTTP transport.</p><h3
id="SSE-Configuration.1">Configuration</h3><p>There are several ways to configure
SSE transport (and as the consequence, SSE support). The most straightforward one is to pass
the init parameter&#160;<strong>"transportId"</strong> to the CXF servlet
in question, for example:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">final
CXFNonSpringServlet cxfServlet = new CXFNonSpringServlet();
 final ServletHolder holder = new ServletHolder(cxfServlet);
 holder.setInitParameter(CXFCdiServlet.TRANSPORT_ID, SseHttpTransportFactory.TRANSPORT_ID);
@@ -128,7 +176,7 @@ holder.setInitParameter(CXFCdiServlet.TR
 factory.setTransportId(SseHttpTransportFactory.TRANSPORT_ID);
 ...
 return factory.create();</pre>
-</div></div><h2 id="SSE-AdvancedConfiguration">Advanced Configuration</h2><p>Since
<strong>Apache CXF 3.2.3</strong> release, it is possible to use alternative means
to configure transports, including SSE one, by passing it through the <strong>Bus</strong>
property "<a shape="rect" class="external-link" href="http://org.apache.cxf.preferred.transport.id"
rel="nofollow">org.apache.cxf.preferred.transport.id</a>" (also available as <strong>AbstractTransportFactory.PREFERRED_TRANSPORT_ID</strong>
constant). With this property set to preferred transport, CXF servlet in question is going
to pick it up instead of using the default one. SSE implementation benefits from that and
in many cases setting the <strong>"transportId" </strong>init parameter on the
servlet level could be omitted.</p><h2 id="SSE-OSGi">OSGi</h2><p>For
the deployments inside OSGi containers (like Apache Karaf), <strong>Apache CXF</strong>
provides a dedicated <strong>cxf-sse</strong> feature (which depends on <strong>c
 xf-http</strong> and <strong>cxf-jaxrs</strong>).</p><div class="preformatted
panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
+</div></div><h3 id="SSE-AdvancedConfiguration">Advanced Configuration</h3><p>Since
<strong>Apache CXF 3.2.3</strong> release, it is possible to use alternative means
to configure transports, including SSE one, by passing it through the <strong>Bus</strong>
property "<a shape="rect" class="external-link" href="http://org.apache.cxf.preferred.transport.id"
rel="nofollow">org.apache.cxf.preferred.transport.id</a>" (also available as <strong>AbstractTransportFactory.PREFERRED_TRANSPORT_ID</strong>
constant). With this property set to preferred transport, CXF servlet in question is going
to pick it up instead of using the default one. SSE implementation benefits from that and
in many cases setting the <strong>"transportId" </strong>init parameter on the
servlet level could be omitted.</p><h3 id="SSE-OSGi.1">OSGi</h3><p>For
the deployments inside OSGi containers (like Apache Karaf), <strong>Apache CXF</strong>
provides a dedicated <strong>cxf-sse</strong> feature (which depends on <strong
 >cxf-http</strong> and <strong>cxf-jaxrs</strong>).</p><div
class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
 <pre>karaf@root()&gt; feature:install cxf-sse </pre>
 </div></div><p>Once installed, the dependent bundles could benefit from
SSE capabilities by specifying desired transport in the Blueprint configuration, for example.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
 <pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">&lt;blueprint
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"



Mime
View raw message