Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Since Apache CXF 3.2.3 release, it is possible to use alternative means to configure transports, including SSE one, by passing it through the Bus property "org.apache.cxf.preferred.transport.id" (also available as AbstractTransportFactory.PREFERRED_TRANSPORT_ID 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 "transportId" init parameter on the servlet level could be omitted. 

OSGi

For the deployments inside OSGi containers (like Apache Karaf), Apache CXF provides a dedicated cxf-sse feature. Once installed, the dependent bundles could benefit from SSE capabilities by specifying desired transport in the Blueprint configuration, for example.

Code Block
xml
xml
<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">

    <cxf:bus>
        <cxf:features>
            <cxf:logging />
        </cxf:features>
    </cxf:bus>

    <jaxrs:server id="sseSampleService" address="/" transportId="http://cxf.apache.org/transports/http/sse">
        <jaxrs:serviceBeans>
            <ref component-id="..." />
        </jaxrs:serviceBeans>
        <jaxrs:providers>
            <ref component-id="..." />
        </jaxrs:providers>
    </jaxrs:server>

</blueprint>