Distributed OSGi Reference Guide
Table of Contents | ||||
---|---|---|---|---|
|
Configuration Properties
New in DOSGI 1.2: Servlet Filters (javax.servlet.Filter) can be registered as OSGi services with the "org.apache.cxf.httpservice.filter" boolean
property set to true and used to secure DOSGi server endpoints.Endpoints can enforce the registration of the filters by setting an "org.apache.cxf.httpservice.requirefilter" boolean property to true.
...
Property Name | Data Type | Example | Description | ||
---|---|---|---|---|---|
org.apache.cxf.ws.address | String | {{ http://localhost:9090/greeter![]() | }} The address at which the service with be made available remotely. If this property is not specified, this defaults to {{http://localhost:9000/fully/qualified/ClassName ![]() }}. | ||
org.apache.cxf.ws.httpservice.context | String |
| When this property is specified, the OSGi HTTP Service is used to expose the service, rather than a dedicated Jetty HTTP Server. This property doesn't allow the specification of a port number, as this is provided by the HTTP Service. The Distributed OSGi distributions come with Pax-Web, for which configuration information can be found | here: , however other OSGi HTTP Service implementations are potentially configured differently. | |
org.apache.cxf.ws.frontend | String |
| The CXF frontend which will be used to create endpoints. Defaults to 'simple' which is an Aegis-based simple frontend. Note that for JAXWS to work a javax.jws.* has to be imported into the interface and/or implementation and client bundles for annotations like @WebService and @WebMethod be recognized | ||
org.apache.cxf.ws.databinding | String |
| Supported values are 'aegis and 'jaxb', defaults to 'aegis'. Note that for JAXB to work JAXB packages like javax.xml.bind.annotation.* have to be imported | ||
org.apache.cxf.ws.databinding.bean | DataBinding | An actual DataBinding instance to use. If not specified, a default one is created according to the type specified in the org.apache.cxf.ws.databinding property. | |||
org.apache.cxf.ws.wsdl.location | String |
| WSDL location | ||
org.apache.cxf.ws.wsdl.service.ns | String {{ | http://services.org![]() | WSDL service namespace | ||
org.apache.cxf.ws.wsdl.service.name | String |
| WSDL service name | ||
org.apache.cxf.ws.wsdl.port.name | String |
| WSDL port name | ||
org.apache.cxf.ws.in.interceptors | String, String[], List |
| List of CXF in interceptors | ||
org.apache.cxf.ws.out.interceptors | String, String[], List |
| List of CXF out interceptors | ||
org.apache.cxf.ws.in.fault.interceptors | String, String[], List |
| List of CXF in fault interceptors | ||
org.apache.cxf.ws.out.fault.interceptors | String, String[], List |
| List of CXF out fault interceptors | ||
org.apache.cxf.ws.features | String, String[], List, Object |
| List of CXF out features |
...
Property Name | Data Type | Example | Description | ||
---|---|---|---|---|---|
org.apache.cxf.rs.address | String | {{ http://localhost:9090/greeter![]() | The address at which the service with be made available remotely. If this property is not specified, this defaults to | {{. | |
org.apache.cxf.rs.httpservice.context | String |
| When this property is specified, the OSGi HTTP Service which is used to expose the service, rather than a dedicated Jetty HTTP Server. By default, absolute address may look like 'http://localhost:8080/auction' | ||
org.apache.cxf.rs.provider | Boolean |
| Can be used to identify a global JAXRS provider as CXF-compatible | ||
org.apache.cxf.rs.provider.expected | Boolean |
| Can be used to require global providers to set an 'org.apache.cxf.rs.provider' property with a value 'true'. | ||
org.apache.cxf.rs.provider.globalquery | Boolean |
| Can be used to disable queries for global providers, defaults to 'true'. | ||
org.apache.cxf.rs.databinding | String |
| This property has a limited value for JAXRS services as JAXB is supported by default, the only supported value is 'aegis' and it is a shortcut for registering an Aegis provider, see below for more information on how to register custom providers for JAXRS services | ||
org.apache.cxf.rs.wadl.location | String |
| WADL location | ||
org.apache.cxf.rs.provider | String, String[], List |
| List of JAX-RS providers | ||
org.apache.cxf.rs.in.interceptors | String, String[], List |
| List of CXF in interceptors | ||
org.apache.cxf.rs.out.interceptors | String, String[], List |
| List of CXF out interceptors | ||
org.apache.cxf.rs.in.fault.interceptors | String, String[], List |
| List of CXF in fault interceptors | ||
org.apache.cxf.rs.out.fault.interceptors | String, String[], List |
| List of CXF out fault interceptors | ||
org.apache.cxf.rs.features | String, String[], List |
| List of CXF out features |
...
Custom JAXRS providers including CXF-specific providers can be registered like regular OSGI services, for example :
Code Block | ||||
---|---|---|---|---|
| ||||
Object provider = new CustomMessageBodyReaderWriter();
bundleContext.registerService(
new String[]{"javax.ws.rs.ext.MessageBodyReader", "javax.ws.rs.ext.MessageBodyReader"}, provider);
|
...
Alternatively, one can register per-service specific providers during the application service registration :
Code Block | ||||
---|---|---|---|---|
| ||||
CustomMessageBodyReaderWriter provider1 = new CustomMessageBodyReaderWriter();
provider.setCustomProperty(true);
CustomMessageBodyReaderWriter provider2 = new CustomMessageBodyReaderWriter();
provider2.setCustomProperty(false);
Dictionary properties = new Hashtable();
properties.put("org.apache.cxf.rs.provider", provider);
Dictionary properties2 = new Hashtable();
properties.put("org.apache.cxf.rs.provider", provider2);
bundleContext.registerService(
new String[]{"org.books.BookService"}, new BookServiceImpl(), properties);
bundleContext.registerService(
new String[]{"org.books.BookService"}, new AdvancedBookServiceImpl(), properties2);
|
Finally, one can declare them using "org.apache.cxf.rs.provider" :
Code Block | ||||
---|---|---|---|---|
| ||||
<property name="org.apache.cxf.rs.provider" value="org.foo.bar.Provider1,org.foo.bar.Provider2"/>
|
or, when using declarative services :
Code Block | ||||
---|---|---|---|---|
| ||||
<property name="org.apache.cxf.rs.provider">
org.foo.bar.Provider1
org.foo.bar.Provider2
</property>
|
...
By default all *.xml
files in the OSGI-INF/remote-service location are considered, this location can be changed by setting the Remote-Service
header in the bundle manifest, e.g.
No Format |
---|
Remote-Service: META-INF/osgi |
...
A sample OSGI-INF/remote-service/sd.xml
file looks like this:
No Format |
---|
<service-decorations xmlns="http://cxf.apache.org/xmlns/service-decoration/1.0.0">
<service-decoration>
<match interface="org.apache.F(.*)">
<match-property name="test.prop" value="xyz"/>
<add-property name="service.exported.interfaces" value="*"/>
</match>
</service-decoration>
</service-decorations>
|
...