Hi
On 07/06/12 04:24, KARR, DAVID wrote:
-----Original Message-----
From: Ron Grabowski [mailto:[email protected]]
Sent: Wednesday, June 06, 2012 8:07 PM
To: [email protected]
Subject: Re: Configuring JAX-RS without Spring: specify relative
address?

I'm using a non-Spring web.xml similar to this:


<servlet>
     <servlet-name>HelloWorld</servlet-name>
     <servlet-
class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-
class>
     <init-param>
       <param-name>jaxrs.serviceClasses</param-name>
       <param-value>
         com.example.jaxrs.AlgorithmService
       </param-value>
     </init-param>
     <init-param>
         <param-name>jaxrs.providers</param-name>
            <param-value>
                com.example.jaxrs.GsonProvider
            </param-value>
     </init-param>
     <init-param>
           <param-name>jaxrs.extensions</param-name>
           <param-value>
             json=application/json
         </param-value>
     </init-param>
</servlet>
<servlet-mapping>
     <servlet-name>HelloWorld</servlet-name>
     <url-pattern>/servicesRest/*</url-pattern>
</servlet-mapping>

Ah, I see.  Using the url-pattern is a natural fit.

In addition to that you can also introduce a 'jaxrs.address' parameter for setting the relative path (default is '/'), but I guess it's of little use in the non-Spring case

Cheers, Sergey


________________________________
  From: "KARR, DAVID"<[email protected]>
To: "[email protected]"<[email protected]>
Sent: Wednesday, June 6, 2012 1:30 PM
Subject: Configuring JAX-RS without Spring: specify relative address?

I've developed a handful of CXF JAX-RS services that work with Spring.
I'm going to have to quickly learn about how to do it in a new service
that doesn't use Spring.  I've found some of the references that talk
about this, although they're spread around, and not necessarily
consistent.

I think I'd prefer to do as much configuration in the web.xml, as
opposed to programmatic configuration.  In the example on the wiki, at
http://cxf.apache.org/docs/jaxrs-services-
configuration.html#JAXRSServicesConfiguration-
ConfiguringJAXRSservicesincontainerwithoutSpring , it doesn't even
mention setting the server address, which in my Spring-based services
set this with a relative path on the "address" property of the
"jaxrs:server" element.  How is the server address configured when you
do it this way?


--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to