Hi You can use a custom http binding. See about this at http://camel.apache.org/jetty
eg just extend the default, and add those headers in the writeResponse method, and call its super to do the actual writing. On Tue, Jul 22, 2014 at 9:20 PM, Gavagai <[email protected]> wrote: > Hi all - > > I am trying to add some headers to the exchange's "out" on all routes. > Specifically, I would like to add the following to support CORS: > > exch.out.headers['Access-Control-Allow-Origin'] = '*' > exch.out.headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, > GET, OPTIONS' > exch.out.headers['Access-Control-Request-Method'] = '*' > exch.out.headers['Access-Control-Allow-Headers'] = 'Origin, > X-Requested-With, Content-Type, Accept, Authorization, Cookie' > > I do not understand how to do this for all routes. It works great when it is > done in a processor, but I obviously don't want to have to add these to each > processor. I tried intercepting the message using interceptFrom(), but the > headers so defined are not retained when the message is forwarded on to the > next destination. I also tried setting properties on the exchange, but this > presents problems when forming the response. > > What is the best way to add HTTP headers to the messages returned from all > routes? Basically say "for every message, always add these headers as the > final step." > > Tim > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Adding-HTTP-Headers-to-All-Jetty-Routes-tp5754265.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: [email protected] Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
