Hi On Sun, Aug 7, 2011 at 6:24 PM, Sperner, Klaus <[email protected]> wrote: > Dear CXF Users, > > I'm trying to develop a RESTful interface (JAX-RS) using Apache CXF, and I'd > like to deploy it into a Tomcat Server from the Eclipse IDE. I found this > tutorial > (http://pettergraff.blogspot.com/2010/11/developing-web-service-in-eclipse.html), > which describes the needed steps for a normal Web service (JAX-WS) very > detailed, but I didn't find any tutorials for the creation of RESTful > interfaces. Is there such a tutorial around, or could you provide me with a > short sequence of the necessary steps to accomplish the deployment of the > server and client side components. As I don't know much about Maven and > nothing about Spring, I'd like to omit these technologies in the first step, > but if I need them, or if they make it much easier, I'll have a closer look > at them. >
If you prefer starting without Spring then the simplest way to start is to use CXFNonSpringJaxrsServlet: http://cxf.apache.org/docs/jaxrs-services-configuration.html#JAXRSServicesConfiguration-ConfiguringJAXRSservicesincontainerwithoutSpring For example, lets assume you have services.war (built with Ant or in Eclipse) so the base URI is for example "http://localhost:8080/services". Configure the servlet in web.xml, for example: <servlet> <servlet-name>CXFServlet</servlet-name> <display-name>CXF Servlet</display-name> <servlet-class> org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet </servlet-class> <init-param> <param-name>jaxrs.serviceClasses</param-name> <param-value> org.bar.RootResource </param-value> </init-param> </servlet> ... Assuming org.bar.RootResource has a class-level @Path("/") and resource method having @GET and @Path("/bar"), then after deploying services.war, "GET http://localhost:8080/services/bar" should return some representation... http://cxf.apache.org/docs/jax-rs.html#JAX-RS-Settinguptheclasspath should help re setting up Eclipse classpath if you prefer working from Eclipse. We've put a lot of effort in improving demos and documentation in our Talend distributions but I must admit an Eclipse-based tutorial is missing - we'll look into it :-) Let us know please how are getting on with the initial setup, Cheers, Sergey > Any help would be appreciated. > Thanks in advance and best regards, > Klaus > > Klaus Sperner > Research Associate > SAP (Switzerland) Inc., Kreuzplatz 20, 8008 Zurich, Switzerland > > T +41 58 871 78 31, M +41 76 409 40 63, F +41 58 871 78 12 > mailto:[email protected] > > Please consider the impact on the environment before printing this e-mail. > > > > -- Sergey Beryozkin http://sberyozkin.blogspot.com Talend - http://www.talend.com
