The CXF component swallows all headers and doesn't pass them through. So I can't just copy headers around. UriInfo definitely does not report the header correctly. So from all avenues, I can't find an answer. So far, my current method has been to simply hardcode the base path as a configuration element, but this falls apart if I have multiple aliases for my server, such as example.com and performrequest.com, I won't be able to identify which server I'm answering for.
Zach Calvert -----Original Message----- From: Willem Jiang [mailto:willem.ji...@gmail.com] Sent: Thursday, March 29, 2012 3:38 AM To: users@camel.apache.org Subject: Re: Get HTTP Headers In CXF Bean Hi, I'm not sure how did you hold the header inside of the camelCXFBean. If you just want to pass the header, you can change the route by using the setHeader. If you want to get full control of it, you can use Processor or Bean to do this kind of job. On Thu Mar 29 04:46:22 2012, Sergey Beryozkin wrote: > On 28/03/12 19:09, Calvert, Zach (Zach)** CTR ** wrote: >> I am trying to get a hold of either the camel header >> "CamelHttpBaseUri" or get the correctly populated resource "@Context >> UriInfo uriInfo" inside of a CamelCXF bean. I'm able to get the >> UriInfo, but the baseURI exposed out of the UriInfo is >> "camel://cxfbean:" instead of something like "http://example.com". We >> are using jetty as the from: >> <camel:route> >> <camel:from >> uri="jetty:http://0.0.0.0:{{jetty.port}}/restms/?matchOnUriPrefix=true" >> /> >> <camel:log message="Message received from jetty"/> >> <camel:to >> uri="cxfbean:restfulService?headerFilterStrategy=#keepAllMessageHeadersStrategy" >> /> >> <camel:log message="Cxfbean handled message"/> >> </camel:route> >> >> I need to get the base URI, so if I reach my server by going to >> http://example.com/rest, I know where the request came from. >> > > Perhaps injecting HttpServletRequest can do a trick ? I think CXF will > check for the Message.BASE_PATH for non-CXF destinations, so may be > cxfbean processor does not set it and hence UriInfo, not sure right now, > >> >> Is this possible? >> > UriInfo does need to return the actual HTTP address so ideally it > should be possible, > > Cheers, Sergey > >> >> >> Thanks, >> Zach Calvert >> >> > -- Willem ---------------------------------- FuseSource Web: http://www.fusesource.com Blog: http://willemjiang.blogspot.com (English) http://jnn.javaeye.com (Chinese) Twitter: willemjiang Weibo: willemjiang