JAX-RS endpoint configuration was not possible (or not easy at all) in last TomEE release. The brand new one makes it possible.
It is important to be able to add custom providers, custom (cxf) interceptors or features…
The idea is to put the configuration in openejb-jar.xml file. If you have an EJB put it in ejb-deployment properties. If it is a pojo (= not an EJB) we copied the same pattern: create a pojo-deployment tag with a nested properties tag.
<openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1"> <ejb-deployment ejb-name="CalculatorBean"> <properties> <!-- here goes the config --> </properties> </ejb-deployment> <pojo-deployment class-name="org.foo.bar.DummyEndpoint"> <properties> <!-- here goes the config --> </properties> </pojo-deployment> </openejb-jar>
Then use the following keys in properties tag prefixed by either cxf.jaxrs. or cxf.jaxws. depending which endpoint you want to configure (the SOAP one or the REST one):
- properties
- features
- in-interceptors
- out-interceptors
- in-fault-interceptors
- out-fault-interceptors
- databinding
- providers (only for rest endpoint)
Properties value should match the id of a service in resources.xml file. Then properties of this service will be used as endpoint properties.
For features and interceptors the rule is the same: value is a list comma separated. Each value of the list is either a qualified class name or an id of a service in resources.xml.
Databinding is simply either a qualified name or a service id in resources.xml.
Here is a sample:
openejb-jar.xml:
<openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1"> <ejb-deployment ejb-name="CalculatorBean"> <properties> cxf.jaxws.in-interceptors = wss4j </properties> </ejb-deployment> </openejb-jar>
resources.xml:
<resources> <Service id="wss4j" class-name="org.apache.openejb.server.cxf.config.WSS4JInInterceptorFactory" factory-name="create"> action = UsernameToken passwordType = PasswordText passwordCallbackClass = org.superbiz.ws.security.PasswordCallbackHandler </Service> </resources>
This is using the openejb-jar-1.1 syntax, but in http://openejb.979440.n4.nabble.com/Tinkering-with-JAX-WS-web-service-URLs-in-EJB-3-1-module-of-EAR-tp4658250p4658251.html you referred me to an example using the openejb-jar-2.1 syntax.
Is one preferred over the other?
Are there features in 1.1 that are not available in 2.1?
Are there features in 2.1 that are not available in 1.1?
Is there a comprehensive document comparing the two?
Thanks,
Hi,
yeah 2 was not very nice so we use back 1 in last version