Hi Paul, why not using <ref bean=""/> ?
Let me check how it parses. Does it work with <ref bean=""/> ? Regards JB On 16/08/2018 17:53, Paul Spencer wrote: > Karaf 4.2.0, Java 8, CXF 3.2.6 > I am trying to enable CORS in my restful service based on the example in > https://cxf.apache.org/docs/jax-rs-cors.html, but the header > "Access-Control-Allow-Origin: *" is not in the response. The only variation > from the example is the definition of the providers. The example used <ref > bean="cors-filter"> and I am using <ref component-id="cors-filter" />. > > What am I not doing? > > *** > * Supporting information > *** > > ** Request and Response > sparrow:~ paul$ curl -i -H "Accept:text/plain" -X get > http://192.168.212.130:8181/cxf/rest/annotatedGet/Hello > HTTP/1.1 200 OK > Content-Type: text/plain > Date: Thu, 16 Aug 2018 15:46:44 GMT > Transfer-Encoding: chunked > Server: Jetty(9.4.6.v20170531) > > Hello > sparrow:~ paul$ > > ** From Karaf.log > 16:46:44.259 INFO [qtp1158074324-166] Inbound Message > ---------------------------- > ID: 3 > Address: http://192.168.212.130:8181/cxf/rest/annotatedGet/Hello > Http-Method: GET > Content-Type: > Headers: {Accept=[text/plain], Content-Type=[null], > Host=[192.168.212.130:8181], User-Agent=[curl/7.54.0]} > -------------------------------------- > 16:46:44.263 INFO [qtp1158074324-166] Outbound Message > --------------------------- > ID: 3 > Response-Code: 200 > Content-Type: text/plain > Headers: {Content-Type=[text/plain], Date=[Thu, 16 Aug 2018 15:46:44 GMT]} > Payload: Hello > -------------------------------------- > > ** From blueprint.xml > <jaxrs:server id="service" address="/rest"> > <jaxrs:serviceBeans> > <ref component-id="cors-server" /> > </jaxrs:serviceBeans> > <jaxrs:providers> > <ref component-id="cors-filter" /> > </jaxrs:providers> > </jaxrs:server> > > ** From Karaf > > karaf@root()> list -t 1 | grep CXF > 76 │ Active │ 40 │ 3.2.6 │ Apache CXF Core > 77 │ Active │ 40 │ 3.2.6 │ Apache CXF Runtime JAX-RS > Frontend > 78 │ Active │ 40 │ 3.2.6 │ Apache CXF Runtime Management > 79 │ Active │ 40 │ 3.2.6 │ Apache CXF JAX-RS Client > 80 │ Active │ 40 │ 3.2.6 │ Apache CXF JAX-RS Extensions: > Providers > 81 │ Active │ 40 │ 3.2.6 │ Apache CXF JAX-RS Extensions: > Search > 82 │ Active │ 40 │ 3.2.6 │ Apache CXF JAX-RS Extensions: > JSON Basic > 83 │ Active │ 40 │ 3.2.6 │ Apache CXF JAX-RS Service > Description > 84 │ Active │ 40 │ 3.2.6 │ Apache CXF Runtime HTTP > Transport > 85 │ Active │ 40 │ 3.2.6 │ Apache CXF Karaf Commands > 125 │ Active │ 40 │ 3.2.6 │ Apache CXF RS Cross-Origin > Resource Sharing > karaf@root()> > > > > > Paul Spencer > > > > -- > Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html > -- Jean-Baptiste Onofré [email protected] http://blog.nanthrax.net Talend - http://www.talend.com
