This is exactly what I need, but the exchange does not seem to have
HttpMessage within it. I tried both versions of HttpMessage (http and
http4) that camel supports. Here is my code:

        //import org.apache.camel.component.http4.HttpMessage;
        import org.apache.camel.component.http.HttpMessage;

        HttpMessage msg = exchange.getIn(HttpMessage.class); //msg is
always null
        HttpServletRequest req = msg.getRequest();

Note, my routebuilder code looks something like this:
         from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
         .process(myProcessor)
         
.to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false");

So, the request is coming in from a servlet context.

tia,
rouble


On Thu, Jan 24, 2013 at 3:32 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> On Wed, Jan 23, 2013 at 10:10 PM, Pranab Mehta <rou...@gmail.com> wrote:
>> I am running Camel 2.8, and to proxy a https web service I use the
>> following route:
>>         from("servlet:///proxyWebService/api/?matchOnUriPrefix=true")
>>         .process(myProcessor)
>>         
>> .to("https4://realWebService:8443/api/?bridgeEndpoint=true&throwExceptionOnFailure=false");
>>
>> Now, in the process leg, I want to be able to extract the full Request
>> URL with hostname and port that was used to access the servlet. I am
>> hoping this information is somewhere in the Exchange, but I am unable
>> to find it.
>>
>
> You can get access to the HttpServletRequest, where you can find all
> the details you need.
>
> In the processor you can do
>
> HttpMessage msg = exchange.getIn(HttpMessage.class);
> HttpServletRequest req = msg.getRequest();
>
>
>> tia,
>> rouble
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cib...@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to