<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3289902251967497593</id><updated>2012-01-30T14:11:01.040-08:00</updated><title type='text'>Musings about web services</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default?start-index=101&amp;max-results=100'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>134</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-6981164174952312887</id><published>2012-01-30T09:13:00.000-08:00</published><updated>2012-01-30T14:11:01.047-08:00</updated><title type='text'>OAuth without the end user explained</title><content type='html'>One is the most confusing things in &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;OAuth&lt;/span&gt;&lt;/span&gt; is a so-called 2-leg &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;OAuth&lt;/span&gt;&lt;/span&gt; flow where an explicit authorization step involving the end user pressing an Allow or Deny button is not taken.&lt;br /&gt;&lt;br /&gt;There are many resources on the web explaining what is an &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;OAuth&lt;/span&gt;&lt;/span&gt; 2-leg flow. Most of those explanations are effectively describing the process where the 3rd party consumer accesses its own space on the resource server, possibly with the end user  itself 'hiding' behind such a consumer.&lt;br /&gt;&lt;br /&gt;But the classical &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;OAuth&lt;/span&gt;&lt;/span&gt; is about the 3rd party consumer being able to access one way or another the resources of the end user. How does a 2-leg flow gets into the picture ?&lt;br /&gt;&lt;br /&gt;Please read this blog &lt;a href="http://blog.nerdbank.net/2011/06/what-is-2-legged-oauth.html"&gt;entry&lt;/a&gt;. This is the best explanation I've seen so far and it was so good I had to stop doing my current task immediately and quickly update the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;CXF&lt;/span&gt;&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;OAuth&lt;/span&gt;&lt;/span&gt; 1.0 code to be able to handle all the variations of the 2-leg flows better.&lt;br /&gt;&lt;br /&gt;I think this 'pure' 2-leg flow described by Andrew is really close to a client credentials flow in &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;OAuth&lt;/span&gt;&lt;/span&gt; 2.0. Without a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;pre&lt;/span&gt;&lt;/span&gt;-authorized access token (authorization code) the options are limited for a 2-leg flow.&lt;br /&gt;&lt;br /&gt;Please see the updated &lt;a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+OAuth"&gt;documentation&lt;/a&gt; for more information on how &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;CXF&lt;/span&gt; supports &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;OAuth&lt;/span&gt; and its 2-leg flows in particular.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-6981164174952312887?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/6981164174952312887/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=6981164174952312887' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6981164174952312887'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6981164174952312887'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2012/01/oauth-without-end-user-explained.html' title='OAuth without the end user explained'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-5467176033083901505</id><published>2012-01-26T04:06:00.000-08:00</published><updated>2012-01-26T04:53:00.381-08:00</updated><title type='text'>Make your Application Server CXF JAX-RS friendly</title><content type='html'>Now and then I'm seeing users reporting issues on the forums to do with deploying web applications with CXF JAX-RS libraries into some of the popular Java EE application servers. &lt;br /&gt;&lt;br /&gt;So I thought, while investigating a problem reported on the CXF users list to do with using a CXF Redirection feature in WebLogic, that it was also worth giving it a try and experimenting with deploying a complete OAuth demo web application packaged as a war archive that we are working upon into several popular application servers.&lt;br /&gt;&lt;br /&gt;Initially I focused on testing Glassfish, JBoss and WebLogic and you can see the notes on how to overcome various deployment issues &lt;a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Deployment"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;It was a rather interesting exercise and I had few observations at a time.&lt;br /&gt;&lt;br /&gt;WebLogic was the simplest to work with, as far as deploying the application was concerned without having to tweak anything at the container level. The management console of WebLogic is quite sophisticated and seems like this application server is still very capable. I only had to tweak the servlet configuration to get a CXFServlet using a wildcard URI pattern redirecting to WebLogic specific JSP engine properly as advised by the user who reported the issue.&lt;br /&gt;&lt;br /&gt;Glassfish is OSGI-enabled and it was interesting to see Apache Felix serving as the default OSGI framework, which is a good news for the OSGI community at large, as it should drive the fixes back to this Apache project.&lt;br /&gt;&lt;br /&gt;I had hard time though getting past the Jersey filter trying to deal with this application - it was failing eventually due to it not able to inject a CXF-specific JAX-RS Context instance. I only managed to get it work after removing one of Jersey jars from the available libs - one would only have to do it or may be something simpler :-) if the war has JAX-RS Application implementations and the OAuth demo has 5.&lt;br /&gt;&lt;br /&gt;JBoss 7 was easy enough to deploy to. RestEasy also tries to load Applications but it was much easier to deal with it in JBoss. As a side note I thought the way JBoss 7 managed to move away from having to dump all the libs into common folders was very impressive. It is somewhat similar to the Apache Karaf's features mechanism, with Karaf having the repository of libraries and features linking those libraries together. In JBoss the repository itself has some additional metadata.&lt;br /&gt;&lt;br /&gt;One thing I thought about after finishing this exercise was that the fact that the deployed applications are eagerly scanned for JAX-RS interfaces exposes a possible issue with these scanners. And the issue is that these scanners need to check if a deployed war contains a /META-INF/services/javax.ws.rs.ext.RuntimeDelegate resource or not and if it points to some alternative implementation then just leave this web application alone.&lt;br /&gt;&lt;br /&gt;It would make it simpler not only for CXF JAX-RS users who may want to work with Glassfish or JBoss but for Jersey and RestEasy users too who may want to try the containers where either of this popular implementations is not natively supported. Besides, it would meet the general expectation that a self-contained war should be deployable to any Java EE container.&lt;br /&gt;&lt;br /&gt;In meantime, please consider contributing the tips to this &lt;a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Deployment"&gt;section&lt;/a&gt;. The tips in the WebLogic section have been provided on the CXF users list, so please keep them coming.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-5467176033083901505?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/5467176033083901505/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=5467176033083901505' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/5467176033083901505'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/5467176033083901505'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2012/01/make-your-application-server-cxf-jax-rs.html' title='Make your Application Server CXF JAX-RS friendly'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-1042717463758914125</id><published>2012-01-20T02:07:00.000-08:00</published><updated>2012-01-20T02:43:04.952-08:00</updated><title type='text'>CORS Support in CXF</title><content type='html'>Cross-Origin Resource Sharing (&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;CORS&lt;/span&gt;) is a &lt;a href="http://www.w3.org/TR/cors/"&gt;W3C specification&lt;/a&gt; (Working Draft) which "defines a mechanism to enable client-side cross-origin    requests". Please see &lt;a href="http://www.w3.org/TR/cors/#introduction"&gt;the Introduction&lt;/a&gt; for more information.&lt;br /&gt;&lt;br /&gt;We had several users asking questions about how &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;CORS&lt;/span&gt; could possibly be supported in &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;CXF&lt;/span&gt;. Then at some point of time a mysterious :-) &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;sergkorney&lt;/span&gt; offered his help with prototyping an initial code for a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;CORS&lt;/span&gt; filter, and the process moved forward.&lt;br /&gt;&lt;br /&gt;Benson took charge and wrote a comprehensive and well-documented filter implementation which follows the &lt;a href="http://www.w3.org/TR/cors/"&gt;specification&lt;/a&gt; very closely.&lt;br /&gt;&lt;br /&gt;This filter can do the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;preflight&lt;/span&gt; and simple request checks. It interacts with the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;JAX&lt;/span&gt;-RS &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;runtime&lt;/span&gt; by relying on its selection algorithm to confirm that an application has a resource method which is capable of dealing with the current request in cases when the filter does not block. If a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;JAX&lt;/span&gt;-RS resource method which can handle the HTTP OPTIONS verb indicates via a dedicated annotation that it will  handle the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;preflight&lt;/span&gt; check, then the filter will delegate to it. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;JAX&lt;/span&gt;-RS root resources and individual methods can be customized for them to take part in the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;CORS&lt;/span&gt; process.&lt;br /&gt;&lt;br /&gt;It is likely to grow into a more complex security feature in time.&lt;br /&gt;&lt;br /&gt;Please review this initial &lt;a href="http://cxf.apache.org/docs/jax-rs-cors.html"&gt;documentation&lt;/a&gt; (with the link to the package.html), start experimenting and provide the feedback.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-1042717463758914125?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/1042717463758914125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=1042717463758914125' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1042717463758914125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1042717463758914125'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2012/01/cors-support-in-cxf.html' title='CORS Support in CXF'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-9068084774755197592</id><published>2012-01-11T05:42:00.000-08:00</published><updated>2012-01-12T02:38:28.692-08:00</updated><title type='text'>RESTful endpoint in 60 seconds in Talend Open Studio</title><content type='html'>I briefly mentioned in the end of this &lt;a href="http://sberyozkin.blogspot.com/2011/12/locator-support-for-restful-services-in.html"&gt;post&lt;/a&gt; that we are working on the tooling for creating &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;RESTful&lt;/span&gt; endpoints in &lt;a href="http://www.talend.com/download.php?src=HomePage#AI"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;Talend&lt;/span&gt; Open Studio for &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;ESB&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I'd like to offer to your attention my first screen-cast available on the &lt;a href="http://www.youtube.com/user/TalendChannel?feature=watch#p/u/0/a7ZNOGMLPYA"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;Talend&lt;/span&gt; Channel&lt;/a&gt;. It shows how one create and test a basic HTTP Service endpoint echoing the POST payload back to the client. I timed it all for some fun, so it actually did took me 60 seconds to create a service and about 60 seconds to test it.&lt;br /&gt;&lt;br /&gt;Of course one would spend much more time on developing a more involved service but the idea was to give you a glimpse of how easy you can create a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;RESTful&lt;/span&gt; service as well as to point to the flexibility of the tooling as far as wiring the extra components in is concerned.&lt;br /&gt;&lt;br /&gt;Future presentations will show how to create more involved services, those supporting multiple HTTP verbs, with more components facilitating the access to the real data.&lt;br /&gt;&lt;br /&gt;Please listen to this short &lt;a href="http://www.youtube.com/user/TalendChannel?feature=watch#p/u/0/a7ZNOGMLPYA"&gt;presentation&lt;/a&gt;, download the Studio and try creating your own HTTP service and also check what it offers with respect to working with SOAP services and Camel routes.&lt;br /&gt;&lt;br /&gt;Oh yes, one more thing, if you are into languages and you'd like to hear what an Irish-Belorussian accent is about :-), then please listen indeed to this screen-cast&lt;br /&gt;&lt;br /&gt;Enjoy !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-9068084774755197592?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/9068084774755197592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=9068084774755197592' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/9068084774755197592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/9068084774755197592'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2012/01/restful-endpoint-in-60-seconds-in.html' title='RESTful endpoint in 60 seconds in Talend Open Studio'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-1193953415343879833</id><published>2012-01-06T03:42:00.000-08:00</published><updated>2012-01-06T04:02:56.380-08:00</updated><title type='text'>Maven archetype for creating CXF JAX-RS applications</title><content type='html'>A number of Maven &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;plugins&lt;/span&gt; that &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;CXF&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;JAX&lt;/span&gt;-RS users could try for generating the initial code they could build upon for creating working applications was close to zero not too long ago, in fact it was actually 0.&lt;br /&gt;&lt;br /&gt;Then we added a &lt;a href="http://cxf.apache.org/docs/jaxrs-services-description.html#JAXRSServicesDescription-wadl2javacommandlinetool"&gt;wadl2java&lt;/a&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;plugin&lt;/span&gt; so the numbers started to look better :-).&lt;br /&gt;&lt;br /&gt;And now starting from &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;CXF&lt;/span&gt; 2.5.1 an archetype &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;plugin&lt;/span&gt; for creating Spring-based &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;JAX&lt;/span&gt;-RS applications is also available, all thanks to &lt;a href="http://dssheep.blogspot.com/"&gt;Benson&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Please see &lt;a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Maven+Plugins"&gt;this page&lt;/a&gt; for more information.&lt;br /&gt;The generated project will get the integration tests running too, so having a simple end-to-end application created and tested in less than a minute is really cool.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-1193953415343879833?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/1193953415343879833/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=1193953415343879833' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1193953415343879833'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1193953415343879833'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2012/01/maven-archetype-for-creating-cxf-jax-rs.html' title='Maven archetype for creating CXF JAX-RS applications'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-4310687638530443732</id><published>2011-12-29T07:48:00.000-08:00</published><updated>2011-12-30T09:03:51.851-08:00</updated><title type='text'>Jettison 1.3.1 has been released</title><content type='html'>&lt;a href="http://jettison.codehaus.org/"&gt;Jettison 1.3.1&lt;/a&gt; has just been released, please the &lt;a href="http://jettison.codehaus.org/Download"&gt;Download&lt;/a&gt; page for more information about the latest fixes.&lt;br /&gt;&lt;br /&gt;The two updates which would be of interest to CXF users (or those who rely on other stacks that ship the providers wrapping Jettison) are to do with making it possible to create formatted JSON outputs and making sure that the ignorable (empty) text content (reported by JAXB when processing the mixed content data) is blocked. The latter update, among other things, will make the &lt;a href="http://sberyozkin.blogspot.com/2011/10/describing-json-services-in-wadl.html"&gt;WADL JSON representations&lt;/a&gt; look nicer given that they are produced from the wrapped XML payload.&lt;br /&gt;&lt;br /&gt;Few other improvements made it into this release too, particularly those JIRAs which had the patches attached to them have been resolved.&lt;br /&gt;&lt;br /&gt;I'd like to encourage the Jettison community to continue providing patches and as far as I'm concerned I can say that the patches will be eventually applied and the fixes will make it into the the future Jettison releases.&lt;br /&gt;&lt;br /&gt;Happy New Year !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-4310687638530443732?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/4310687638530443732/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=4310687638530443732' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/4310687638530443732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/4310687638530443732'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/12/jettison-131-has-bean-released.html' title='Jettison 1.3.1 has been released'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-6788658678811665304</id><published>2011-12-12T09:25:00.000-08:00</published><updated>2011-12-12T09:39:16.741-08:00</updated><title type='text'>Associating user login names with OAuth Access tokens</title><content type='html'>The classical OAuth flow involves the authorized 3rd-party client magically accessing the end user's resources without even specifying a user name or id, for example:&lt;br /&gt;&lt;br /&gt;GET /user/calendar&lt;br /&gt;&lt;br /&gt;How can the server figure out which resource to return ? The answer is that the request will have an Authorization header with an access token key and in OAuth 1.0 the token needs to get the information about the end user authorizing a given 3rd party consumer associated with it at the authorization time.&lt;br /&gt;&lt;br /&gt;With this association in place, the server will have an easy way to get to the name or id of the user used to authorize the client, and the way to do it in soon to be released CXF 2.5.1 is documented &lt;a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+OAuth#JAX-RSOAuth-Howtogettheuserloginname"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I'd like to thank &lt;a href="http://www.jroller.com/gmazza/"&gt;Glen&lt;/a&gt; for helping me with getting this enhancement done.&lt;br /&gt;&lt;br /&gt;We are continuing working on the demo which will show most of the CXF OAuth support in practice. Please stay tuned to see how you can write secure OAuth applications with CXF :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-6788658678811665304?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/6788658678811665304/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=6788658678811665304' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6788658678811665304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6788658678811665304'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/12/associating-user-login-names-with-oauth.html' title='Associating user login names with OAuth Access tokens'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-909934987980216798</id><published>2011-12-07T02:26:00.000-08:00</published><updated>2011-12-07T03:07:16.165-08:00</updated><title type='text'>Locator Support For RESTful Services in Talend ESB</title><content type='html'>Back in June I &lt;a href="http://sberyozkin.blogspot.com/2011/06/failover-support-for-cxf-jax-rs-clients.html"&gt;blogged&lt;/a&gt; about CXF JAX-RS providing a &lt;a href="http://cxf.apache.org/docs/jax-rs-failover.html"&gt;&lt;span style="text-decoration: underline;"&gt;fail-over support&lt;/span&gt;&lt;/a&gt; for RESTful Java clients and mentioned some relevant work started in Talend. &lt;br /&gt;&lt;br /&gt;Things are happening in the Talend land where all the interesting new features in Apache projects that our Coders team is contributing to are taken on board, analyzed and wired in the products real fast. And the newly released Talend ESB 5 brings a Locator support for RESTful endpoints and clients with the client-side Locator feature built on top of the CXF fail-over mechanism. Kudos to the ESB team for implementing it.&lt;br /&gt;&lt;br /&gt;If you get a working HTTP-centric code then having such a code not hard-coding the endpoint address of the RESTful server which is part of the large WEB application and seeing it working even after a given server or the HTTP connection to it goes down will be encouraging.&lt;br /&gt;&lt;br /&gt;Are you all into writing large RESTful applications end-to-end ? Have problems answering to your friends who like working with SOAP (they are still your friends though :-)) and tell you that with REST it's not possible to write Locator-aware fail-over capable clients ? If the answer to either of those 2 questions is yes then go to a new &lt;a href="http://www.talend.com/index.php"&gt;Talend&lt;/a&gt; web site, download &lt;a href="http://www.talend.com/download.php?src=HomePage#AI"&gt;Talend ESB v5&lt;/a&gt;, get to  /examples/talend/tesb/locator-rest and proceed from there.&lt;br /&gt;&lt;br /&gt;One thing I should mention is that &lt;a href="http://www.talend.com/download.php?src=HomePage#AI"&gt;Talend Open Studio for ESB&lt;/a&gt; is also available for download, it builds on top of Talend Data Integration suite and offers a second-to-none UI support for developing web services and routes. If you work with CXF SOAP Web Services or Camel then you probably won't be able to get back to your old UI tools after trying Talend Open Studio for ESB.&lt;br /&gt;&lt;br /&gt;And the good news is that we are working on bringing the users a tooling for developing RESTful applications. It is a work in progress but it's happening, stay tuned !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-909934987980216798?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/909934987980216798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=909934987980216798' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/909934987980216798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/909934987980216798'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/12/locator-support-for-restful-services-in.html' title='Locator Support For RESTful Services in Talend ESB'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3313802694516429843</id><published>2011-11-23T05:30:00.000-08:00</published><updated>2011-11-23T06:09:40.611-08:00</updated><title type='text'>Observations about Maven Central Search URIs</title><content type='html'>I was using a &lt;a href="http://search.maven.org/"&gt;Maven Central Search Engine&lt;/a&gt; to find a Google GWT artifact. The search engine is very useful, no doubt about it. I then somehow got focused on the actual URI which identifies the specific GWT artifact I was after:&lt;br /&gt;&lt;br /&gt;"http://search.maven.org#search|gav|1|g%3A'com.google.gwt'%20AND%20a%3A'gwt'".&lt;br /&gt;&lt;br /&gt;I'm using single quotes just to keep the whole URI expression inside double quotes.&lt;br /&gt;&lt;br /&gt;That does not seem like a user-friendly URI to me, and I guess it does not have to be, but I'd just like to analyze it a bit more.&lt;br /&gt;&lt;br /&gt;I'm not sure what "|gav|1|" is about, but the main expression (encoded), is really this one:&lt;br /&gt;&lt;br /&gt;"g%3A'com.google.gwt'%20AND%20a%3A'gwt'" which reads like this: "find resources with a group 'com.google.gwt' and artifact 'gwt'".&lt;br /&gt;&lt;br /&gt;Now compare it with this equivalent &lt;a href="http://tools.ietf.org/html/draft-nottingham-atompub-fiql-00"&gt;FIQL&lt;/a&gt; expression which CXF will happily &lt;a href="http://cxf.apache.org/docs/jax-rs-advanced-features.html#JAX-RSAdvancedFeatures-FIQLsearchqueries"&gt;help to handle&lt;/a&gt;:&lt;br /&gt;"g=='com.google.gwt';a=='gwt'"&lt;br /&gt;&lt;br /&gt;thus giving us&lt;br /&gt;&lt;br /&gt;"http://search.maven.org?_s=g=='com.google.gwt';a=='gwt'".&lt;br /&gt;&lt;br /&gt;This query a bit simplistic but FIQL does start 'scaling' when we want to use composite queries, for example:&lt;br /&gt;&lt;br /&gt;"http://search.maven.org?_s=g=='com.google.com';(a=='gwt',a=='gwt-inject');(v=gt=2.0;v=le=3.0)"&lt;br /&gt;&lt;br /&gt;which reads "Find all the modules with a given group, with artifact set to 'gwt' or 'gwt-index' and having versions greater than 2.0 but less or equal to 3.0". It's impressive how FIQL can capture so complex queries in a compact way with a URI which humans can understand. FIQL simply rocks and I encourage users to experiment with it more. By the way, check out the &lt;a href="http://sberyozkin.blogspot.com/2011/04/building-fiql-queries-in-cxf.html"&gt;client-side FIQL&lt;/a&gt; support, can be handy for building FIQL queries inside the HTML forms.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3313802694516429843?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3313802694516429843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3313802694516429843' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3313802694516429843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3313802694516429843'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/11/observations-about-maven-central-search.html' title='Observations about Maven Central Search URIs'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-7592790708321387304</id><published>2011-11-23T02:03:00.000-08:00</published><updated>2011-11-23T04:54:44.752-08:00</updated><title type='text'>[OT] CXF- Even Better Than The Real Thing</title><content type='html'>Listening to U2 for a long time seems to start affecting me, so much that I can't stop 'producing' my own 'mix' (the Title line of this post) of the fantastic U2's "Even Better Than The Real Thing".&lt;br /&gt;Those who follow this blog for a while will notice I'm getting a bit repetitive by mixing 'CXF' with phrases from some songs I've heard, sorry :-). But if you are working with CXF you may probably agree with the title :-). Have Fun.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-7592790708321387304?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/7592790708321387304/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=7592790708321387304' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/7592790708321387304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/7592790708321387304'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/11/ot-cxf-even-better-than-real-thing.html' title='[OT] CXF- Even Better Than The Real Thing'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3162970854836478063</id><published>2011-11-22T04:56:00.000-08:00</published><updated>2011-11-22T05:46:06.626-08:00</updated><title type='text'>Complex WADL Processing in CXF</title><content type='html'>We have seen a number of JIRA issues opened against a &lt;a href="http://cxf.apache.org/docs/jaxrs-services-description.html"&gt;WadlToJava&lt;/a&gt; generator &lt;a href="http://sberyozkin.blogspot.com/2011/06/wadl-first-development-in-cxf.html"&gt;since it was added to CXF 2.4.1&lt;/a&gt;.  Seeing the community experimenting with it was really reassuring and it confirmed there was some genuine interest toward working with WADL. WADL was a really fine effort from Marc Hadley and it does seem to have nearly all it needs to move from a submission to a final recommendation.&lt;br /&gt;&lt;br /&gt;One of the major contributions to the CXF WadlToJava code generator came from Christos Fragoulides who did help to push it to the next level by providing a lot of feedback and fixes while working with a more up-to-date WADL document describing &lt;a href="http://www.rackspace.com/cloud/cloud_hosting_products/servers/api/"&gt;Rackspace Cloud Servers API&lt;/a&gt;. They have a complex WADL document which utilizes most of the WADL capabilities and it is in such cases where one can start seeing the advantages of being able to get a document and start testing the server in a matter of minutes. By the way, Rackspace, hope we can see a more up-do-date WADL document live soon :-).&lt;br /&gt;&lt;br /&gt;Then, when I already thought that our WADL code generator was flying high, came another very good contribution from Lars Weber which should make it possible to get a useful code from WADL descriptions like this &lt;a href="http://www.w3.org/Submission/wadl/#x3-36000A.2"&gt;one&lt;/a&gt;. Now the generator supports local references for all the WADL elements, in addition to &lt;a href="http://cxf.apache.org/docs/jaxrs-services-description.html#JAXRSServicesDescription-SharingdeclarationsbetweenmultipleWADLs"&gt;external resource references&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;Note that the &lt;a href="http://www.w3.org/Submission/wadl/#x3-36000A.2"&gt;AtomPub example&lt;/a&gt; relies on a WADL &lt;a href="http://www.w3.org/Submission/wadl/#x3-290002.12.4"&gt;link&lt;/a&gt; element which can be used to identify a portion of the representation. How one can get to a portion of the representation in CXF JAX-RS ? Easy, use an &lt;a href="http://cxf.apache.org/docs/jax-rs-advanced-xml.html#JAX-RSAdvancedXML-XPathsupport"&gt;XPathProvider&lt;/a&gt;. &lt;br /&gt;  &lt;br /&gt;So please try the WADL code generator in CXF 2.5.0, stress it more and provide the valuable feedback.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3162970854836478063?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3162970854836478063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3162970854836478063' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3162970854836478063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3162970854836478063'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/11/complex-wadl-processing-in-cxf.html' title='Complex WADL Processing in CXF'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-8689044970769177557</id><published>2011-11-10T02:17:00.000-08:00</published><updated>2011-11-10T03:24:38.463-08:00</updated><title type='text'>Lets make OAuth go mainstream with CXF JAX-RS</title><content type='html'>&lt;a href="http://tools.ietf.org/html/rfc5849"&gt;OAuth 1.0&lt;/a&gt; offers a fairly complex HTTP-centric solution to a classical problem of "how a resource owner (end user) can allow a third-party consumer to access some of the resources this user owns on the resource server".&lt;br /&gt;&lt;br /&gt;I recall being quite confused about OAuth and what exactly it was supposed to help with, when starting to look into it about 2 years ago. I guess it was a typical reaction of someone trying to grasp a given technology without having any prior experience in the area. What was the story with that redirection, and then with yet another one, and how all the pieces were supposed to be wired together ? Was it about the authentication or authorization, and where would something like OpenId come in ? I was asking myself those kind of questions.&lt;br /&gt;&lt;br /&gt;It takes a bit of time to realize how elegant OAuth actually is. OAuth 1.0 has been supported by major players such as Google, Facebook and many others. Jersey and RestEasy are offering their support. And OAuth 2.0 is going to make a massive impact real soon.&lt;br /&gt;&lt;br /&gt;CXF 2.5.0 is joining the OAuth game. And we have tried our best to make it possible for users to write complete, functional, secure OAuth applications the way they write their HelloWorld demos. &lt;br /&gt;&lt;br /&gt;Before providing more information, I'd like to thank Lukash Moren for providing a high-quality OAuth 1.0 implementation as part of his GSOC 2009 project, and Bill for asking me to work on OAuth during my brief spell at JBoss - it all kind of happened at the same time...&lt;br /&gt;&lt;br /&gt;Now, please review this &lt;a href="http://cxf.apache.org/docs/jax-rs-oauth.html"&gt;documentation&lt;/a&gt; providing a comprehensive overview of what it takes to create and deploy an OAuth server, with a lot of examples and hints on various approaches one may need to choose from when building a complete OAuth solution.&lt;br /&gt;&lt;br /&gt;Much depends on how the resource server manages the user resources and provides an access the the end users and third-party consumers. Many options are available but the message we'd like to send is that you don't need to create a WEB application similar to those provided by Google or Facebook or Twitter in order to get working with OAuth. CXF JAX-RS provides the ingredients one may need to apply OAuth to all sort of problems requiring the end user authorizing a 3rd party access. Obviously we will be improving what is already there as time goes by.  &lt;br /&gt;&lt;br /&gt;So lets make OAuth go mainstream with CXF JAX-RS, start building OAuth applications and enjoy it all the way.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-8689044970769177557?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/8689044970769177557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=8689044970769177557' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/8689044970769177557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/8689044970769177557'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/11/lets-make-oauth-go-mainstream-with-cxf.html' title='Lets make OAuth go mainstream with CXF JAX-RS'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-7993574359015231829</id><published>2011-11-09T03:20:00.000-08:00</published><updated>2011-11-09T04:53:08.841-08:00</updated><title type='text'>SAML Claims-Based Authorization for JAX-RS endpoints</title><content type='html'>&lt;a href="http://en.wikipedia.org/wiki/SAML_2.0"&gt;SAML&lt;/a&gt; has been around for a while and is used in real-world applications. CXF WS-Security framework is already offering a second-to-none support for SAML, especially with the introduction of the CXF's own STS, please check &lt;a href="http://coheigea.blogspot.com/"&gt;Colm&lt;/a&gt;'s and &lt;a href="http://owulff.blogspot.com/"&gt;Oliver&lt;/a&gt;'s blogs and have some exciting read if you work with WS. Actually, STS can become quite important even for the advanced RESTful security - so follow those blogs even you don't work with WS :-).&lt;br /&gt;&lt;br /&gt;The good thing about SAML is that SAML-based solutions do not have to be WS-* based only. SAML is an extensible and rich language and all sort of SAML profiles can be utilized for RESTful applications too. Arguably SAML is complex but the fact it's being used around is critical. &lt;br /&gt;&lt;br /&gt;CXF JAX-RS is 'keen' to help users start working with SAML. CXF 2.5.0 offers an &lt;a href="http://cxf.apache.org/docs/jax-rs-saml.html"&gt;initial support&lt;/a&gt; for including SAML assertions in the HTTP request payloads and using them to enforce the &lt;a href="http://cxf.apache.org/docs/jax-rs-saml.html#JAX-RSSAML-ClaimsBasedAccessControl"&gt;Claims-Based&lt;/a&gt; or legacy &lt;a href="http://cxf.apache.org/docs/jax-rs-saml.html#JAX-RSSAML-RoleBasedAccessControl"&gt;Role-Based&lt;/a&gt; Access Control rules on the deployed JAX-RS endpoints.   &lt;br /&gt;&lt;br /&gt;One can get a SAML Assertion posted to the server inside a wrapper XML element which will include the actual application payload such as Book and the assertion itself, with the complete envelope being signed only or with both the application payload and the assertion itself being signed individually. All of it is done by registering a couple of client and server side handlers which will transparently add an envelope, signatures and then validate it all on the server side with the application payload (Book) becoming a root XML node in the end, ready to be processed by the JAX-RS runtime.&lt;br /&gt;&lt;br /&gt;With REST we do not always post the XML data so what you can also do is easily add an optionally deflated and then base64-encoded assertion either to the &lt;a href="http://cxf.apache.org/docs/jax-rs-saml.html#JAX-RSSAML-SAMLassertionsinAuthorizationheader"&gt;Authorization&lt;/a&gt; header or a &lt;a href="http://cxf.apache.org/docs/jax-rs-saml.html#JAX-RSSAML-SAMLassertionsasFormvalues"&gt;form field&lt;/a&gt;. Such encoded values might also be signed - something we may support in due time.&lt;br /&gt;&lt;br /&gt;Having a SAML assertion available as part of the application payload raises a question as to what can actually be done with it. SAML is often used to provide SSO solutions for RESTful services, but we are not there yet, so the best thing that we could come up with at this initial stage is to let JAX-RS users utilize SAML claims in order to enforce the access control rules.&lt;br /&gt;&lt;br /&gt;SAML claims are much richer than those which can be asserted with the RBAC rules. However @RolesAllowed and friends are still used a lot and probably will be so it was important to make sure that the legacy rules can work with SAML assertions having claims which are actually representing roles and also offer the way to assert much richer rules which are possible with SAML claims.&lt;br /&gt;&lt;br /&gt;Have a look please at this &lt;a href="http://cxf.apache.org/docs/jax-rs-saml.html#JAX-RSSAML-ClaimsBasedAccessControl"&gt;sample code fragment&lt;/a&gt; and the follow-up comments. One have a lot of flexibility in the way the claim-based rules can be expressed and also complement the existing RBAC rules without even modifying the code which can also be important.&lt;br /&gt;&lt;br /&gt;Before such rules can be enforced, the assertion needs to be validated. The SAML handler will do its own &lt;a href="http://cxf.apache.org/docs/jax-rs-saml.html#JAX-RSSAML-SAMLAssertionValidation"&gt;validation&lt;/a&gt;, and if you have STS deployed them you may actually want to delegate to it to do some validation too (recall the advice at the start of this post :-)). See also how you can &lt;a href="http://cxf.apache.org/docs/secure-jax-rs-services.html#SecureJAX-RSServices-WSTrustintegration"&gt;setup an STS client&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;The question which has not been seriously addressed yet is how one will create SAML assertions in the first place. At this stage one can start experimenting with using a &lt;a href="http://cxf.apache.org/docs/jax-rs-saml.html#JAX-RSSAML-CreatingSAMLAssertions"&gt;callback approach&lt;/a&gt; and I think we can offer a support for utilizing a WS STSClient on the client side for getting the assertions and transparently adding them to the payload easily enough - please note, the fact that STSClient is a WS client is the least important fact here, it's a perfect mediator between the client code and STS and it does not matter if a SAML assertion which will make it into a non-SOAP payload was actually fetched using a SOAP client.&lt;br /&gt;&lt;br /&gt;Note that supporting other interesting SAML-based solutions is of interest to us, that involves the possibility of supporting a &lt;a href="http://en.wikipedia.org/wiki/SAML_2.0#Web_Browser_SSO_Profile"&gt;WEB Browser SSO profile&lt;/a&gt;, etc.&lt;br /&gt;&lt;br /&gt;In meantime, please write your simple SAML callback implementation which will generate SAML assertions and start stressing your endpoints secured by claim-based rules, or even invent a new SAML profile along the way :-) &lt;br /&gt;&lt;br /&gt;Stay tuned !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-7993574359015231829?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/7993574359015231829/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=7993574359015231829' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/7993574359015231829'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/7993574359015231829'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/11/saml-claims-based-authorization-for-jax.html' title='SAML Claims-Based Authorization for JAX-RS endpoints'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3739572212175327441</id><published>2011-11-07T02:50:00.000-08:00</published><updated>2011-11-07T04:52:46.546-08:00</updated><title type='text'>Simple XML Security with CXF JAX-RS</title><content type='html'>Enhancing the security support for JAX-RS services was a major theme during the CXF 2.5.0 development. CXF already offers a good support for users to create secure RESTful services relying on HTTPS and it also offers a number of useful utility classes for enforcing the authentication and authorization rules. &lt;br /&gt;&lt;br /&gt;But the security can be a much richer subject, it is indeed and it is the right time now for us to start working on the advanced security features for CXF JAX-RS users to start experimenting and working with the message level security, tapping into the richness of SAML, deploying OAuth solutions. And we will be analyzing and providing a support for the most interesting and useful security features which are already being or will be used by the community.  &lt;br /&gt; &lt;br /&gt;As far as the message level security is concerned, &lt;a href="http://www.w3.org/TR/xmldsig-core/"&gt;XML Signature&lt;/a&gt; and &lt;a href="http://www.w3.org/TR/xmlenc-core/"&gt;XML Encryption&lt;/a&gt; are the two prominent W3C specifications which have been used as the basis for providing the message integrity and confidentiality without relying on HTTPS mainly for SOAP XML services, with the help of WS-Security related specifications.&lt;br /&gt;&lt;br /&gt;In REST, XML is only one of the many formats which can be supported, but XML is still a very major format which is used a lot. Given the popularity of XML and also to simplify the integration with SOAP-based solutions, it does make sense to get the message-level security supported well for XML services and get to supporting other relevant efforts allowing to sign all sort of payloads next.&lt;br /&gt;&lt;br /&gt;And this is what we did in CXF 2.5.0. We put a lot of effort in providing a solution that will make working with XML Security a child's play yet practical and able to deliver for users relying on JAX-RS.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.w3.org/TR/xmldsig-core/"&gt;XML Signature&lt;/a&gt; and &lt;a href="http://www.w3.org/TR/xmlenc-core/"&gt;XML Encryption&lt;/a&gt; are complex specifications but I hope you can agree after reading this &lt;a href="http://cxf.apache.org/docs/jax-rs-xml-security.html"&gt;section&lt;/a&gt; that working with these specifications and making them protect the messages can be interesting, simple and a real fun.&lt;br /&gt;&lt;br /&gt;Note that all what is needed to get an &lt;a href="http://cxf.apache.org/docs/jax-rs-xml-security.html#JAX-RSXMLSecurity-XMLSignature"&gt;XML signature applied&lt;/a&gt; to a given application payload is to register a single handler on client and server sides. By default, a signature will be enveloped as a last child inside a given XML instance such as Book. On the server side, the signature will be validated, removed from the payload and made available on the current Message for other handlers to use it if needed, for example, for optional SAML handlers be able to verify SubjectConfirmation methods such as "sender-vouches".&lt;br /&gt;&lt;br /&gt;After the payload has become 'free' of its enclosed signature, it's wrapped in a useful CXF DOM-aware STAX reader and passed along to the JAX-RS runtime.&lt;br /&gt;&lt;br /&gt;Making CXF JAX-RS produce enveloping or detached signatures is as easy as setting a signature style property on a client-side handler with the server side one capable of reading all types of signatures.&lt;br /&gt;&lt;br /&gt;And now that we have a signed payload, isn't it tempting to get it &lt;a href="http://cxf.apache.org/docs/jax-rs-xml-security.html#JAX-RSXMLSecurity-XMLEncryption"&gt;encrypted&lt;/a&gt; too ? So here you go, all you need to get a self-contained &lt;a href="http://www.w3.org/TR/xmlenc-core/#sec-eg-EncryptedKey"&gt;EncryptedData&lt;/a&gt; with an embedded EncryptedKey capturing an encryption key is to register a single handler on client and server sides which will help CXF encrypt a payload (possibly signed) and then decrypt it on the server side. &lt;br /&gt;&lt;br /&gt;One thing which is worth noting is that &lt;a href="http://ws.apache.org/wss4j/"&gt;WSS4J&lt;/a&gt; is relied upon by this feature - this is an internal implementation detail and should be of no concern to users building advanced secure RESTful services. WSS4J has a lot of useful code and it makes sense at this stage to reuse it under the hood.&lt;br /&gt;&lt;br /&gt;Give it a try please and as usual, please help us with the feedback. If you are a security expert - let us know what may need to be improved and if you are not - learn new advanced security concepts with CXF and become the one :-) Enjoy !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3739572212175327441?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3739572212175327441/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3739572212175327441' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3739572212175327441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3739572212175327441'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/11/simple-xml-security-with-cxf-jax-rs.html' title='Simple XML Security with CXF JAX-RS'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-930227855505565680</id><published>2011-11-04T03:32:00.001-07:00</published><updated>2011-11-04T04:25:23.500-07:00</updated><title type='text'>Capturing the info about roles with JAASLoginInterceptor</title><content type='html'>CXF ships a useful utility JAASLoginInterceptor which greatly simplifies the process of interacting with the JAAS subsystem and creating a current SecurityContext encapsulating the information about a user principal and roles which will be used for making authorization decisions. See &lt;a href="http://sberyozkin.blogspot.com/2010/12/authentication-and-authorization-cxf.html"&gt;this post&lt;/a&gt; for some more information.&lt;br /&gt;&lt;br /&gt;When working with Apache Karaf, the simple way to get roles distinguished from a user principal is to configure the Karaf JAAS context such that role names start from a prefix such as "role_" and then let JAASLoginInterceptor know about it using a now deprecated "rolePrefix" property. &lt;br /&gt;&lt;br /&gt;However when the existing stores containing the info about roles are used this simple technique may not work given that all sort of naming conventions can be used which may not 'managed' by a rolePrefix property. It makes it trickier to capture roles given that in Karaf the classes representing roles and user principals implement only a single Principal marker interface.&lt;br /&gt;&lt;br /&gt;So in 2.5.0 what you can do in such cases is to use new roleClassifier and roleClassifierType properties to let JAASLoginInterceptor know how to get to the roles. Please see &lt;a href="http://cxf.apache.org/docs/security.html#Security-Authentication"&gt;this section&lt;/a&gt; for an example (the updated content will be visible shortly). This enhancement came after the conversation with my Talend colleague Andrei Shakirin.&lt;br /&gt;&lt;br /&gt;Additionally, Aki Yoshida enhanced the interceptor to better cope with the containers providing custom callbacks, for example, it will work perfectly with Jetty providing ObjectCallback instead of javax.security.auth.callback.PasswordCallback.&lt;br /&gt;&lt;br /&gt;Finally note that SecurityContexts set by JAASLoginInterceptor on the current CXF message implement &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/api/src/main/java/org/apache/cxf/security/LoginSecurityContext.java"&gt;LoginSecurityContext&lt;/a&gt;. This one can be very handy for getting say Spring SecurityContexts populated, for doing the custom authorization based on the list of provided roles and using the underlying Subject returned from the JAAS subsystem as needed.&lt;br /&gt;&lt;br /&gt;If you are asking at this stage, hmm, do I really need to continue using the servlet security, then you are most likely on the right track :-)&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-930227855505565680?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/930227855505565680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=930227855505565680' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/930227855505565680'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/930227855505565680'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/11/capturing-info-about-roles-with.html' title='Capturing the info about roles with JAASLoginInterceptor'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3230537316894643145</id><published>2011-11-01T11:20:00.000-07:00</published><updated>2011-11-01T11:31:31.513-07:00</updated><title type='text'>Better support for big attachments in CXF 2.5.0</title><content type='html'>Dan had a high quality patch from Sam Meder applied just in time before CXF 2.5.0 has been released which is to do with limiting the max size of the incoming attachments - which is a very good improvement indeed. Whether you use WS and MTOM or depend on JAX-RS, a new "org.apache.cxf.io.CachedOutputStream.MaxSize" system property can be your friend, see this &lt;a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Multiparts#JAX-RSMultiparts-Readinglargeattachments"&gt;page&lt;/a&gt; for more info. &lt;br /&gt;And virtually at the same time Dan did another fix for the runtime to cope better with attachments bigger than 2 GB, how about that :-) ?&lt;br /&gt;&lt;br /&gt;It's great to see the CXF Runtime core delivering extremely well as far as working with attachments is concerned&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3230537316894643145?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3230537316894643145/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3230537316894643145' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3230537316894643145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3230537316894643145'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/11/better-support-for-big-attachments-in.html' title='Better support for big attachments in CXF 2.5.0'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-8785219993987466105</id><published>2011-11-01T10:08:00.000-07:00</published><updated>2011-11-01T10:21:07.706-07:00</updated><title type='text'>All you need to get HTML views is RequestDispatcherProvider</title><content type='html'>While working on the new OAuth demo for the soon to be released Talend TSF distro based on Apache CXF 2.5.0 (see Dan's &lt;a href="http://cxf.547215.n5.nabble.com/ANNOUNCE-Apache-CXF-2-5-0-released-td4955562.html"&gt;announcement&lt;/a&gt;), I relied a lot on &lt;a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Redirection#JAX-RSRedirection-WithRequestDispatcherProvider"&gt;RequestDispatcherProvider&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;As you know a typical OAuth flow may involve a lot of interacting with the user and a complete demo should also show the user going to or being redirected to the 3rd party provider site, as well as approving the 3rd party accessing one or more of its private resources.&lt;br /&gt;&lt;br /&gt;I was amazed, I really was, how simple and easy it was to get multiple RequestDispatcherProvider instances configured to redirect all sort of responses to JSP views handlers while still being able to return alternative representations such as XML ones. &lt;br /&gt;&lt;br /&gt;I highly encourage people to try &lt;a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Redirection#JAX-RSRedirection-WithRequestDispatcherProvider"&gt;RequestDispatcherProvider&lt;/a&gt;, say goodbye to complex views integrations and never look back.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-8785219993987466105?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/8785219993987466105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=8785219993987466105' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/8785219993987466105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/8785219993987466105'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/11/all-you-need-to-get-html-views-is.html' title='All you need to get HTML views is RequestDispatcherProvider'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3787964286283600665</id><published>2011-11-01T04:40:00.000-07:00</published><updated>2011-11-01T05:57:39.149-07:00</updated><title type='text'>CXF Transform Feature and Redirection</title><content type='html'>The &lt;a href="http://cxf.apache.org/docs/transformationfeature.html"&gt;Transform feature&lt;/a&gt; is proving to be useful to CXF users, given that dynamically changing or dropping the incoming or outbound namespace(s) as well as updating the element names is often required when the changes have not been propagated across or are not even possible. The fact that all the modifications are done at the STAX level is critical as far as the performance is concerned.&lt;br /&gt;&lt;br /&gt;The feature has been enhanced recently thanks to Aki Yoshida. The incoming payloads can get new elements added in a number of ways which can be very useful when the services validating the data using the close content schemas are in operation. Multiple updates (example, adding some elements, dropping another one, changing the name and or namespace of yet another one - all on the same payload) are better supported too.&lt;br /&gt;&lt;br /&gt;There will be more enhancements coming in in time but I've been actually planning to highlight one of the lesser known tricks which one can use with the Transform feature, something that we &lt;a href="http://sberyozkin.blogspot.com/2011/04/transform-feature-demonstrated-in.html"&gt;demonstrate&lt;/a&gt; in our Talend distributions.&lt;br /&gt;&lt;br /&gt;Consider the case where you have an endpoint deployed with hundreds or many thousands of clients consuming in. Those could be some long-running clients executing the code, possibly embedded in browsers, and that code is aware of the way this endpoint can be consumed. The time has come to deploy an updated endpoint. The more open the environment is - the fewer options are there to get the clients updated at the same time when the old endpoint goes down and the new one gets deployed.&lt;br /&gt;&lt;br /&gt;This is not a new problem per se, but Transform Feature, in combination with the servlet redirection, offers its own simple way to tackle the cost of upgrading all the clients:&lt;br /&gt;&lt;br /&gt;Keep the servlet serving the endpoint which is now down around but only have it redirecting all the requests from the old clients to the new servlet serving the new updated endpoint. This will keep the old clients happy for a while and the process of upgrading them can become less 'stressful'.&lt;br /&gt;&lt;br /&gt;So now we will have a new endpoint serving the new clients but it will also get the requests redirected to it from the older clients. How will the new endpoint figure out how to handle a given request without resorting to a low-level XML or JSON manipulation ?&lt;br /&gt;&lt;br /&gt;Yes, you are right - Transform Feature will help - it will ensure the old requests are recognized by the new endpoint and the responses from this new endpoint are recognized by the old clients still unaware of the fact they are talking to the new endpoint.&lt;br /&gt;&lt;br /&gt;Here is how the relevant part of web.xml may look like:&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- Old Servlet --&amp;gt;&lt;br /&gt;&amp;lt;servlet&amp;gt;&lt;br /&gt; &amp;lt;servlet-name&amp;gt;CXFServletV1&amp;lt;/servlet-name&amp;gt;&lt;br /&gt; &amp;lt;display-name&amp;gt;CXFServletV1&amp;lt;/display-name&amp;gt;&lt;br /&gt; &amp;lt;servlet-class&amp;gt;&lt;br /&gt;   org.apache.cxf.transport.servlet.CXFServlet&lt;br /&gt; &amp;lt;/servlet-class&amp;gt;&lt;br /&gt; &amp;lt;init-param&amp;gt;&lt;br /&gt;  &amp;lt;param-name&amp;gt;redirect-servlet-path&amp;lt;/param-name&amp;gt;&lt;br /&gt;  &amp;lt;param-value&amp;gt;/v2&amp;lt;/param-value&amp;gt;&lt;br /&gt; &amp;lt;/init-param&amp;gt;&lt;br /&gt;&amp;lt;/servlet&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- New Servlet --&amp;gt;&lt;br /&gt;&amp;lt;servlet&amp;gt;&lt;br /&gt; &amp;lt;servlet-name&amp;gt;CXFServletV2&amp;lt;/servlet-name&amp;gt;&lt;br /&gt; &amp;lt;display-name&amp;gt;CXFServletV2&amp;lt;/display-name&amp;gt;&lt;br /&gt; &amp;lt;servlet-class&amp;gt;&lt;br /&gt;   org.apache.cxf.transport.servlet.CXFServlet&lt;br /&gt; &amp;lt;/servlet-class&amp;gt;&lt;br /&gt;&amp;lt;/servlet&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;servlet-mapping&amp;gt;&lt;br /&gt; &amp;lt;servlet-name&amp;gt;CXFServletV1&amp;lt;/servlet-name&amp;gt;&lt;br /&gt; &amp;lt;url-pattern&amp;gt;/v1/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;&amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;servlet-mapping&amp;gt;&lt;br /&gt; &amp;lt;servlet-name&amp;gt;CXFServletV2&amp;lt;/servlet-name&amp;gt;&lt;br /&gt; &amp;lt;url-pattern&amp;gt;/v2/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;&amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;CXFServletV1 will redirect all the requests to the servlet listening on /v2 which is CXFServletV2.&lt;br /&gt;&lt;br /&gt;Next we configure the Transform feature like this:&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt; &lt;br /&gt;&amp;lt;bean id=&amp;quot;transform&amp;quot; &lt;br /&gt; class=&amp;quot;org.apache.cxf.feature.StaxTransformFeature&amp;quot;&amp;gt;&lt;br /&gt; &amp;lt;property name=&amp;quot;contextPropertyName&amp;quot; &lt;br /&gt;              value=&amp;quot;http.service.redirection&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;!-- the rest of the feature config --&amp;gt;     &lt;br /&gt;&amp;lt;/bean&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The feature is configured to do the transformations only if a boolean property identified by the "contextPropertyName" is set on the current message. In this case, if the request has been redirected then the message will have an "http.service.redirection" set to true. It won't be the case for the requests coming from the new clients and thus the feature won't affect them.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3787964286283600665?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3787964286283600665/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3787964286283600665' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3787964286283600665'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3787964286283600665'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/11/cxf-tranform-feature-and-redirection.html' title='CXF Transform Feature and Redirection'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3192754051634326188</id><published>2011-10-02T08:53:00.000-07:00</published><updated>2011-10-06T04:57:01.445-07:00</updated><title type='text'>Describing JSON Services in WADL</title><content type='html'>WADL can describe RESTful XML services really well, by having request and response representations linked to corresponding XML or Relax NG schema element declarations.&lt;br /&gt;However, you've most likely seen the following fragments showing that both XML and JSON representations are supported:&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;&amp;lt;response&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;representation&lt;br /&gt;   mediaType="application/xml"&lt;br /&gt;   element="ns:Book""/&amp;gt;&lt;br /&gt;&amp;lt;representation&lt;br /&gt;   mediaType="application/json"/&amp;gt;&lt;br /&gt;&amp;lt;/response&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The above fragment can describe a method like this one:&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;@GET&lt;br /&gt;@Produces(&lt;br /&gt;{"application/xml",&lt;br /&gt; "application/json"})&lt;br /&gt;public Book getBook() {...}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So given the WADL fragment above, the consumer can get an idea of how an XML response will look like, and thus how to consume and possibly validate it. The description of the JSON response representation gives no information at all.&lt;br /&gt;&lt;br /&gt;That is not fair I can hear you, JSON fans, saying :-). Or perhaps I can hear people saying WADL is not good enough for describing JSON services. But CXF makes things possible :-), and hopefully the following two recent updates can help:&lt;br /&gt;&lt;br /&gt;1. Setting a linkJsonToXmlSchema property on CXF WADLGenerator will result in a fragment like this one be created:&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;&amp;lt;response&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;representation&lt;br /&gt;   mediaType="application/xml"&lt;br /&gt;   element="ns:Book""/&amp;gt;&lt;br /&gt;&amp;lt;representation&lt;br /&gt;   mediaType="application/json"/&amp;gt;&lt;br /&gt;   element="ns:Book""/&amp;gt;&lt;br /&gt;&amp;lt;/response&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Well, describing JSON representation with XML schema is not technically correct, but more often than not an XML schema element instance will give a pretty good idea how a JSON will look like, for example, a Book bean can be used to generate both XML and JSON sequences by the providers in charge.&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Update&lt;/span&gt;: CXF WadlToJava generator has been updated to handle WADL representation elements with the "application/json" media type which link to XML Schema elements.&lt;br /&gt;&lt;br /&gt;2. Setting HTTP Accept header to application/json when requesting WADL will result in a WADL JSON representation returned. For example, given&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;?_wadl&amp;amp;_type=json&lt;br /&gt;&lt;/pre&gt;  &lt;br /&gt;&lt;br /&gt;will return a JSON-format WADL instance. Is that really cool ? You bet it is. What about WADL grammar referencing XML schemas, does it really make sense to JSON-format XML schemas ? No it does not, but we have a &lt;a href="http://json-schema.org/"&gt;JSON schema&lt;/a&gt; initiative so what you need to do is just configure WADLGenerator to reference a schema like the one describing Products in &lt;a href="http://tools.ietf.org/html/draft-zyp-json-schema-03#section-3"&gt;this section&lt;/a&gt; and here you go. For example:&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;WADLGenerator wg = new WADLGenerator();&lt;br /&gt;wg.setSchemaLocations(&lt;br /&gt;   Collections.singletonList("json.schema"));&lt;br /&gt;// do not create JAXB context&lt;br /&gt;wg.setUseJaxbContextForQnames(false);&lt;br /&gt;// let JSON provider handle it&lt;br /&gt;wg.setIgnoreMessageWriters(false);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The provider can have the above properties set from Spring if needed.&lt;br /&gt;The reference to the json.schema will be replaced with an absolute URI so the consumer handling a WADL JSON representation will be able to GET the referenced schema in the follow-up request.&lt;br /&gt;&lt;br /&gt;For the above approach to become of some practical use, the tooling support is important. Consider opening a JIRA in the SoapUI project, vote for it and see what happens :-).&lt;br /&gt;&lt;br /&gt;Enjoy !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3192754051634326188?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3192754051634326188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3192754051634326188' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3192754051634326188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3192754051634326188'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/10/describing-json-services-in-wadl.html' title='Describing JSON Services in WADL'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3645075613167588310</id><published>2011-07-04T04:12:00.000-07:00</published><updated>2011-07-04T04:41:16.736-07:00</updated><title type='text'>What happened at Talend R&amp;D summit</title><content type='html'>Last week many of us had a chance to attend to a 3 day R&amp;amp;D event organized by Talend in Paris. And what a summit it was.&lt;br /&gt;&lt;br /&gt;It was good to meet &lt;a href="http://www.dankulp.com/blog/"&gt;Dan&lt;/a&gt;, &lt;a href="http://blog.nanthrax.net/"&gt;JB&lt;/a&gt;, &lt;a href="http://www.liquid-reality.de/pages/viewpage.action?pageId=131134"&gt;Christian&lt;/a&gt;, our colleagues from Talend Bonn's office and of course the hosts, people who organized and run the event. The only regret I have I could not play our regular chess game with Hadrian - but I guess we have plenty of time in the future to do it again :-)&lt;br /&gt;&lt;br /&gt;I've had a chance to attend to similar events before and I did like it very much, but this last event stands on its own. Talend is still a young company but one can't help being impressed  by what this team has already achieved. The tooling is &lt;span style="font-weight: bold;"&gt;very&lt;/span&gt; impressive, be it Talend ESB, core Talend Data Integration or Master Data Management UI suites. They understand what managing data, jobs, processes is about, what good &lt;span style="font-weight: bold;"&gt;UI&lt;/span&gt; is about.   &lt;br /&gt;&lt;br /&gt;Talend ESB team has had cool demos showing how ESB consumers and producers backed up by Apache CXF can be wired in together, run as live jobs, exported as OSGI bundles, with consumers locating endpoints and users seeing the &lt;a href="http://www.liquid-reality.de/display/liquid/2011/05/25/Monitoring+your+CXF+Services+Calls+with+Talend+ESB+Standard+Edition"&gt;management statistics&lt;/a&gt;. It is really impressive, I thought it was. The new Camel Builder is the tool to explore too - it also supports linking to Talend Jobs with each Job possibly representing a super complex chain on its own.&lt;br /&gt;&lt;br /&gt;Talend team works very hard and this team knows how to play hard too :-).&lt;br /&gt;&lt;br /&gt;Good to be part of Apache and Talend teams...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3645075613167588310?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3645075613167588310/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3645075613167588310' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3645075613167588310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3645075613167588310'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/07/what-happened-at-talend-r-summit.html' title='What happened at Talend R&amp;D summit'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-8768430835971303048</id><published>2011-06-26T14:20:00.000-07:00</published><updated>2011-06-26T15:00:20.332-07:00</updated><title type='text'>WADL First Development in CXF</title><content type='html'>The auto-generation of &lt;a href="http://www.w3.org/Submission/wadl/"&gt;WADL&lt;/a&gt; documents has been supported in CXF JAX-RS for a while. Letting users get a WADL instance and use a tool like &lt;a href="http://www.soapui.org/"&gt;soapUI&lt;/a&gt; to test a live RESTful endpoint is very useful.&lt;br /&gt;&lt;br /&gt;Don't get distracted by the fact WADL is not favoured by some REST advocates. Being able to test a live endpoint without spending time on writing a dedicated test code is good.&lt;br /&gt;&lt;br /&gt;CXF JAX-RS also offers a &lt;a href="http://cxf.apache.org/docs/jaxrs-services-description.html#JAXRSServicesDescription-GeneratingtheclientcodefromWADLatruntime"&gt;CodeGenerator&lt;/a&gt; filter which can be configured on test/development/POC servers for possible users being able to download the source code, compile it and start experimenting immediately. Java is just the only option there for now but of course more languages can be supported easily.&lt;br /&gt;&lt;br /&gt;That is all fine, but one limitation there is that what is possibly the most important WADL feature, underrated at the moment, is not really utilized. WADL is very resource centric and IMHO it's a perfect language for bridging would-be RESTful application modeling tools with the actual code. I'm not referring to UML-like modeling but a more high level approach with a tool linking entities representing root resources, subresources and data and using WADL as a internal link between a specific tool data representation and a wadl2java code generator. I'm not referring to a complex WADL XML editor here.&lt;br /&gt;&lt;br /&gt;All/most of us do Java-first development and it's kind of easy to assume that nobody will need a document-first development. But the document-first approach has its followers as it has its benefits.&lt;br /&gt;&lt;br /&gt;CXF is all about choice, options, diversity and letting users get their web services projects done using the strategies preferred in their teams. CXF 2.4.1 offers a &lt;a href="http://cxf.apache.org/docs/jaxrs-services-description.html#JAXRSServicesDescription-WADLoverview"&gt;server side WADL-first development&lt;/a&gt; support  - give it a try and enjoy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-8768430835971303048?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/8768430835971303048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=8768430835971303048' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/8768430835971303048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/8768430835971303048'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/06/wadl-first-development-in-cxf.html' title='WADL First Development in CXF'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-461059157619293978</id><published>2011-06-24T13:46:00.000-07:00</published><updated>2011-06-24T14:29:57.374-07:00</updated><title type='text'>Talend joins JCP and JSR-339</title><content type='html'>This week &lt;a href="http://www.talend.com/index.php"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;Talend&lt;/span&gt;&lt;/a&gt; has joined &lt;a href="http://www.jcp.org/en/home/index"&gt;Java Community Process&lt;/a&gt; (&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;JCP&lt;/span&gt;) and &lt;a href="http://www.jcp.org/en/jsr/detail?id=339"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;JSR&lt;/span&gt;-339&lt;/a&gt; (&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;JAX&lt;/span&gt;-RS 2.0) Expert Group (&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;EG&lt;/span&gt;) with myself acting as the company representative in this &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;EG&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;This is a good news for us working on Apache &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;CXF&lt;/span&gt; as it's another vote of confidence from &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;Talend&lt;/span&gt; in &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;CXF&lt;/span&gt; continuing positioning itself as the best-of-breed web services framework for developing &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;WS&lt;/span&gt; and REST compliant and robust service endpoints and consumers which just work. &lt;br /&gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;Talend&lt;/span&gt; has a history of supporting open source projects and communities. Joining &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;JCP&lt;/span&gt; and supporting &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;JAX&lt;/span&gt;-RS 2.0 specification is another step in that direction, simply because &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;JAX&lt;/span&gt;-RS 2.0 will become important for Apache &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;CXF&lt;/span&gt; users building &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;RESTful&lt;/span&gt; services.&lt;br /&gt;&lt;br /&gt;Another reason is that &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;Talend&lt;/span&gt; has a lot of experience in data-integration technologies. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;Talend&lt;/span&gt; tooling is powerful and impressive which will be a subject of another post. REST and data are good matches. Many interesting opportunities will arise for exposing data as &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;RESTful&lt;/span&gt; endpoints, letting people search and link to the data of interest. It's natural &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;Talend&lt;/span&gt; would like to get involved in &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_20"&gt;JAX&lt;/span&gt;-RS 2.0.&lt;br /&gt;&lt;br /&gt;See this &lt;a href="http://www.talend.com/blog/"&gt;blog entry&lt;/a&gt; for more information.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="display: block;" id="formatbar_Buttons"&gt;&lt;span class=" on down" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);"&gt;&lt;img src="img/blank.gif" alt="Link" class="gl_link" border="0" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-461059157619293978?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/461059157619293978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=461059157619293978' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/461059157619293978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/461059157619293978'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/06/talend-joins-jcp-and-jsr-339.html' title='Talend joins JCP and JSR-339'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-2081315158047143302</id><published>2011-06-16T03:43:00.000-07:00</published><updated>2011-06-16T04:45:53.083-07:00</updated><title type='text'>Failover support for CXF JAX-RS clients</title><content type='html'>You may recall all those discussions about "RESTful services can be consumed from browsers by humans only" statements. It was awhile back and of course it's been proven since then that it's possible to write a sophisticated client code consuming RESTful services in a number of ways.&lt;br /&gt;&lt;br /&gt;In JAX-RS land, Paul Santoz innovated with introducing the fluent API with all/most JAX-RS stacks having custom implementations, and this API is now being standardized by &lt;a href="http://www.jcp.org/en/jsr/detail?id=339"&gt;JSR-339&lt;/a&gt; expert group. Proxy based API is also supported by some stacks.&lt;br /&gt;&lt;br /&gt;What is important to realize now is that JAX-RS client runtimes need to become more robust and sophisticated in order to move further, beyond supporting the assertion that "yes, we can do it, we can write the client code for working with RESTful services".&lt;br /&gt;&lt;br /&gt;A human working with the browser has more space as far as time and decision making is concerned, when facing a connection failure for example. On the other hand, the code needs to be smarter and ready if the expectations that it does not exit immediately after a connection has become slow, broken or a target endpoint has been recycled is to be met.&lt;br /&gt;&lt;br /&gt;This is where a failover feature comes in and it's been supported for CXF JAX-WS clients for a long time. Starting from CXF 2.4.1 it's also the case for CXF JAX-RS clients.&lt;br /&gt;&lt;br /&gt;Please check &lt;a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Failover"&gt;this page&lt;/a&gt; for more info, experiment and provide the feedback.&lt;br /&gt;&lt;br /&gt;It also confirms that in CXF we are committed to  bringing the best support for developing SOAP and REST services. SOAP  and REST developers have their 'differences' :-) but we understand them,  bring both 'camps' together, and do our best to support them at the  framework level.&lt;br /&gt;&lt;br /&gt;As a side note, if you think about it, making clients failover-capable is a cheap way toward ensuring something close to 24-7 up time. If you are Amazon or BBC then you have all the hardware and experience in place to ensure the clients nearly never experience a "can't connect" problem. What if you are running an OSGI container hosting service endpoints and need to replace a service ?&lt;br /&gt;&lt;br /&gt;Failover-enabling clients is a simple way toward making service endpoints replaceable without affecting the critical client code being executed somewhere.  Configuring a CXF failover feature with a small timeout between retries will do the trick really well.&lt;br /&gt;&lt;br /&gt;One thing which is really exciting for me is that my Talend colleagues are already working on providing enterprise-level failover-like features for CXF JAX-RS clients and I'm going to talk about it in one of the future posts.&lt;br /&gt;&lt;br /&gt;If you have already integrated CXF JAX-RS in your higher-level product then I'd encourage you to follow Talend's lead.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-2081315158047143302?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/2081315158047143302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=2081315158047143302' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2081315158047143302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2081315158047143302'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/06/failover-support-for-cxf-jax-rs-clients.html' title='Failover support for CXF JAX-RS clients'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3837472630875321113</id><published>2011-06-06T08:09:00.000-07:00</published><updated>2011-06-06T08:46:18.049-07:00</updated><title type='text'>Learn about major Apache projects with Talend</title><content type='html'>&lt;a href="http://www.talend.com/"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;Talend&lt;/span&gt;&lt;/a&gt; Application Integration Division team is working on organizing 1 or 2 day courses designed to provide developers with &lt;span style="font-weight: bold;"&gt;free&lt;/span&gt;, hands-on training on Apache &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;CXF&lt;/span&gt;, Apache &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;Karaf&lt;/span&gt;, Apache Camel and Apache &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;ActiveMQ&lt;/span&gt; projects.&lt;br /&gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;Talend&lt;/span&gt; will organize the training days in locations where a reasonable number of people can attend.&lt;br /&gt;&lt;br /&gt;Please take this 5 min &lt;a href="http://ht.ly/575dz"&gt;survey&lt;/a&gt; and start looking forward to meeting &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;Talend&lt;/span&gt; in your local area :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3837472630875321113?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3837472630875321113/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3837472630875321113' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3837472630875321113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3837472630875321113'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/06/learn-about-major-apache-projects-with.html' title='Learn about major Apache projects with Talend'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-9191609692722705652</id><published>2011-05-10T04:07:00.000-07:00</published><updated>2011-05-10T04:36:52.196-07:00</updated><title type='text'>How to use Camel transport with CXF JAX-RS endpoints</title><content type='html'>The following configuration shows how to have HTTP or JMS messages forwarded to &lt;br /&gt;CXF JAX-RS endpoints in Camel:&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;&amp;lt;beans&amp;gt;&lt;br /&gt;&amp;lt;jaxrs:server address=&amp;quot;camel://direct:bookStore&amp;quot;&lt;br /&gt;  serviceClass=&amp;quot;service.BookStoreImpl&amp;quot;/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;camelContext xmlns=&amp;quot;http://camel.apache.org/schema/spring&amp;quot;&amp;gt;&lt;br /&gt;    &lt;br /&gt; &amp;lt;!-- JMS to CXF JAX-RS --&amp;gt;&lt;br /&gt; &amp;lt;route&amp;gt;&lt;br /&gt;  &amp;lt;from uri=&amp;quot;jms://test.bookStore&amp;quot;/&amp;gt;&lt;br /&gt;  &amp;lt;to uri=&amp;quot;direct:bookStore&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;/route&amp;gt;&lt;br /&gt;        &lt;br /&gt; &amp;lt;!--  Jetty to CXF JAX-RS --&gt;&lt;br /&gt; &amp;lt;route&amp;gt;&lt;br /&gt;  &amp;lt;from &lt;br /&gt;uri=&amp;quot;jetty:http://0.0.0.0:9002/bookstore?matchOnUriPrefix=true&amp;quot;/&amp;gt;&lt;br /&gt;  &amp;lt;to uri=&amp;quot;direct:bookStore&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;/route&amp;gt;&lt;br /&gt;&amp;lt;/camelContext&amp;gt;&lt;br /&gt;&amp;lt;/beans&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note that you need to use "camel://direct:bookStore" as the address of the jaxrs endpoint and then use "direct:bookStore" in route definitions. &lt;br /&gt;&lt;br /&gt;The above configuration will only work with the current CXF trunk and 2.3.x branch snapshots.&lt;br /&gt;The address like "camel://direct:bookStore" is confusing CXF JAX-RS a bit in 2.3.4/2.4.0 and earlier. &lt;br /&gt;&lt;br /&gt;However a workaround is available for earlier versions. &lt;a href="http://www.liquid-reality.de/pages/viewpage.action?pageId=131134"&gt;Christian&lt;/a&gt; wrote a couple of &lt;a href="http://www.talend.com/resources/documentation.php#SF"&gt;Talend Integration Factory demos&lt;/a&gt; showing the workaround in action. It is just a matter of adding a simple handler into routes which will make sure CXF JAX-RS is capable of matching requests forwarded to "camel://direct:bookStore". &lt;br /&gt;&lt;br /&gt;That said, I'd encourage those who are interested to check Christian's demos anyway, for example, the jaxrs-http-jms demo also shows how to build a Camel route which gets the response from the jaxrs endpoint and converts it using a JAXB converter and pushes it further to the JMS queue.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-9191609692722705652?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/9191609692722705652/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=9191609692722705652' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/9191609692722705652'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/9191609692722705652'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/05/how-to-use-camel-transport-with-cxf-jax.html' title='How to use Camel transport with CXF JAX-RS endpoints'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-291289893637059425</id><published>2011-04-29T09:30:00.000-07:00</published><updated>2011-04-29T10:00:24.234-07:00</updated><title type='text'>CXF JAX-RS: Moving ahead with WS-Trust integration</title><content type='html'>Making sure existing WS-Trust STS services can be used to enforce the security of deployed web services is of high importance to customers who have invested into WS-Trust based security solutions. It's just a common sense for them.&lt;br /&gt;&lt;br /&gt;CXF provides some very advanced support for securing communications between JAX-WS consumers and providers and delegating to STS for  validating the security tokens. CXF JAX-RS endpoints rely on HTTPS. That is as far as it can get at the moment. That is sufficient in many cases but the fundamental issue is that customers who want to use STS can not depend on it for additionally securing JAX-RS endpoints.&lt;br /&gt;&lt;br /&gt;Now, I've seen people talking about RESTifying STS services, i.e, making sure plain HTTP consumers can talk to it. That is probably a worthy idea as it is likely will make it easier to communicate with STS. It does not solve the issue of using STS for validating all sort of security tokens (SAML assertions, etc) though. &lt;br /&gt;&lt;br /&gt;But the thing is that in CXF we have a very good integration between JAX-WS and JAX-RS frontends.&lt;br /&gt;Reusing JAX-WS and WS-Security runtimes for talking to STS is the fastest and most effective way to ensure JAX-RS endpoints can also be protected with STS.&lt;br /&gt;&lt;br /&gt;Right now, we've done a very small step forward, we can get Basic Authentication credentials validated by STS, see &lt;a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Secure+JAX-RS+Services"&gt;this section&lt;/a&gt; for more info. &lt;br /&gt;&lt;br /&gt;More work will have to be done for supporting SAML assertions passed via HTTPS or as part of XML security protected payloads.&lt;br /&gt;&lt;br /&gt;OAuth and OpenId are also there. CAS is there. Other efforts are under way. These are of interest to us. We have a brilliant OAuth contribution from Łukasz Moreń in the CXF sandbox. But at this stage the integration with WS-Trust/STS is of high priority.&lt;br /&gt;&lt;br /&gt;Stay tuned!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-291289893637059425?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/291289893637059425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=291289893637059425' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/291289893637059425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/291289893637059425'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/04/cxf-jax-rs-moving-ahead-with-ws-trust.html' title='CXF JAX-RS: Moving ahead with WS-Trust integration'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-7167266556644902736</id><published>2011-04-28T05:25:00.000-07:00</published><updated>2011-04-28T06:37:28.857-07:00</updated><title type='text'>Transform Feature demonstrated in Talend Service Factory 2.4.0</title><content type='html'>&lt;a href="http://www.talend.com/download.php#SF"&gt;Talend Service Factory 2.4.0&lt;/a&gt; has several new advanced demos shipped as part of &lt;a href="http://www.talend.com/resources/documentation.php#SF"&gt;the examples distribution&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Please check &lt;a href="http://www.jroller.com/gmazza/entry/tsf_ws_security_samples"&gt;Glen's blog&lt;/a&gt; for the information about WS-Trust and WS-SecurityPolicy demos.&lt;br /&gt;&lt;br /&gt;Here I would like to describe a "jaxrs-jaxws-transformations" demo which shows the new &lt;a href="http://sberyozkin.blogspot.com/2011/04/transforming-xml-in-cxf.html"&gt;Transform Feature&lt;/a&gt; at its best.&lt;br /&gt;&lt;br /&gt;Many options for enhancing the existing XML schemas are possible. Usually, a namespace gets changed to indicate a breaking change to do with reordering elements, changing their names or structure or introducing new elements into a type with a closed schema content. Things are more complicated in the real world where best practices can require namespace changes for all updates made to a given schema.&lt;br /&gt;&lt;br /&gt;The demo 'works' with the case where a Customer type has had a new optional property added to it. In addition, the namespace has also been modified, even though we are not dealing with the breaking update here.&lt;br /&gt;&lt;br /&gt;The demo shows how:&lt;br /&gt;&lt;br /&gt;* old and new JAX-RS clients can talk to existing (old) and new JAX-RS endpoints respectively - usual case&lt;br /&gt;* old and new JAX-WS clients can talk to existing (old) and new JAX-WS endpoints respectively - usual case&lt;br /&gt;&lt;br /&gt;Next, it shows how:&lt;br /&gt;&lt;br /&gt;* new JAX-RS clients can talk to old JAX-RS endpoints&lt;br /&gt;* new JAX-WS clients can talk to old JAX-WS endpoints&lt;br /&gt;&lt;br /&gt;and&lt;br /&gt;&lt;br /&gt;* old JAX-RS clients can talk to new JAX-RS endpoints&lt;br /&gt;* old JAX-WS clients can talk to new JAX-WS endpoints&lt;br /&gt;&lt;br /&gt;In this latter case, with old clients talking to new endpoints, two assumptions are made. First one is that the old clients know they are talking to new endpoints and thus Transform Feature affecting outgoing and incoming payloads is applied on the client side. Second one is that clients do not know that new endpoints will be used to handle their requests - the server side redirection and Transform Feature are used in tandem to make it work.&lt;br /&gt;&lt;br /&gt;Finally,  &lt;a href="http://cxf.apache.org/docs/jax-rs-advanced-xml.html#JAX-RSAdvancedXML-Introduction"&gt;XMLSource&lt;/a&gt; is also shown in action on the client side.&lt;br /&gt;&lt;br /&gt;This is a fairly involved demo trying to show how backward and forward compatibility may get achieved.&lt;br /&gt;&lt;br /&gt;Try this demo and see if you can find it useful for the work you do in the real world.&lt;br /&gt;&lt;br /&gt;Enjoy !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-7167266556644902736?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/7167266556644902736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=7167266556644902736' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/7167266556644902736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/7167266556644902736'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/04/transform-feature-demonstrated-in.html' title='Transform Feature demonstrated in Talend Service Factory 2.4.0'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3362438931989463764</id><published>2011-04-19T07:23:00.000-07:00</published><updated>2011-04-19T08:20:51.827-07:00</updated><title type='text'>Building FIQL queries in CXF</title><content type='html'>Building &lt;a href="http://tools.ietf.org/html/draft-nottingham-atompub-fiql-00#section-3"&gt;FIQL&lt;/a&gt; queries is not a difficult process. Typical queries are simple enough to build them manually, for example:&lt;br /&gt;&lt;br /&gt;_s=id=le=123&lt;br /&gt;&lt;br /&gt;More complex queries relying on 'and' or 'or' conditions (possibly composed with each other) and multiple operators are a bit more tedious and complex to build.&lt;br /&gt;&lt;br /&gt;CXF 2.4.0 introduces a &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/client/SearchConditionBuilder.java"&gt;SearchConditionBuilder&lt;/a&gt; utility class (thanks to Andy Michalec) which can be used to simplify building FIQL queries and working with CXF JAX-RS endpoints already supporting FIQL queries.&lt;br /&gt;&lt;br /&gt;Have a look please at this &lt;a href="http://cxf.apache.org/docs/jax-rs-advanced-features.html#JAX-RSAdvancedFeatures-BuildingFIQLqueries"&gt;section&lt;/a&gt;, try SearchConditionBuilder and provide the feedback.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3362438931989463764?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3362438931989463764/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3362438931989463764' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3362438931989463764'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3362438931989463764'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/04/building-fiql-queries-in-cxf.html' title='Building FIQL queries in CXF'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-7379890160696097695</id><published>2011-04-14T08:41:00.000-07:00</published><updated>2011-04-14T09:40:17.138-07:00</updated><title type='text'>Transforming XML in CXF</title><content type='html'>Working with XML based web services does not only involve having a proxy or HTTP client invoking on the remote endpoint with the underlying data-binding magically populating a given bean instance with the values contained in XML tags.&lt;br /&gt;&lt;br /&gt;Working with XML also implies that some care has to be taken for all those clients distributed all over the enterprise and the WEB at large be able to consume the existing and newer endpoints.&lt;br /&gt;&lt;br /&gt;If you have a newer endpoint deployed that can handle the payloads from the older clients then the &lt;span style="font-weight: bold;"&gt;backward&lt;/span&gt; compatibility is maintained. If the validation is enabled then this is usually achieved by adding optional elements to the updated schema.&lt;br /&gt;&lt;br /&gt;What happens if you have so many endpoints that they have to be gradually replaced by newer ones, should newer clients be blocked from consuming the old endpoints ? Is it really needed if all the new payloads add is some ignorable content that makes the information about a given concept more complete for newer endpoints ? Is it even realistic as in the case of the WEB ? Is telling such clients 'wait, the endpoint is being upgraded' is the cheapest/simplest option ?&lt;br /&gt;&lt;br /&gt;This is where the &lt;span style="font-weight: bold;"&gt;forward&lt;/span&gt; compatibility comes in and it implies that the unrecognized content has to be ignored. Disabling the validation is not always safe as the newer clients providing new content can expect that that new content has been processed into account as opposed to being ignored. Validation will prevent the important unrecognized tags from being dropped. But it also will prevent the forward compatibility altogether.&lt;br /&gt;&lt;br /&gt;The new CXF &lt;a href="http://cxf.apache.org/docs/transformationfeature.html"&gt;Transform Feature&lt;/a&gt; has been introduced and hopefully it will help users with resolving all sorts of backward and forward compatibility issues. CXF JAX-WS and JAX-RS endpoints and clients can be configured for namespaces be dropped or changed, elements dropped, changed or appended to existing elements. This is all realized at the STAX XMLStreamReader and XMLStreamWriter levels so it is fast and effective.&lt;br /&gt;&lt;br /&gt;Does your web service need to talk to the legacy server which does not understand what namespaces are ? Do you need to consume a response from the newer endpoint which has a new namespace introduced ? Do you need certain elements ignored or dropped on the input/output ?&lt;br /&gt;&lt;br /&gt;Use the transformation feature, get inspired and write the services which just work and don't cause all the clients be recompiled/updated whenever a minor change to the new endpoint has been applied. Have the web service clients talking to a variety of endpoints without changing the code.&lt;br /&gt;&lt;br /&gt;The use of the transform feature in combination with the servlet-based  redirection allows for replacing the old endpoints with the new ones and  redirecting the requests from the old clients to the new endpoints.  Which is quite cool. See this &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_soap_rest/WEB-INF/web.xml"&gt;web.xml&lt;/a&gt;  (CXFServletV1 redirects to CXFServletV2, effectively changing final URI  path from /v1/rest-transform to /v2/rest-transform), with CXFServletV2  serving a jaxrs:endpoint with the "restTransform" id, the last jaxrs endpoint  in this &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml"&gt;beans.xml&lt;/a&gt;.  Note this endpoint relies on the transform feature which drops the  namespaces from the inbound payloads and changes the name of the  outbound element, only for redirected requests - so that V1 clients can  talk to V2 endpoints without V2 clients being affected.&lt;br /&gt;&lt;br /&gt;Finally, if you use the default CXF JAX-RS JSONProvider then the transform feature can be applied to input/output JSON sequences too, surely you don't want the JSON clients failing to parse the JSON data if you happen to add one more property to the JAXB bean which is used to produce a JSON sequence :-).&lt;br /&gt;&lt;br /&gt;Most of it can also be done by custom CXF interceptors as well, which can register custom STAX handlers or use XSLT or XPath. I've updated the &lt;a href="http://cxf.apache.org/docs/jax-rs-advanced-xml.html"&gt;Advanced XML&lt;/a&gt; section  on the CXF JAX-RS wiki, have a look please.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-7379890160696097695?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/7379890160696097695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=7379890160696097695' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/7379890160696097695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/7379890160696097695'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/04/transforming-xml-in-cxf.html' title='Transforming XML in CXF'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-1555395517760944486</id><published>2011-04-14T08:15:00.001-07:00</published><updated>2011-04-14T08:39:51.483-07:00</updated><title type='text'>Jettison 1.3 is released</title><content type='html'>As it happens, &lt;a href="http://netzooid.com/blog/"&gt;Dan&lt;/a&gt; and &lt;a href="http://www.nighttale.net/"&gt;Dejan&lt;/a&gt; have let me manage the Jettison project from now on. And thus I'm happy to announce that &lt;a href="http://docs.codehaus.org/display/JETTISON/2011/04/14/Jettison+1.3+Released"&gt;Jettison 1.3 has been released&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Jettison 1.3 has had two patches from CXF users applied.&lt;br /&gt;&lt;br /&gt;MappedXMLStreamReader can now read top-level explicit arrays containing qualified and unqualified tags - this allows JAXB to deserialize such JSON sequences into explicit collections (lists, etc). For this to work, the support for older convention assuming a top-level array may only contain a single node had to be dropped. Additionally, simple tags explicitly set to null  have no CHARACTER events reported.&lt;br /&gt;&lt;br /&gt;I think the good news is that Jettison will keep moving forward. One thing I'd like to clarify is that I won't be actively working with Jettison - however you can definitely expect patches addressing open JIRA issues being applied. Jettison has a small code base, so if you use it and see some issue then just check out the trunk and create a patch.&lt;br /&gt;&lt;br /&gt;This latest release has really being driven by lingering issues opened against CXF JAX-RS but you don't have to use CXF for Jettison JIRAs be fixed - if you like working with Jettison then providing a patch is the only thing you need to do for the given issue be addressed :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-1555395517760944486?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/1555395517760944486/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=1555395517760944486' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1555395517760944486'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1555395517760944486'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/04/jettison-13-is-released.html' title='Jettison 1.3 is released'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-7840650483433332782</id><published>2011-02-21T06:56:00.001-08:00</published><updated>2011-02-24T04:35:40.442-08:00</updated><title type='text'>Advanced Integration with the Talend Integration Factory</title><content type='html'>&lt;a href="http://www.talend.com/download.php#"&gt;Talend Integration Factory&lt;/a&gt;, the Community Edition, has been released recently and is available for the download. Additionally, the Advanced Examples distribution can be downloaded from &lt;a href="http://www.talend.com/resources/documentation.php"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The Talend Integration Factory (TIF) is an advanced platform for building real-world application integration solutions. It is centered around the powerful Apache Camel integration engine.&lt;br /&gt;&lt;br /&gt;What I'm finding interesting about this solution is that the people involved into building it have the in-depth knowledge about what it takes to build the integration solutions which work and scale really well. Their optimism and the number of their ideas is boundless, and this solution will grow and deliver the real value for the customers.&lt;br /&gt;&lt;br /&gt;Give the examples a try - the team is planning to bring you some really interesting  and advanced examples in time, please see Christian's &lt;a href="http://www.liquid-reality.de/display/liquid/2011/02/16/Talend+Integration+Factory+powered+by+Apache+Camel+is+released"&gt;blog entry&lt;/a&gt; for more information.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-7840650483433332782?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/7840650483433332782/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=7840650483433332782' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/7840650483433332782'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/7840650483433332782'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/02/advanced-integration-with-talend.html' title='Advanced Integration with the Talend Integration Factory'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-5187857145551382433</id><published>2011-02-01T13:29:00.000-08:00</published><updated>2011-02-01T13:45:31.822-08:00</updated><title type='text'>JAX-RS Attachments demo in TSF 2.3.2</title><content type='html'>The &lt;a href="http://www.talend.com/download.php#SF"&gt;Talend SF 2.3.2.0&lt;/a&gt; distribution contains various minor improvements and has some dependencies, including the Karaf one, updated to new versions.&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://www.talend.com/resources/documentation.php#SF"&gt;Talend SF 2.3.2.0 Examples&lt;/a&gt; distribution contains a new jaxrs_attachments demo.&lt;br /&gt;&lt;br /&gt;CXF JAX-RS offers a comprehensive support for reading and writing attachments and this demo tries to demonstrate it by showing how &lt;a href="http://www.w3.org/TR/xop10/"&gt;XOP&lt;/a&gt; and regular multiparts can easily be dealt with.&lt;br /&gt;&lt;br /&gt;We are going to build upon it when we move on to doing the more advanced development with the proper support for multiparts being required.&lt;br /&gt;&lt;br /&gt;Have a look at this demo if you're interested. And expect more interesting demos added soon. Stay tuned.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-5187857145551382433?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/5187857145551382433/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=5187857145551382433' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/5187857145551382433'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/5187857145551382433'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/02/jax-rs-attachments-demo-in-tsf-232.html' title='JAX-RS Attachments demo in TSF 2.3.2'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-4129577360576114560</id><published>2011-01-21T13:09:00.000-08:00</published><updated>2011-01-23T14:18:35.946-08:00</updated><title type='text'>Unified Search Experience Made Easy With CXF</title><content type='html'>Providing the quality search experience is an important task for any serious web application project.&lt;br /&gt;&lt;br /&gt;Most of the HTML forms let users do simple queries resulting in the equality or partial match checks on the server side. For example, "Find the book with the id starting from 123" or "Find all the books with the author's first name starting from Fred".&lt;br /&gt;&lt;br /&gt;Imagine the following task. Provide a web interface which will let users search for all the books which have an id greater than 123. Or find the list if customers which paid less than 200 dollars.&lt;br /&gt;&lt;br /&gt;What I've observed quite a few times is that when multiple services are built by individual teams within the same large organization or as part of single large project then every team will create its own query language.&lt;br /&gt;&lt;br /&gt;One team will come with a custom query language built within this very team. And the other team working on some other service will build a slightly different variation of the custom query language.&lt;br /&gt;&lt;br /&gt;The end result is that the users may need to learn two query languages, one in order to query the 1st service and the other one - in order to query the 2nd one.&lt;br /&gt;&lt;br /&gt;Sometimes different teams will agree on using the same query language.&lt;br /&gt;&lt;br /&gt;Using explicit SQL expressions is one option. Most likely a frontend UI tool will collect the user input and convert it into SQL and then pass it to the remote service. IMHO the use of SQL as a query language on the WEB should be discouraged for the obvious reasons: the fact the the end service uses an SQL database for storing the data is the very last thing the consumer should know about, just too much information is being leaked for this to work.&lt;br /&gt;&lt;br /&gt;The use of XQuery or query languages created by Google Data and Microsoft teams is an entirely different approach. It does let developers provide a unified search experience to the users. For example, all the Google Data services have to support the same query language - something that users can appreciate.&lt;br /&gt;&lt;br /&gt;As I mentioned in this &lt;a href="http://sberyozkin.blogspot.com/2010/03/cxf-jaxrs-search-extensions.html"&gt;post&lt;/a&gt;, CXF JAX-RS supports converting &lt;a href="http://tools.ietf.org/html/draft-nottingham-atompub-fiql-00"&gt;FIQL&lt;/a&gt; expressions into SearchCondition expressions which capture the FIQL queries and let users match them against the application data.&lt;br /&gt;&lt;br /&gt;FIQL is indeed a simple language - please read this &lt;a href="http://aruld.info/sakila-restful-search-using-cxf-fiql/"&gt;post&lt;/a&gt; from Arul for a nice introduction to FIQL.  IMHO it does offer a viable alternative to more complex and advanced query languages and we'd like to continue enhancing the CXF search extensions for users be able to get the best out of FIQL.&lt;br /&gt;&lt;br /&gt;The CXF &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchCondition.java"&gt;SearchCondition&lt;/a&gt; interface offers a utility method for converting the FIQL queries to SQL expressions. This method (toSQL()) has been deprecated recently. While the users who find this method working for them may continue using it for a while, it is now recommended to use the SearchCondition visitors, thanks to Brian Topping for providing a patch.&lt;br /&gt;&lt;br /&gt;It were possible to convert SearchCondition into more optimized SQL or non-SQL expressions even before the introduction of visitors but now the relevant code has become much cleaner. The &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java"&gt;SQLPrinterVisitor&lt;/a&gt; is shipped with CXF and it can be used to convert the queries to SQL, using the proper SQL aliases if needed. For example, imagine a query such as "a==b". The 'a' may easily be assumed to be the name of the column in some table - but we may not necessarily want the end users to 'hard code' the names of the columns in the queries; thus the SQL visitor lets the service developers to register an alias map, for the resulting query to contain say "A_Column" instead of 'a'.&lt;br /&gt;&lt;br /&gt;I can imagine XQuery-aware and other visitors being added in time. In fact the way we are trying to build the search extensions is to make sure other query languages such as XQuery/etc are supported transparently. If users will start asking about supporting the new query language then we'll just provide the relevant SearchContext parser and SearchCondition visitor.&lt;br /&gt;&lt;br /&gt;One immediate enhancement we are thinking of is to add a SearchQueryBuilder which users would use to build FIQL/etc queries using simple Java operations and pass the builder result to WebClients or proxies.&lt;br /&gt;&lt;br /&gt;So imagine all the different web services within the same organization supporting the same simple URI friendly query language which is easy to understand and use. One thing you can be sure of is that the end users will appreciate it, especially when they start building their own client applications which need to query a number of those web services.&lt;br /&gt;&lt;br /&gt;By the way, it should work nicely for CXF JAX-WS services too provided they've been JAX-RS-enabled.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-4129577360576114560?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/4129577360576114560/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=4129577360576114560' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/4129577360576114560'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/4129577360576114560'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/01/unified-search-experience-made-easy.html' title='Unified Search Experience Made Easy With CXF'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3518059841306790118</id><published>2011-01-09T11:38:00.000-08:00</published><updated>2011-01-09T12:32:24.547-08:00</updated><title type='text'>JAX-WS and JAX-RS United in CXF</title><content type='html'>I've just reread the &lt;a href="http://sberyozkin.blogspot.com/2008/07/rest-and-soap-united-in-cxf.html"&gt;REST and SOAP United&lt;/a&gt; blog entry I did back in July 2008, more than 2 years ago.&lt;br /&gt;&lt;br /&gt;This theme is as active as ever in CXF; as I've mentioned on this blog quite a few times we've been trying to provide the environment for SOAP developers to experiment with JAX-RS with as few changes as possible and indeed, quite a few CXF SOAP developers do use JAX-RS today while continuing running their SOAP services. Some developers are choosing to annotate the same service interface or implementation class with both JAX-WS and JAX-RS annotations, while some of those, preferring to do the WSDL-first approach, have tried to apply an external CXF JAX-RS user model, something that is demonstrated now in one of the Talend SF demos, and thus avoiding having to modify the (generated) code altogether.&lt;br /&gt;&lt;br /&gt;There have been some new improvements recently in the integration between JAX-WS and JAX-RS runtimes.&lt;br /&gt;&lt;br /&gt;First, many of the custom &lt;a href="http://cxf.apache.org/docs/annotations.html"&gt;CXF annotations&lt;/a&gt; are now supported by the JAX-RS frontend. So one can easily do a combined JAX-WS and JAX-RS service which for example supports a FastInfoset feature by using CXF FastInfoset, Feature or In/OutInterceptors annotations, possibly also relying on say a DataBinding annotation enabling the CXF SDO DataBinding.&lt;br /&gt;&lt;br /&gt;It was possible to wrap &lt;a href="http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-CXFDataBindingsasJAXRSproviders"&gt;CXF DataBindings as JAX-RS MessageBodyReaders and MessageBodyWriters&lt;/a&gt; for a while, with XmlBeans being the latest DataBinding supported, thus effectively reusing the same provider instance between JAX-WS and JAX-RS endpoints.&lt;br /&gt;&lt;br /&gt;But just a couple of weeks ago a CXF user asked about having JAX-RS MessageBodyWriters being used by SOAP JAX-WS endpoints. Does it sound a bit hairy to you :-), irrespectively of whether you are a JAX-WS or JAX-RS developer ?&lt;br /&gt;It might sound so initially but I think it is just the next natural step in the way both frontends can get integrated.&lt;br /&gt;&lt;br /&gt;A user who asked a question had developed an optimized XML Stax provider and did not want to rely on JAXB while working with JAX-WS services. So I just went ahead and added a utility &lt;a href="http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-JAXRSDataBinding"&gt;JAX-RS DataBinding&lt;/a&gt; which can be plugged in into JAX-WS endpoints and which will delegate to custom  JAX-RS writers and readers. I used a &lt;a href="http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-JAXBsupport"&gt;JAXBElementProvider&lt;/a&gt; shipped with the JAX-RS frontend to test this feature. Thus, even though most SOAP developers will unlikely use the feature due to a number of limitations, some of them might go ahead and see if some of the existing JAX-RS XML-aware providers can do something useful for their SOAP applications.&lt;br /&gt;&lt;br /&gt;I've just thought about doing SOAP-Atom with Atom payloads being transmitted inside SOAP envelopes and handled by CXF JAX-RS Atom providers. But no, I won't advocate doing the double enveloping (soap:Envelope plus atom:feed) at all even though this feature makes it possible now :-).&lt;br /&gt;&lt;br /&gt;Have fun :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3518059841306790118?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3518059841306790118/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3518059841306790118' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3518059841306790118'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3518059841306790118'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2011/01/jax-ws-and-jax-rs-united-in-cxf.html' title='JAX-WS and JAX-RS United in CXF'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-1028138067167164610</id><published>2010-12-17T05:16:00.001-08:00</published><updated>2010-12-17T14:34:43.729-08:00</updated><title type='text'>Authentication and Authorization the CXF Way</title><content type='html'>I've been working recently on a number of tests and a demo showing how CXF endpoints can be protected by having consumers relying either on Basic Authentication or WS-Security UsernameTokens authenticated and the authorization rules enforced.&lt;br /&gt;&lt;br /&gt;Often enough, when confronted with the problem of making sure the authentication and the authorization works, many users think of using either the J2EE-style authentication (configured via web.xml) or Spring Security.&lt;br /&gt;&lt;br /&gt;The former option does not really work with WS-Security and sometimes may not be easy to configure in a fine-grained fashion, besides one may want to defer the role verification until just before the actual invocation occurs. The latter option can let you do it all, given how advanced the Spring Security is. If you're a Spring Security savvy person then wiring it in to secure the endpoints against some arbitrary WS-Security tokens can be a child's play :-) but one have to admit that it might be a bit 'intimidating' sometimes and in some cases Spring is simply not used in a given project. Additionally, making it work in OSGI may present quite a challenge on its own.&lt;br /&gt;&lt;br /&gt;The other thing I've heard of is that users dealing with WS-Security may not necessarily want to deal directly with the WSS4J library at the level of their CXF interceptors (by the way, please subscribe to the &lt;a href="http://coheigea.blogspot.com/"&gt;Colm&lt;/a&gt;'s blog for more information about WSS4J and other security-related thoughts and updates).&lt;br /&gt;&lt;br /&gt; So in the end a number of CXF &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/security/"&gt;security interceptors&lt;/a&gt; has been introduced to make it as easy as possible for CXF users to secure the endpoints at the authentication and authorization levels.&lt;br /&gt;&lt;br /&gt;Additionally, a CXF-specific &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/security/"&gt;UsernameToken&lt;/a&gt; has been introduced which at the moment encapsulates the information obtained from the WSS4J UsernameToken.&lt;br /&gt;As you can see, it implements the &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/security/SecurityToken.java"&gt;SecurityToken&lt;/a&gt; interface with the idea being that more token types will be supported in time. For example, an &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/security/AbstractSecurityContextInInterceptor.java"&gt;AbstractSecurityContextInInterceptor&lt;/a&gt; converts a token to a CXF SecurityContext instance by delegating to subclasses which know about a current token type, with&lt;br /&gt;AbstractUsernameTokenInterceptor being one such subclass. In the end, say a concrete AbstractUsernameTokenInterceptor implementation only sees CXF UsernameToken which it needs to use somehow for authenticating and populating a current Subject.&lt;br /&gt;&lt;br /&gt;The Subject instance will be wrapped in a CXF &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/api/src/main/java/org/apache/cxf/security/SecurityContext.java"&gt;SecurityContext&lt;/a&gt; which will be used later on to do the authorization or further wrapped by JAX-RS or JAX-RS SecurityContext objects and injected into service beans. You may want to use &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/security/"&gt;SimplePrincipal and SimpleGroup&lt;/a&gt; helpers if needed when creating custom Subjects.&lt;br /&gt;&lt;br /&gt;Note that CXF ships two SecurityContext implementations which attempt to figure out which Subject Principals are roles. &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/security/DefaultSecurityContext.java"&gt;DefaultSecurityContext&lt;/a&gt; assumes Group instances represent primitive or group roles, while &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/security/RolePrefixSecurityContextImpl.java"&gt;RolePrefixSecurityContextImpl&lt;/a&gt; find the Principals by checking if their names start from the configurable role prefix, example, from "ROLE_" (&lt;a href="http://iocanel.blogspot.com/2010/09/karafs-jaas-modules-in-action.html"&gt;this post&lt;/a&gt; has some more information).&lt;br /&gt;&lt;br /&gt;So far so good - the authentication has been taken care of if you use WS-Security. If you don't them the authentication will occur earlier on at the container entry level, with or without SpringSecurity involved. However, after working on the container-level authentication demo last week it became apparent that CXF needs a utility &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/security/JAASLoginInterceptor.java"&gt;JAASLoginInterceptor&lt;/a&gt;. You only need to tell it the name of the LoginContext to resolve and optionally provide a role prefix name in case Subject does not use Groups to represent the roles. You may also need to override its getCallbackHandler method returning &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/security/NamePasswordCallbackHandler.java"&gt;NamePasswordCallbackHandler&lt;/a&gt; instances by default, for example, this &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JettyJAASLoginInterceptor.java"&gt;custom interceptor&lt;/a&gt; ensures it can handle Jetty ObjectCallbacks for setting the password.&lt;br /&gt;&lt;br /&gt;Another good news is that the JAASLoginInterceptor will work equally well with CXF UsernameTokens (created during WS-Security-related requests) and AuthorizationPolicy capturing Basic or Digest authentication details.&lt;br /&gt;&lt;br /&gt;Next we may need to enforce the authorization rules. &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/security/SimpleAuthorizingInterceptor.java"&gt;SimpleAuthorizingInterceptor&lt;/a&gt; can be injected with a method names to roles map, while  &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/security/SecureAnnotationsInterceptor.java"&gt;SecureAnnotationsInterceptor&lt;/a&gt; takes it one step further and lets users just inject a reference to a secured object and it will figure out how individual methods are supposed to be secured; it checks RolesAllowed annotations by default but one can provide the annotation class name used to specify the roles.&lt;br /&gt;If you have roles stored in say the database then you may want to extend &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/security/AbstractAuthorizingInInterceptor.java"&gt;AbstractAuthorizingInterceptor&lt;/a&gt; and override its getExpectedRoles method.&lt;br /&gt;&lt;br /&gt;If you are securing JAXWS or JAXRS endpoints, you only need to add one or two interceptors, say an optional JAASLoginInterceptor and SimpleAuthorizingInterceptor. When securing JAX-RS endpoints with these interceptors you may also want to add a custom CXF out fault interceptor, for example, like &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/SecurityOutFaultInterceptor.java"&gt;this one&lt;/a&gt;, if you want 403 or 401, instead of 500 being returned; alternatively you can let the exception propagate up to the servlet level when possible and deal with the ServletExceptions at the filter levels.&lt;br /&gt;&lt;br /&gt;The JAX-RS frontend also ships two &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/"&gt;utility filters&lt;/a&gt; wrapping JAASLoginInterceptor and both authorization interceptors, The one which wraps the JAASLoginInterceptor returns 401 by default and adds a realm name to the WWW-Authenticate response header if needed. It also lets users specify the resource URI where the client needs to be redirected to instead of getting 401. If needed a simple subclass can ensure unrecognized callbacks are dealt with the same way it's done with JAASLoginInterceptor. Here is a &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JettyJAASFilter.java"&gt;sample filter&lt;/a&gt; .&lt;br /&gt;&lt;br /&gt;Finally, some more information on how to configure the interceptors. Have a look at this &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_simple_security/WEB-INF/beans.xml"&gt;beans.xml&lt;/a&gt;. The test assumes the authentication is managed by the container, for example, one can configure a Maven Jetty plugin to enforce it. The &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_simple_security/WEB-INF/web.xml"&gt;web.xml&lt;/a&gt;  requests the authentication only and see how SimpleAuthorizingInterceptor and SecureAnnotationsInterceptor are set up to do the rest - the authorization.&lt;br /&gt;&lt;br /&gt;This &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_jaas_security/WEB-INF/beans.xml"&gt;beans.xml&lt;/a&gt; introduces the JAASLoginInterceptor (and the JAX-RS filter) into the picture. I think it would be fare to say it is simple to setup both the JAAS authenticator and the authorization filters in CXF. And guess what - this very configuration can make your application secure without changing a bit in the standalone server, the servlet container and the OSGI container such as Karaf.&lt;br /&gt;&lt;br /&gt;The varying part is ensuring the server/container sees the JAAS configuration such as this &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/jaas.cfg"&gt;one&lt;/a&gt; (FYI, "BookLogin" is the name injected into JAASLoginInterceptor, while &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginModule.java"&gt;BookLoginModule&lt;/a&gt;  is wrapping a Jetty PropertyFileLoginModule).&lt;br /&gt;&lt;br /&gt;In my test I'm passing a system property "java.auth.security.login.config" to the test server process. In Karaf one needs to deploy a bundle containing the JAAS config. The bottom line is that the issue of bootstrapping the server with this information is an issue of its own.&lt;br /&gt;&lt;br /&gt;So what do you do in the end once you set these new CXF interceptors ? You can just relax and see your secure CXF application working like a charm irrespectively of where it is deployed to :-)&lt;br /&gt;&lt;br /&gt;Enjoy !&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="display: block;" id="formatbar_Buttons"&gt;&lt;span class=" on down" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);"&gt;&lt;img src="img/blank.gif" alt="Link" class="gl_link" border="0" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-1028138067167164610?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/1028138067167164610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=1028138067167164610' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1028138067167164610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1028138067167164610'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/12/authentication-and-authorization-cxf.html' title='Authentication and Authorization the CXF Way'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-573018681279279388</id><published>2010-12-17T03:17:00.000-08:00</published><updated>2010-12-17T04:53:29.659-08:00</updated><title type='text'>Talend Service Factory Examples</title><content type='html'>As Dan has already &lt;a href="http://www.dankulp.com/blog/?p=285"&gt;mentioned&lt;/a&gt;, we have created a number of &lt;a href="http://www.talend.com/resources/documentation.php#SF"&gt;documented examples&lt;/a&gt; which have been tuned to run within the OSGI Karaf container shipped as part of the &lt;a href="http://www.talend.com/download.php#SF"&gt;Talend Service Factory release&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The OSGI container in the release is really an optimized OSGI-aware Web Services stack with only the most relevant bundles being loaded. We've also tried to take care of minor issues such as ensuring that the default HTTP port is 8080 and that the HttpService context  is set to "/services" by default as opposed to "/cxf". You can set these initial settings in 30 seconds yourself - but don't you want the demos just to work without having to know how to configure pax web and cxf osgi properties from the very start :-) ?&lt;br /&gt;&lt;br /&gt;We have some serious plans to make sure CXF plays really well in OSGI - please keep an eye on the CXF dev list. We will want to make sure the CXF services and indeed the consumers just work in OSGI.  &lt;br /&gt;&lt;br /&gt;Additionally, most of the examples provide options for starting the services from the command line and within the servlet container.&lt;br /&gt;&lt;br /&gt;Next I'd like to actually spend a bit of time and describe what examples we ship. What we have now is some classical CXF examples, such as the one demonstrating all sorts of CXF interceptors in action and additionally prepared to run in the OSGI container. The OSGI-fied example demonstrating SOAP over JMS specification is also there.&lt;br /&gt;&lt;br /&gt;Finally we have started closing the gap which has existed in the area of JAX-RS demos and we've added 6 new demos.&lt;br /&gt;&lt;br /&gt;Two first demos are called jaxrs-intro and jaxrs-advanced with the idea to show the basic JAX-RS features and then progress to a more involved example, not only showing more sophisticated JAX-RS features but also applying them to solving a reasonably interesting problem, traversing the Person family tree in a number of ways and updating individual Persons. These demos will be regularly updated.&lt;br /&gt;&lt;br /&gt;The next 2 demos, jaxrs-jaxws-java-first and jaxrs-jaxws-description-first show how SOAP and RESTful services can be combined.&lt;br /&gt;The first one shows how both JAX-WS and JAX-RS annotations can be combined on a single interface, how endpoints can share the same service bean and how both JAX-WS and CXF JAX-RS proxies can effectively use the same code for invoking on the services. The second one shows how SOAP services developed using a WSDL-first approach can be selectively exposed as RESTful services by applying an external CXF-JAXRS user model giving that modifying the interface generated from WSDL is not an option.&lt;br /&gt;&lt;br /&gt;What we actually want to show with these 2 demos is that making this experience as seamless as possible is a top priority for us - we do want users to &lt;a href="http://sberyozkin.blogspot.com/2010/02/what-is-common-between-cxf-and.html"&gt;really like developing both SOAP and RESTful services with CXF&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The next demo, jaxrs-jms-http, shows how a typical JAX-RS HTTP server can be enhanced to receive the JMS messages with just adding few extra lines to the configuration. As noted &lt;a href="http://sberyozkin.blogspot.com/2010/02/support-for-jms-in-cxf-jaxrs.html"&gt;here&lt;/a&gt;, you may want to do it if you'd like to preserve your investment in the JAX-RS but also make sure the service is capable of getting the messages from a variety of (transport) channels. This demo also shows how HTTP requests can be processed oneway with the server picking up the messages and forwarding them further to the JMS destination.&lt;br /&gt;&lt;br /&gt;The last example is jaxrs-jaxws-authorization. This example shows CXF authentication and authorization interceptors in action, authenticating the users via JAAS and populating the CXF SecurityContext with Principal and its roles, and then enforcing the authorization rules for both JAX-WS and JAX-RS endpoints. The JAAS interceptor is only used when the demo is run within Karaf so that the Karaf JAAS context can be resolved. When the demo is deployed into the servlet container, the container-managed authentication is utilized to populate the current Principal.&lt;br /&gt;&lt;br /&gt;This demo will be significantly simplified in the next release due to the recent related CXF enhancements (the topic of the next post).   &lt;br /&gt;&lt;br /&gt;You'll see many more examples added in time.&lt;br /&gt;&lt;br /&gt;So please download the examples and give them a try. Note, you have to register in order to download the examples, this is due to the fact the examples content in general is considered to be a premium content at Talend, hopefully it won't be a problem for those who are interested.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-573018681279279388?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/573018681279279388/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=573018681279279388' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/573018681279279388'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/573018681279279388'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/12/talend-service-factory-examples.html' title='Talend Service Factory Examples'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-2174386321991118561</id><published>2010-12-17T02:38:00.000-08:00</published><updated>2010-12-17T03:01:16.275-08:00</updated><title type='text'>Change the world and go home</title><content type='html'>I recall I was reading the &lt;a href="http://www.25hoursaday.com/weblog/2008/01/13/ChangeTheWorldOrGoHomeWhyILoveWorkingAtMicrosoft.aspx"&gt;Change the world or go home&lt;/a&gt; post from &lt;a href="http://www.25hoursaday.com/weblog/default.aspx"&gt;Dare Obasanjo&lt;/a&gt; and being a bit confused not about the content (which was interesting and thought provoking as usual) but about the 'or' bit in the subject.&lt;br /&gt;&lt;br /&gt;I was asking myself, would it make sense to say "Change the world *and* go home" :-) ? I believe all of us working with the Open Source are &lt;a href="http://sberyozkin.blogspot.com/2008/09/fixing-capitalism-with-open-source.html"&gt;changing the world&lt;/a&gt; every day, then we go home in the end of the day, and then we are back at it the next day, changing the world with our individual contributions, negligible in the scope of the big picture.&lt;br /&gt;&lt;br /&gt;Of course, "or" had the meaning in the Dare's post. But I kind of like 'and' more :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-2174386321991118561?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/2174386321991118561/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=2174386321991118561' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2174386321991118561'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2174386321991118561'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/12/change-world-and-go-home.html' title='Change the world and go home'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-1111059919848701263</id><published>2010-11-18T02:13:00.000-08:00</published><updated>2010-11-21T10:32:34.734-08:00</updated><title type='text'>Sopera opens the development center in Ireland</title><content type='html'>Last week myself and my colleague Colm stepped in into an office that Sopera secured for us in Dublin, Ballsbridge. We can nearly see the IONA Building we used to go to not that long ago from our place. The view from its window is really nice. &lt;br /&gt;&lt;br /&gt;We are delighted. Being able to get to the office and work with and talk to your colleagues but also work from home on a given day is the ideal situation for software engineers and it really does feel it is the beginning of the new journey for us, with the only way ahead from here - onwards, especially now that Sopera has been acquired by Talend.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-1111059919848701263?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/1111059919848701263/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=1111059919848701263' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1111059919848701263'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1111059919848701263'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/11/sopera-opens-development-center-in.html' title='Sopera opens the development center in Ireland'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-5285127186807083201</id><published>2010-11-15T09:08:00.000-08:00</published><updated>2010-11-15T09:35:40.843-08:00</updated><title type='text'>CXF Auto Redirect Feature in action</title><content type='html'>I was working today on testing some CXF JAX-RS client code against Tomcat and Jetty servers. All was going well with Tomcat : after deploying a sample.war to Tomcat and doing :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;WebClient wc = WebClient.create("http://localhost:8080/sample";&lt;br /&gt;wc.getCollection(Book.class);&lt;br /&gt;// print the collection&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;a collection of Books was printed in the console.&lt;br /&gt;&lt;br /&gt;However this code stopped working once I deployed a sample.war to Jetty, using  a Maven Jetty plugin. I spent some good few hours debugging it before I spotted that Jetty returns HTTP 302 to a "GET /sample" request with the Location header pointing to "http://localhost:8080/sample/", note the trailing slash. &lt;br /&gt;&lt;br /&gt;So changing the code to&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;WebClient wc = WebClient.create("http://localhost:8080/sample/";&lt;br /&gt;wc.getCollection(Book.class);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;made it work for both Tomcat and Jetty deployments. One other option to deal with the redirects is to use one of the WebClient methods returning JAX-RS Response rather than a typed one, and check the status and then follow the new URI if needed.&lt;br /&gt;&lt;br /&gt;But I found the following code working nicely in the end :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;WebClient wc = WebClient.create("http://localhost:8080/sample";&lt;br /&gt;WebClient.getConfig(wc).getHttpConduit().getClient()&lt;br /&gt;         .setAutoRedirect(true);&lt;br /&gt;wc.getCollection(Book.class);&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-5285127186807083201?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/5285127186807083201/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=5285127186807083201' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/5285127186807083201'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/5285127186807083201'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/11/cxf-auto-redirect-feature-in-action.html' title='CXF Auto Redirect Feature in action'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-6408797499553266214</id><published>2010-11-08T08:48:00.000-08:00</published><updated>2010-11-09T07:55:30.813-08:00</updated><title type='text'>Being at ApacheCon 2010</title><content type='html'>I got a chance to attend to the &lt;a href="http://na.apachecon.com/c/acna2010/"&gt;Apache Conference in Atlanta&lt;/a&gt; last week thanks to Sopera organizing this trip. It was the first time I was at the ApacheCon, and it was an interesting and unique experience.&lt;br /&gt;&lt;br /&gt;First, Sopera had a workshop during the first 2 days of the week, before the conference started, so it was a good opportunity for many of us in the OS team to meet each other and we had some interesting discussions along the way.&lt;br /&gt;&lt;br /&gt;ApacheCon brings together an interesting mix of people, some of them having the commercial interest, some representing large commercial and government organizations adopting OS, and some working on OS projects because this is what they really like doing on their own time.&lt;br /&gt;&lt;br /&gt;It was interesting to listen to some technical talks. And meeting new people and seeing the former colleagues I used to work with (with some of them I will be working again from now on :-)) was great. And of course, meeting CXF legends such as Glen and Benson was another highlight :-).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-6408797499553266214?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/6408797499553266214/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=6408797499553266214' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6408797499553266214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6408797499553266214'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/11/being-at-apachecon-2010.html' title='Being at ApacheCon 2010'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-4857233722318089297</id><published>2010-10-27T09:24:00.000-07:00</published><updated>2010-10-27T09:45:32.200-07:00</updated><title type='text'>Give us your headaches</title><content type='html'>Have I already mentioned that I liked reading the &lt;a href="http://en.wikipedia.org/wiki/Richard_Branson"&gt;Richard Branson&lt;/a&gt;'s auto-biography ?&lt;br /&gt;&lt;br /&gt;I honestly think it was a gem of a book which I picked up in the Gatwick airport on the way to Dublin from Minsk. That is a story about the life journey told with a lot of humor, filled with some absolutely hilarious accounts of various events and with some very serious thoughts about doing business and contributing to saving the humanity.&lt;br /&gt;&lt;br /&gt;You might want to ask, what is it all to do with the web services or software development given this post is not marked with [OT] ?&lt;br /&gt;&lt;br /&gt;During his student days, Richard set up the Student Advisory Centre which consulted students on all the issues they could have, free of charge. One of their slogans was "Give us your headaches". This centre still operates today.&lt;br /&gt;&lt;br /&gt;I thought, when I was reading about it, that to some extent, this is what the OS business model was partly about. In OS we are working on projects such as CXF and we are determined to make it all work really well, without any headaches, in the most demanding environments.&lt;br /&gt;&lt;br /&gt;The OS business model is partially about providing the insurance that customers will experience no headaches when running such OS-driven projects in their productions. In fact this model has been proven very successful, by such top companies such as RedHat for example.&lt;br /&gt;&lt;br /&gt;Are you considering to start using CXF but a bit concerned what will happen further down the road with all the OS development going on into it ?&lt;br /&gt;&lt;br /&gt;Give us your headaches :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-4857233722318089297?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/4857233722318089297/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=4857233722318089297' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/4857233722318089297'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/4857233722318089297'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/10/give-us-your-headaches.html' title='Give us your headaches'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-321540666323682375</id><published>2010-10-27T08:59:00.000-07:00</published><updated>2010-10-27T09:22:58.193-07:00</updated><title type='text'>CXF : Here we come !</title><content type='html'>I'm happy to confirm that after a short break I'm going to have a chance to resume working on CXF and its JAXRS project in particular.&lt;br /&gt;&lt;br /&gt;I'll join &lt;a href="http://www.dankulp.com/blog/"&gt;Dan&lt;/a&gt; and the rest of the Sopera OS team and we will be determined as ever to bring you the best production-quality web services framework around.&lt;br /&gt;&lt;br /&gt;And with your help we will make the CXF users and dev lists the "hippiest place to be", the phrase is borrowed from a &lt;a href="http://en.wikipedia.org/wiki/Richard_Branson"&gt;Richard Branson&lt;/a&gt;'s auto-biography.&lt;br /&gt;&lt;br /&gt;CXF won't be the only effort we will focus in Sopera but it is going to be one of the main ones.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sopera.de/en/home"&gt;&lt;/a&gt;Stay tuned.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-321540666323682375?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/321540666323682375/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=321540666323682375' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/321540666323682375'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/321540666323682375'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/10/cxf-here-we-come.html' title='CXF : Here we come !'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-7063299409973472618</id><published>2010-10-27T07:57:00.000-07:00</published><updated>2010-10-27T08:45:42.668-07:00</updated><title type='text'>Goodbye JBoss</title><content type='html'>So after less than 6 months after starting to work for &lt;a href="http://www.jboss.org/"&gt;JBoss&lt;/a&gt; I decided to quit and accept an offer from &lt;a href="http://www.sopera.de/en/home"&gt;Sopera&lt;/a&gt;. In hindsight, I'm thinking that talking about the career publicly is not always the very best idea - spending such a short period of time at one of the leading company in the industry is not something that will improve my CV.&lt;br /&gt;&lt;br /&gt;Back in April/May I was indeed looking forward to that great opportunity and it was not a stop-gap measure by any means. But CXF and CXF JAXRS are calling me back - it is next to impossible to resist. I'll blog about it next but this post is about JBoss and I'd like to talk about it a bit.&lt;br /&gt;&lt;br /&gt;Just 6 months ago I had a fairly vague idea about what JBoss were doing, apart from knowing that they were part of RedHat, that it was an application server and that their JBossWS project was providing a CXF JAXWS integration option. And of course I knew about RestEasy.&lt;br /&gt;&lt;br /&gt;In the reality, JBoss is a very live, active and progressive project, with a lot of very clever and innovative people working on it and who are really passionate about JBoss. And they have a very open and democratic environment with everyone being able to express their thoughts aloud.&lt;br /&gt;&lt;br /&gt;I've promised in my previous post I'd link to various JBoss subprojects. Here are the links to some of them :&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.jboss.org/jbossws"&gt;JBossWS&lt;/a&gt; : Web Service Framework for JBoss AS&lt;br /&gt;&lt;a href="http://www.jboss.org/resteasy"&gt;RestEasy&lt;/a&gt; : JAX-RS implementation with various features&lt;br /&gt;&lt;a href="http://www.jboss.org/picketlink/docs.html"&gt;PicketLink&lt;/a&gt; :  STS, etc&lt;br /&gt;&lt;a href="http://www.jboss.org/jbosstm"&gt;JBossTS&lt;/a&gt; : While many are saying that WS transactions support is next to impossible to provide this team just does it&lt;br /&gt;&lt;a href="http://jboss.org/hornetq"&gt;HornetQ&lt;/a&gt; :  Putting the buzz in messaging&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;As far as I'm concerned it is obvious I've given away the real opportunity with a great company. That said, the life is about many opportunities, and I'm about to pursue the new and exciting one, with the young and innovative company.&lt;br /&gt;&lt;br /&gt;Goodbye JBoss, Hello Sopera !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-7063299409973472618?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/7063299409973472618/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=7063299409973472618' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/7063299409973472618'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/7063299409973472618'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/10/goodbye-jboss.html' title='Goodbye JBoss'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-5145111290765268307</id><published>2010-05-24T09:47:00.000-07:00</published><updated>2010-05-24T10:44:55.210-07:00</updated><title type='text'>The New Beginning : JBoss</title><content type='html'>Today I've started working for &lt;a href="http://www.jboss.org/"&gt;JBoss&lt;/a&gt;, the division of &lt;a href="http://www.redhat.com/"&gt;RedHat&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;This is a truly new beginning for me and I'm looking forward to my new career in JBoss and RedHat. I'll have a chance to work with and learn from a lot of great engineers and contribute to a number of interesting projects.&lt;br /&gt;&lt;br /&gt;It is a big new world out there. RedHat Linux, JBoss, ws and restful services, clouds, virtualization, messaging, transactions, osgi, etc... I'm optimistic and hopeful it will be a great ride.&lt;br /&gt;&lt;br /&gt;From now on I'll be linking to various RedHat/JBoss related projects, news, etc.&lt;br /&gt;&lt;br /&gt;I'll continue working in a web services area. I'll be involved in a &lt;a href="http://www.jboss.org/jbossws"&gt;JBossWS&lt;/a&gt; project. I'll also have a chance to work with &lt;a href="http://www.jboss.org/resteasy"&gt;RestEasy&lt;/a&gt; and possibly contribute to it; it is a powerful JAXRS implementation which has been leading alongside with Jersey and it is also likely to become a home for realizing and implementing a number of pragmatic ideas coming from the &lt;a href="http://www.jboss.org/reststar"&gt;Rest-*&lt;/a&gt; effort.&lt;br /&gt;&lt;br /&gt;I also have a message for those of you who have decided to try or use CXF JAXRS. It is a project I've put a lot of effort into and I'm really keen to continue supporting CXF JAXRS users which is what I'll be doing though the time I'll be able to spend on it will be limited to after-work hours and weekends. I think CXF JAXRS will do well - it's become quite solid with respect to helping CXF users with developing REST-based services. The development effort which will go into it will become quite limited - but I hope it will live.&lt;br /&gt;&lt;br /&gt;Stay tuned and have fun !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-5145111290765268307?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/5145111290765268307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=5145111290765268307' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/5145111290765268307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/5145111290765268307'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/05/new-beginning-jboss.html' title='The New Beginning : JBoss'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-1712393980449368507</id><published>2010-05-19T06:06:00.000-07:00</published><updated>2010-05-19T06:17:51.406-07:00</updated><title type='text'>New Kid On the Block : JBoss OSGI</title><content type='html'>I've been reviewing today the &lt;a href="http://community.jboss.org/en/jbossosgi"&gt;JBoss OSGI&lt;/a&gt; documentation and I've been really impressed. They can work with existing containers such as Equinox and Felix but can do well on its own too. Check the &lt;a href="http://jbmuc.dyndns.org/jboss-osgi/userguide/html/index.html"&gt;documentation&lt;/a&gt; - it is very well written. &lt;br /&gt;&lt;br /&gt;For some of you a 'new kid on the block' may not sound right if you've worked with or heard of JBossOsgi already :-). &lt;br /&gt;&lt;br /&gt;It's likely to affect the existing balance on the market of OSGI-aware frameworks. Watch this &lt;a href="http://community.jboss.org/en/jbossosgi"&gt;space&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-1712393980449368507?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/1712393980449368507/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=1712393980449368507' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1712393980449368507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1712393980449368507'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/05/new-kid-on-block-jboss-osgi.html' title='New Kid On the Block : JBoss OSGI'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-1258233975258076878</id><published>2010-05-11T09:48:00.000-07:00</published><updated>2010-05-11T10:04:24.331-07:00</updated><title type='text'>OT : bbc.co.uk and tut.by</title><content type='html'>Time and time again I'm being very impressed by the quality of [bbc.co.uk|http://www.bbc.co.uk/]. It is just possibly the best web site which I've seen. Their "Live Football" section is the best one too :-)&lt;br /&gt;&lt;br /&gt;The [tut.by|http://www.tut.by/] (Belorussian news portal) is quite impressive too, not as powerful as the BBC one - but good nonetheless.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-1258233975258076878?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/1258233975258076878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=1258233975258076878' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1258233975258076878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1258233975258076878'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/05/ot-bbccouk-and-tutby.html' title='OT : bbc.co.uk and tut.by'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-2957636848196279283</id><published>2010-03-26T10:37:00.000-07:00</published><updated>2010-03-27T13:39:35.596-07:00</updated><title type='text'>Converting FIQL expressions into SQL queries in CXF JAXRS</title><content type='html'>I've done some more work on the &lt;a href="http://sberyozkin.blogspot.com/2010/03/cxf-jaxrs-search-extensions.html"&gt;search extensions&lt;/a&gt; so that users can easily introspect a given &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchCondition.java"&gt;SearchCondition&lt;/a&gt; instance representing either a primitive or complex query and also added a utility SearchCondition.toSQL(String tableName, String... columnNames) which can be used to convert this search condition into an equivalent SQL query to be subsequently executed against a database.   &lt;br /&gt;&lt;br /&gt;For example,&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;// find all conditions with names starting from 'ami' &lt;br /&gt;// and levels greater than 10&lt;br /&gt;SearchCondition&lt;Condition&gt; sc = &lt;br /&gt;   fiqlParser.parse("name==ami*;level=gt=10");&lt;br /&gt;assertEquals("SELECT * FROM table &lt;br /&gt;              WHERE &lt;br /&gt;              name LIKE 'ami%' &lt;br /&gt;              AND &lt;br /&gt;              level &gt; '10'",&lt;br /&gt;              sq.toSQL("table"));&lt;br /&gt;&lt;br /&gt;// find all conditions with names starting from 'foo' &lt;br /&gt;// and those with names not ending with 'bar' or&lt;br /&gt;// levels greater than 10 &lt;br /&gt;SearchCondition&lt;Condition&gt; sc2 = &lt;br /&gt;   fiqlParser.parse(&lt;br /&gt;   "name==foo*;(name!=*bar,level=gt=10)");&lt;br /&gt;assertEquals("SELECT * FROM table &lt;br /&gt;              WHERE &lt;br /&gt;              (name LIKE 'foo%') &lt;br /&gt;              AND &lt;br /&gt;              ((level &gt; '10'") &lt;br /&gt;                OR &lt;br /&gt;               (name NOT LIKE '%bar')),&lt;br /&gt;              sq.toSQL("table"));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here are some clarifications. First, note that the above code shows that a FIQL parser creates a search condition but it is a unit test code, the actual user code will use a &lt;a href="http://sberyozkin.blogspot.com/2010/03/cxf-jaxrs-search-extensions.html"&gt;SearchContext&lt;/a&gt; instead in a type safe way, providing a bean class to it. SearchContext will create an instance and will inject into it the property values, those provided and extracted from the original FIQL expression.&lt;br /&gt;&lt;br /&gt;This provides for a possibility to protect against possible &lt;a href="http://en.wikipedia.org/wiki/SQL_injection"&gt;SQL injection&lt;/a&gt; attacks at the Java and the bean validation levels. For example, if a Book bean has an integer 'id' property then there's no way an unsafe FIQL query such as 'id==DROP%20users' can result in a 'DROP users' value injected due to a NumberFormatException.&lt;br /&gt;&lt;br /&gt;Additionally, bean setters may have some custom validation logic and the CXF FIQL parser may also get enhanced to check for the bean validation annotations.&lt;br /&gt;&lt;br /&gt;Perhaps you might want to give it a try and see how safe this option of auto-converting FIQL expressions into SQL queries is ? &lt;br /&gt;&lt;br /&gt;In the end of the day, the good thing is that you actually do not have to use &lt;br /&gt;SearchCondition.toSQL to get the SQL query. Suppose you are still concerned about the security or see that this method is not going to help you with building the advanced SQL queries which you actually use in the production, may be you are using java.sql.PreparedStatements or perhaps you don't even use a relational database but rather work with say &lt;a href="http://cassandra.apache.org/"&gt;Cassandra&lt;/a&gt;. If it is the case then just introspect a SearchCondition by getting to all the subconditions it has, and build a query which suits best.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-2957636848196279283?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/2957636848196279283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=2957636848196279283' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2957636848196279283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2957636848196279283'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/03/converting-fiql-expressions-into-sql.html' title='Converting FIQL expressions into SQL queries in CXF JAXRS'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-6374639734517191391</id><published>2010-03-20T10:20:00.000-07:00</published><updated>2010-03-20T11:14:27.551-07:00</updated><title type='text'>XOP support in CXF JAXRS</title><content type='html'>An &lt;a href="http://www.w3.org/TR/xop10/"&gt;XML-binary Optimized Packaging&lt;/a&gt; (XOP) is a W3C specification which is mainly associated with a &lt;a href="http://www.w3.org/TR/soap12-mtom/"&gt;SOAP Message Transmission Optimization Mechanism&lt;/a&gt; (MTOM) but is equally applicable to plain XML.&lt;br /&gt;&lt;br /&gt;XOP is actually a very good specification which provides for the inclusion of binary data in XML payloads via links to co-located or external parts and thus facilitates the processing of such payloads by technologies like XSLT or even XMLSecurity, &lt;a href="http://www.ddj.com/dept/webservices/184406347"&gt;this article&lt;/a&gt; gives a pretty good description. &lt;br /&gt;&lt;br /&gt;A CXF user has recently tried to have a single Java service class serving both SOAP MTOM and 'basic' HTTP multipart-related requests. Now, it is possible to do it, but I found it was not quite appealing so to say for users having to create either MTOM or multipart/related (with no links from the root part) payloads for the whole idea to work out. In addition, users have to add CXF JAXRS Multipart annotations to every method parameters corresponding to individual multipart parts which was not ideal given that the same user was also experimenting with a &lt;a href="http://sberyozkin.blogspot.com/2010/03/wsdl-first-cxf-jaxrs-model-first.html"&gt;document-first approach&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;So it took me virtually 1 day to add a XOP support to CXF JAXRS, thanks, as usual, to the fact that CXF has it all, specifically, attachment interceptors already deal with MTOP/XOP and its JAXB databinding has all the related utility code required for serializing/deserializing XOP payloads. One would need to set a CXF Message.MTOM-ENABLED property on CXF JAXRS clients/endpoints, but I think it is ok even though a property name is SOAP related, but it is really just an indicator to CXF as to whether do XOP or not. &lt;br /&gt;&lt;br /&gt;I think it is a good enhancement indeed :&lt;br /&gt;&lt;br /&gt;- SOAP users doing multiparts (MTOM) can have a simpler option for reusing the same code base when trying to do HTTP/REST as well, the only restriction at the moment is that CXF JAXRS  will not unwrap the complex data types, example, just have a single  EmailPayload method parameter, as opposed to many parameters corresponding to EmailPayload parts, such as text, attachments, etc; it is better anyway IMHO&lt;br /&gt; &lt;br /&gt;- it is just a nice to have feature for CXF JAXRS users to play with, as far the multiparts support is concerned&lt;br /&gt; &lt;br /&gt;The only regret I have is that I started working on it late enough and thus did not have it merged into soon to be released 2.2.7.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-6374639734517191391?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/6374639734517191391/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=6374639734517191391' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6374639734517191391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6374639734517191391'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/03/xop-support-in-cxf-jaxrs.html' title='XOP support in CXF JAXRS'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-5940018073856026050</id><published>2010-03-15T06:31:00.000-07:00</published><updated>2010-03-15T10:36:45.665-07:00</updated><title type='text'>WSDL - first, CXF JAXRS model - first !</title><content type='html'>So you're a SOAP developer who prefers starting the development of a new service from creating a WSDL document first. It is a WSDL-first approach that works for you, not a Java-first one. You are also interested in giving it a try and seeing what advantages following the RESTful style can give the users of your application, but would also like to keep a single code base.&lt;br /&gt;&lt;br /&gt;If so then please read on this long post...&lt;br /&gt;&lt;br /&gt;CXF makes it easy for developers to expose a single Java class as a SOAP and REST service, by sharing a service bean between multiple jaxws and jaxrs endpoints. The problem is, as far as you're concerned, that it requires one to follow a Java-first approach.&lt;br /&gt;&lt;br /&gt;One option is for CXF to offer users an option to do a &lt;a href="http://sberyozkin.blogspot.com/2010/03/on-way-to-wadl-first-development-in-cxf.html"&gt;WADL-first development&lt;/a&gt;.  CXF JAXRS is not quite there just yet but nothing prevents it now from providing a code gen command line utility and a maven plugin. This is an ongoing effort though and some UI tooling support would also be required. So, eventually, one would be able to use WSDL for developing SOAP services and WADL for developing RESTful services. This may or may not become a viable approach for users preferring a document-first style. Working on different documents (WADL and WSDL) might not make much sense, and creating a shared service class will not be possible.&lt;br /&gt;&lt;br /&gt;The other advice which you, the SOAP developer, are most likely to hear today is as follows : you'd be better off migrating to REST/JAXRS altogether rather than sticking with SOAP. So the issue of figuring out how to do SOAP and REST the document-first style at the same time would be resolved. Even though there is some evidence that a number of individual and corporate developers may have done just that, I think this advice may not be the most effective option, as far as convincing those who have invested in SOAP and actually liking it no matter what that there could be a better option awaiting them. It is enhancing the runtime for it to be able to do the advanced stuff SOAP developers can do today with respect to the message-level security, multiparts and the document-first development and providing the easy path for SOAP developers to experiment with REST in the live production is what can convince the most conservative developers over time that the other approach (REST) may be adopted, &lt;a href="http://intertwingly.net/blog/2008/10/21/Progressive-Disclosure"&gt;partially&lt;/a&gt; at least.&lt;br /&gt;&lt;br /&gt;Here is another option CXF could try: implement WSDL2, thus letting users define both SOAP and REST bindings in a single document which can be quite effective from the development point of view. Now, WSDL2 is said to be a better language than WSDL 1.1, but the question is : would an investment into implementing it be cost-effective ? Will it bring new users to CXF? And is it worth investing into it just for the sake of letting users do both SOAP and REST development the document-first way ? It does not seem it can do better that WADL in describing a RESTful application, given that it is more likely WADL can be enhanced even further while WSDL2 will not(not touching here on the interface vs resource centric approaches issue). Finally, as Dan Kulp says, a user demand is just not there, at least at the CXF users list. It can be quite a difficult thing to do, deciding on whether a given feature should be implemented depending on the existing or anticipated demand from users, sometimes expecting the users/customers always indicate to you what should be done next can stifle the innovation, but in case of WSDL2 it seems like the right thing to do. &lt;br /&gt;    &lt;br /&gt;This post has been long enough but I've tried to do some analysis there...So here is what can be done right now the real cost effective way (thanks to one of CXF users trying this option first) : generate your SOAP and JAXB classes from WSDL and then&lt;br /&gt;'attach' some RESTful behavior to generated interfaces by relying on &lt;a href="http://cxf.apache.org/docs/jax-rs.html#JAX-RS-RESTfulserviceswithoutannotations"&gt;the annotation-free feature&lt;/a&gt; and finally have both jaxws and jaxrs endpoint sharing an implementation bean, with the jaxrs endpoint including the model describing the interface only. Example, imagine that no JAXRS annotations exist in this (generated) &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreJaxrsJaxws.java"&gt;source interface&lt;/a&gt;. Next, just describe this interface similarly to the way it is done &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/resources2.xml"&gt;here&lt;/a&gt;. Finally add a &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_proxy/WEB-INF/beans.xml"&gt;jaxrs endpoint&lt;/a&gt; (see the one with a 'bookservice3' id) referring to the model describing this interface and the bean which implements it and you're done.&lt;br /&gt;&lt;br /&gt;It would be mostly about making your code a bit more HTTP aware as opposed to magically turning it into a RESTful application, but it is an easy start and you may want to give it a try. And if it works for you then you might want to ask your friends from the UI team to have a tool generating CXF JAXRS models for you :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-5940018073856026050?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/5940018073856026050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=5940018073856026050' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/5940018073856026050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/5940018073856026050'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/03/wsdl-first-cxf-jaxrs-model-first.html' title='WSDL - first, CXF JAXRS model - first !'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-2560748237693897978</id><published>2010-03-13T08:46:00.000-08:00</published><updated>2010-03-13T10:26:44.604-08:00</updated><title type='text'>CXF JAXRS Search Extensions</title><content type='html'>What is it that defines a user experience on the WEB ? Reading the information, submitting some information, following the links and searching.&lt;br /&gt;&lt;br /&gt;How to let the users do the advanced search of the data your application makes available publicly ? One way is to let users type or transform their requirements into XQuery expressions, another option is to build a URI-friendly query language which will let users easily type it and link to the resulting URIs.&lt;br /&gt;&lt;br /&gt;This &lt;a href="http://www.25hoursaday.com/weblog/CommentView.aspx?guid=77753f6d-1d6a-4e53-a64c-8a469ff6ad35"&gt;post&lt;/a&gt; provides a good comparison between two approaches used by Microsoft Astoria and Google Base Data respectively. As you can see one can do some fairly sophisticated queries but they seem to be quite complicated for users be able to type them manually and in some cases are not easy on the eye. Both approaches provide for advanced search capabilities (to do with hierarchies, etc) but which may not be easy to implement.&lt;br /&gt;&lt;br /&gt;Andy Michalec and myself have worked recently on implementing a search extension which will allow users to use a &lt;a href="http://tools.ietf.org/html/draft-nottingham-atompub-fiql-00"&gt;Feed Item Query Language&lt;/a&gt; (FIQL) to  do the advanced search queries against CXF JAXRS endpoints. FIQL is a simple, very intuitive and easy on the eye URI-friendly language which lets users express fairly advanced queries.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.mnot.net/"&gt;Mark Nottingham&lt;/a&gt; writes simple and practical  specifications. CXF now implements two specifications authored by Mark, &lt;a href="http://www.ietf.org/rfc/rfc5005.txt"&gt;RFC-5005&lt;/a&gt; (&lt;a href="http://sberyozkin.blogspot.com/2010/02/use-your-favorite-atom-reader-to-view.html"&gt;partially&lt;/a&gt;) and the FIQL &lt;a href="http://tools.ietf.org/html/draft-nottingham-atompub-fiql-00"&gt;draft&lt;/a&gt; and I think CXF users will start getting some real value out of it.&lt;br /&gt;&lt;br /&gt;Even though FIQL is a language originally meant to be used for searching Atom feeds, it is written such that non-Atom data can be searched too. So after Andy has spent an hour or so :-) on writing a quality FIQL parser, I just wired in a &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchContext.java"&gt;SearchContext&lt;/a&gt; into the CXF JAXRS runtime and now users can do the following :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;WebClient wc =&lt;br /&gt;WebClient.create("http://localhost:9080/books?"&lt;br /&gt;+ "_s=name==CXF*;id=ge=123;id=lt=555");&lt;br /&gt;List&amp;lt;Book&amp;gt; books = wc.getCollection(Book.class);&lt;br /&gt;&lt;/book&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here we create a FIQL expression allowing us to get all the books with names starting from "CXF" and ids greater or equal to 123 but less than 555. FIQL can let you do much more powerful queries but I think it is just a brilliant effort from Mark.&lt;br /&gt;&lt;br /&gt;Note how simple the query is, here are the rules in a nutshell : it is only the first '=', the one which follows an _s query name (for the record, _search is also supported) which acts as a usual separator between a query name and its value, '==' means 'equals', while '=' in '=gt=', etc helps easily identify a condition such as 'greater than'. A user can quite easily type such an expression in a browser without some (web )UI gadget hiding the complexity of the language.&lt;br /&gt;&lt;br /&gt;And here is the server side test code :&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;@Path("books")&lt;br /&gt;public class Books {&lt;br /&gt;&lt;br /&gt;private Map&amp;lt;Long, Book&amp;gt; books;&lt;br /&gt;@Context&lt;br /&gt;private SearchContext context;&lt;br /&gt;&lt;br /&gt;@GET&lt;br /&gt;public List&amp;lt;Book&amp;gt; getBook() {&lt;br /&gt;&lt;br /&gt;SearchCondition&amp;lt;Book&amp;gt; sc =&lt;br /&gt;   searchContext.getCondition(Book.class);&lt;br /&gt;List&amp;lt;Book&amp;gt; found = sc.findAll(books.values());&lt;br /&gt;return found;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;An injected SearchContext returns you a &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchCondition.java"&gt;SearchCondition&lt;/a&gt; which can be a composite one and encapsulates a given FIQL expression, though nothing prevents us transparently supporting other languages in the future, such as XQuery, etc.&lt;br /&gt;&lt;br /&gt;Now, at the moment the assumption is made that the data are kept in memory, but often enough the search requirements are passed down to the database layer. You can try to push SearchCondition as close as possible to the db layer but SearchCondition, having captured the FIQL expression can let you easily transform it into an SQL language expression if needed, ex, it can let you check all the conditions it encapsulates, and the values which will be used during the checks, etc.&lt;br /&gt;&lt;br /&gt;I'm not sure yet if I'll merge it into 2.2.7-SNAPSHOT or not. May be I'll keep it in 2.3-SNAPSHOT and experiment a bit more and then merge it into 2.2.8-SNAPSHOT once the interfaces are deemed capable enough. Will also update the Atom pull server to let users search for very specific log entries, that what FIQL was created for :-)&lt;br /&gt;&lt;br /&gt;Enjoy !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-2560748237693897978?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/2560748237693897978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=2560748237693897978' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2560748237693897978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2560748237693897978'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/03/cxf-jaxrs-search-extensions.html' title='CXF JAXRS Search Extensions'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-6771389302691302126</id><published>2010-03-10T04:17:00.000-08:00</published><updated>2010-03-10T07:52:43.030-08:00</updated><title type='text'>On the way to WADL-first development in CXF JAXRS</title><content type='html'>Yesterday I added a CXF JAXRS request filter capable of generating the Java code for consuming a given JAXRS resource on demand. I was about to finish it two weeks ago but had to postpone it a bit. Here's a test code fragment showing how to get a zip containing the source :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;// Get the link to the source&lt;br /&gt;WebClient wc =&lt;br /&gt; WebClient.create("http://localhost:9080/petstore");&lt;br /&gt;XMLSource source = wc.query("_code")&lt;br /&gt;                    .query("_os", getOs())&lt;br /&gt;                    .get(XMLSource.class);&lt;br /&gt;String link = source.getValue(&lt;br /&gt;  "ns:html/ns:body/ns:ul/ns:a/@href",&lt;br /&gt;  Collections.singletonMap("ns",&lt;br /&gt;    "http://www.w3.org/1999/xhtml"));&lt;br /&gt;// download a zip file          &lt;br /&gt;WebClient wcZip = WebClient.create(link);&lt;br /&gt;InputStream is = wcZip.accept("application/zip")&lt;br /&gt;                .get(InputStream.class);&lt;br /&gt;// unzip and compile it&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Please see a &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java"&gt;testPetStoreSource&lt;/a&gt; test for more details. The _os query is optional, it is there to ensure you can get OS-specific line separators added to some of the generated classes (ex, the server is running on Windows, you'd like to run a test client on Unix). You can also add a _language query but it is only Java which is supported for now.&lt;br /&gt;&lt;br /&gt;What is interesting is that a newly introduced CodeGeneratorProvider generates the source from a WADL instance which another provider, WADLGenerator, creates after introspecting a given JAXRS resource. The zipped source will contain the JAXB-generated classes from a WADL grammar section (if any) and the proxies (interfaces) representing WADL resources, including the subresources, with the resource methods linking to corresponding JAXB classes.&lt;br /&gt;&lt;br /&gt;You can request that classes be generated from a WADL grammar section only by adding a _codeType=grammar query. Two other possible values here are 'proxy' and 'web', the former value is a default one at the moment with the latter one being not supported yet. I need to think a bit more about what sort of code can be generated for a _codeType=web. Suppose we have a resource named BookStore. What is the difference between a method called getBook (in case of proxies) and a method called get(in case of web clients) ?  I'm also not sure yet what to do with cases where WADL resource contains multiple methods like GET but with different mediaType values, need a bit more time. In meantime if the word 'proxy' makes you nervous :-) then please just use _codeType=grammar to download the classes representing schema elements and proceed from there by using your JAXRS runtime's web client api.&lt;br /&gt;&lt;br /&gt;How does CodeGeneratorProvider generate the proxies given that &lt;a href="http://sberyozkin.blogspot.com/2009/11/wadl-dilemma.html"&gt;WADL does not provide for it&lt;/a&gt; ? Internally, it requests a WADLGenerator to add 'id' attributes to WADL resource elements representing root or subresource resources and to WADL resource/method elements. Example, wadl:resource/@id="{org.apache.cxf.test.RootResource}" and wadl:resource/wadl:method/@id="getBook".&lt;br /&gt;&lt;br /&gt;This is really all what 'facilitates' the WADL to Java code generation which is exactly what CodeGeneratorProvider does. In fact, I haven't actually even thought originally about introducing such a provider but then I thought that a future command-line codegen tool allowing for a server-side code be generated from a WADL document will do exactly what CodeGeneratorProvider does, albeit it will generate the resource class skeletons as opposed to proxies. In fact, given that CodeGeneratorProvider is a regular CXF JAXRS provider, you can set a false 'generateInterfaces' property on it and you'll get a *server-side* code downloaded, perhaps you might want to use it to write your own added-value service interposing the original one.&lt;br /&gt;&lt;br /&gt;CXF 2.2.7 will be out soon so please experiment with this new feature.&lt;br /&gt;&lt;br /&gt;I'll need to think a bit more about the format for resource ids, perhaps it can be just "BookStore" but a future codegen tool can ask users to provide a package name. We can have JAXB classes acting as subresources that is why I've introduced an extended QName format initially. At the moment WADL does not allow internal method elements to contain ids (as opposed to global &lt;a href="http://www.w3.org/Submission/wadl/#x3-70002.2"&gt;ones&lt;/a&gt;), hope this restriction can be lifted, alternatively it would be easy for a (UI) tool allowing users to create WADL documents to ensure resource methods are declared globally and then linked to from internal resources.&lt;br /&gt;&lt;br /&gt;Seems like using resource and method ids for the purpose of allowing WADL-first development might make sense, it will preserve the simplicity of WADL the language.&lt;br /&gt;&lt;br /&gt;Finally, why worry about the WADL-first development ? It is simple : IMHO it might help in making the RESTful approach toward developing web services being more attractive to many developers who prefer starting with building a picture of the future application first. So imagine your UI tool showing a nice view of how resources relate/link to each other and what formats and HTTP methods they support and schemas they're aware of, would not it be cool to be able to press a button next and have most of the code being generated for you ?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-6771389302691302126?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/6771389302691302126/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=6771389302691302126' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6771389302691302126'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6771389302691302126'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/03/on-way-to-wadl-first-development-in-cxf.html' title='On the way to WADL-first development in CXF JAXRS'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-6989697940719881073</id><published>2010-03-10T03:47:00.000-08:00</published><updated>2010-03-10T04:13:57.980-08:00</updated><title type='text'>CXF is my favourite game</title><content type='html'>I was listening to the radio in the car this morning and I heard 'And I'm losing my favourite game' by The Cardigans. For some reasons, I'm often associating certain phrases from the songs I hear at a given moment of time with what I'm thinking or doing at the moment. So the idea of "CXF is my favourite game" sprang to mind and here I am, with all the time on my hands, blogging about it.&lt;br /&gt;&lt;br /&gt;The last week was quite interesting. For the most of the last 20 years I've been at work virtually every day doing something, writing some code, discussing something, thus being presented with an opportunity (this is how I'd like to see our severance with the Fuse team) to rethink and take a break poses quite a challenge. But there's definitely something in it. For example, I've been to London many times but I felt the trip last week was the best one : you kind of feel the energy of the city and realize the world is so rich and there are definitely opportunities lurking out there.&lt;br /&gt;&lt;br /&gt;I've been focusing mainly on CXF for the last couple of years. I don't  know yet where my next career move will bring me to, but I'm feeling there could more coming from CXF, I'll try to keep contributing whenever a get a chance. The software world is big but I'd like to see CXF being a continuous success.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-6989697940719881073?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/6989697940719881073/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=6989697940719881073' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6989697940719881073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6989697940719881073'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/03/cxf-is-my-favourite-game.html' title='CXF is my favourite game'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-7701425706181365712</id><published>2010-02-26T12:48:00.000-08:00</published><updated>2010-03-03T01:35:12.776-08:00</updated><title type='text'>Higher and higher we are gonna take it...</title><content type='html'>I've been thinking today how to title this blog entry. First I typed "Sky is the limit" but spotted &lt;a href="http://www.metrolyrics.com/skys-the-limit-lyrics-notorious-big.html"&gt;this page&lt;/a&gt;. Then I typed "The best is yet to come" but surely I found &lt;a href="http://www.lyricsfreak.com/f/frank+sinatra/best+is+yet+to+come_20056364.html"&gt;this one&lt;/a&gt;. So I ended up borrowing a phrase from the &lt;a href="http://www.azlyrics.com/lyrics/killers/blingconfessionofaking.html"&gt;Killer's Confessions of the King&lt;/a&gt; and stopped being melodramatic.&lt;br /&gt;&lt;br /&gt;It is the time to seek a new beginning and reflect a bit on the last 5.5 years I spent with IONA and Progress Fuse.&lt;br /&gt;&lt;br /&gt;IONA was the company where I grew up as a software engineer. I was fortunate to work from the day one with the best engineers one can dream of working with, some of them being very well-known in the industry and some not but it is them from the latter group who brought me to that stage where seeing a failing system test passing was the most satisfactory thing one can imagine. It was the company where one could learn to compromise and move forward. And we had quite a few laughs all the way ! And &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;VisIONAry&lt;/span&gt;  t-shirts were the 'best' in the industry :-).&lt;br /&gt;&lt;br /&gt;Working for IONA was the real thing. I enjoyed it. But I have to admit working in Progress Fuse on the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;CXF&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;JAXRS&lt;/span&gt; implementation was probably the best part. It was the 'working on the line' kind of experience, the bleeding edge, it had it all ! Working on the open source projects gives one a chance to be a coder and an architect and lets the one to talk to users on the everyday basis. I'm not sure what can be better, as far as the software engineering is concerned.&lt;br /&gt;&lt;br /&gt;Now it is time to think. Listen to U2. Start updating my CV. Visit London next week and hope Arsenal will not lose again (good we bought the city break package the previous week :-)  as I'm feeling a bit frugal at the moment :-)) Continue supporting &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;CXF&lt;/span&gt; users. And seek the new beginning.&lt;br /&gt;&lt;br /&gt;Stay tuned and have fun !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-7701425706181365712?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/7701425706181365712/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=7701425706181365712' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/7701425706181365712'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/7701425706181365712'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/02/higher-and-higher-we-are-gonna-take-it.html' title='Higher and higher we are gonna take it...'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-1532210394314968994</id><published>2010-02-17T09:12:00.000-08:00</published><updated>2010-02-17T10:22:12.575-08:00</updated><title type='text'>Use your favorite Atom reader to view CXF logs</title><content type='html'>Andy &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;Michalec&lt;/span&gt; and myself have worked recently on the Atom-based logging feature. Andy has &lt;a href="http://sberyozkin.blogspot.com/2009/11/atom-logging-in-cxf.html"&gt;implemented&lt;/a&gt; all the base classes and a push-style feature as well as wrote the &lt;a href="http://cxf.apache.org/docs/jax-rs.html#JAX-RS-ATOMpushstylelogging"&gt;initial draft&lt;/a&gt; describing how the push-style logging works. Myself has contributed recently by adding the initial code for supporting a pull-style logging.&lt;br /&gt;&lt;br /&gt;Here is some more information about these features. They haven't made it into 2.2.6 nor will they make it into 2.2.7, etc but rather stay on the 2.3-SNAPSHOT trunk given that their code has been moved from the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;jaxrs&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;frontend&lt;/span&gt; to a new rt-management-web component available on the trunk only.&lt;br /&gt;&lt;br /&gt;I reckon the push style feature is already quite functional, you can try it by downloading a 2.3-SNAPSHOT and 'attach' &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;AtomPushBeans&lt;/span&gt; to your &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;jaxws&lt;/span&gt; or &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;jaxrs&lt;/span&gt; endpoints by listing the loggers used by your code, as documented on the wiki. You may also find these links of interest :&lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_logging_atompush/WEB-INF/beans.xml"&gt;&lt;br /&gt;beans.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;xml&lt;/span&gt;&lt;/a&gt; and &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushSpringTest.java"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;JAXRSAtomLoggingPushSpringTest&lt;/span&gt;&lt;/a&gt;, plus non-Spring &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;JAXRSAtomLoggingPushTest&lt;/span&gt;&lt;/a&gt; and batch &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_batch.properties"&gt;logging.properties&lt;/a&gt;. You can have log entries wrapped in a number of ways, as feeds or entries, with the content being added as an explicit entry content or an entry extension. Processing such entries is easy on the client side, with &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;CXF&lt;/span&gt; you can do xmlSource.getNode('atom:entry/atom:content/*', &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;LogRecord&lt;/span&gt;.class) or xmlSource.getNodes('atom:feed/atom:entry/atom:content/*', &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;LogRecord&lt;/span&gt;.class).&lt;br /&gt;&lt;br /&gt;Before actually moving to describing the pull-style feature, I'd like to mention that &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;CXF&lt;/span&gt; can transparently ensure that Log4J or &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;SL&lt;/span&gt;4J events can be captured back into JUL log records so you can get non-JUL records pushed/pulled as well.&lt;br /&gt;&lt;br /&gt;Now, just today, I've finalized the first cut of the pull-style logging feature and I'm actually quite excited with the fact I was able to get a link to an endpoint-specific log feed from the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;CXF&lt;/span&gt; services page and see the list of log entries in &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;Firefox&lt;/span&gt;, IE and a standalone Atom reader, by traversing to individual log entries (not in IE though which does not seem to recognize alternate links). Give it a try please, you actually might like it and it is very easy to try :-) !&lt;br /&gt;&lt;br /&gt;Have a look at this &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_logging_atompull/WEB-INF/beans.xml"&gt;beans.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;xml&lt;/span&gt;&lt;/a&gt; (see an &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;atomPullServer&lt;/span&gt; bean which 'attaches' itself to a '&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;resourceServer&lt;/span&gt;' endpoint and relies on an '&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;atomServer&lt;/span&gt;' endpoint  to expose the log entries) and the &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPullSpringTest.java"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_20"&gt;JAXRSAtomLoggingPullString&lt;/span&gt;&lt;/a&gt; test (see &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_21"&gt;testFeed&lt;/span&gt;()). You will also need to add a dependency on the&lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/management-web/pom.xml"&gt; rt/management-web&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Some more details about the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_22"&gt;AtomPullServer&lt;/span&gt;. By default it is set to display 40 entries per page and keep 500 records in memory. It uses 'previous', 'next', 'last' and 'first' &lt;a href="http://www.ietf.org/rfc/rfc5005.txt"&gt;links&lt;/a&gt; to let users traverse across the whole range. The problem here is that I don't know of atom readers supporting these link types, let me know please if you do. Perhaps you do a simple atom browser yourself or easily deal with these links &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_23"&gt;programmatically&lt;/span&gt;. May be we even add a basic browser in &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_24"&gt;CXF&lt;/span&gt; over time.&lt;br /&gt;&lt;br /&gt;You can inject into it a &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/ReadWriteLogStorage.java"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_25"&gt;ReadWriteLogStorage&lt;/span&gt;&lt;/a&gt; implementation which can be used to offload the records to the external storage and persist them after restarts. Or just register a &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/ReadableLogStorage.java"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_26"&gt;ReadOnlyLogStorage&lt;/span&gt;&lt;/a&gt; if you do not want your logging &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_27"&gt;runtime&lt;/span&gt; to generate duplicate records if they're already being saved to an external file. At the moment, the latter storage requires a bit more effort as you'd need to write a file parser but it's doable and we may add few helpers later on. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_28"&gt;ReadOnlyLogStorage&lt;/span&gt; relies on the &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchCondition.java"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_29"&gt;SearchCondition&lt;/span&gt;&lt;/a&gt;, stay tuned on the updates about using it in a regular &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_30"&gt;JAXRS&lt;/span&gt; application code. Note that even if you already log to a file,  you can still use the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_31"&gt;AtomPullServer&lt;/span&gt; to capture the most important log entries, there will be few of them in a healthy system so you can probably just set the max in memory size to 1000 and not worry about reading the same events from a file...&lt;br /&gt;&lt;br /&gt;So this is what we have at the moment, give &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_32"&gt;it&lt;/span&gt; a try please and help us to improve this feature.&lt;br /&gt;&lt;br /&gt;Enjoy !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-1532210394314968994?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/1532210394314968994/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=1532210394314968994' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1532210394314968994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1532210394314968994'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/02/use-your-favorite-atom-reader-to-view.html' title='Use your favorite Atom reader to view CXF logs'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3323491849044963865</id><published>2010-02-09T05:21:00.000-08:00</published><updated>2010-02-09T05:48:43.577-08:00</updated><title type='text'>Support for JMS in CXF JAXRS</title><content type='html'>One of CXF JAXRS users have asked about the possibility of supporting JMS for a given JAXRS resource be able to get data over HTTP and JMS.&lt;br /&gt;&lt;br /&gt;CXF has been designed from the ground up to support multiple transports so it was very easy to ensure CXF JAXRS could get the messages from JMS. Please see this &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/jms_server_config.xml"&gt;beans.xml&lt;/a&gt;, it is just a matter of adding a transportId attribute to a given jaxrs:server endpoint, so if you have say a single service bean shared by both http and jms aware jaxrs endpoints you have multiple channels supported.&lt;br /&gt;&lt;br /&gt;Now, you may ask, what is it all about ? JAXRS is about helping users to build HTTP-based RESTful services ? What about a "transport independence being a bug but not a feature" thing ?&lt;br /&gt;&lt;br /&gt;I guess I could've said that REST is not about using HTTP, but it is just that HTTP, being the transport/application protocol of the WEB, is firmly associated with REST.&lt;br /&gt;&lt;br /&gt;What really matters IMHO is that CXF JAXRS users will be able to see their 'investment' in JAXRS growing up. They've chosen to structure and annotate their resources in a way which makes it easy to expose them as RESTful services and being able to get data from different channels by relying on the underlying runtime is a good thing.&lt;br /&gt;&lt;br /&gt;One of the reasons behind the 'longetivity' of SOAP is that users can get SOAP messages from JMS, in other words, they can easily tap into all those MQ stores with the help of the runtime.&lt;br /&gt;Of course, one well-accepted alternative would be to use a routing engine such as Camel which would delegate from a jms channel to a given jaxrs endpoint. CXF gives you another alternative now.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3323491849044963865?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3323491849044963865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3323491849044963865' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3323491849044963865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3323491849044963865'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/02/support-for-jms-in-cxf-jaxrs.html' title='Support for JMS in CXF JAXRS'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-5520566367017686202</id><published>2010-02-09T04:22:00.000-08:00</published><updated>2010-02-09T04:59:01.173-08:00</updated><title type='text'>What is common between CXF and Microsoft WCF</title><content type='html'>This morning I've read the &lt;a href="http://www.infoq.com/interviews/box-soap-xml-rest-m;jsessionid=0569CEC1542B22A7CCEE888ACC27C5CF"&gt;interview with Don Box&lt;/a&gt; (thanks to this &lt;a href="http://markclittle.blogspot.com/2010/02/don-box-interview.html"&gt;blog entry&lt;/a&gt;). I'm kind of unhappy with Twitter 'hijacking' a lot of people like Don expressing their thoughts aloud, I like reading the blogs, I can not get a lot out of Twitter one-sentences. I was 'following' Don since him contributing to his MSDN COM column, I wish himself and others could still find some time and blog...&lt;br /&gt;&lt;br /&gt;So back to the interview. Here is what I liked most. &lt;a href="http://www.innoq.com/blog/st/"&gt;Stefan&lt;/a&gt; asks :&lt;br /&gt;&lt;br /&gt;" &lt;span onclick="goToTime(8);"&gt;What is Microsoft doing from your perspective with  regards to REST support? Do you see the two worlds coexist? Which role does  which one play?&lt;/span&gt;"&lt;br /&gt;&lt;br /&gt;Don replies and finishes with :&lt;br /&gt;&lt;br /&gt;"One of the interesting things about Microsoft that took me a couple of years to  understand was there is no place for religion in products. We build products for  lots of different people and if someone wants to do REST, I want them to love  our stuff. If someone wants to do SOAP and WSDL, I want them to love our stuff.  Basically, it's our job to allow our customers to do what they want to go do  with their software and the easier we can make that, the better. "&lt;br /&gt;&lt;br /&gt;+1. This is what it is all about. This is what CXF is about. I love working on the CXF JAXRS project, JAXRS is a fantastic spec. I've also had some great experience in interacting with (IONA) customers (though mostly indirectly by fixing bugs :-)) who continue building advanced SOAP services even today. In CXF we are trying hard to ensure users can get the best of their chosen technologies/approaches, by combining them if needed.&lt;br /&gt;&lt;br /&gt;I also liked how Don was talking about Mark Baker. In fact I was quite fortunate to have a long exchange with Mark where I was asking him a lot of newbie questions, it can even be found at     &lt;a href="http://lists.w3.org/Archives/Public/www-archive/" title="Index of www-archive@w3.org" rel="start"&gt;www-archive@w3.org&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-5520566367017686202?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/5520566367017686202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=5520566367017686202' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/5520566367017686202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/5520566367017686202'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2010/02/what-is-common-between-cxf-and.html' title='What is common between CXF and Microsoft WCF'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-557920772725977569</id><published>2009-12-18T13:31:00.000-08:00</published><updated>2009-12-18T14:18:04.216-08:00</updated><title type='text'>Support for CXF in Enunciate</title><content type='html'>&lt;a href="http://enunciate.codehaus.org/index.html"&gt;Enunciate&lt;/a&gt; is a popular framework which can be used to deploy and expose Java applications as WEB applications. I had read good reviews about it long before I joined the CXF JAX-RS project.&lt;br /&gt;&lt;br /&gt;Thus I was quite excited when I found out from &lt;a href="http://markmail.org/message/xtf2onovj7yjhh4v#query:enunciate%201.15+page:1+mid:jemybad754tsfw7d+state:results"&gt;this announcement&lt;/a&gt; CXF JAX-RS was also optionally supported. Please see some more information from the &lt;a href="http://enunciate.codehaus.org/modules.html"&gt;modules&lt;/a&gt; page which says that CXF JAXWS and JAXRS frontends are supported (as a side note, CXF users can deploy endpoints without depending on Spring by relying on non-Spring CXF servlets).&lt;br /&gt;&lt;br /&gt;I would like to use this post to encourage the leads of other higher-level frameworks to let users choose between different web services enablers and those exposing Java applications as RESTful services in particular, by doing it the way Enunciate did.&lt;br /&gt;&lt;br /&gt;It will not harm. Giving users a choice never harms. The most likely sideeffect is that your favourite framework will likely see more users coming in.&lt;br /&gt;&lt;br /&gt;I hope Enunciate will make CXF and CXF JAX-RS more visible. Likewise I hope Enunciate will enjoy seeing a number of its users rising in turn too. I will be happy to play with this framework later on too and see if I can contribute somehow.&lt;br /&gt;&lt;br /&gt;Enjoy !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-557920772725977569?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/557920772725977569/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=557920772725977569' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/557920772725977569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/557920772725977569'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/12/support-for-cxf-in-enunciate.html' title='Support for CXF in Enunciate'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-5615638277691081127</id><published>2009-12-17T14:08:00.000-08:00</published><updated>2009-12-17T14:38:49.471-08:00</updated><title type='text'>The RESTful Java with JAX-RS book</title><content type='html'>&lt;a href="http://bill.burkecentral.com/"&gt;Bill Burke&lt;/a&gt;, the author of &lt;a href="http://www.jboss.org/resteasy/"&gt;RestEasy&lt;/a&gt;, has had his new book, &lt;a href="http://oreilly.com/catalog/9780596158040"&gt;RESTful Java with JAX-RS&lt;/a&gt;,  published recently.&lt;br /&gt;&lt;br /&gt;Bill is one of the main contributors to the success of JAX-RS so this good JAX-RS reference book with practical examples will be welcomed by all JAX-RS users and ReastEasy fans in particular.&lt;br /&gt;&lt;br /&gt;Here I would like to thank Bill for letting us do a small contribution to the book. He kindly approached us and proposed to do a brief description of the Apache CXF implementation of JAX-RS which is what we did.  Seeing it being referenced alongside the heavyweights like Jersey and RestEasy is encouraging and humbling.&lt;br /&gt;&lt;br /&gt;Finally, Bill, being the true host of the whole project, referenced RestEasy last in the list of the implementations. Very kind. Thanks Bill !&lt;br /&gt;&lt;br /&gt;Please give this book a good read :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-5615638277691081127?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/5615638277691081127/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=5615638277691081127' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/5615638277691081127'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/5615638277691081127'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/12/restful-java-with-jax-rs-book.html' title='The RESTful Java with JAX-RS book'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-8002192610952289157</id><published>2009-12-16T03:13:00.001-08:00</published><updated>2009-12-16T03:49:29.080-08:00</updated><title type='text'>OT: The Fever Pitch</title><content type='html'>I have to make an admission : I really start liking the way &lt;a href="http://www.arsenal.com/"&gt;Arsenal&lt;/a&gt; FC plays. In fact, I simply can not help waiting to see them playing on the BBC Match of The Day tonight and then reading the reviews in different newspapers and online on BBC and &lt;a href="http://www.arsenal.com/"&gt;arsenal.com&lt;/a&gt; tomorrow, even if they not win. &lt;a href="http://www.arsenal.com/first-team/players/andrey-arshavin"&gt;Arshavin&lt;/a&gt; is 'to blame'.  But now I can also see what a good team Arsenal is.&lt;br /&gt;&lt;br /&gt;When I came to work to England nearly 13 years ago, I already was a ManU supporter. A lot of ManU supporters actually live abroad. After living for nearly a year in Manchester I became even more ManU-obsessed, especially after seeing them playing live in Liverpool at Everton, despite the fact I found out that actually there also was a Manchester City FC too, supported by quite a few locals I spoke too :-). I still love watching ManU playing, they are playing for people who watch them and they probably still have the more local-grown talent on the pitch than other teams in the top 4.&lt;br /&gt;&lt;br /&gt;That said, Arsenal is the team which I am really excited about at the moment. It was a 'ruined' weekend when they lost to Chelsea but the last weekend was great ! Two weeks ago I watched them playing Stoke on the Match of The Day on Saturday on both RTE1 and BBC and then again the next day on the Match of The Day 2 on BBC.&lt;br /&gt;&lt;br /&gt;What is the story ? Another milder version of the &lt;a href="http://www.amazon.com/Fever-Pitch-Nick-Hornby/dp/1573226882"&gt;Fever Pitch&lt;/a&gt; ? And what a great book that was, my friend who is an Everton fan, presented it to me the other day.&lt;br /&gt;&lt;br /&gt;I realized this Monday Arshavin inspires me. He is a match winner and a real fighter. Arsenal are a bit "vertically challenged" upfront as one of Arsenal fans said the other day :-), but they are a great team to watch.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Go Arsenal !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-8002192610952289157?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/8002192610952289157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=8002192610952289157' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/8002192610952289157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/8002192610952289157'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/12/ot-fever-pitch.html' title='OT: The Fever Pitch'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-400739324362671024</id><published>2009-12-11T05:01:00.000-08:00</published><updated>2009-12-11T05:22:48.077-08:00</updated><title type='text'>The argument about fast JSON processors</title><content type='html'>I have heard by now a number of times that &lt;a href="http://jettison.codehaus.org/"&gt;Jettison&lt;/a&gt; is slower than &lt;a href="http://jackson.codehaus.org/"&gt;Jackson&lt;/a&gt; when it comes to handling large JSON sequences.&lt;br /&gt;&lt;br /&gt;To be honest, I am not sure what this argument is about. Perhaps because I do not understand JSON ? I would rather see statements like : Jackson is a popular JSON processor which can let users create correct JSON sequences without users having to introduce JAXB dependencies. This is something I can get.&lt;br /&gt;&lt;br /&gt;The argument about the performance sounds like a red-herring to me. Are you writing a service which returns a 7OK JSON sequence ? Is it the sign you may need to rethink the way your service has been designed ? IMHO JSON is not the means to pass around huge sequences, it is the format which has been designed to help users streamline the development of client-facing Web frontends, at least this is my understanding.&lt;br /&gt;&lt;br /&gt;So if you need to deal with large chunks of data then may be you may want to return a JSON-formatted Atom feed, something that Abdera supports, with links pointing back to the next chunks of data. Or just use XML for a similar purpose ?&lt;br /&gt;&lt;br /&gt;And if you write your Ajax JavaScript clients handling JSON sequences of small to medium size then perhaps the performance issue is not actually an issue ?&lt;br /&gt;&lt;br /&gt;Having said all this, I will be happy to see Jettison supporting streaming eventually. Hope it will happen soon. The most important thing though is that it will now more likely to produce correct JSON sequences which is what users really want.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-400739324362671024?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/400739324362671024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=400739324362671024' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/400739324362671024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/400739324362671024'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/12/argument-about-fast-json-processors.html' title='The argument about fast JSON processors'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-6194997202525254672</id><published>2009-12-10T10:48:00.000-08:00</published><updated>2009-12-10T14:41:04.500-08:00</updated><title type='text'>Better Jettison is on the way</title><content type='html'>It would be fare to say the &lt;a href="http://jettison.codehaus.org/"&gt;Jettison project&lt;/a&gt; has been stagnating for a while now.&lt;br /&gt;&lt;br /&gt;I do think it has been doing really well as part of CXF, by generating and consuming JSON sequences from and into JAXB beans. It has not been always 'successful' but still worked well for many cases. In addition, CXF JAX-RS provides a number of options for customizing input and output JSON sequences on top of Jettison :&lt;br /&gt;&lt;br /&gt;&lt;a href="http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-JSONsupport"&gt;http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-JSONsupport&lt;/a&gt;&lt;br /&gt;&lt;a href="http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-CustomizingJAXBXMLandJSONinputandoutput"&gt;http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-CustomizingJAXBXMLandJSONinputandoutput&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;That said, Jettison has not been capable of handling recursive structures well, and may 'surprise' now and then in a number of other cases. Some CXF users have tried a well-rated &lt;a href="http://jackson.codehaus.org/"&gt;Jackson&lt;/a&gt;, however, some users are still like working with the default Jettison-based CXF JAX-RS provider.&lt;br /&gt;&lt;br /&gt;Thus it was just a matter of time before motivated and interested users were to step in and contribute to Jettison. John Worrell has recently done a major refactoring of the Jettison XMLStreamWriter implementation and his patch has already been applied by &lt;a href="http://www.nighttale.net/"&gt;Dejan&lt;/a&gt;. In fact, CXF trunk has just been updated to depend on &lt;a href="http://snapshots.repository.codehaus.org/org/codehaus/jettison/jettison/1.2-SNAPSHOT/"&gt;Jettison 1.2-SNAPSHOT&lt;/a&gt; containing the improved writer . This is a great contribution from John and I do hope it will give a new lease of life to Jettison.&lt;br /&gt;&lt;br /&gt;If you do use Jettison, with or without CXF, then please give the latest SNAPSHOT a try. Please report the issues if any to the &lt;a href="http://xircles.codehaus.org/projects/jettison/lists"&gt;Jettison users list&lt;/a&gt; or leave a comment at &lt;a href="http://jira.codehaus.org/browse/JETTISON-87"&gt;Jettison-87&lt;/a&gt; and also close the JIRAs which may have been fixed, example, a well-known &lt;a href="http://jira.codehaus.org/browse/JETTISON-57"&gt;Jettison-57&lt;/a&gt;  has been fixed along the way after the patch from John has been applied.&lt;br /&gt;&lt;br /&gt;So it is a good news for Jettison users. Another CXF user has actually expressed an interest in enhancing Jettison for it to support streaming.&lt;br /&gt;&lt;br /&gt;The better Jettison is on the way.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-6194997202525254672?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/6194997202525254672/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=6194997202525254672' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6194997202525254672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6194997202525254672'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/12/better-jettison-is-on-way.html' title='Better Jettison is on the way'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3400825095912327705</id><published>2009-12-06T10:42:00.000-08:00</published><updated>2009-12-06T13:56:36.637-08:00</updated><title type='text'>Embracing Atom with CXF</title><content type='html'>Until recently, it has been possible to write an &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;AtomPub&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;JAX&lt;/span&gt;-RS application in &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;CXF&lt;/span&gt; by using &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;Abdera&lt;/span&gt; Feed or Entry classes like this :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;&lt;br /&gt;public class &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;AtomPubResource&lt;/span&gt; {&lt;br /&gt;&lt;br /&gt; @GET&lt;br /&gt; @Path("/feed")&lt;br /&gt; public Feed &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;getCollection&lt;/span&gt;() {&lt;br /&gt;     // create Feed as needed&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; @GET&lt;br /&gt; @Path("/feed/{id}")&lt;br /&gt; public Entry getEntry(@PathParam("id") int id) {&lt;br /&gt;     // get individual entry&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; @POST&lt;br /&gt; @Path("/feed")&lt;br /&gt; public void &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;addEntry&lt;/span&gt;(Entry entry) {&lt;br /&gt;     // update collection&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; // etc&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Going this route gives users the most control over how a given feed is initialized and how entries have the actual content captured. Some frameworks provide &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;JAXB&lt;/span&gt;-based classes for dealing with Atom primitives such as feeds and entries - I am not quite keen on extending &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;CXF&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;JAXRS&lt;/span&gt; in a similar way, after all, what it can give a user apart from introducing alternative foreign classes into their main application code ?&lt;br /&gt;&lt;br /&gt;With the addition of &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AtomPojoProvider.java"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;AtomPojoProvider&lt;/span&gt;&lt;/a&gt; provider and &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/atom/"&gt;Atom-specific extensions&lt;/a&gt; few more options are now available for &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;CXF&lt;/span&gt; users to start playing with Atom (note the provider and extensions code may still get changed).&lt;br /&gt;&lt;br /&gt;To start with, users can now simply do :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;@Path("/store")&lt;br /&gt;public class &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;BookStore&lt;/span&gt; {&lt;br /&gt;&lt;br /&gt; private Books books = new Books();&lt;br /&gt;&lt;br /&gt; @GET&lt;br /&gt; @Path("/books")&lt;br /&gt; @Produces(&lt;br /&gt;  {&lt;br /&gt;   "application/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;xml&lt;/span&gt;",&lt;br /&gt;   "application/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;json&lt;/span&gt;",&lt;br /&gt;   "application/atom+&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;xml&lt;/span&gt;;type=feed"&lt;br /&gt;  })&lt;br /&gt; public Books &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;getBooks&lt;/span&gt;() {&lt;br /&gt;     return books;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; @GET&lt;br /&gt; @Path("/books/{id}")&lt;br /&gt; @Produces(&lt;br /&gt;  {&lt;br /&gt;   "application/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;xml&lt;/span&gt;",&lt;br /&gt;   "application/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;json&lt;/span&gt;",&lt;br /&gt;   "application/atom+&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;xml&lt;/span&gt;;type=entry"&lt;br /&gt;  })&lt;br /&gt; public Book getBook(@PathParam("id") int id) {&lt;br /&gt;     return books.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_20"&gt;getBook&lt;/span&gt;(id);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; @POST&lt;br /&gt; @Consumes(&lt;br /&gt;  {&lt;br /&gt;   "application/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_21"&gt;xml&lt;/span&gt;",&lt;br /&gt;   "application/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_22"&gt;json&lt;/span&gt;",&lt;br /&gt;   "application/atom+&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_23"&gt;xml&lt;/span&gt;;type=entry"&lt;br /&gt;  })&lt;br /&gt; public void &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_24"&gt;addBook&lt;/span&gt;(Book book) {&lt;br /&gt;     books.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_25"&gt;addBook&lt;/span&gt;(book);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; // etc&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;What happens here is that you continue write your Java &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_26"&gt;JAX&lt;/span&gt;-RS code, the way you may often do, without introducing any direct dependencies on the Atom-specific classes, and just experimenting at the same time with implementing an &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_27"&gt;AtomPub&lt;/span&gt; application on top of your collection classes like Books. Starting with &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_28"&gt;AtomPub&lt;/span&gt; and Atom is now as simple as updating Produces and Consumes values and registering an &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_29"&gt;AtomPojoProvider&lt;/span&gt;.&lt;br /&gt;As long as your Books class has default collection setter and getter methods, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_30"&gt;getBooks&lt;/span&gt; and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_31"&gt;setBooks&lt;/span&gt; returning and accepting a List of Book instances in this case, and happy with some of default Feed and Entry properties, that is all that needs to be done.&lt;br /&gt;&lt;br /&gt;The next step is to tell the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_32"&gt;AtomPojoProvider&lt;/span&gt; the names of the collection &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_33"&gt;getters&lt;/span&gt; and setters on individual classes such as Books.&lt;br /&gt;&lt;br /&gt;The next step is to register Feed and/or Entry builders which can help &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_34"&gt;AtomPojoProvider&lt;/span&gt; with setting various &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/atom/AbstractFeedBuilder.java"&gt;Feed&lt;/a&gt; and &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/atom/AbstractEntryBuilder.java"&gt;Entry&lt;/a&gt; properties, still without introducing direct dependencies in your main code. &lt;br /&gt;&lt;br /&gt;Finally, you can take the complete control with registering Feed or Entry &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/atom/AtomElementWriter.java"&gt;writers&lt;/a&gt; or &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/atom/AtomElementReader.java"&gt;readers&lt;/a&gt;. This option is similar to having &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_35"&gt;Abdera&lt;/span&gt; Feed or Entry classes in your main application code except that these providers will let you deal with these classes outside of the main application code.&lt;br /&gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_36"&gt;CXF&lt;/span&gt; users will now have plenty of options for writing &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_37"&gt;AtomPub&lt;/span&gt; applications on top of the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_38"&gt;JAX&lt;/span&gt;-RS &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_39"&gt;runtime&lt;/span&gt;. Give it a try and enjoy !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3400825095912327705?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3400825095912327705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3400825095912327705' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3400825095912327705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3400825095912327705'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/12/embracing-atom-with-cxf.html' title='Embracing Atom with CXF'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-4696222629736539655</id><published>2009-11-25T13:19:00.000-08:00</published><updated>2009-12-12T04:43:57.079-08:00</updated><title type='text'>Come on, Abdera !</title><content type='html'>Just few hours after blogging about the &lt;a href="http://sberyozkin.blogspot.com/2009/11/atom-logging-in-cxf.html"&gt;Atom blogging feature&lt;/a&gt; being now developed in CXF, I thought it might be worth checking what was actually happening with &lt;a href="http://abdera.apache.org/"&gt;Abdera&lt;/a&gt; which we currently depend upon in CXF.&lt;br /&gt;&lt;br /&gt;I actually noticed before not much was happening in the project by briefly looking at the main page but did not pay any attention to it. This time I clicked few more links, and when reading the &lt;a href="http://mail-archives.apache.org/mod_mbox/abdera-dev/200911.mbox/browser"&gt;November archive&lt;/a&gt; I just experienced a number of conflicting emotions during few minutes :-), starting from the disappointment and ending with a cautious optimism.&lt;br /&gt;&lt;br /&gt;What I do not understand is how a project which by many users is assumed to be a Reference Implementation of everything to do with Atom and AtomPub ended up being nearly retired ? How it could have happened given that just a couple of years ago AtomPub and Atom were probably one of the most talked about technologies ? They were touted as candidates for a complete replacement for SOAP given that Feed provides an envelope-like wrapper around (data) Entries ?&lt;br /&gt;&lt;br /&gt;Well, it is not that important today. The thing is that actually many users do use AtomPub and Atom. Things are happening on the atom-syntax list. Abdera is obviously not the only way to create Atom Feeds or Entries but it just a very good library for doing it. IMHO it is a perfect library for users to use when they need to create sophisticated and real-life feeds or entries. I am not so optimistic about Abdera acting as a standalone server framework, IMHO it is not why most users are relying on Abdera. I would personally like to see it moving toward imlementing other promising Atom draft specs, etc.&lt;br /&gt;&lt;br /&gt;In CXF we are sticking with Abdera for the time being. As far as the Atom logging feature is concerned, using Atom was a rather obvious choice due to the fact it was the most cost effective way to have the interesting events  be delived to a variety of the existing Atom-aware consumers.&lt;br /&gt;&lt;br /&gt;We hope Abdera will help us. We would like Abdera, the Atom and AtomPub RI to live and succeed. This project needs a leader and it is good to know James Snell is planning to reengage.&lt;br /&gt;&lt;br /&gt;Do you remember Microsoft Web3S ? I thought it was a good effort, but the Atom won.&lt;br /&gt;&lt;br /&gt;So will Abdera stay around ? Come on, Abdera !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-4696222629736539655?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/4696222629736539655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=4696222629736539655' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/4696222629736539655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/4696222629736539655'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/11/common-abdera.html' title='Come on, Abdera !'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-2058680198109378693</id><published>2009-11-20T08:32:00.000-08:00</published><updated>2009-11-20T13:19:35.519-08:00</updated><title type='text'>Updates to the CXF JAXRS runtime</title><content type='html'>Updates to the CXF JAX-RS runtime have been somewhat limited during the last few months due the ongoing high-priority internal project I've been assigned to contribute to. This project is likely to continue for another couple of months.&lt;br /&gt;&lt;br /&gt;Given this, I've focused on working on some of the issues which users have asked on the CXF lists a number of times, directly or indirectly.&lt;br /&gt;&lt;br /&gt;So here is what has been done for CXF 2.2.5 :&lt;br /&gt;&lt;br /&gt;1. Redirection support, both at the &lt;a href="http://cwiki.apache.org/confluence/display/CXF20DOC/Servlet+Transport"&gt;CXFServlet&lt;/a&gt; (check the Redirection section) and &lt;a href="http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-Redirection"&gt;CXF JAX-RS&lt;/a&gt; levels. Users can redirect to static or dynamic resources such as &lt;a href="http://cxf.apache.org/docs/jax-rs.html#JAX-RS-ModelViewControllersupport"&gt;JSP&lt;/a&gt;, or to some other servlets.&lt;br /&gt;&lt;br /&gt;2. Additional updates to the way JAXB/JSON  inputs/outputs can be &lt;a href="http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-CustomizingJAXBandJSONinputandoutput"&gt;customized&lt;/a&gt;. The purpose of this feature is to let users do simple input/output updates by changing, dropping or appending elements and or attributes. For example, it is now should be possible to deserialize the sequence of JSON arrays without a root element.&lt;br /&gt;&lt;br /&gt;3. Few minor updates to JSONProvider, such as a BadgerFish convention support and a fix to let CXF JAXRS endpoints interact with the Dojo JSON RestStore (patch has been submitted).&lt;br /&gt;&lt;br /&gt;4. Improvements to the way &lt;a href="http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-Formsandmultiparts"&gt;multipart/form-data requests are handled&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;5. &lt;a href="http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-Customselectionbetweenmultipleresources"&gt;ResourceComparator extension&lt;/a&gt; which can let users affect the way multiple matching resource classes or methods are selected.&lt;br /&gt;&lt;br /&gt;6. &lt;a href="http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-DocumentingresourceclassesandmethodsinWADL"&gt;Documentation&lt;/a&gt; annotation has been added for more descriptive WADLs be generated&lt;br /&gt;&lt;br /&gt;For the next couple of months or so, due the above-mentioned internal project, I will continue focusing on making the localized updates which will may make the difference for CXF JAXRS users. Plus do some JAX-RS 1.1 work and try to contribute to Andy's Atom logging project. I will not have time to do any Java EE work as mandated by the JAX-RS 1.1 maintenance spec - I'll rather focus on working on more down to earth issues for 2.3.  By the way, if anyone out there is contemplating contributing to CXF JAX-RS then doing the EJB or other EE-related JAX-RS 1.1 tasks will be welcomed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-2058680198109378693?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/2058680198109378693/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=2058680198109378693' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2058680198109378693'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2058680198109378693'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/11/updates-to-cxf-jaxrs-runtime.html' title='Updates to the CXF JAXRS runtime'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-4244563432994767954</id><published>2009-11-20T08:19:00.001-08:00</published><updated>2009-11-20T08:31:43.130-08:00</updated><title type='text'>The release of CXF 2.2.5</title><content type='html'>CXF 2.2.5 has just been released. I don't often, if ever, blog about individual CXF releases but I thought it was worth commenting about this release.&lt;br /&gt;&lt;br /&gt;In CXF 2.2.5 improvements have been done to the core, JAXWS and JAXRS runtimes, but I'll post an update about JAXRS-related updates next.&lt;br /&gt;&lt;br /&gt;What is remarkable about CXF 2.2.5 is that in the space of few weeks nearly 100 or so long-pending bugs and enhancement requests have been fixed. CXF core and the JAXWS runtime have been improved a lot. Dan, Benson, Christian and others have embarked on the bug fixing spree and the result has been impressive. I've become dizzy during the last few weeks getting the constant stream of merge emails to the trunk and 2.2.x in my email box.&lt;br /&gt;&lt;br /&gt;I know it is next to impossible to do a perfect software product. The CXF JAXWS implementation is about to become the one.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-4244563432994767954?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/4244563432994767954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=4244563432994767954' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/4244563432994767954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/4244563432994767954'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/11/release-of-cxf-225.html' title='The release of CXF 2.2.5'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3853146689144854137</id><published>2009-11-18T01:35:00.000-08:00</published><updated>2009-11-18T02:06:39.741-08:00</updated><title type='text'>Atom Logging in CXF</title><content type='html'>Andrzej (Andy) Michalec, the CXF committer, has just committed the initial code for supporting push-style Atom logging in CXF.&lt;br /&gt;&lt;br /&gt;It is only a beginning. It all seems quite straightforward to implement, but even a push-style Atom logger requires a lot of effort and thinking for it to be implemented well, and even more work will be needed to polish the original implementation. So it is a great effort from Andy, thanks.&lt;br /&gt;&lt;br /&gt;This code will initially live in the CXF JAX-RS implementation code base but the idea is that all of CXF endpoints, JAXWS and JAXRS based ones, will be able to have their logging events handled by these Atom-based handlers, by registering them from the logging properties or from Spring.&lt;br /&gt;The pull-style appender will be done later on, it will be more complex than the push-style one. Supporting Feed Archiving features, etc, is on the map, and we hope Abdera will help there.&lt;br /&gt;&lt;br /&gt;Going forward, we can see users being able to selectively register callback URis with CXF endpoint-specific push-style loggers or subscribe to individual feeds, possibly finding the required feed from a master feeds endpoint.  The users will be able to apply a lot of various configuration to both push and pull style loggers. Some of this configuration will have to do with the mechanics of the pull- or push- style deliveries, and some of it will have to do with how the log records will be presented in an Atom feed - there're quite a few possible options there.&lt;br /&gt;&lt;br /&gt;This will also drive further requirements on the CXF JAXRS Client API, namely the support for one ways and asyncs will be on the map.&lt;br /&gt;&lt;br /&gt;I'm thrilled. I really am. Hope you will be too once you start using this feature in CXF.&lt;br /&gt;We'll start documenting it a bit later on, we might have it all done in time for CXF 2.3.&lt;br /&gt;&lt;br /&gt;Think CXF, think Atom. Think Atom, think CXF. Enjoy :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3853146689144854137?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3853146689144854137/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3853146689144854137' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3853146689144854137'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3853146689144854137'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/11/atom-logging-in-cxf.html' title='Atom Logging in CXF'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-9044270940355127470</id><published>2009-11-16T08:51:00.000-08:00</published><updated>2009-11-17T01:40:24.641-08:00</updated><title type='text'>The WADL Dilemma</title><content type='html'>The &lt;a href="https://wadl.dev.java.net/"&gt;Web Application Description Language&lt;/a&gt; (WADL) is now being acknowledged by many as a language which is practical, functional, very capable of describing the advanced RESTful web services and yet simple and easy to read and understand.&lt;br /&gt;&lt;br /&gt;WADL has now been &lt;a href="http://www.w3.org/Submission/wadl/"&gt;submitted to  W3C&lt;/a&gt; which is a great achievement for Marc Hadley. What is really unique about this submission is that it has not been submitted  by the usual suspects like Microsoft and IBM but rather by the individual author. It seems that the time when various web services specifications have been discussed by a number of years by various companies is behind us, but you never know.&lt;br /&gt;&lt;br /&gt;CXF has been supporting WADL since 2.2.3. The auto-generated WADL instances can describe live RESTful services quite well, with JAXB-generated schemas being included in WADL grammar elements and indeed with all the subresources being described too, as long as the static subresource resolution is enabled.&lt;br /&gt;&lt;br /&gt;More enhancements have to and will be done but first I'll touch on what I call a WADL dilemma.&lt;br /&gt;&lt;br /&gt;It is a Web Application Description Language. It is the way it describes the *Web application* that distinguishes it. For example, a WADL consumer such as a RESTful client test framework can read a given WADL document and let users test the application by following the application paths described by WADL.&lt;br /&gt;&lt;br /&gt;I think it's of little doubt that the decision has been made to design WADL such that application interfaces (such as Person or Book, etc) could not be described in WADL. This is absolutely normal given that RESTful consumers are generally programming againt generic HTTP interfaces and programming with proxies is often considered to be an antipattern. Thus I guess adding the possibility to describe application interfaces was an obvious  non-starter.&lt;br /&gt;&lt;br /&gt;As a side note, before proceeding further, I think I might be nearly coming to the conclusion, that as far as choosing between proxies or http-centric clients for consuming restful services is concerned, it is really like choosing between different shades of grey. Some users, when they see proxies, think RPC immediately but it is not quite the case for proxies producing perfectly valid RESTful requests. Neither option is immune to the service changes though but good frameworks such as CXF will offer a lot of help for coping with such changes. I think it may be more a matter of the taste these days...&lt;br /&gt;&lt;br /&gt;So back to the dilemma. What I think is currently missing from WADL is the fact it can not be used to generate what seems to be the main source of auto-generated WADL instances : JAX-RS annotated service classes. The WADL-first option will work well for the http-centric consumers but it is Java-first all the way for the JAX-RS services.&lt;br /&gt;&lt;br /&gt;The Java-first approach to the services development has proved to be very popular and viable. However, the option of modeling web resources and generating service classes seems quite attractive too but enhancing WADL to support such an option would just basically turn it into WSDL.  And this is where the dilemma is.&lt;br /&gt;&lt;br /&gt;In meantime,  a number of various approaches is being tried to create richer WADLs out of Java classes. One of those attempts is to do with extracting Java Docs for resource classes and methods and publishing them as WADL documentation fragments - it does seem like a step too far given that Java Docs are meant for the Java engineers using a given interface or class. But not for the users of Web Services backed up by such classes/interfaces.&lt;br /&gt;&lt;br /&gt;In CXF we've added a Description annotation which is mapped to a &lt;a href="http://www.w3.org/Submission/wadl/#x3-80002.3"&gt;WADL doc element&lt;/a&gt; and we will recommend users to use this annotation for documenting resources or methods using the language intended for the users of a given web service.&lt;br /&gt;&lt;br /&gt;The other thing we need to think about is how we can let users do the WADL first developement. The question is how to avoid turning it into WSDL. That said, we should also probably look closer at the option of supporting WSDL2, especially for the users who do both SOAP and REST - having a single document describing both SOAP and REST may benefit them, though as far as describing RESTful services is concerned WSDL2 seems a bit limited.&lt;br /&gt;&lt;br /&gt;Stay tuned.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-9044270940355127470?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/9044270940355127470/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=9044270940355127470' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/9044270940355127470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/9044270940355127470'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/11/wadl-dilemma.html' title='The WADL Dilemma'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-2384174383687631429</id><published>2009-09-22T12:43:00.000-07:00</published><updated>2009-09-22T14:13:11.234-07:00</updated><title type='text'>What is Distributed OSGI ?</title><content type='html'>Many of you have already heard about Distributed OSGi (DOSGi) OSGi initiative and about the &lt;a href="http://cxf.apache.org/distributed-osgi.html"&gt;CXF DOSGi RI subproject&lt;/a&gt; (superbly documented by &lt;a href="http://coderthoughts.blogspot.com/"&gt;David&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;I'd just like to comment a bit more about DOSGi.&lt;br /&gt;&lt;br /&gt;Quite a few people have just immediately branded DOSGi as yet another RPC-technology and thus being not worthy of their attention.  This is not quite correct.&lt;br /&gt;&lt;br /&gt;DOSGi does prescribe how the OSGI consumers can end up with a proxy after using an OSGI ServiceTracker to get hold of a particular service interface reference.  So it does make it possible for OSGI clients to consume remote applications with the help of proxies. Guess what ? Sometimes proxies will just work really well - some of those remote services will probably not change ever again or has been written by the same developer who writes a client bundle - thus making the future changes more manageable.&lt;br /&gt;&lt;br /&gt;In the end of the day it is obvious DOSGi will help popularize OSGi among many developers out there as it makes it quite straightforward to have an end-to-end (D)OSGI application working.&lt;br /&gt;&lt;br /&gt;But of course DOSGi is more than just about creating proxies under the hood. The primary use case is to let users expose their OSGI applications as remote services - you don't even have to use DOSGi on the other end to consume such services. It's become more obvious with the DOSGi RI now letting users to expose their OSGI services as SOAP based or RESTful (JAX-RS) services. You can consume such services from your browser if you wish.&lt;br /&gt;&lt;br /&gt;So what some people might've missed is that in its basic form a DOSGi RI is an OSGi-enabled (CXF-based) web services stack. DOSGi RI is a handy collection of a number of OSGI bundles which you can drop into your favorite OSGI container and start developing web services (SOAP or RESTful ones) with OSGI in mind. DOSGi RI is a &lt;span style="font-weight: bold;"&gt;composite Web Services OSGi feature&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;But DOSGi offers few more options. DOSGi Discovery service is a useful thing indeed. Now, it does facilitate the creation of proxies by helping DOSGI to discover that some services have been published. But note that DOSGI does not force your consumer bundles to use proxies, especially those consuming the RESTful services.&lt;br /&gt;You can just write the client code using an HTTP-centric client API and simply use OSGi to replace your consumer bundles as needed. Or you can get hold of the DOSGi Discovery service and still use an HTTP-centric client API by feeding it the address of the remote RESTful service you've just obtained from the Discovery service. It would probably be worth adding a utiltity bundle to the DOSGi RI distribution which will help interested users to interact with the Discovery service though consuming it directly should not be too difficult.&lt;br /&gt; &lt;br /&gt;Hopefully this blog entry has shed some more light on what DOSGi is about.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-2384174383687631429?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/2384174383687631429/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=2384174383687631429' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2384174383687631429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2384174383687631429'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/09/what-is-distributed-osgi.html' title='What is Distributed OSGI ?'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3514020496189099256</id><published>2009-08-28T02:48:00.000-07:00</published><updated>2009-08-29T15:17:34.479-07:00</updated><title type='text'>JAXRS and JAXB without annotations in CXF</title><content type='html'>The CXF JAXRS extension allowing users to describe how their services have to be handled by the JAX-RS runtime without annotating them has already been mentioned in &lt;a href="http://sberyozkin.blogspot.com/2009/05/annotation-free-services-with-cxf-jax.html"&gt;this entry&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;It has been improved since then, it is now possible to describe interfaces with the runtime being able to apply the model information to the objects injected from Spring or registered from OSGI BundleActivators. Here is the &lt;a href="http://cxf.apache.org/docs/jax-rs.html#JAX-RS-RESTfulserviceswithoutannotations"&gt;updated documentation&lt;/a&gt;, and &lt;a href="http://cxf.apache.org/docs/jax-rs.html#JAX-RS-IntegrationwithDistributedOSGi"&gt;here is the short info&lt;/a&gt; on the DOSGi demo showing this feature in action.&lt;br /&gt;&lt;br /&gt;Now, when I mentioned this feature for the first time, I implied that for the (CXF JAXRS) JAXB provider to continue working JAXB annotations still had to be there. The JAXB provider has been enhanced quite a bit recently but one of the enhancements which is worth mentioning here is that one can now tell it to marshal and unmarshal Java beans without them being annotated with annotations like @XmlRootElement or introducing JAXBElements in their method signatures. One can simply set a 'marshalAsJaxbElement' property on the JAXB provider and it will wrap all the objects as needed. It is also possible to be more selective about which objects will be wrapped under the hood. For more information see &lt;a href="http://cxf.apache.org/docs/jax-rs.html#JAX-RS-AutomaticJAXBElementconversionduringserialization"&gt;here&lt;/a&gt; and &lt;a href="http://cxf.apache.org/docs/jax-rs.html#JAX-RS-HandlingJAXBbeanswithoutXmlRootElementannotations"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;So yes, it is possible after all : have a production code working without annotations.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3514020496189099256?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3514020496189099256/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3514020496189099256' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3514020496189099256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3514020496189099256'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/08/jaxrs-and-jaxb-without-annotations-in.html' title='JAXRS and JAXB without annotations in CXF'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-380620675088311487</id><published>2009-06-20T11:13:00.000-07:00</published><updated>2009-06-20T11:45:26.711-07:00</updated><title type='text'>Distributed OSGi RI gets the RESTful edge</title><content type='html'>We have completed the initial CXF JAX-RS integration into the &lt;a href="http://cxf.apache.org/distributed-osgi.html"&gt;DOSGi RI&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;There is a number of various approaches out there to expose a given OSGI service remotely - DOSGi is a good effort which describes how this task can be resolved in a standard way. &lt;br /&gt;&lt;br /&gt;So now DOSGi users will be able to expose a given bean either as a SOAP or RESTful service. There will be more updates coming in shortly for a given bean be exposed as a combined SOAP/RESTful service and for properties be applied in a way which will let users easily configure a large number of services.   &lt;br /&gt;&lt;br /&gt;Now, as far as RESTful services are concerned, one can also expose them &lt;a href="http://sberyozkin.blogspot.com/2009/05/annotation-free-services-with-cxf-jax.html"&gt;without applying JAX-RS annotations&lt;/a&gt;. I'm actually quite excited about this option despite the fact it kind of tries to sway you from being a good JAX-RS citizen :-). One thing is that one of the promises of DOSGi is that users should be able to expose the interfaces transparently, without forcing the knowledge of JAX-RS/etc on the remote consuming bundles. While there will be cases when having annotations is perfectly acceptable in DOSGi it is still nice to have an option to do it without annotations. &lt;br /&gt;&lt;br /&gt;As a side note, applying the external model info to a lot of existing applications out there which are exposed as RESTful services using expensive adapters or can not afford changing the code looks really promising to me.&lt;br /&gt;&lt;br /&gt;I would also like to thank Josh Holtzman for his contribution. More updates to follow soon.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-380620675088311487?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/380620675088311487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=380620675088311487' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/380620675088311487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/380620675088311487'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/06/distributed-osgi-ri-gets-restful-edge.html' title='Distributed OSGi RI gets the RESTful edge'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-2913594640829327940</id><published>2009-06-08T15:28:00.000-07:00</published><updated>2009-06-08T15:46:43.151-07:00</updated><title type='text'>Pragmatic Web Services with Apache CXF</title><content type='html'>Pragmatic web services are the ones which deliver, have been written with the interoperability in mind and which can cope with inevitable changes.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://architects.dzone.com/articles/pragmatic-web-services-apache"&gt;Pragmatic Web Services with Apache CXF&lt;/a&gt; article has been published at &lt;a href="http://www.dzone.com/"&gt;DZone&lt;/a&gt; &lt;a href="http://architects.dzone.com/"&gt;Architects Zone&lt;/a&gt; and it attempts to look at how changes might be dealt with the help of various CXF features. It spends little time talking about REST and SOAP though it describes how some JAX-RS extensions can help dealing with the changes.&lt;br /&gt;&lt;br /&gt;Arguably, the example which is looked at in the article is a bit contrived in that search parameters are presented in some methods as PATH variables. One can easily come up with a more suitable example where PATH variables can be used and I thought the example served the purpose of the article really well. &lt;br /&gt;&lt;br /&gt;There are some minor formatting and link issues with the article at the moment but hopefully the DZone team who have helped a lot in publishing this article will fix them.     &lt;br /&gt;&lt;br /&gt;Comments are welcome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-2913594640829327940?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/2913594640829327940/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=2913594640829327940' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2913594640829327940'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2913594640829327940'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/06/pragmatic-web-services-with-apache-cxf.html' title='Pragmatic Web Services with Apache CXF'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-1376141242400467685</id><published>2009-06-02T10:12:00.000-07:00</published><updated>2009-06-02T10:27:48.793-07:00</updated><title type='text'>The benefit of a doubt</title><content type='html'>I have read recently some thriller which has nothing to do with a "web services" topic. I don't remember now the actual details of that thriller but I read there something which I thought might be relevant.&lt;br /&gt;&lt;br /&gt;It was something like "If you'd like to be a good doctor then you have to continue doubt everything you have already learnt or are about to learn".&lt;br /&gt;&lt;br /&gt;I think something similar can be advised to software engineers, myself including, and to web services developers in particular. Of course, there should be some compromise there, so that one does not become a doubts 'freak' :-) and so that the doubts don't wreck the success of the project. I think "being doubtful" is the quality which no one will ask you about at the interview :-) but having some healthy pessimism is a good thing nonetheless.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-1376141242400467685?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/1376141242400467685/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=1376141242400467685' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1376141242400467685'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1376141242400467685'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/06/benefit-of-doubt.html' title='The benefit of a doubt'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-6489016901464491463</id><published>2009-06-02T09:35:00.000-07:00</published><updated>2009-06-02T10:34:16.316-07:00</updated><title type='text'>Apache CXF passes JAX-RS 1.0 TCK</title><content type='html'>&lt;span style="text-decoration: underline;"&gt;&lt;/span&gt; The latest 2.2.2 patch release of &lt;a href="http://cxf.apache.org/"&gt;Apache CXF&lt;/a&gt; is the first one which passes a JAX-RS 1.0 TCK.&lt;br /&gt;&lt;br /&gt;It has been a long and rocky road for the CXF JAX-RS implementation. It came quite late into the game, with JAX-RS RI (&lt;a href="https://jersey.dev.java.net/"&gt;Jersey&lt;/a&gt;), &lt;a href="http://www.jboss.org/resteasy/"&gt;RestEasy&lt;/a&gt;, &lt;a href="http://www.restlet.org/"&gt;Restlets&lt;/a&gt; being already there. Doubts like "why a SOAP stack needs a JAX-RS implementation given that SOA has a new definition now or why duplicate what other JAX-RS implementations have done" combined with the lack of resources didn't help so by the time  JAX-RS 1.0 RI (&lt;a href="https://jersey.dev.java.net/"&gt;Jersey&lt;/a&gt;) was released in the end of last September, CXF JAX-RS was still suffering from some embarrassing bugs :-).&lt;br /&gt;&lt;br /&gt;But we hanged on and CXF users started using it and helped us to move to the stage where it was sufficient to fix some edge cases during a 5-days spell to virtually claim a JAX-RS TCK 1.0 compliance.&lt;br /&gt;&lt;br /&gt;One might say it is not a big news given that a JAX-RS 1.0 RI (&lt;a href="https://jersey.dev.java.net/"&gt;Jersey&lt;/a&gt;) was released in the end of last September while &lt;a href="http://www.jboss.org/resteasy/"&gt;RestEasy&lt;/a&gt;  announced its compliance in January.&lt;br /&gt;&lt;br /&gt;In CXF we are still seeing this result as an accomplishment which was only possible due to the fact that users tried it and helped us to push it forward. I'd also like to thank &lt;a href="http://www.dankulp.com/blog/"&gt;Dan&lt;/a&gt; for his support from the very beginning and Jervis Liu for his initial CXF JAX-RS effort.&lt;br /&gt;&lt;br /&gt;So in CXF we have the best JAX-WS implementation out there and the JAX-RS implementation is now live and kicking. CXF does and will help users build their SOAs - it does not claim it knows the only definition of SOA. CXF JAX-RS has some interesting extensions and we have some more exciting ones in mind.&lt;br /&gt;&lt;br /&gt;So stay tuned and thanks a million to all those who helped and supported us.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-6489016901464491463?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/6489016901464491463/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=6489016901464491463' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6489016901464491463'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6489016901464491463'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/06/apache-cxf-passes-jax-rs-10-tck.html' title='Apache CXF passes JAX-RS 1.0 TCK'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3788835193087973282</id><published>2009-05-21T07:26:00.000-07:00</published><updated>2009-09-01T03:21:43.094-07:00</updated><title type='text'>Annotation-free services with CXF JAX-RS</title><content type='html'>One can hear now and then people saying : "It would it be good if I did not have to add so many annotations to a service class but well...". Many JSR specifications rely seriously on annotations and it does not seem like a reversible process really. Nearly every new enhancement leads to a new annotation type being introduced.&lt;br /&gt;&lt;br /&gt;Annotations can be handy, they can save you a ton of time, they can help you with the injection of external resources, they can tell some great external library to do the job for you, they can be great after all. And they also can clutter your code and make it less readable or plain brittle.&lt;br /&gt;&lt;br /&gt;Some annotations in Java-based web services frameworks enable Java classes to act as services, notably those defined in JAX-RS and JAX-WS. Here is a typical JAX-RS example :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;@Path("/bookstore")&lt;br /&gt;public class BookStore {&lt;br /&gt;&lt;br /&gt;@GET&lt;br /&gt;@Path("books/{id}")&lt;br /&gt;@Produces("application/xml")&lt;br /&gt;public Book getBook(@PathParam("id") Long id) {&lt;br /&gt;  return books.get(id);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;@Path("books/{id}/chapter")&lt;br /&gt;public Chapter getFirstChapterSub(&lt;br /&gt;  @PathParam("id") Long id) {&lt;br /&gt;  return books.get(id).getChapter(1);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Several annotation such as @Path, @GET, @PathParam and @Produces enable Book and Chapter classes to act as resource and subresource classes respectively.&lt;br /&gt;&lt;br /&gt;The JAX-RS specification primarily talks about two main things : which annotations  enable a given Java class to act as a service and how to ensure that the expectations expressed through these annotations are met, that is how to dispatch to a given method or populate a given parameter value, etc.&lt;br /&gt;&lt;br /&gt;In CXF JAX-RS, we thought of letting users to write services without them having to annotate Java classes for a while and now we have done a first step in this direction, by following an example of the CXF SOAP simple frontend. One can apply an externally defined model instance to an existing resource tree, on either server or client side (proxies) and a CXF JAX-RS runtime will use this model instead of annotations.&lt;br /&gt;&lt;br /&gt;One can apply such model in a number of ways.&lt;br /&gt;&lt;br /&gt;One can create a number of &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/UserResource.java"&gt;UserResource&lt;/a&gt;   beans, each representing either a root or sub-resource resource. For example, one can subclass a UserResource instance and populate it in its @PostConstruct method using some external information. A list of UserResource instances can then either be registered from Spring using a jaxrs:modelBeans child element or programmatically.&lt;br /&gt;&lt;br /&gt;Or you can define a model instance either directly in a Spring beans.xml or  in an external xml file and link to it, using either a jaxrs:model child element or jaxrs:modelRef attribute .&lt;br /&gt;&lt;br /&gt;When using Spring, you often want to proxify a given service bean so we ensured you can use annotation-free proxified beans too.&lt;br /&gt;&lt;br /&gt;All options are supported on the client and server sides, for jaxrs:client and jaxrs:server. In the client case it obviously applies to a proxy-based flavor only given that http-centric clients deal with the metadata (such as path, queries, etc) explicitly.&lt;br /&gt;&lt;br /&gt;So lets see an example. Here are &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotations.java"&gt;BookStoreNoAnnotations&lt;/a&gt; root resource and &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ChapterNoAnnotations.java"&gt;ChapterNoAnnotations&lt;/a&gt; sub-resource classes. Both classes actually deal with JAXB-annotated beans, ChapterNoAnnotations being one of them, but such beans have been likely generated out of schemas, but even if not, one will not have to go and start coding in JAX-RS annotations if it is what one does not want to do.&lt;br /&gt;&lt;br /&gt;In one test we attach an externally defined &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/resources.xml"&gt;model instance&lt;/a&gt; using this configuration :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;&amp;lt;jaxrs:server&lt;br /&gt;address='/thebooks6'&lt;br /&gt;modelRef='classpath:/.../resources/resources.xml'/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;In other one we embed it directly inside jaxrs:server using a jaxrs:model, see this &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml"&gt;endpoint&lt;/a&gt; with id 'bookservice7'.  In both cases an HTTP client code can invoke on either BookStoreNoAnnotations#getBook() or ChapterNoAnnotations#getItself(), by going through a BookStoreNoAnnotations#getBookChapter() subresource method first in the latter case.&lt;br /&gt;&lt;br /&gt;In model one simply lists all the resource classes which may want to act either as root or subresource classes. The runtime will detect which one acts as a subresource one based on the response type of a given resource method, provided the model defines path but no HTTP verb values for this method.&lt;br /&gt;&lt;br /&gt;The model is flexible enough to accommodate for most of the information which is otherwise available from JAX-RS annotations. It is really a combination of 3 simple beans, notably UserResource, UserOperation and Parameter, and they can grow as needed to keep up with the progress of JAX-RS.&lt;br /&gt;&lt;br /&gt;Such model can be generated by a UI tool and simple enough to be created using an XML-editing tool.&lt;br /&gt;&lt;br /&gt;Note the goal of this CXF extension is give to users more options when a task of enabling a given set of Java classes arises. If you are conscious about writing JAX-RS compliant code such that you can swap JAX-RS implementations under the hood and see your resource working then you will likely want to skip this option.&lt;br /&gt;&lt;br /&gt;But then you might want to consider it when a cost of annotating a set of resource classes is deemed to be high. For example, embedding explicit path values using @Path annotations does seem quite brittle - path values and the way one embeds values into them or format requirements may change and now you are faced with the need to recompile. It may or may nor be an isolated and cheap update.&lt;br /&gt;&lt;br /&gt;So please think about it, try it and provide the feedback.&lt;br /&gt;&lt;br /&gt;By the way, this post can be viewed as a continuation of the &lt;a href="http://sberyozkin.blogspot.com/2009/05/standards-in-web-services-frameworks.html"&gt;previous&lt;/a&gt; one.&lt;br /&gt;Actually, I think this approach can work quite nicely once CXF JAX-RS  gets embedded in a &lt;a href="http://cxf.apache.org/distributed-osgi.html"&gt;Distributed OSGi&lt;/a&gt; implementation, with some DOSGi users being keen to keep the Java interfaces as transparent as possible.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3788835193087973282?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3788835193087973282/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3788835193087973282' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3788835193087973282'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3788835193087973282'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/05/annotation-free-services-with-cxf-jax.html' title='Annotation-free services with CXF JAX-RS'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-6526618667303858003</id><published>2009-05-14T01:56:00.000-07:00</published><updated>2009-05-14T02:36:14.575-07:00</updated><title type='text'>Standards in web services frameworks</title><content type='html'>CXF implements a number of specifications which have been standardized for users be able to write interoperable and indeed portable web service implementations in Java.&lt;br /&gt;&lt;br /&gt;Interoperable web service implementations are those which can successfully communicate with web services written in other languages or with the help of alternative Java frameworks.&lt;br /&gt;&lt;br /&gt;In the SOAP world it is specifications like WS-Security for example which attempt to describe for what is needed for an interoperable secure multi-hop SOAP conversation to go ahead.&lt;br /&gt;&lt;br /&gt;In the REST world it can be the combination of specifications like HTTP, AtomPub, XMLSecurity.&lt;br /&gt;&lt;br /&gt;Portable web service implementations are those which can be successfully run on alternative Java web services stacks without their code having to be changed.&lt;br /&gt;&lt;br /&gt;JAX-WS and JAX-RS are really those kind of specifications which enable Java implementations to participate in web services interactions as opposed to specifications like WS-Security for example. These specifications make it possible to write portable Java web service implementations.&lt;br /&gt;&lt;br /&gt;It is interesting in this regard to comment on the fact that apparently Spring does not implement JAX-RS for example. I think Spring fans simply dont mind - they do care about being able to plug in into the web services world with the help of whatever tools Spring offers to them. Such web service implementations wont be portable but so what given than Spring users are probably not even thinking of leaving Spring ? What matters most is the interoperability.&lt;br /&gt;&lt;br /&gt;In addition to those web services standards, there is another kind of healthy standards conflict in CXF : how to enable a certain feature, should it be enabled using the core Spring support or using a CXF specific Spring extension for example.&lt;br /&gt;&lt;br /&gt;Many users who understand and like Spring consider using the core Spring support being the only standard way. Some other users are just happy with CXF extensions. For example in CXF JAX-RS, one can use either Spring AOP or CXF specific custom invokers to intercept a method invocation. &lt;br /&gt;&lt;br /&gt;The goal of this blog entry is to say is that it is what your favorite framework does can become a standard for you. It is about liking what it does. If you are a Spring fan and do RESTful web services with Spring REST (or whatever it is being called) then it is the standard that works for you. If you are a JAX-RS RI fan then probably you dont mind if some of its features have not been standardized.&lt;br /&gt;&lt;br /&gt;In CXF we will think and work on popularizing its own CXF standards, with the main goal, that of helping users writing interoperable and effective web services, being the priority.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-6526618667303858003?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/6526618667303858003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=6526618667303858003' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6526618667303858003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6526618667303858003'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/05/standards-in-web-services-frameworks.html' title='Standards in web services frameworks'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-8751443896279618606</id><published>2009-05-13T09:42:00.000-07:00</published><updated>2009-05-13T10:01:15.212-07:00</updated><title type='text'>CXF JAX-RS XPath provider</title><content type='html'>I think writing the code like this is great :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;WebClient wc = WebClient.create(endpointAddress);&lt;br /&gt;Book b = &lt;br /&gt;  wc.get(XMLSource.class).get("/*/book[@name='Bar']", &lt;br /&gt;        Book.class);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;But may be sometimes you may just want&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;WebClient wc = WebClient.create(endpointAddress);&lt;br /&gt;Book b = wc.get(Book.class);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;and still be able to get to the Book named 'Bar' which is part of a larger document.&lt;br /&gt;&lt;br /&gt;So a simple &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XPathProvider.java"&gt;XPathProvider&lt;/a&gt; reader has been added to CXF, you can use it on either sides by registering it programmatically or from Spring. You can  register a unique provider per class by adding an expression and class name pair, or you can have a single provider applying a single expression in all cases or per-class specific expression.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-8751443896279618606?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/8751443896279618606/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=8751443896279618606' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/8751443896279618606'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/8751443896279618606'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/05/cxf-jax-rs-xpath-provider.html' title='CXF JAX-RS XPath provider'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-7627102891092295799</id><published>2009-05-07T07:48:00.000-07:00</published><updated>2009-09-01T03:25:58.541-07:00</updated><title type='text'>MVC the XML way with CXF JAX-RS</title><content type='html'>For some reasons,  the 'V' bit in a MVC pattern is often associated by Java users with Java Server Pages (JSP).  Personally I've never been a fan of JSP - I don't understand why would users want to mix Java code into HTML pages or pretend they don't do it by spending time on writing tag libraries in Java.&lt;br /&gt;&lt;br /&gt;Fortunately, technologies like XSLT and well-known techniques for decoupling the presentation from content exist and in CXF we did a bit of work for users be able to refresh their XML skills and say goodbye to another legacy Java technology which is JSP and never look back.&lt;br /&gt;&lt;br /&gt;If you work with CXF and do like JSP then please read on anyway - hope you will appreciate that XSLT (or technology like XQuery) can do the job too. As a side note, even if you won't want to use XSLT for generating HTML pages, in CXF you will be able to use it for generating all types of formats, doing micro-transformation routes by dealing with either legacy (backward-compatibilty) or newer (forward compatibilty) XML requests and responses.  With XSLT you can pretty much just produce any format you need, starting from text and ending with RDF - you won't need RDF-specific libraries for it :-)&lt;br /&gt;&lt;br /&gt;So we introduced an &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java"&gt;XSLTJaxbProvider&lt;/a&gt;. It's a very flexible provider. You can tell it to transform input or output data (on either client or server sides) . You can specify a stylesheet which will apply to all incoming data, or you can tell the provider to invoke a stylesheet a.xsl for application/xml and b.xsl for application/atom+feed formats. You can also tell it which Java classes are supported : for example, you may want JAXB to directly deal with Book class but you may also want to pre/post transform Book2 XML instances.&lt;br /&gt;&lt;br /&gt;For a moment JAXP Templates are used to preprocess/compile XSLT templates and SAX events are used to drive in and out transformations. The base class, JAXBElementProvider does all the work and the XSLT provider only deals with the final marshal/unmarshal invocations by wrapping input or output streams as needed.  For the record, JAXBElementProvider has been updated to deal with Stax XMLStreamReaders/Writers which gives yet another option of pre/post transforming the data and we will update the XSLT provider to pick them up, when they're available, which will essentially create 2-level transformation chains.&lt;br /&gt;&lt;br /&gt;Template instances will get all the JAX-RS Path template variables, query and last past segment matrix name-value pairs as xsl:param parameters (note : you will only need to declare the parameters you need, in XSLT unused passed-in parameters will be ignored). Additionally UriInfo.getAbsolutePath(), UriInfo.getPath() and UriInfo.getBasePath() will be available as 'absolute.path', 'relative.path' and 'base.path' respectively. We'll update the provider as needed to push more useful information to templates.&lt;br /&gt;&lt;br /&gt;If you don't use JAXB but deal with XML then please feel free just to create a custom provider. You'll just probably need to remove the 'extends JAXBElementProvider' bit from a class definition with few other minor updates.&lt;br /&gt;&lt;br /&gt;I added a simple system test which shows how to merge the (JAXB-produced) XML into HTML. It's well-known technique, described in articles like&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.xml.com/pub/a/2000/07/26/xslt/xsltstyle.html"&gt;Style-free XSLT stylesheets&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.ibm.com/developerworks/xml/library/x-runxslt/"&gt;Integrating data at runtime with XSLT stylesheets&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The idea is not to go the traditional JSP way by combining XSLT instructions and presentation tags into a single source which makes the source unreadable and difficult to maintain. Rather let people who understand how to  do proper HTML work on HTML templates, Java developers produce Java code (possibly dealing with either Java classes for JAXB to handle or JAXP Sources ) and those who like XSLT write XSLT templates which sources both presentation HTML and content XML inputs and transforms them as needed. HTML templates have special xml tags which XSLT templates replace with actual data. Trust me, this seperation of roles does work in practice quite well, I can vouch for it based on my previous experience, though I guess we didnt do the complicated stuff - but it worked nonetheless.&lt;br /&gt;&lt;br /&gt;Now lets get back to the test. Look at the &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml"&gt;jaxrs endpoint&lt;/a&gt; with 'bookservice5' id. It registers an XSLTJaxbProvider which is told to handle Book classes only and invoke a &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/templates/template.xsl"&gt;template.xsl&lt;/a&gt; for application/xhtml+xml and &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/template2.xsl"&gt;template2.xsl&lt;/a&gt; for application/xml. (For the record, this endpoint also registers CXF JAX-RS Request/Response filters which install custom Stax stream readers/writers which perform namespace translations - as advised by one of CXF users recently). The provider is also injected with &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/URIResolverImpl.java"&gt;URIResolverImpl&lt;/a&gt;, a systemId property is also supported.&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/template.xsl"&gt;template.xsl&lt;/a&gt; template sources in an xhtml template &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/book.xhtml"&gt;book.xhtml&lt;/a&gt; and imports &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/template2.xsl"&gt;template2.xsl&lt;/a&gt;. Thus &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/template2.xsl"&gt;template2.xsl&lt;/a&gt; can be used on its own too. A URIResolver instance registered earlier on takes care of resolving those relative references. Now, the &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/book.xhtml"&gt;book.xhtml&lt;/a&gt; has a special tag books:bookTag which is what a &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/template.xsl"&gt;template.xsl&lt;/a&gt; reacts upon : the flow is to copy the html tags and pull in the xml content as needed when special tags get encountered. Note that fundamental XSLT style is to do a free flow and rely on matches which makes the templates code much more readable and easier to understand.&lt;br /&gt;&lt;br /&gt;In our test we simply copy the whole XML content blob into the  resulting HTML, by preprocessing a Book instance as needed (see the imported  &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/template2.xsl"&gt;template2.xsl&lt;/a&gt;). Perhaps it would be better to add special tags to &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/book.xhtml"&gt;book.xhtml&lt;/a&gt; corresponding to Book id and Book name, with HTML table tags if needed.&lt;br /&gt;&lt;br /&gt;The server test code is in &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSpring.java"&gt;BookStoreSpring.getBookXSLT()&lt;/a&gt;. Note that JAX-RS Path, Query and Matrix parameter values are available to &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/template2.xsl"&gt;template2.xsl&lt;/a&gt;, when used on its own or when being imported.&lt;br /&gt;&lt;br /&gt;See testGetBookXSLTXml() and testGetBookXSLTHtml()  &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java"&gt;here&lt;/a&gt;. Here is the one which extract the Book instance from an HTML document :&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;&lt;br /&gt;WebClient wc = WebClient.create(endpointAddress);&lt;br /&gt;wc.accept("application/xhtml+xml")&lt;br /&gt;.path(666)&lt;br /&gt;.matrix("name2", 2)&lt;br /&gt;.query("name", "Action - ");&lt;br /&gt;XMLSource source = wc.get(XMLSource.class);&lt;br /&gt;Map&lt;string, string=""&gt; namespaces = new HashMap&lt;string, string=""&gt;();&lt;br /&gt;namespaces.put("xhtml", "http://www.w3.org/1999/xhtml");&lt;br /&gt;Book2 b = source.getNode(&lt;br /&gt;"xhtml:html/xhtml:body/xhtml:ul/xhtml:Book",&lt;br /&gt;namespaces,&lt;br /&gt;Book2.class);&lt;br /&gt;&lt;/string,&gt;&lt;/string,&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In reality you wont see a Book element in an xhtml namespace though :-)&lt;br /&gt;&lt;br /&gt;So it is the XML all the way. I believe it's great fun to be able easily and explicitly control how the XML looks like and to mix a much looser XPath style with the Java code. So give it a try and have fun.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Update&lt;/span&gt;. I mentioned above that XSLTJaxbProvider can choose which template to use depending on the media type, such as application/atom+feed for example. Note that even though this provider has static Produces and Consumes values, you can still tell to handle other media types for the runtime to view it as an eligible provider, look at the &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml"&gt;bean&lt;/a&gt; with 'jsonProvider' id on how to overwrite the static Produces and Consumes values on a given message body provider. So for example you can easily tell XSLTJaxbProvider to actually convert a given JAXB-produced XML into JSON by registering an application/json specific template (which will transform XML into JSON) with it and registering application/json as a custom Produces value.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-7627102891092295799?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/7627102891092295799/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=7627102891092295799' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/7627102891092295799'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/7627102891092295799'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/05/mvc-xml-way-with-cxf-jax-rs.html' title='MVC the XML way with CXF JAX-RS'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-13339729389473197</id><published>2009-04-13T08:09:00.000-07:00</published><updated>2009-04-14T12:52:54.919-07:00</updated><title type='text'>Analysis of CXF RESTful client APIs</title><content type='html'>We have recently introduced the CXF RESTful client API for CXF users be able to consume non-SOAP HTTP-based web services at ease. The goal of this blog entry is to compare the three different API flavors CXF offers, discuss the pros and cons of each one, with some occasional off-topic musings :-)&lt;br /&gt;&lt;br /&gt;Before I proceed I'd like to acknowledge the fact a Rest Easy JAX-RS implementation offers a proxy-based support in their own &lt;a href="http://www.jboss.org/file-access/default/members/resteasy/freezone/docs/1.0.1.GA/userguide/html/RESTEasy_Client_Framework.html"&gt;client framework&lt;/a&gt;. I was not aware of it at a time of introducing the CXF RESTful api but I'm happily doing it now - well done Rest Easy :-). If at least two implementations do a proxy-based API then may be there's a chance we'll get this approach standardized ?&lt;br /&gt;&lt;br /&gt;Now, here's the actual comparison of the CXF RESTful apis.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Beautiful Proxies&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Proxies have been written off as the main reason behind the brittle client applications having to be recompiled every time a service they consume changes. Others say they epitomize all the problems associated with  the rpc-encoded, SOAP-based services.  Others would avoid them simply because they're not cool.&lt;br /&gt;&lt;br /&gt;Things can be quite different in the reality though and here's why.&lt;br /&gt;&lt;br /&gt;Typically, the code which relies on proxies has to be recompiled whenever the service interface changes. These proxies have often been generated from a given service document. The key thing here is that it's actually service interface developers who control how robust the client-side proxies will be.&lt;br /&gt;&lt;br /&gt;Whenever a new requirement arises users will often add yet another operation in the interface description instead of extending the data the existing operations operate upon or introducing another interface instead. Read the last sentence again : you should recognize this is how HTTP-based resources cooperate with each other. When a current (service)  resource 'exhausts' itself, a new resource is introduced with the previous one delegating to the new one.&lt;br /&gt;&lt;br /&gt;So what's it to do with proxies ? Proxies can capture this process remarkably well and with some help from the service interface authors they can weather the changes.&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;BookDescription desc = new BookDescription();&lt;br /&gt;desc.setId(123);&lt;br /&gt;Book book = BookStore.getBook(desc);&lt;br /&gt;Chapters chapters = book.getChapters();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The rule is simple : design the interface such that a single complex type is accepted and/or returned from a given method. In the above example, when the book description changes it is well likely the client code won't need to be recompiled.&lt;br /&gt;&lt;br /&gt;In fact it's likely the service code won't need to be recompiled either. It's ironic that everyone accepts the code like this on the server side, without talking about RPC, for writing say RESTful services :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;@Path("/store")&lt;br /&gt;class BookStore {&lt;br /&gt;&lt;br /&gt;@GET @PATH("/{id}")&lt;br /&gt;public Book getBook(BookDescription desc) {&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Look - this code can be as brittle as the client code shown earlier on. Just add an integer id instead of BookDescription and then see what happens to this code when you need to retrieve by a book name as well : recompilation to accommodate for a new argument 'String name' or a new operation like getBookByName() in the Java code is a typical answer. Get a complex type instead and both clients and servers will become much more cost-effective when dealing with minor changes. By the way, pay attention to the getBookByName() alternative - it's not the problem of documents like WSDL that such operations pop up - rather it's the absence of single complex types in the signatures that cause them appear in the Java code.&lt;br /&gt;&lt;br /&gt;Another thing to recognize in the above server code fragment is that the code which returns a Book serves as a client to a code which expects the Book on the other end. Rather than returning a name this code returns a Book - it's natural but imagine what would've happened to the code on both sides if a name was returned originally but then a new requirement to get the chapters would arise as well...&lt;br /&gt;&lt;br /&gt;In fact the server code is often less aware of the fact that the distributed network is out there. With CXF JAXRS proxies you can get all the details of the underlying exceptions if needed and switch easily to their HTTP-centric forms.&lt;br /&gt;&lt;br /&gt;When you view the outside web services world through a given proxy you often won't notice a difference between the styles. In fact, sometimes you'll actually see how little substance is there in some of those REST vs SOAP discussions. In my own mind, it's not generic interfaces in REST vs proxies in SOAP. Rather, shortcomings of the individual (WS-*) interfaces are often confused with those of SOAP or blamed on WSDL. In my own mind SOAP suffers from the lack of GET but on the other hand it can get the people agree on how to get messages secured across the hops. REST forces people to think in terms of data as a given resource typically supports a common set of verbs, with SOAP you tunnel everything through POST but nothing prevents you from thinking in terms of data too, with REST you get the support of generic tools like browsers, with SOAP you miss on it but sometimes you probably don't notice it nor WEB does - you're just happy that your application delivers.&lt;br /&gt;&lt;br /&gt;With the advent of JAX-RS MessageBody providers, proxies can cope even better with changes to the data. Everyone uses JAXB now because it magically hides the 'complexities' of XML from developers. Sometimes I find it strange though I do use JAXB now and then too. You know what - sometimes it is ok just to write a little bit of XML processing code, web services are about interoperability and XML is the underlying format which can make it possible. But if you do JAXB then you can always interpose an XML-processing JAX-RS provider which will adapt an incoming XML to the one which will be deserialized properly by JAXB. Or perhaps you can just skip JAXB altogether as one of CXF users suggested once.&lt;br /&gt;&lt;br /&gt;Proxies based on the JAX-RS Path values with custom regular expressions can serve as early validation points. Proxies in CXF can throw the exceptions you need and can let you examine the actual response headers and easily switch to HTTP-centric clients. Using a given proxy is like exercising a micro Domain-Specific-Language instance.&lt;br /&gt;&lt;br /&gt;Proxies and existing JAXRS annotations can coexist very well in most cases. One exception is that @Contexts can not be used as method parameters, it is ok. Another edge case is that when root path annotations with template variables, those sitting on top of the resource class, may (not always) require a client to provide the substitution instances at the proxy creation time.&lt;br /&gt;&lt;br /&gt;Would I use them myself. If it were not an infinitely rich data model that my code were to consume then why not ? If I knew I was about to write a code consuming a well-behaving web service which deals with books and clearly documents its extension policies, then why not ? Would it turn my client code into an RPC-encoded piece as opposed to the RESTful one ? I don't know...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The breeze of fresh air : HTTP-centric clients&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I have to admit : programming HTTP can be very refreshing, liberating if you wish. You can see it actually works, you know you do the generic interface programming, the code is explicit about gets, updates, deletes. It's new and indeed it's cool.&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;WebClient wc = WebClient.create("http://bookstore.com");&lt;br /&gt;Response r = wc.get();&lt;br /&gt;Book b = getWithJAXB(resonse.getEntity());&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In CXF we saw no reason in introducing the client analogs of Response. When a server code uses Response, clearly it's intended for a client ? It's called 'Response' and one can get the status, headers (metadata) and the entity on either side. Same for other types like WebApplicationException.&lt;br /&gt;&lt;br /&gt;I like this http-centric code but I'm still trying to figure out why and when I would actually use it.&lt;br /&gt;&lt;br /&gt;First, I think it would be naive to assume using the above code makes it any more reusable than the proxy-based one. It's simply not the case that you can take this code and use against any other Book service out there simply because other services will do something different with a common set of HTTP verbs, or simply will deal with a completely different set, PATCH anyone or WebDav ?&lt;br /&gt;&lt;br /&gt;Second, the combination of the generic HTTP code and that of JAXB (suppose a default JAXB provider is used to deal with XML) makes me a bit dizzy - though I like the above code still - may be because it is just something new. Why do we say we write a remote web services code here and yet completely hide away from what makes the fundamental idea behind web services, that of interoperability, work ?&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;WebClient wc = WebClient.create("http://bookstore.com");&lt;br /&gt;Response r = wc.get();&lt;br /&gt;Book b = getWithJAXB(resonse.getEntity());&lt;br /&gt;&lt;br /&gt;Response r = wc.path("/foo/bar").get();&lt;br /&gt;r = wc.back().get();&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I do like the way WebClients can switch back and forward when working with a given service, or indeed convert themselves into proxies and back, say when dealing with a large set of services, with proxies being available for a subset of exposed resources. Switching from proxies to WebClients can be handy when handling the remote exceptions.&lt;br /&gt;&lt;br /&gt;I like the way Builder pattern. It was obvious we'd need to do the builder pattern given that Jersey does it on the client side - if the client API does get standardized then you know the builder pattern will be there.&lt;br /&gt;&lt;br /&gt;There is only one problem with the Builder pattern - you may not actually want to hardcode the wc.path("/foo/bar") into your client code - it's plain brittle. It's a common problem with all those in-code rules, paths, routes - people forget sometimes why they are writing the web service code - to work in the interoperable way as long as possible.&lt;br /&gt;&lt;br /&gt;When would I use WebClients ? They'd excel in testing the resources, for sure. It's new and it's fresh. They'd work nicely in combination with proxies, or indeed against the well-behaved services, perhaps embedding explicit paths will work.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Want to be cool ? Use XMLSource&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In CXF we have introduced an &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XMLSource.java"&gt;XMLSource&lt;/a&gt;, a light weight utility class for dealing with XPath expressions.&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;WebClient wc = WebClient.create("http://bookstore.com");&lt;br /&gt;XMLSource source = ws.get(XMLSource.class);&lt;br /&gt;source.setBuffering(true);&lt;br /&gt;Book b1 = source.getNode("/store/book[1]", Book.class);&lt;br /&gt;Book b2 = source.getNode("/store/book[2]", Book.class);&lt;br /&gt;Book[] books = source.getNode("/store/book", Book.class);&lt;br /&gt;URI firstBookLink = source.getLink("/store/book/@href");&lt;br /&gt;// xml:base&lt;br /&gt;URI baseURI = source.getBaseURI();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I do like it. Working with XPath is the best way to write a robust web services code, on either side (note, XMLSource can be used on the server side too as a method input parameter). It does support namespaces too, just pass along a map of prefix to namespace pairs :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;WebClient wc = WebClient.create("http://bookstore.com");&lt;br /&gt;XMLSource source = ws.get(XMLSource.class);&lt;br /&gt;Map&amp;lt;String, String&amp;gt; map =&lt;br /&gt;  new HashMap&amp;lt;String, String&amp;gt;();&lt;br /&gt;map.put("ns", "http://books");&lt;br /&gt;Book b1 = source.getNode("/ns:store/ns:book[1]", map, Book.class);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;As you know, in XPath, you don't need to match the prefix like 'ns' against the actual prefix which will be on the wire, so the above code will work even if books are qualified with 'bar:', as long as it is "http://books" which that prefix binds to.&lt;br /&gt;&lt;br /&gt;At the moment XMLSource uses JAXB but it will support custom XML-aware providers too eventually. One problem with existing JAXP classes like Source is that you can run an XPath expression against a given Source just once really, with XMLSource you can do multiple times against XML instances of small to medium sizes (note that setBuffering(true) call).&lt;br /&gt;&lt;br /&gt;We will help users to get back to XML - it's good and very cool to know and understand the technology which underpins the modern web services - so be cool !&lt;br /&gt;&lt;br /&gt;Look at it the other way. You are about to start writing a code which will consume one of those Atom-inspired Google services : http://code.google.com/apis/base/starting-out.html. You know what you need to do, XMLSource will make it trivial for you :-)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So that is it for now, and the long story cut short : please use CXF Restful API, choose the flavor you like and help us to improve it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-13339729389473197?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/13339729389473197/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=13339729389473197' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/13339729389473197'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/13339729389473197'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/04/analysis-of-cxf-restful-client-apis.html' title='Analysis of CXF RESTful client APIs'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-8760063000310756409</id><published>2009-03-24T14:28:00.000-07:00</published><updated>2009-03-24T15:06:46.045-07:00</updated><title type='text'>GET is the real differentiator</title><content type='html'>It's been few months since I actually read the posts from the blogs I follow. On Monday I got the chance and I was not disappointed at all :-). A lot of interesting stuff as usual  from the likes of &lt;a href="http://dehora.net/journal/"&gt;Bill D'Ora&lt;/a&gt;, etc, etc. Since I started reading the Bill's blog first, I immediately spotted what is it that I can't help avoiding commenting upon.&lt;br /&gt;&lt;br /&gt;Bill says in his &lt;a href="http://www.dehora.net/journal/2009/02/03/just-use-post/"&gt;feedback&lt;/a&gt; to a &lt;a href="http://www.tbray.org/ongoing/"&gt;Tim Bray&lt;/a&gt;'s &lt;a href="http://www.tbray.org/ongoing/When/200x/2009/01/29/Name-Value-Pairs"&gt;Name-Value Pairs&lt;/a&gt; post, when explaining POST vs PUT differences : "The pro-REST answer is to use PUT". Now, there's more context in Bill's post, but this statement which finally sent a message to me, though may be not the intended one.&lt;br /&gt;&lt;br /&gt;I'd rephrase  this phrase like this : "The HTTP Programmer's answer is to use PUT (in certain conditions)". This is what it is. REST is not about stating that PUT has to be used, rather it's an interface design question for a given HTTP service resource whether it's PUT or POST which is used. I think it only adds to the confusion as to what REST is about when people say the RESTful way is to do PUT and DELETE as opposed to say doing updates with POST.&lt;br /&gt;&lt;br /&gt;After reading Tim Bray's post I found &lt;a href="http://roy.gbiv.com/untangled/2009/it-is-okay-to-use-post"&gt;another interesting one&lt;/a&gt;. I don't think REST practitioners will start switching to just GET and POST. But it's good to see some clarifications in this area from the experts.&lt;br /&gt;&lt;br /&gt;I browsed through some of my old posts, here're some related ones :&lt;br /&gt;&lt;a href="http://sberyozkin.blogspot.com/2007/10/my-simple-web.html"&gt;My Simple WEB&lt;/a&gt; and &lt;a href="http://sberyozkin.blogspot.com/2007/10/one-for-reads-many-for-writes.html"&gt;One For Reads Many For Writes&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-8760063000310756409?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/8760063000310756409/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=8760063000310756409' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/8760063000310756409'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/8760063000310756409'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/03/get-is-real-differentiator.html' title='GET is the real differentiator'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-8991666584265135669</id><published>2009-02-26T09:11:00.000-08:00</published><updated>2009-02-26T10:26:54.389-08:00</updated><title type='text'>CXF JAXRS Client API updates</title><content type='html'>We've been working on improving the &lt;a href="http://sberyozkin.blogspot.com/2009/02/cxf-jaxrs-client-api-preview.html"&gt;initial Client API&lt;/a&gt; prototype we had added to CXF. Particularly, the goal was to tap a bit into a powerful CXF core runtime which gives us interceptor chains and a highly optimized HTTPConduit.&lt;br /&gt;&lt;br /&gt;I was overwhelmed with how many options CXF JAXWS client runtime had for all sorts of invocations, asynchronous ones, one ways, synchronous ones with retries, automatic processing of cases where a destination has been moved to a new address, secure HTTPS invocations, etc. So CXF JAXRS client runtime will eventually end up being as flexible and configurable as its JAXWS 'brother' (hopefully, if you're completely into REST then this analogy does not shock you too much :-)).&lt;br /&gt;&lt;br /&gt;With CXF 2.2 coming out soon I didn't have time to update the CXF JAXRS client code to do all the things CXF JAXWS can do - this will gradually be done later on. But few key things have been done, mainly it's now possible for both proxy and http-centric CXF JAXRS clients to transparently pick up the CXF Bus configuration, rely on the HTTPConduit which deals with all the complicated HTTP stuff (chunking, http proxies, timeouts, etc),  as well as custom outbound and inbound CXF interceptors.&lt;br /&gt;One interesting thing about it is that you can now basically reuse in certain cases, say, secure JAXWS and JAXRS proxies (with the HTTPS-related configuration being picked up from Spring) and you can always find out what type of proxy you're dealing with :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;&lt;br /&gt;BookService jaxwsService = ...&lt;br /&gt;BookService jaxrsService = ...&lt;br /&gt;useBookService(jaxwsService);&lt;br /&gt;useBookService(jaxrsService);&lt;br /&gt;&lt;br /&gt;if (WebClient.client(jaxwsService) == null) {&lt;br /&gt;// it's a jaxws client&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;For example, see this &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java"&gt;JAXRS HTTPS test&lt;/a&gt; which does a secure invocation with both proxy and http-centric clients. Note how straightforward it is. Actually that needs to be simplified, with a CXF Bus creation code to be pushed into a JAXRSClientFactoryBean - but you can do it right now by simply passing a command line CXF property pointing to a configuration code with the bus creation code becoming redundant.&lt;br /&gt;&lt;br /&gt;The actual simple configuration is &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https.xml"&gt;here&lt;/a&gt;, it configures both client and server sides.&lt;br /&gt;&lt;br /&gt;Another interesting thing is that we can now inject JAXRS proxies into the server service code, be it JAXWS or JAXRS one. For example, have a look at &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSoapRestImpl.java"&gt;this test resource class&lt;/a&gt; which can serve both JAXRS and JAXWS invocations. JAXRS proxy is injected like this :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;public class BookStoteSoapRestImpl {&lt;br /&gt; @Resource(name="rectClient")&lt;br /&gt; private BookStoreJaxrsJaxws webClient;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;and then it's used inside a getBook() method, irrespectively of whether it's a jaxws or jaxrs invocation which is inderway, by invoking the same method :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;public class BookStoteSoapRestImpl {&lt;br /&gt;    public Book getBook(Long id) {&lt;br /&gt;        // if it's not a recursive invocation then&lt;br /&gt;        webClient.getBook();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now the invocation goes over HTTP in this case but we'll add the support for local transport invocations too.&lt;br /&gt;&lt;br /&gt;Please check &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml"&gt;this configuration sample&lt;/a&gt; on how a jaxrs:client is configured. Among other things you can setup all the headers which need to flow, plus input/output interceptors and whether subresource proxies if any need to inherit the headers. I'll also add a support for a basic autorization here as opposed to doing it at the &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/Client.java"&gt;Client&lt;/a&gt; level, as one really needs to do it in combination with HTTPS.&lt;br /&gt;&lt;br /&gt;You can also inject jaxws:clients into your JAXRS endpoints if you wish. REST and SOAP united indeed.&lt;br /&gt;&lt;br /&gt;So that's what happening with CXF JAXRS Client API. More enhancements will be done to it, to its proxy, http- and xml-centric parts and the way it integrates with the core runtime.&lt;br /&gt;&lt;br /&gt;Stay tuned.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-8991666584265135669?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/8991666584265135669/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=8991666584265135669' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/8991666584265135669'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/8991666584265135669'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/02/cxf-jaxrs-client-api-updates.html' title='CXF JAXRS Client API updates'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-1770885071614075033</id><published>2009-02-26T06:24:00.000-08:00</published><updated>2009-02-26T06:49:06.215-08:00</updated><title type='text'>CXF JAXRS in Camel</title><content type='html'>My colleague William Tam has spent some of his time on &lt;a href="http://camel.apache.org/"&gt;Camel&lt;/a&gt; providing the support for &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;CXF&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;JAXRS&lt;/span&gt; consumers, which is much appreciated.&lt;br /&gt;&lt;br /&gt;The way William did it is very nice in that &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;JAXWS&lt;/span&gt; will eventually be supported too, using the same high-level route definition. What is also good is that no strange queries like ?&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;httpverb&lt;/span&gt;=POST will have to specified in routes, as in case of other Camel components consuming HTTP requests.&lt;br /&gt;&lt;br /&gt;Here's a basic example (courtesy of William) :&lt;br /&gt;&lt;br /&gt;from("jetty:http://localhost:9000?matchOnUriPrefix")&lt;br /&gt;        .to("&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;cxfbean&lt;/span&gt;:&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;serviceBean&lt;/span&gt;")&lt;br /&gt;&lt;br /&gt;where '&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;serviceBean&lt;/span&gt;' is an identifier for a resource class bean under which it's also been registered in a Camel service registry.&lt;br /&gt;&lt;br /&gt;With &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;CXF&lt;/span&gt; 2.0 being released soon we have a client &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;api&lt;/span&gt; support coming out too, which will make it possible to add &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;cxf&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;jaxrs&lt;/span&gt; producers calling out to external services, we'll make sure it goes into a Camel 2.0 final release.&lt;br /&gt;&lt;br /&gt;I'd encourage someone from a &lt;a href="http://www.mulesource.org/"&gt;Mule&lt;/a&gt; community to add support for &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;CXF&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;JAXRS&lt;/span&gt; routes too, perhaps by combining it somehow with the existing Mule &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;CXF&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;JAXWS&lt;/span&gt; routes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-1770885071614075033?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/1770885071614075033/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=1770885071614075033' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1770885071614075033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1770885071614075033'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/02/cxf-jaxrs-in-camel.html' title='CXF JAXRS in Camel'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-439460523669816060</id><published>2009-02-19T14:07:00.000-08:00</published><updated>2009-02-19T14:44:53.739-08:00</updated><title type='text'>FAQ : Why CXF implements JAXRS</title><content type='html'>A number of people have asked us why, or why, do we spend the time on implementing JAXRS in CXF, despite the brilliance of existing third-party implementations, with all the resources and big names support behind them.&lt;br /&gt;&lt;br /&gt;The answer is quite simple actually. We're not hell-bent on trying to emulate what others have done, nor are we into some kind of JAXRS 'battle' - not yet anyway. We aim for a 'simpler' goal which is to make sure CXF is seen as the best of breeds platform for developers writing  web services. We won't tell them they have to write REST services - we'll trust their choice and ensure CXF will handle most demanding requirements, whether it SOAP, REST or both.&lt;br /&gt;&lt;br /&gt;CXF is being recognized now as a top platform for writing SOAP services - highly optimized, tried and tested. There were times it was beginning its life with writing JAXWS from scratch and people, myself including were asking why. It was quite a bit of time ago though, and no one asks such questions any more.  CXF JAXWS is just going to get stronger, it' s happening every day. IONA trusted in those few involved in the early CXF work to pull it off and that trust payed off.&lt;br /&gt;&lt;br /&gt;So here we're, tinkering with the CXF JAXRS implementation. Odds are not that terrific for now but we'll persevere and see what happens. We continue trust in our experience and we'll get to the final destination eventually. And when we do we won't mind if a fledgling &lt;a href="http://people.apache.org/repo/m2-snapshot-repository/org/apache/cxf/cxf-bundle-jaxrs/2.2-SNAPSHOT/"&gt;CXF JAXRS&lt;/a&gt; will get off the ground on its own...&lt;br /&gt;&lt;br /&gt;The bottom line is that we do see JAXRS  as  a very important technology for CXF.  CXF is not a pure SOAP stack anymore. It's a progressive framework where all sorts of services will coexist.&lt;br /&gt;&lt;br /&gt;Have fun&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-439460523669816060?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/439460523669816060/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=439460523669816060' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/439460523669816060'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/439460523669816060'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/02/faq-why-cxf-implements-jaxrs.html' title='FAQ : Why CXF implements JAXRS'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3122244749158479200</id><published>2009-02-13T12:59:00.000-08:00</published><updated>2009-02-15T14:22:32.334-08:00</updated><title type='text'>CXF JAXRS Client API Preview</title><content type='html'>We've worked very hard recently on prototyping the client API for CXF JAXRS. We've tried our best to come up with something which will offer at least something new. It has not been easy but hopefully you'll acknowledge some differences. So without further ado here's the first overview of the CXF JAXRS Client API.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The proxies : design your resource classes and use them everywhere.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Proxy-based API is very familiar to CXF JAXWS users. As I've mentioned a number of times before it's our top priority to ensure JAXWS users can start playing with RESTful services similarly to how they do it with SOAP services. I can already hear people saying - sure, that RPC stuff is here again - but hold one please, proxy-based API can be made quite robust and I will dedicate a separate post to the comparison of different forms of client  API that CXF JAXRS supports and talk about their pros and cons. And you know what,   CXF JAXRS proxies are http-centric too. So here are some examples for a start.&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;  ProviderFactory.getInstance().register(&lt;br /&gt;       new ResponseToBookNotFoundMapper());&lt;br /&gt;  String base = "http://localhost";&lt;br /&gt;  BookInterface bp = JAXRSClientFactory.create(base,&lt;br /&gt;                                     BookInterface.class);&lt;br /&gt;  try {&lt;br /&gt;       Book b = bp.getBook(123);&lt;br /&gt;  } catch (BookNotFound ex) {}&lt;br /&gt;  BookSubresource bs = b.getSubresource(1, 2);&lt;br /&gt;  bs.getBooks(); &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;BookInterface and BookSubresource are proxies created by &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactory.java"&gt;JAXRSClientFactory&lt;/a&gt;. You've already spent some time designing your service resource classes - no need to do it again for a client side. Proxies 'navigate' with the help of JAXRS annotations and do the remote invocations. The power of UriBuilder makes the replacement of URI template variables along the way quite straightforward really. All the JAXRS parameter annotations are handled such that the receiving end will work as expected : path, query and matrix parameters will find its way into a resulting URI while HttpHeader and Cookie will go to request headers.&lt;br /&gt;&lt;br /&gt;The values will be encoded by default unless Encoded annotation is available - if you do plan to decode yourself then it's reasonable to expect you encode yourself in such cases.&lt;br /&gt;&lt;br /&gt;FormParams and MultivaluedMap parameters are handled like any other parameters representing a request body - they're serialized with the help of JAXRS MessageBodyWriters. Likewise, return values are  handled  by JAXRS MessageBodyReaders.&lt;br /&gt;Registered ResponseExceptionMappers will be given a chance to handle exceptional JAXRS Responses, othewise JAXRS WebApplicationException containing the Response will be thrown.&lt;br /&gt;&lt;br /&gt;Consumes and Produces values control Content-Type and Accept headers.&lt;br /&gt;&lt;br /&gt;Note that in the above example the root proxy is created on an interface. It might not always be possible to refactor your resource class to get the JAXRS annotations inherited  from an interface. No worries, CGLIB proxies will be created in such cases, for root and sub-resource classes - you'll just need to be a little bit careful and avoid doing some initialization with side effects in default constructors.&lt;br /&gt;&lt;br /&gt;With proxies you can't have Context parameters in your method signatures - but may be it's a good thing indeed. You can't also have Objects returned as sub-resource instances - I know JAXRS lets you do it and indeed it's a great way to test how well the dynamic resolution on sub-resources works :-), but it's Java afterall :-), not a big deal I think.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Proxies are HTTP clients&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Every proxy is &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/Client.java"&gt;Client&lt;/a&gt; which represents the common capabilities for both proxy and http-centric clients. JAXRSClientFactory has few methods for common cases when headers need to be customized  but here's how you can control what the proxy sends and receives :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;BookProxy ps = JAXRSClientFactory.create(uri);&lt;br /&gt;WebClient.client(ps).type("text/xml").accept(text/xml)&lt;br /&gt;  .modified(date, false);&lt;br /&gt;Book b = ps.getBook();&lt;br /&gt;if (b == null) {&lt;br /&gt;  Response r = WebClient.client(ps).getResponse();&lt;br /&gt;  if (r.getStatus() == 204) {&lt;br /&gt;      // check what the story is with&lt;br /&gt;      // the http-centric client&lt;br /&gt;      WebClient wc =&lt;br /&gt;        new WebClient(WebClient.client(ps), true);&lt;br /&gt;      Response r2 = wc.get();&lt;br /&gt;      // create a new proxy now&lt;br /&gt;      BookProxy ps2 =&lt;br /&gt;         JAXRSClientProxy.fromClient(wc, true);&lt;br /&gt;      assertEquals(&lt;br /&gt;         WebClient.client(ps).getCurrentURI(),&lt;br /&gt;         WebClient.client(ps2).getCurrentURI())&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The headers set explicitly will be chosen instead of those  derived from Consumes and Provides (for Content-Type and Accept). If no information is available then most likely application/xml will be set - after all, it's all mostly about XML services.&lt;br /&gt;The code above also shows few more details. If Book instance is null then most likely the conditional GET has worked  but we'd like to do more checks just in case, first by checking the actual Response and then using a &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java"&gt;WebClient&lt;/a&gt; http centric client which is initialized with our proxy's current URI and existing headers. Then we create a new proxy from a WebClient instance by inheriting its headers too.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;HTTP-centric clients&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;WebClient represents HTTP-centric clients. I do think it's unfortunate we have no standard client API. We tried to apply the same builder pattern used by JAXRS ResponseBuilder. All the header-related methods have been done after checking the section 14 of HTTP 1.1, plus JAXRS JAXRS HttpHeaders and ResponseBuilder.  Here are some examples.&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;  WebClient wc = new WebClient("http://foo");&lt;br /&gt;  WebClient wc2 = new WebClient(wc.getBaseURI());&lt;br /&gt;  Response r = wc2.accept("text/plain").get();&lt;br /&gt;  Response r = wc2.post(new Book());&lt;br /&gt;  Book b = wc2.get(Book.class);&lt;br /&gt;  Book b2 = wc2.invoke("myhttpmethod",&lt;br /&gt;                                       body, Book.class);&lt;br /&gt;  //etc&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can get a Response or a typed object, you choose. WebClient is a Client, but the builder pattern works thanks to the covariance support.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;WebClient acts like a browser&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;&lt;br /&gt;WebClient wc = new WebClient("http://foo");&lt;br /&gt;// submit form to http://foo/bar/foo/baz&lt;br /&gt;wc.path("bar").path("foo/baz").&lt;br /&gt;     form(new Form().set("a", "b")&lt;br /&gt;                                    .set("c", "d"));&lt;br /&gt;wc.back();&lt;br /&gt;assert(wc.getCurrentURI(),&lt;br /&gt;            "http://foo/bar/foo");&lt;br /&gt;// get back to base URI&lt;br /&gt;wc.back(fast);&lt;br /&gt;&lt;br /&gt;assert(wc.getCurrentURI(),&lt;br /&gt;            "http://foo");&lt;br /&gt;&lt;br /&gt;wc.to("http://newhost");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The power of XPath and XSLT&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Sometimes you just need to look into a resulting XML, either when dealing with unexpected changes  or when retrieving  a subnode. So we've gone ahead and created a utility class &lt;a href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/XMLSource.java"&gt;XMLSource&lt;/a&gt;, to be optimized and enhanced later. You'll be able to easily get to a required XML piece in a number of ways,  initial example :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;XMLSource xs = new XMLSource(&lt;br /&gt;    (InputStream)client.get().getEntity());&lt;br /&gt;Book b = xs.getNode("/books/book[1]", Book.class);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;There are quite a few more things to say about what we have but I guess it's enough for now.&lt;br /&gt;It's not yet finished at all - stay tuned for more updates. And we'd welcome a lot any constructive feedback - please send the comments to CXF lists or comment here or contact me directly.&lt;br /&gt;&lt;br /&gt;And yes - thanks to JAXRS and RI (Jersey) for being innovative and inspiring.&lt;br /&gt;&lt;br /&gt;Enjoy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3122244749158479200?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3122244749158479200/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3122244749158479200' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3122244749158479200'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3122244749158479200'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/02/cxf-jaxrs-client-api-preview.html' title='CXF JAXRS Client API Preview'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-6116501382489195921</id><published>2009-02-05T03:11:00.000-08:00</published><updated>2009-02-05T03:42:51.372-08:00</updated><title type='text'>JAXRS Spring Security Demo in Fuse</title><content type='html'>We've recently added a &lt;a href="http://static.springframework.org/spring-security/site/index.html"&gt;Spring Security&lt;/a&gt; JAXRS &lt;a href="http://projects.open.iona.com/projects/svn/iona/cxf/trunk/distribution/src/main/release/samples/jax_rs/spring_security/"&gt;demo&lt;/a&gt; to our &lt;a href="http://fusesource.com/"&gt;Fuse&lt;/a&gt; &lt;a href="http://fusesource.com/products/enterprise-cxf/"&gt;Service Framework&lt;/a&gt; distributions covering both 2.1 and 2.2 lines. &lt;br /&gt;&lt;br /&gt;Spring Security is powerful indeed. The demo shows how easily one can secure JAXRS resource classes, those derived from interfaces and those which are plain classes and  are wrapped by CGLIB proxies, with or without applying dedicated security annotations to individual resource methods.&lt;br /&gt;&lt;br /&gt;You need to create an account in order to see the source of the demo. I hope you can appreciate why we added the demo to Fuse : we intend to continue raising the awareness of Fuse. This demo will be regularly tested by our CPI process which is based on &lt;a href="http://xharness.codehaus.org/"&gt;Xharness&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;You can also get the idea of what the demo does by checking the system tests in CXF trunks on Apache. In fact the system tests evolved a bit since the demo was created, they show how subresource methods can be controlled too, with subresource instances being injected Spring proxies themselves.&lt;br /&gt;&lt;br /&gt;Hopefully though the perceived initial inconvenience to do with the account activation :-) will be compensated by the fact that you're likely to find some information of interest on everything which is happening in the Fuse world and may decide to get back again :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-6116501382489195921?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/6116501382489195921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=6116501382489195921' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6116501382489195921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6116501382489195921'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/02/jaxrs-spring-security-demo-in-fuse.html' title='JAXRS Spring Security Demo in Fuse'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3812148126351570433</id><published>2009-02-04T13:25:00.000-08:00</published><updated>2009-02-04T14:17:12.410-08:00</updated><title type='text'>New CXF SubProject : Distributed OSGI RI</title><content type='html'>&lt;a href="http://cxf.apache.org/"&gt;Apache CXF&lt;/a&gt; has recently had a &lt;a href="http://svn.apache.org/repos/asf/cxf/dosgi/trunk/"&gt;new subproject&lt;/a&gt; created which hosts a Distributed OSGI Reference Implementation.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://coderthoughts.blogspot.com/"&gt;David Bosschaert&lt;/a&gt; and &lt;a href="http://modualrit.blogspot.com/"&gt;Eric Newcomer&lt;/a&gt; have already posted about it.&lt;br /&gt;&lt;br /&gt;I'd like to add few comments.&lt;br /&gt;&lt;br /&gt;I think in the todays software world it's not easy to innovate and it's a great achievement indeed for Eric, David, Tim Diekman, Eoghan Glynn and all the folks from various companies who worked very hard and have contributed to the DOSGI-related efforts.&lt;br /&gt;&lt;br /&gt;Don't get discouraged by the RPC-ishness of DOSGI - if you do then I recommend you to read &lt;a href="http://blogs.iona.com/newcomer/archives/000572.html"&gt;this very convincing post&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;I do hope to plugin the CXF JAXRS implementation into a DOSGI RI. It's a topic for a separate post, but one can write a perfectly restful yet capable of surviving the changes client code which relies on proxies.&lt;br /&gt;&lt;br /&gt;While DOSGI will be perfect for OSGI developers, it will also attract those who are primarily after the promise of OSGI containers to replace modules on the fly in a predictable way - this is one of the reasons people might want to play with DOSGI  even though today they may do fine without it.&lt;br /&gt;&lt;br /&gt;When a given DOSGI server module will get replaced it would be ideal for the active   incoming client requests not to be lost or for clients to get helpful error messages. OSGI can help here. Hopefully future versions of DOSGI will address this fundamental issue. Perhaps we can expect a dedicated (OSGI) service be introduced which will process the pending messages as needed, by either replying properly or saving them to some storage while a given service implementation or a DOSGI bundle itself get replaced.&lt;br /&gt;&lt;br /&gt;You can expect a lot of features from DOSGI RI which sits on top of WS-Policy aware CXF runtime.&lt;br /&gt;&lt;br /&gt;Please give it a try, contribute and provide some feedback and enjoy playing with  this new and cool technology.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3812148126351570433?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3812148126351570433/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3812148126351570433' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3812148126351570433'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3812148126351570433'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/02/new-cxf-subproject-distributed-osgi-ri.html' title='New CXF SubProject : Distributed OSGI RI'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-8455687382798631451</id><published>2009-02-02T08:28:00.000-08:00</published><updated>2009-02-03T01:57:31.277-08:00</updated><title type='text'>Multiparts in CXF JAXRS</title><content type='html'>We've just had CXF JAXRS updated to deal with multiparts. Multipart/related, multipart/alternative, multipart/mixed and multipart/form-data are supported at the moment.&lt;br /&gt;&lt;br /&gt;The reason I've decided to blog about it is that I was fascinated how little work I had actually to do to make it all happen. CXF JAXRS sits on top of the robust CXF runtime core component, which, among other things, has a great support for (de)serializing multipart requests, with the ability for attachments exceeding a given configurable memory threshold be saved into a configurable directory.&lt;br /&gt;&lt;br /&gt;A number of options is available for developers wishing to handle multipart requests. First we tried to make sure that JAXWS users trying JAXRS can reuse the same code they use when dealing with attachments in JAXWS. Particularly, one can get a root attachment bound to a method parameter, while the subordinate ones can later be retrieved for further processing :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;public class Resource {&lt;br /&gt;@Context &lt;br /&gt;private MessageContext cxfJaxrsContext;&lt;br /&gt;&lt;br /&gt; @POST&lt;br /&gt; @Path("/")&lt;br /&gt; public void handle(StreamSource root) {&lt;br /&gt;   // check the root one...&lt;br /&gt;   // get to the rest of them&lt;br /&gt;   Map&amp;lt;String, DataHandler&amp;gt; parts = &lt;br /&gt;       AttachmentUtils.getChildAttachmentsAsMap(mc);&lt;br /&gt;   handleParts(parts);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The root attachment can be bound to any type which can be supported by registered providers :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;public class Resource {&lt;br /&gt;@Context &lt;br /&gt;private MessageContext cxfJaxrsContext;&lt;br /&gt;&lt;br /&gt; @POST&lt;br /&gt; @Path("/")&lt;br /&gt; public void handle(JaxbBook book) {&lt;br /&gt;   // book represents the root one&lt;br /&gt;   List&amp;lt;Attachment&amp;gt; parts =  AttachmentUtils.getChildAttachments(mc);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; @POST&lt;br /&gt; @Path("/")&lt;br /&gt; public void handle2(JSONBook book) {&lt;br /&gt;   // book represents the root one&lt;br /&gt;   List&amp;lt;Attachment&amp;gt; parts =  AttachmentUtils.getChildAttachments(mc);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; @POST&lt;br /&gt; @Path("/")&lt;br /&gt; public void handle3(MultipartBody body) {&lt;br /&gt;   Attachment a = body.getRootAttachment();&lt;br /&gt;   List&amp;lt;Attachment&amp;gt; parts =  body.getChildAttachments();&lt;br /&gt; } &lt;br /&gt;&lt;br /&gt; @POST&lt;br /&gt; @Path("/")&lt;br /&gt; public void handle4(List&amp;lt;InputStream&amp;gt; all) {&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; @POST&lt;br /&gt; @Path("/")&lt;br /&gt; public void handle5() {&lt;br /&gt;    Attachment a = AttachmentUtils.getRootAttachment(mc);&lt;br /&gt;    List&amp;lt;Attachment&amp;gt; parts =  AttachmentUtils.getChildAttachments(mc);&lt;br /&gt;    AttachmentUtils.getAllAttachments(mc);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;One can address individual parts like this :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;public class Resource {&lt;br /&gt;@Context &lt;br /&gt;private MessageContext cxfJaxrsContext;&lt;br /&gt;&lt;br /&gt; @POST&lt;br /&gt; @Path("/")&lt;br /&gt; public void handle(@Multipart(value="id1", &lt;br /&gt;                    type="application/json") JSONBook book, &lt;br /&gt;                    @Multipart(value="id2") JaxbBook book) {&lt;br /&gt;   &lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;For multipart/form-data, FormParams can be used to bind to individual parts representing form fields. MultipartMap is supported. One limitation at the moment is that with multipart/form-data, parts can only be bound to Strings (which can further be processed as per the JAXRS parameter handling rules if FormParam is used, with CXF JAXRS ParameterHandler being of likely help here). Thus if one wants to upload files then at the moment one needs to use MultipartBody and do some custom processing :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;public class Resource {&lt;br /&gt;&lt;br /&gt; @POST&lt;br /&gt; @Path("/")&lt;br /&gt; @Consumes("multipart/form-data")&lt;br /&gt; public void handle(MultipartBody body) {&lt;br /&gt;     // presumes the part has a content id&lt;br /&gt;     Attachment a = body.getAttachmentById("file");  &lt;br /&gt;     ContentDisposition cd = a.getContentDisposition();&lt;br /&gt;     InputStream is = a.getDataHandler().getInputStream();&lt;br /&gt;     // proceed&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Configuring the attachments directories and memory thresholds can be done on a per jaxrs:endpoint from Spring, setting corresponding bean properties on a CXF JAXRS provider dealing with multiparts. Or you can do it from your code if you wish :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;public class Resource {&lt;br /&gt;&lt;br /&gt; @POST&lt;br /&gt; @Path("/")&lt;br /&gt; public void handle() {&lt;br /&gt;     List&amp;lt;Attachment&amp;gt; all = &lt;br /&gt;         AttachmentUtils.getAllAttachments(mc, &lt;br /&gt;                                           "/tmp", "589678")&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Outbound attachments will also be supported. Give it a go and let us know what you think.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-8455687382798631451?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/8455687382798631451/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=8455687382798631451' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/8455687382798631451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/8455687382798631451'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2009/02/multiparts-in-cxf-jaxrs.html' title='Multiparts in CXF JAXRS'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-6909028732815219970</id><published>2008-12-17T03:51:00.000-08:00</published><updated>2008-12-17T04:26:03.149-08:00</updated><title type='text'>Managing contexts in CXF JAXRS</title><content type='html'>In JAXRS, a number of classes representing various features of a given request exist, as opposed to a composite WebServiceContext in JAXWS which lets get to individual contexts and message properties.&lt;br /&gt;&lt;br /&gt;Imagine this JAXRS resource class which needs to know where the request came from, how secure it is, what the structure of the request URI is, what servlet context parameters corresponding to a given request are, what HTTP headers are involved and if certain request preconditions are met. And if you're writing a composite message body provider then, in addition to the above requirements, you also want to query other available providers as well as to check if a certain context resolver is available.&lt;br /&gt;&lt;br /&gt;How unreatistic these requirements are ? It's likely they won't arise in many cases at the same time but likewise it's likely they'll will have to be met in some cases.&lt;br /&gt;&lt;br /&gt;So here's a portable JAXRS code showing how you can get an access to all the contexts :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;public class CompositeMessageReader&lt;br /&gt;  implements MessageBodyReader&amp;lt;Composite&amp;gt; {&lt;br /&gt;&lt;br /&gt;  @Context UriInfo u;&lt;br /&gt;  @Context SecurityContext sc;&lt;br /&gt;  @Context HttpHeaders  h;&lt;br /&gt;  @Context Request r;&lt;br /&gt;  @Context ServletContext sc;&lt;br /&gt;  @Context HttpServletRequest httpR;&lt;br /&gt;  @Context ContextResolver&lt;jaxbcontext&gt; contextR;&lt;br /&gt;&lt;br /&gt;  // use the injected contexts&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/jaxbcontext&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And here's a CXF JAXRS specific code on how you can get an access to all the contexts plus the properties of the underlying message.&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" color="#FFF8DC"&gt;&lt;br /&gt;public class CompositeMessageReader&lt;br /&gt;  implements MessageBodyReader&amp;lt;Composite&amp;gt; {&lt;br /&gt;&lt;br /&gt;  @Context org.apache.cxf.jaxrs.ext.MessageContext mc;&lt;br /&gt;  // use the injected contexts&lt;br /&gt;  mc.getSecurityContext();&lt;br /&gt;  mc.getHttpHeaders();&lt;br /&gt;  mc.getUriInfo();&lt;br /&gt;  mc.getContextResolver(JAXBContext.class)&lt;br /&gt;  mc.getRequest();&lt;br /&gt;  mc.getServletContext();&lt;br /&gt;  mc.getServletConfig();&lt;br /&gt;  mc.getHttpServletRequest();&lt;br /&gt;  mc.getHttpServletResponse();&lt;br /&gt;&lt;br /&gt;  FutureJAXRSContext newContext =&lt;br /&gt;      mc.getContext(FutureJAXRSContext.class);&lt;br /&gt;&lt;br /&gt;  mc.get(PROPERTY_KEY);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I'm contradicting here to my previous post where I'm whining :-) about the JAXRS portability.&lt;br /&gt;But you know how long would it take you to get back to a portable JAXRS code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-6909028732815219970?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/6909028732815219970/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=6909028732815219970' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6909028732815219970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6909028732815219970'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2008/12/managing-contexts-in-cxf-jaxrs.html' title='Managing contexts in CXF JAXRS'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-2116768396622313500</id><published>2008-12-17T03:22:00.000-08:00</published><updated>2008-12-17T03:50:55.716-08:00</updated><title type='text'>JAXRS Wish List</title><content type='html'>I think I won't say anything new by repeating that a JAXRS specification has been a success.&lt;br /&gt;&lt;br /&gt;It brings so many new annotations into a Java code but the main goal behind it, at least as far I see was to popularize the REST paradigm among java developers and surely, the goal has been achieved.&lt;br /&gt;&lt;br /&gt;Marc Hadley, Paul Sandoz and indeed all the experts who contributed to the JAXRS specification have done a fantastic job. And no doubts more is to come from newer versions of JAXRS.&lt;br /&gt;&lt;br /&gt;So here's my wish list. It's not a long one. May be it's a bit early given that JAXRS 1.0 was only released last September but here it goes :&lt;br /&gt;&lt;br /&gt;Please focus on the Portability.&lt;br /&gt;There's no uniform way to express that a given service class is a singleton. There's no portable client api - why is that ? In JAXWS one can do a portable code which creates and consumes services.  There's no uniform way to query for a document describing a service.&lt;br /&gt;&lt;br /&gt;That's it really - not a long list indeed :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-2116768396622313500?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/2116768396622313500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=2116768396622313500' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2116768396622313500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2116768396622313500'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2008/12/jaxrs-wish-list.html' title='JAXRS Wish List'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-810913980333122552</id><published>2008-12-09T13:03:00.000-08:00</published><updated>2008-12-09T14:06:04.671-08:00</updated><title type='text'>CXF JAXRS Keeps Getting Better</title><content type='html'>I could not resist it, even though I'm not a Christina &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;Aguilera's&lt;/span&gt; fan :-)&lt;br /&gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;CXF&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;JAXRS&lt;/span&gt; is catching up. Jersey is an extremely strong player, and I have little doubt about the top quality of other &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;JAXRS&lt;/span&gt; implementations  - but their &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;CXF&lt;/span&gt; competitor has something to say on its own - right now.&lt;br /&gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;CXF&lt;/span&gt; is there to offer a number of approaches toward building serious web services. The fusion of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;JAXWS&lt;/span&gt; and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;JAXRS&lt;/span&gt; is likely to appeal to many developers and this is just one of the areas where &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;CXF&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;JAXRS&lt;/span&gt; can play its part.&lt;br /&gt;&lt;br /&gt;Stay tuned.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-810913980333122552?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/810913980333122552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=810913980333122552' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/810913980333122552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/810913980333122552'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2008/12/cxf-jaxrs-keeps-getting-better.html' title='CXF JAXRS Keeps Getting Better'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-285627450514203031</id><published>2008-12-01T13:43:00.000-08:00</published><updated>2008-12-03T04:37:22.612-08:00</updated><title type='text'>Continuations in CXF</title><content type='html'>It's a classic problem really, how a service can help a client to submit a request and obtain a response asynchronously. A number of approaches exist :&lt;br /&gt;&lt;br /&gt;* Client does an invocation on a web service and provides an address to reply to - this requires a client to have  a web service of its own for the callback to eventually arrive while on the server side, for the (HTTP) transport thread be released, a typical HTTP 201 may be sent back as an initial acknowledgement, depending on if it's a typical two-way or so-called one way operation.&lt;br /&gt;&lt;br /&gt;* Service responds with a resource address a client needs to poll for the results be eventually obtained which requires a client to structure the code accordingly.&lt;br /&gt;&lt;br /&gt;There's another approach emerging - using suspended invocations or continuations. Actually, it's not a new approach but with &lt;a href="http://www.mortbay.org/jetty/"&gt;Jetty&lt;/a&gt; supporting and  &lt;a href="http://jcp.org/en/jsr/detail?id=315"&gt;Servlet 3 &lt;/a&gt;embracing them the suspended invocations are bound to enter the mainstream.&lt;br /&gt;&lt;br /&gt;Please read a &lt;a href="http://docs.codehaus.org/display/JETTY/Continuations"&gt;Jetty Continuations&lt;/a&gt;  page on when using continuations can make sense.&lt;br /&gt;&lt;br /&gt;Without further ado, here's a sample code fragment showing how one can do continuations in CXF in a transport neutral way. CXF Continuations API is currently supported for SOAP-HTTP services based on Jetty 6 and SOAP-JMS services. CXF JAXRS runtime supports them too :&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" background-color="#FFF8DC"&gt;&lt;br /&gt;&lt;br /&gt;import org.apache.cxf.jaxrs.ext.MessageContext;&lt;br /&gt;&lt;br /&gt;@Path("/")&lt;br /&gt;public class WebResource {&lt;br /&gt;&lt;br /&gt; private @Context MessageContext context;&lt;br /&gt; private Executor executor = ...;&lt;br /&gt;&lt;br /&gt; @GET @PATH("/quote/{id}")&lt;br /&gt; public Quote getQuote(@PathParam("id") String policyId) {&lt;br /&gt;&lt;br /&gt;  String key = &lt;br /&gt;   "org.apache.cxf.continuations.ContinuationProvider";&lt;br /&gt;  ContinuationProvider provider = context.get(key);&lt;br /&gt;&lt;br /&gt;  Continuation c = provider.getContinuation();&lt;br /&gt;  synchronized (c) {&lt;br /&gt;       if (c.isNew()) {&lt;br /&gt;          FutureTask&lt;quote&gt;&lt;quote&gt; f = new FutureTask(&lt;br /&gt;             new  CallablePolicyHandler(policyId, c));&lt;br /&gt;          c.setUserObject(f);&lt;br /&gt;          executor.execute(f);&lt;br /&gt;          c.suspend(timeout);&lt;br /&gt;       } else {&lt;br /&gt;        FutureTask&lt;quote&gt;&lt;quote&gt; f = (FutureTask&lt;quote&gt;)c.getUserObject();&lt;br /&gt;        if (f.done())  {&lt;br /&gt;          return f.get();&lt;br /&gt;        }&lt;br /&gt;        c.suspend(decreaseTimeout());&lt;br /&gt;       }&lt;br /&gt;     }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;What happens is that when continuation.suspend(timeout) is called, the current transport thread gets immediately released and a pending request is put back in the requests queue. Once an asynchronous activity gets completed, it will call continuation.resume() - in this example it's done somewhere inside a CallablePolicyHandler, which results in a suspended request be returned to this method. The code now checks if the FutureTask is done and if not then it means an initial timeout was not enough for the asynchronous activity to complete - in this specific case we decide to suspend a request yet again but with a smaller timeout.&lt;br /&gt;&lt;br /&gt;Note that in case of JAXWS the code will be absolutely identical for this specific sample, except that a ContinuationProvider instance will have to be obtained from a JAXWS WebServiceContext.getMessageContext().&lt;br /&gt;&lt;br /&gt;Both CXF JAXRS MessageContext and JAXWS MessageContext will have to be used when combining JAXWS and JAXRS. I think we may need to come up with a common MessageContext interface for such cases.&lt;br /&gt;&lt;br /&gt;Finally, this CXF Continuations API won't change when Jetty 7 (and indeed Tomcat) implementing Servlet 3 specification will ship.&lt;br /&gt;&lt;br /&gt;For another example see this &lt;a href="http://svn.codehaus.org/jetty/jetty/trunk/modules/examples/async-webservices-example-webapp/"&gt;CXF-based demo&lt;/a&gt; in a Jetty 7 trunk.  It shows the use of JAXWS asynchronous handlers among other things. Note in this demo a new ServletRequest.suspend() call is used as opposed to ContinuationsSupport.getContinuation() and Continuation.suspend() pair of calls in Jetty 6. Nothing to worry about though  if you're a CXF Continuations API user - it all will be handled internally without you noticing it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-285627450514203031?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/285627450514203031/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=285627450514203031' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/285627450514203031'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/285627450514203031'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2008/12/continuations-in-cxf.html' title='Continuations in CXF'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-8573422587287258910</id><published>2008-11-06T14:48:00.000-08:00</published><updated>2008-11-06T14:49:56.335-08:00</updated><title type='text'>Portugal</title><content type='html'>&lt;a href="http://www.flickr.com/photos/32146462@N07/"&gt;Here are some photos&lt;/a&gt; from our trip to Portugal, it was a great trip.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-8573422587287258910?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/8573422587287258910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=8573422587287258910' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/8573422587287258910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/8573422587287258910'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2008/11/portugal.html' title='Portugal'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-675881030048407492</id><published>2008-11-04T13:38:00.000-08:00</published><updated>2008-11-04T13:54:12.864-08:00</updated><title type='text'>Pragmatic message about REST</title><content type='html'>&lt;a href="http://intertwingly.net/blog/"&gt;Sam Ruby&lt;/a&gt; says in his &lt;a href="http://intertwingly.net/blog/2008/10/21/Progressive-Disclosure"&gt;Progressive Disclosure&lt;/a&gt; post :&lt;br /&gt;&lt;br /&gt;"Without intending to take anything away from Roy’s (valid) criticism on labeling, REST isn’t an all or nothing proposition.  One can get significant value from partial adoption."&lt;br /&gt;&lt;br /&gt;IMHO this message is much stronger and much more likely to be heard in the SOAP quarters than the "drop WS, adopt REST" message. For the latter message to (ever) get mostly if not fully materialized, the former needs to be heard well.&lt;br /&gt;&lt;br /&gt;+1.&lt;br /&gt;&lt;br /&gt;Indeed, &lt;a href="http://cxf.apache.org/"&gt;Apache CXF&lt;/a&gt; preaches this message too with its best-of-breed JAX-WS support and its fledgling but being constantly improved JAX-RS support, now supporting 1.0 API with just few exceptions.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-675881030048407492?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/675881030048407492/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=675881030048407492' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/675881030048407492'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/675881030048407492'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2008/11/pragmatic-message-about-rest.html' title='Pragmatic message about REST'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-887174202903993325</id><published>2008-11-04T12:40:00.000-08:00</published><updated>2008-11-04T13:37:16.503-08:00</updated><title type='text'>On How to Get a Cup of Coffee</title><content type='html'>&lt;a href="http://www.infoq.com/"&gt;InfoQ&lt;/a&gt; has recently published a &lt;a href="http://www.infoq.com/articles/webber-rest-workflow"&gt;How To Get a Cup of Coffee&lt;/a&gt; article about RESTful services.&lt;br /&gt;&lt;br /&gt;I did like reading the article : it talks about workflows, shows with the help of state diagrams how clients actually drive and execute  applications and overall it entertains the reader so I'd like to join those who welcomed this article. It was the only technical article I read last week, on vacation, and I was nearly killed when I was spotted reading it :-)&lt;br /&gt;&lt;br /&gt;What surprised me a bit though is what the authors say about clients discovering which method, say PUT which may be invoked on a given resource service. For example :&lt;br /&gt;&lt;br /&gt;"to find out if we can change the order, we ask the resource what operations it's prepared to process using the HTTP &lt;code&gt;OPTIONS&lt;/code&gt; verb, as shown on the wire in Figure 6." - please refer to the original article to see Figure 6.&lt;br /&gt;&lt;br /&gt;Next :&lt;br /&gt;&lt;br /&gt;"From Figure 6 we see that the resource is readable (it supports GET) and it's updatable (it supports PUT)."&lt;br /&gt;&lt;br /&gt;I think this use of OPTIONS is of no practical use at all. I agree it does show what OPTIONS can be used for but I find it difficult to imagine a compiled client code checking how a given resource can be updated, especially given what is said next in the article :&lt;br /&gt;&lt;br /&gt;"&lt;em&gt;Although partial updates are the subject of deep philosophical debates within the REST community, we take a pragmatic approach&lt;/em&gt;" and (authors) decide to use PUT to do a partial update. Big +1 on the pragmatic  approach by the way.&lt;br /&gt;&lt;br /&gt;In meantime Mark Nottingham provides some insightful comments but again this comment on the use of PUT for partial updates catches my attention :&lt;br /&gt;&lt;br /&gt;"&lt;span id="quote_33709"&gt;This is a flagrant abuse of the semantics of PUT; if you want to combine a representation with the existing state of the resource, use POST or the emerging PATCH. &lt;/span&gt;"&lt;br /&gt;&lt;br /&gt;To me it all means only one thing : the RESTful HTTP-aware &lt;span style="font-weight: bold;"&gt;compiled&lt;/span&gt; client code is as tightly coupled to a given resource with a &lt;span style="font-weight: bold;"&gt;generic&lt;/span&gt; HTTP interface as the client code generated from either  WSDL or WADL  is.  One service will use PUT, the other one will do  POST and the 3rd  one will use PATCH  - but the knowledge of  the verb to be used when doing  a  given  type of update is embedded in the client application code - unless it's a totally generic client application, say a browser handling HTML forms.&lt;br /&gt;&lt;br /&gt;Here's one more excerpt from the article.&lt;br /&gt;&lt;br /&gt;"&lt;em&gt;Consumers typically agree the semantics of representations and transitions with a service during design and development. But there's no guarantee that as service evolves, it won't confront the client with state representations and transitions the client had never anticipated but knows how to process – that's the nature of the loosely coupled Web. Reaching agreement on resource formats and representations under these circumstances is, however, outside the scope of this article.&lt;/em&gt;"&lt;br /&gt;&lt;br /&gt;I'm curious what can be said about reaching agreements under these circumstances ? I'm seeing the client codes being recompiled in these cases if the newly introduced data or semantically important links are to be noticed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-887174202903993325?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/887174202903993325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=887174202903993325' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/887174202903993325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/887174202903993325'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2008/11/on-how-to-get-cup-of-coffee.html' title='On How to Get a Cup of Coffee'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-6267468165044706721</id><published>2008-10-17T06:56:00.001-07:00</published><updated>2008-11-04T14:05:20.893-08:00</updated><title type='text'>Football : Belarus vs England</title><content type='html'>Belarus played versus England on Wednesday 15&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;th&lt;/span&gt; of October and lost 1 : 3. Even though I was disappointed they did not manage to draw or even win, I was still encouraged by quite positive reviews of the way Belarus played.&lt;br /&gt;&lt;br /&gt;They managed to get level after losing 0:1 and who knows what could have happened if Rooney hadn't rediscovered his lethal attacking skills by the time this campaign started.&lt;br /&gt;&lt;br /&gt;I was on a plane when the match was on, but I have it recorded. The only thing which concerns me a bit is that my (soon to be) 6 year-old son Alex is getting crazy about football at the moment and he's so excited about watching &lt;a href="http://news.bbc.co.uk/sport2/hi/football/internationals/7666668.stm"&gt;Rooney&lt;/a&gt; playing. I'm concerned that if I show him this match he'll start supporting England even when they play Belarus :-)  May be I should wait and see if Belarus manages to shock England in the away game :-)&lt;br /&gt;&lt;br /&gt;Slightly orthogonal note : BATE, a football club from Borisov, a small town near Minsk, is playing in the Champions League this season. In fact, it's the first ever club from Belarus which managed to achieve it. And they play Real Madrid (0:2 - in their 1st meeting in Madrid), Juventus (2:2 in Minsk) and Zenit St Petersburg  (1:1 - away).  Well  done  -  great effort and it brings that much needed experience and indeed finances into the Belarussian football.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-6267468165044706721?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/6267468165044706721/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=6267468165044706721' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6267468165044706721'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/6267468165044706721'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2008/10/football-belarus-vs-england.html' title='Football : Belarus vs England'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-552950010260029662</id><published>2008-09-02T04:58:00.001-07:00</published><updated>2008-09-03T09:42:58.097-07:00</updated><title type='text'>Fixing capitalism with the open source</title><content type='html'>I never thought I'd write about capitalism on this blog :-)&lt;br /&gt;&lt;br /&gt;So I was flying to &lt;a href="http://www.privet-minsk.com/"&gt;Minsk&lt;/a&gt; the other day and I was about to enjoy my holidays at home. While my fellow passengers were reading the home newspapers, I was reading an article by Bill Gates "&lt;a href="http://www.time.com/time/business/article/0,8599,1828069,00.html"&gt;How to fix capitalism&lt;/a&gt;" published by "&lt;a href="http://www.time.com/time"&gt;Time&lt;/a&gt;". I knew I was looking a bit pretentious :-)  at a time, but it was an interesting read. I picked up my copy of Time in the Dublin airport for the only reason - Bill Gates &lt;a href="http://www.time.com/time/business/article/0,8599,1828069,00.html"&gt;was looking at me&lt;/a&gt; from the front page. Actually, the article is called differently online, not sure why, possibly because 'fixing' sounds a bit strong to some hard-core capitalists :-).&lt;br /&gt;&lt;br /&gt;That article is a brief and concise guide on how businesses can help those in great need and still make money out of it. For someone like myself knowing not much about how the business is really made it was quite an inspiring read - I was flying high - literally :-) at that moment of time and I was imagining myself doing some strategic business decisions which would make the world  a better  place.&lt;br /&gt;&lt;br /&gt;Like the way the open source movement is affecting the way the business is made in the software industry, it's likely what Bill Gates wrote about will affect the way the business is made in general, sooner or later. Customers will prefer to buy from producers who are known to be associated with good causes.&lt;br /&gt;&lt;br /&gt;The open source business model is primarily based on the promise that once the ubiquity is reached there will always be customers which would prefer to buy a certified version of the open-source product, that is, pay for the top-class support.&lt;br /&gt;&lt;br /&gt;The open source, by definition, is free and it's being doing well in making capitalism more creative by lowering the cost of entry for those who need to write functioning applications fast. Not everyone who is using the open source software is in great need but those who really are can certainly avail of the freely available software.&lt;br /&gt;&lt;br /&gt;And it's likely that customers will eventually reward vendors who're investing in the open source - simply because the open-source vendors will be seen as the ones who are associated with the good cause.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-552950010260029662?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/552950010260029662/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=552950010260029662' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/552950010260029662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/552950010260029662'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2008/09/fixing-capitalism-with-open-source.html' title='Fixing capitalism with the open source'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3177057824250418545</id><published>2008-07-25T09:08:00.000-07:00</published><updated>2008-07-25T10:19:42.919-07:00</updated><title type='text'>Rest and Soap united in CXF</title><content type='html'>Please ignore the fact that Rest and Soap are presented as two alternatives - even though it's not very accurate this just helps me to make a shorter title for this blog entry.&lt;br /&gt;&lt;br /&gt;I was quite interested in a 'Restifying' SOAP-based services idea awhile back, especially after a &lt;a href="http://www.w3.org/TR/2007/REC-soap12-part2-20070427/#WebMethodFeature"&gt;Web Method Feature&lt;/a&gt; was introduced. I'm not sure anyone relies on it today, when writing practical SOAP-based web services - I just don't know.&lt;br /&gt;&lt;br /&gt;The arrival of &lt;a href="https://jsr311.dev.java.net/"&gt;JAX-RS&lt;/a&gt; introduces some new interesting possibilities in this area - from the perspective of the server-side application development at least.&lt;br /&gt;&lt;br /&gt;Consider the ever popular Bank-Account scenario which uses a Factory pattern.&lt;br /&gt;Here's a typical &lt;a href="http://jcp.org/en/jsr/detail?id=224"&gt;JAX-WS&lt;/a&gt; class :&lt;br /&gt;&lt;br /&gt;@WebService&lt;br /&gt;public class BankService {&lt;br /&gt;&lt;br /&gt;    public &lt;span&gt;&lt;span style="font-size:-1;"&gt;javax.xml.ws.wsaddressing.W3CEndpointReference createAccount(AccountInfo ai) {&lt;br /&gt;           // code omitted for brevity&lt;br /&gt;     }&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;}&lt;br /&gt;&lt;br /&gt;This class will return EPRs, one per every new Account created.&lt;br /&gt;&lt;br /&gt;Now consider the same class slightly updated :&lt;br /&gt;&lt;br /&gt;@WebService(wsdlLocation="bank.wsdl")&lt;br /&gt;@Path("/bank")&lt;br /&gt;public class BankService {&lt;br /&gt;&lt;br /&gt;    @POST&lt;br /&gt;    public &lt;span&gt;&lt;span style="font-size:-1;"&gt;javax.xml.ws.wsaddressing.W3CEndpoint&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-size:-1;"&gt;Reference createAccount(AccountInfo ai) {&lt;br /&gt;           // code omitted for brevity&lt;br /&gt;     }&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;}&lt;br /&gt;&lt;br /&gt;It is the same class with JAX-WS and JAX-RS annotations mixed in.&lt;br /&gt;&lt;br /&gt;In case of SOAP, POST createAccount requests will be targeted to, say, http://localhost:8080/bankservice endpoint address, while in the other case POST requests will be targeted to http://localhost:8080/bank address.&lt;br /&gt;&lt;br /&gt;The only missing bit is a JAX-RS MessageBodyWriter which can handle the handling of &lt;span&gt;&lt;span style="font-size:-1;"&gt;W3CEndpoint&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-size:-1;"&gt;References :&lt;br /&gt;&lt;br /&gt;public class W3c&lt;/span&gt;&lt;/span&gt;MessageBodyWriter {&lt;br /&gt;&lt;br /&gt;     public void writeTo(&lt;span&gt;&lt;span style="font-size:-1;"&gt;W3CEndpoint&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-size:-1;"&gt;Reference epr, ..., &lt;/span&gt;&lt;/span&gt;MutivaluedMap&amp;lt;String, Object&amp;gt; headers, OutputStream os) {&lt;br /&gt;          // just update the headers, do not write into the stream&lt;br /&gt;          headers.putSingle("Location", getEprAddress(epr));&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Now, the  problem is that status code needs to be set to 201 in this case and it's not possible to set a custom http status code in JAX-RS MessageBodyWriters.  Enter CXF JAX-RS filters. They will be invoked before the headers and status code is set on a CXF private Message class :&lt;br /&gt;&lt;br /&gt;public class EprResponseHandler implements ResponseHandler {&lt;br /&gt;     public Response handleResponse(Message m,&lt;br /&gt;                                                                OperationResourceInfo invokedOperation,&lt;br /&gt;                                                                Response response)  {&lt;br /&gt;           Object entity = response.getEntity();&lt;br /&gt;           if (entity != null&lt;br /&gt;               &amp;amp;&amp;amp; &lt;span&gt;&lt;span style="font-size:-1;"&gt;W3CEndpoint&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-size:-1;"&gt;Reference.class.isAssignableFrom(entity)&lt;/span&gt;&lt;/span&gt;)  {&lt;br /&gt;               return Response.created(getEndpointAddress(entity)).build();&lt;br /&gt;          }   else {&lt;br /&gt;               return null;&lt;br /&gt;          }        &lt;br /&gt;     }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Note, the need for a custom MessageBodyWriter goes away now.&lt;br /&gt;&lt;br /&gt;Finally, one needs to configure both JAX-WS and JAX-RS endpoints using Spring for ex, and you're done.&lt;br /&gt;&lt;br /&gt;A couple of additional notes. There's really no need to go for all this trouble of creating custom filters unless you'd like to preserve the same interface you've already used before starting to play with JAX-RS - this may not be that far-fetched a requirement at all.  And sorry for writing a lame and incomplete code  - hopefully it still makes sense :-)&lt;br /&gt;&lt;br /&gt;Finally, note how very similar the programming model on the server can be, when using both JAX-WS and JAX-RS. Big Web Services are often compared to Corba for a number of reasons, one of them the use of EPRs - this is definitely a red-herring. It's the non-support for GET and fine-grained interfaces which put the sides apart.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3177057824250418545?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3177057824250418545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3177057824250418545' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3177057824250418545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3177057824250418545'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2008/07/rest-and-soap-united-in-cxf.html' title='Rest and Soap united in CXF'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-3855825252901317273</id><published>2008-07-25T08:32:00.000-07:00</published><updated>2008-07-25T08:57:47.285-07:00</updated><title type='text'>A RESTful Core for Web-like Application Flexibility</title><content type='html'>I spotted a &lt;a href="http://www.theserverside.com/tt/articles/article.tss?l=ARESTfulCorePart1"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;RESTful&lt;/span&gt; Core for Web-like Application Flexibility&lt;/a&gt; article on the &lt;a href="http://www.theserverside.com/"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;ServerSide&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Please read it.&lt;br /&gt;&lt;br /&gt;I was musing a bit about the universal web programming in a couple of previous posts, using an "if REST approach is considered so appealing to the web application developers then why don't we just have the generic interfaces even in the local &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;JVM&lt;/span&gt;" kind of argument, without any practical suggestions.&lt;br /&gt;&lt;br /&gt;Looks like some clever people are after it - and my take on it is that it's just a matter of time before  we'll see a new programming language, say, W#, pronounced as 'Web Sharp'. It will come out from Microsoft or Sun or IBM or Google or indeed from &lt;a href="http://www.1060research.com/"&gt;1060 Research&lt;/a&gt; labs. I don't see how this would be W# language ever replace Java , but  I have little doubt it will  be unveiled  eventually.&lt;br /&gt;&lt;br /&gt;The authors do not propose to replace, say, a java.util.List interface with a more generic version such that a client code is never even compiled against a fine-grained interface. Given that what they write is considered 'extreme' by some of the readers of their article, deprecating the whole notion of the interface is not a starter even in the nearest longer future :-) What the authors propose seems like an interesting and promising idea, of some moderate 'extreme' :-).&lt;br /&gt;&lt;br /&gt;Interesting stuff.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-3855825252901317273?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/3855825252901317273/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=3855825252901317273' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3855825252901317273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/3855825252901317273'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2008/07/restful-core-for-web-like-application.html' title='A RESTful Core for Web-like Application Flexibility'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-2279635435820317268</id><published>2008-07-15T13:31:00.000-07:00</published><updated>2008-07-15T13:46:01.134-07:00</updated><title type='text'>Is it all about agreement ?</title><content type='html'>I remember reading one of the  &lt;a href="http://markclittle.blogspot.com/"&gt;Mark Little&lt;/a&gt;'s  posts (sorry can't find the link) where he was saying that, yes, it was possible to write transactions in REST, in fact he'd even had some practical experience in that area before.&lt;br /&gt;Yes, while I &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;don't&lt;/span&gt; have such experience I know now how I can do it now with REST.&lt;br /&gt;&lt;br /&gt;Then Mark said that a number of partners had managed to demonstrate the interoperability of one of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;WS&lt;/span&gt;-* Transaction specification as part of some of the interoperability events.&lt;br /&gt;&lt;br /&gt;This makes me wonder : is it what actually defines Web Services ? Not only the actual technology per &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;se&lt;/span&gt; but the fact that multiple businesses can do the same technology and successfully &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;interoperate&lt;/span&gt; ?&lt;br /&gt;&lt;br /&gt;Will it ever happen with &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;RESTful&lt;/span&gt; services ?  Will it be possible for multiple companies to &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;interoperate&lt;/span&gt; with more sophisticated things involved such as transactions, for ex, something which is possible to do with &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;WS&lt;/span&gt;-&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;BusinessActivity&lt;/span&gt; which does not really lock all involved ?&lt;br /&gt;&lt;br /&gt;Or is it something which will &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;not&lt;/span&gt; be ever needed in practice ? Local transactions, different business alliance-specific standards is all what will be needed to either just do transactions or achieve the interoperability in say the transactions area ?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-2279635435820317268?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/2279635435820317268/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=2279635435820317268' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2279635435820317268'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2279635435820317268'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2008/07/is-it-all-about-agreement.html' title='Is it all about agreement ?'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-1854087763196906155</id><published>2008-07-15T13:05:00.000-07:00</published><updated>2008-07-15T13:30:31.258-07:00</updated><title type='text'>About the 10 year plan</title><content type='html'>Through  &lt;a href="http://www.innoq.com/blog/st/"&gt;Stefan &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;Titkov&lt;/span&gt;&lt;/a&gt; I came across &lt;a href="http://www.infoq.com/articles/rest-anti-patterns#view_28732"&gt;this comment&lt;/a&gt;  by &lt;a href="http://soundadvice.id.au/blog/"&gt;Benjamin Carlyle&lt;/a&gt;. Benjamin says :&lt;br /&gt;&lt;br /&gt;"&lt;span id="quote_28732"&gt;Perhaps the clearest contrast is between REST and a strongly-typed O-O language. In nice, crinkly java I get a compile error whenever two components disagree on the definition of an interface. The client tries to call method foo. There is no method foo. Bail. In this setting it makes sense to leverage the strongly-typed nature of the language to make sure you don't release junk. You define interfaces in a detailed and domain-specific way that is checked to yield a consistent releasable whole."&lt;br /&gt;&lt;br /&gt;I briefly touched on it before but given that an interface with more than 4 methods is deemed unsuitable on the Web (for all the reasons associated by REST advocates with this approach) why does  it seem so natural and acceptable to do &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;OO&lt;/span&gt; finer interfaces in a single &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;JVM&lt;/span&gt; ? Will it be the ultimate WEB experience everywhere if there were only generic methods &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;everywhere&lt;/span&gt;, on the WEN and in virtual machines ? The only difference would be that when programming remote services clients would need to be able to catch up remote exceptions and handle them as needed ?&lt;br /&gt;&lt;br /&gt;This is probably a lot of nonsense. But I hope it captures what seems like one the main reasons behind a 'split' between &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;RESTful&lt;/span&gt; and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;WebServices&lt;/span&gt;  communities :  for some it's  natural to program  in terms of generic interfaces, some will eventually accept it, for others  it's simply a non-starter and  more specific interfaces are on the map - with the proper data extensibility policy they can fare pretty well too.&lt;br /&gt;&lt;br /&gt;Benjamin then says :&lt;br /&gt;&lt;br /&gt;"&lt;/span&gt;&lt;span id="quote_28732"&gt;In REST, I want the client or the server I deployed literally 10 years ago to work with whatever I am putting out today. I also want whatever I'm putting out today to work with every bit of code written since that time, and every bit of code that will be written in the next 10 years. &lt;/span&gt;&lt;span id="quote_28732"&gt;"&lt;br /&gt;&lt;br /&gt;I think I've read on one of the &lt;/span&gt;&lt;span id="quote_28732"&gt;Benjamin's blogs that in 10 years time it will be all about REST. I have to admit that prediction may be much closer to the reality as people are&lt;/span&gt;&lt;span id="quote_28732"&gt;  getting behind REST more and more.&lt;br /&gt;&lt;br /&gt;The one quoted above is basically unrealistic IMHO. With one exception only. If you're a client doing GET. I've always believed that GET is one of the main driving force behind the Web (plus links to &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;URIs&lt;/span&gt; which can be &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;GETed&lt;/span&gt;). Doing &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;POSTs&lt;/span&gt;, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;PUTs&lt;/span&gt;, etc, in 10 years time ? I doubt - but I'm happy to be eventually proven wrong.  &lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-1854087763196906155?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/1854087763196906155/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=1854087763196906155' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1854087763196906155'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/1854087763196906155'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2008/07/about-10-year-plan.html' title='About the 10 year plan'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3289902251967497593.post-2006536610486143401</id><published>2008-07-15T12:13:00.000-07:00</published><updated>2008-07-15T13:05:13.914-07:00</updated><title type='text'>CXF and JAX-RS</title><content type='html'>I've had a chance to get involved recently in a &lt;a href="https://jsr311.dev.java.net/"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;JAX&lt;/span&gt;-RS&lt;/a&gt; project in &lt;a href="http://cxf.apache.org/"&gt;Apache &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;CXF&lt;/span&gt;&lt;/a&gt;. This project is far from being complete yet but that's another story... I have to admit I've had a very positive experience while working on it.&lt;br /&gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;CXF&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;JAX&lt;/span&gt;-RS has entered the game quite late, with the leading implementations like &lt;a href="https://jersey.dev.java.net/"&gt;Jersey&lt;/a&gt;, and very likely equally strong &lt;a href="http://wiki.jboss.org/wiki/RESTeasyJAXRS"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;RestEasy&lt;/span&gt;&lt;/a&gt; and &lt;a href="http://wiki.restlet.org/docs_1.1/g1/13-restlet/28-restlet/57-restlet.html"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;Restlets&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;JAX&lt;/span&gt;-RS&lt;/a&gt; being there for a while already. Thanks to the work of my former colleague Jervis &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;Liu&lt;/span&gt;, the feedback from the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;CXF&lt;/span&gt; users and the tremendous feedback from &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;JAX&lt;/span&gt;-RS experts and the very open process behind the way &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;JAX&lt;/span&gt;-RS and Jersey RI team operates has helped &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;CXF&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;JAX&lt;/span&gt;-RS to catch up a little bit with 0.8 &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;api&lt;/span&gt; mostly supported now.&lt;br /&gt;&lt;br /&gt;One can wonder what is next for &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;CXF&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;JAX&lt;/span&gt;-RS ? I hope that with the help of the large &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;CXF&lt;/span&gt; community, its &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;JAX&lt;/span&gt;-RS implementation will eventually become as solid as its top-notch (&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;CXF&lt;/span&gt;) &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;JAX&lt;/span&gt;-&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_20"&gt;WS&lt;/span&gt; 'counterpart'. Will it be able to compete with the likes of Jersey, with it's client &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_21"&gt;api&lt;/span&gt; gem (which will hopefully get standardized one day :-) ) ? It's hard to tell - not in the nearest future for sure.&lt;br /&gt;&lt;br /&gt;Still I reckon &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_22"&gt;CXF&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_23"&gt;JAX&lt;/span&gt;-RS will eventually find its niche. While &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_24"&gt;CXF&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_25"&gt;JAX&lt;/span&gt;-RS users can certainly write &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_26"&gt;RESTful&lt;/span&gt; service only with no &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_27"&gt;JAX&lt;/span&gt;-&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_28"&gt;WS&lt;/span&gt; (SOAP) involved, possibly its best 'argument' is that it sits on top of and is closely integrated with the same &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_29"&gt;runtime&lt;/span&gt; which hosts quite possibly the best &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_30"&gt;JAX&lt;/span&gt;-&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_31"&gt;WS&lt;/span&gt; implementation out there. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_32"&gt;CXF&lt;/span&gt; users will be able to write the services combining &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_33"&gt;JAX&lt;/span&gt;-&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_34"&gt;WS&lt;/span&gt; and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_35"&gt;JAX&lt;/span&gt;-RS technologies, with one or more closely related Java classes involved,  some will experiment and decide to move to &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_36"&gt;JAX&lt;/span&gt;-RS altogether, some will use the combination of two technologies and some might get back to &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_37"&gt;JAX&lt;/span&gt;-&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_38"&gt;WS&lt;/span&gt;, you never know :-)&lt;br /&gt;&lt;br /&gt;Generally, I'm somewhat pessimistic about Java code relying on various annotations which is what &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_39"&gt;JAX&lt;/span&gt;-RS is all about. Having said that I have to admit that &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_40"&gt;JAX&lt;/span&gt;-RS is much more involved in that it's not only about the annotations. Possibly the main achievement of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_41"&gt;JAX&lt;/span&gt;-RS authors is that &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_42"&gt;JAX&lt;/span&gt;-RS 'breaks' the barrier for Java users at large and let them experiment with  &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_43"&gt;RESTful&lt;/span&gt; services while still being in the comfort of the their JAVA code. It's a great effort by those behind  the specification and the RI.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3289902251967497593-2006536610486143401?l=sberyozkin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberyozkin.blogspot.com/feeds/2006536610486143401/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3289902251967497593&amp;postID=2006536610486143401' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2006536610486143401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3289902251967497593/posts/default/2006536610486143401'/><link rel='alternate' type='text/html' href='http://sberyozkin.blogspot.com/2008/07/cxf-and-jax-rs.html' title='CXF and JAX-RS'/><author><name>Sergey Beryozkin</name><uri>http://www.blogger.com/profile/06251894780466207746</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_3sm2xdIa3Sk/SRNpGt12leI/AAAAAAAAAAM/DoZhhwomq3c/S220/SN150019.JPG'/></author><thr:total>0</thr:total></entry></feed>
