atom feed4 messages in org.codehaus.enunciate.user[enunciate-user] CXF REST in Enunciate?
FromSent OnAttachments
Matt RaibleAug 21, 2009 1:31 pm 
Ryan HeatonAug 24, 2009 8:39 am 
Matt RaibleAug 24, 2009 10:47 am 
Ryan HeatonSep 18, 2009 4:25 pm 
Subject:[enunciate-user] CXF REST in Enunciate?
From:Matt Raible (
Date:Aug 21, 2009 1:31:38 pm

After struggling to get Enunciate+Jersey working to generate RESTful services, I decided to try CXF. It worked, and I was able to get CXF to recognize my proxied Spring beans (by configuring them in XML). With CXF, I'm able to use less annotations on my Java classes and it allows you to only annotate interfaces. Because CXF seems less intrusive (from an annotation perspective), is there any interest in offering an alternative REST module that uses CXF? It seems to be as simple as generating a Spring file and mapping the CXF Servlet.

The only issue with CXF is it's default "services" page isn't quite as pretty as Enunciate's generated site (it does generate WADL though). It also doesn't generate downloadable clients.

Using the instructions on the wiki, I was able to use Enunciate to generate documentation for my services. I did have to add annotations to my implementation classes for this to work. After doing this, I noticed that the /rest and /soap paths were hard-coded. Would it be possible to make these configurable options? CXF serves up my services from /api/* and I'm putting the Enunciate site at /docs/*. Therefore, I had to do a bit of find-and-replace to make the paths work. I also had to add @Produces to "turn off" the links to the /xml and /json mappings (CXF uses extensions). Here's my Maven configuration I used to fix up the docs:

<profile> <id>docs</id> <build> <plugins> <plugin> <groupId>org.codehaus.enunciate</groupId> <artifactId>maven-enunciate-plugin</artifactId> <version>1.14</version> <executions> <execution> <goals> <goal>docs</goal> </goals> <configuration> <!-- the directory where to put the docs -->

<docsDir>${}/${}/docs</docsDir> </configuration> </execution> </executions> </plugin> <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.3</version> <executions> <execution> <id>fix-docs</id> <phase>process-sources</phase> <configuration> <tasks> <!-- Replace Enunciate's Endpoint URLs with CXF's --> <replaceregexp flags="g"> <regexp pattern="\./rest/(.*)/rest"/> <substitution expression="\.\./api/rest/\1/api/rest"/> <fileset dir="${}/${}/docs"> <include name="**/*.html"/> </fileset> </replaceregexp> <replaceregexp flags="g"> <regexp pattern="\./soap/(.*)/soap"/> <substitution expression="\.\./api/\1/api"/> <fileset dir="${}/${}/docs"> <include name="**/*.html"/> </fileset> </replaceregexp> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile>

In summary, I'm interested in adding a CXF REST implementation to Enunciate as well as allowing the documentation generation to have configurable mount points + extensions.