background preloader

CXF

Facebook Twitter

Toll-rest-service/src/main/java/com/blogspot/diegopacheco/roll/rest/service/engine/RESTExposureEngine.java at 6444f4e5373415b0950c2281c0dd95c38df1b152 · toff63/toll-rest-service. Cxf/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AtomPojoProvider.java at df534a8752db1183a1dd23c3bc357a43fca4723d · apache/cxf. Musings about web services: Embracing Atom with CXF. Until recently, it has been possible to write an AtomPubJAX-RS application in CXF by using Abdera Feed or Entry classes like this : public class AtomPubResource { @GET @Path("/feed") public Feed getCollection() { // create Feed as needed } @GET @Path("/feed/{id}") public Entry getEntry(@PathParam("id") int id) { // get individual entry } @POST @Path("/feed") public void addEntry(Entry entry) { // update collection } // etc} Going this route gives users the most control over how a given feed is initialized and how entries have the actual content captured.

With the addition of AtomPojoProvider provider and Atom-specific extensions few more options are now available for CXF users to start playing with Atom (note the provider and extensions code may still get changed). To start with, users can now simply do : @Path("/store")public class BookStore { private Books books = new Books(); Finally, you can take the complete control with registering Feed or Entry writers or readers. CXF -- Secure JAX-RS Services. JAX-RS: Security Transport-level protection of JAX-RS endpoints can be managed by underlying Servlet containers, for example, see this Tomcat SSL Configuration section. Additionally CXF provides support for configuring endpoints which depend on embedded Jetty. CXF JAX-RS clients can also be configured to support SSL. JAX-RS endpoints using embedded Jetty can rely on the configuration like this one: If you use JAXRSServerFactoryBean to create and start JAX-RS endpoints from the code then the above configuration can be utilized like this: If you also have a jaxrs:server endpoint declared in the above beans.xml, then make sure you have a 'depends-on' attribute set: Once you have JAX-RS and Jetty HTTPS combined then you can get the application context initiated like this: Having JAX-RS endpoints declared alongside CXF Jetty HTTPS configuration is only needed when an embedded Jetty container is used.

Please also see this HTTPS-based demo in the CXF distribution.