I am fairly new to the Java world and pretty overwhelmed by the beauty of choice between dozens of libraries doing more or less the same thin开发者_JS百科g, or not.
So with Jetty and CXF. I am looking for a web services stack that has built-in support for a wide range of transports and protocols.
I was under the impression that CXF is the more recent project and would be the preferred choice for new software projects. Especially when it comes to applications that have to talk a variety of different protocols and standards like WS-*.
Can you give your opinion on how those frameworks differ from each other?
Which one has broader support for different protocols and standards?
Which one would you prefer regarding its design e.g. how well they hide transport, authentication, authorization, serialization aspects from application logic?
Any kind of answer very welcome!
Cheers, Alex
Jetty is a web server and servlet container. CXF is a library for web services. If you want to serve out content like is done with a web server, choose Jetty. If you need to connect to or provide web services, choose CXF. I'm not sure there's any blurred area between the two.
There is a misunderstanding here, Jetty and CXF are like apples and oranges, it doesn't make sense to compare them. One is a light servlet engine, the other one is a web services stack.
If you're looking for a web services stack (which is my understanding), consider JAX-WS RI or CXF if you are looking for a JAX-WS compliant stack (both support contract-first or java-first), or SpringWS ("only" contract-first), or maybe Axis2 (I don't like it personally it because of its development and deployment model and its performances).
If you don't need fancy WS-* stuff, I'd suggest to use JAX-WS RI which is included in Java 6 and is compliant with the WS-I Basic Profile 1.1 (so it covers a decent bunch of WS-* standards). If you need more advanced things (like WS-SecureConversation, WS-SecurityPolicy, WS-ReliableMessaging, WS-Trust, WS-AtomicTransactions/Coordination, WS-MetadataExchange, SOAP over TCP which are provided by WSIT/Tango), consider using Metro (Metro = JAX-WS RI + WSIT/Tango).
(EDIT: Answering a comment from the OP about WS-SecureConversation support.
Actually, I think that the stack that supports the most WS-* standards is Metro. You might want to check Apache Axis2, CXF and Sun JAX-WS RI in comparison for more details. But, it is very unlikely that you'll need all of them and things might have slightly changed since the article has been published. So CXF might indeed be an alternative. For example, regarding WS-SecureConversation, CXF does support it too according to its documentation but only with "wsdl-first" projects. Without more details about what you're going to do, it's hard to give you a more accurate answer about which one is the best for you.)
Jetty is a server(a servlet container), so is Tomcat and few others. Jetty is decent, Tomcat has been around for a while and has more documentation and tutorials.
CXF looks like an interesting choice. I've only use directly implementations and CXF was fairly new, I think it's the continuation of XFire project.
CXF looks like a wise choice. When in doubt, I would say go with standards and frameworks built upon them. I would say go through the documentation and for complicated matters, you might want to subscribe to some mailing lists.
精彩评论