On 08/11/2007, at 7:37 PM, Liu, Jervis wrote:

Here you go, a brief document on how to build RESTful services in CXF using JAX-RS (JSR-311): http://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+%28JSR-311%29


Hi Jervis,

Thanks for the information.

One clarification: as I'm using the servlet transport, I don't want to set an explicit address, just a path component, so that the REST API is under the URL my CXFServlet maps to.

So given that I have this code to publish my SOAP services:

public void init(ServletConfig servletConfig) throws ServletException {
       super.init(servletConfig);
       Bus bus = this.getBus();
       BusFactory.setDefaultBus(bus);
Endpoint.publish("/review", SpringContext.getComponent("rpcReviewService")); Endpoint.publish("/auth", SpringContext.getComponent("rpcAuthService"));
        ... REST publishing goes here ...
   }

Can I use something like:
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
       sf.setResourceClasses(RestReviewService.class);
       //default lifecycle is per-request, change it to singleton
sf.setResourceProvider(RestReviewService.class, new SingletonResourceProvider());
       sf.setBus(bus);
        sf.setAddress("/rest"); // will this work?

       sf.create();

A more general question: What are the pros and cons of using CXF HTTP binding vs. JSR-311 for REST?

Thanks again,
  Tom

--
ATLASSIAN - http://www.atlassian.com
Our products help over 8,500 customers in more than 95 countries to collaborate





Reply via email to