Building REST style web services
Hi,
I am a bit new to CXF and wondering what is the recommended way to build REST
style web services with CXF now.
I simply decorated my method with the @Get and @HttpResource annotations:
@WebService
public interface IBMICalculator {
@Get
@HttpResource(location = "/computeBMI/{weight}/{height}")
public double computeBMI(@WebParam(name="weight") double weight,
@WebParam(name="height") double height) ;
}
I imported the binding extension xml file in my spring xml configuration file,
cxf.xml:
<import resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml"/>
And i declared an endpoint :
<jaxws:endpoint id="calcBMI"
implementor="com.company.bmi.services.IBMICalculatorImpl"
address="/cxfBmi"
bindingUri="http://apache.org/cxf/binding/http">
<jaxws:serviceFactory>
<bean class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
<property name="wrapped" value="true" />
</bean>
</jaxws:serviceFactory>
</jaxws:endpoint>
It works like a charm. However I read that "This binding has been deprecated
and is likely to be removed from CXF in one of its future releases"
https://cwiki.apache.org/CXF20DOC/http-binding.html
So what is the recommanded way to build REST style web services with CXF now ?
Thanks for helping.