Hi All,

I'd like to clarify that the original "oauth" demo which was submitted to
CXF was actually relies on Spring MVC which is fine given that one can use
CXF in conjunction with Spring MVC.

I should also say that JAX-RS itself will very likely introduce its own MVC
support.

That said, personally I like the idea of keeping MVC terms out of the
application code itself - which IMHO is more JAX-RS centric way of doing
things, i.e, JAX-RS code is all about the business/service code and it is
the job of JAX-RS providers to link the service data with the specific
presentations (XML, HTML, etc). To that end, CXF offers a simple
RequestDispaterProvider (which is JAX-RS MessageBodyWriter) which is capable
of redirecting the data to the view handlers.

Here is the documentation:

http://cxf.apache.org/docs/jax-rs-redirection.html#JAX-RSRedirection-WithRequestDispatcherProvider

We use this approach in other OAuth demos (not shipped with CXF), for
example, the following contains a lot of jsp handlers:
https://github.com/Talend/tesb-rt-se/tree/master/examples/cxf/jaxrs-oauth2/war/src/main/webapp/forms

and

https://github.com/Talend/tesb-rt-se/blob/master/examples/cxf/jaxrs-oauth2/war/src/main/webapp/WEB-INF/restaurantReserve.xml
 

(line 102)

shows how specific beans can be linked to relevant views.

I like this style most because as far as the actual code is concerned, for
example,
https://github.com/Talend/tesb-rt-se/blob/master/examples/cxf/jaxrs-oauth2/service/src/main/java/oauth2/thirdparty/RestaurantReservationService.java,

only has "@Produces("text/html")" on relevant methods.

XSLTDispatcherProvider can also be handy (for binding JAXB beans to HTML
views):

http://cxf.apache.org/docs/jax-rs-advanced-xml.html#JAX-RSAdvancedXML-XSLTsupport

While the opinions on how to offer an HTML support may be different :-), I
believe that CXF should be able to work with either approach. 

Cheers, Sergey



--
View this message in context: 
http://syncope-dev.1063484.n5.nabble.com/DISCUSS-Switch-to-use-Apache-CXF-for-REST-interface-tp5710952p5710955.html
Sent from the syncope-dev mailing list archive at Nabble.com.

Reply via email to