> -----Original Message----- > From: Tom Davies [mailto:[EMAIL PROTECTED] > Sent: 2007?11?12? 6:23 > To: [email protected] > Subject: Re: Programmatically publishing a REST endpoint > > > > 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+%28 JSR-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(); > This should work. Willem Jiang had done some work on this part recently to make it possible to publish an endpoint using servlet transport both from spring configuration and API.
> A more general question: What are the pros and cons of using > CXF HTTP > binding vs. JSR-311 for REST? > If you take a closer look into JSR-311 and CXF HTTP binding, you may find that they have a lot of things in common, such as the URITemplate, HTTP Method annotation etc. Maybe the annotation names are different, but the basic ideas are same. So I would say you can view JSR-311 as an evolved and more standard version of CXF HTTP binding. > Thanks again, > Tom > > -- > ATLASSIAN - http://www.atlassian.com > Our products help over 8,500 customers in more than 95 countries to > collaborate > > > > > ---------------------------- IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
