This means you rely on the client to always send the Host header. Might not 
always work.

Sent from my iPhone

On Jun 24, 2011, at 9:18 PM, Afkham Azeez <az...@wso2.com> wrote:

> The following code works.
> 
> Map<String, String> headers = (Map<String, String>)((Axis2MessageContext) 
> synCtx).getAxis2MessageContext().getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS);
>         
> String address = headers.get("Host");
> 
> On Sat, Jun 25, 2011 at 9:36 AM, Afkham Azeez <az...@wso2.com> wrote:
> 
> 
> On Sat, Jun 25, 2011 at 4:47 AM, Hiranya Jayathilaka <hira...@wso2.com> wrote:
> I found following on simple HTTP server code:
> 
> msgContext.setProperty(MessageContext.TRANSPORT_ADDR,
>                                    conn.getLocalAddress().getHostAddress());
> 
> This returns null for the NHTTP transport 
> 
> But other transports doesn't seem to be setting this. I didn't find anything 
> relevant in servlet transport code :(
> 
> Thanks,
> Hiranya
> 
> On Sat, Jun 25, 2011 at 3:48 AM, Hiranya Jayathilaka <hira...@wso2.com> wrote:
> 
> 
> On Sat, Jun 25, 2011 at 3:07 AM, Afkham Azeez <az...@wso2.com> wrote:
> Sorry, this does not work. I had hardcoded the host for testing it, so for 
> subsequent requests that prop was there.
> 
> It doesn't look like we are keeping track of the full request URI while 
> mediation. The NHTTP transport sets a property named "TransportInURL" (which 
> I think other transports are setting too) on Axis2 message context upon 
> receiving a request. But I'm not sure even that will give the full URL. 
> Here's the implementation from NHTTP transport:
> 
> msgContext.setProperty(
>             Constants.Configuration.TRANSPORT_IN_URL, 
> request.getRequestLine().getUri());
> 
> Very often the URI extracted from the request line is a relative URI and so 
> will not contain the hostname part. Worth trying out though. 
> 
> BTW can't we just infer the hostname part since we know the hostname of the 
> server where the code is running?
> 
> Thanks,
> Hiranya
>  
> 
> 
> On Sat, Jun 25, 2011 at 2:57 AM, Afkham Azeez <az...@wso2.com> wrote:
> I found a way to get this. Hope it is the proper way of handling this.
> 
> ((Axis2MessageContext)synCtx).getAxis2MessageContext().getConfigurationContext().getProperty("synapse.endpoint.lb.algorithm.sdlbEndpointhost")
>  
> 
> 
> On Sat, Jun 25, 2011 at 2:39 AM, Afkham Azeez <az...@wso2.com> wrote:
> Folks,
> To implement the Service-aware LB, I need to get the requested host name. The 
> MessageContext.getTo() method does not return the hostname part. Is there any 
> other way to get this, perhaps from the transport headers?
> 
> Thanks
> Azeez
> 
> -- 
> Afkham Azeez
> Director of Architecture; WSO2, Inc.; http://wso2.com
> Member; Apache Software Foundation; http://www.apache.org/
> 
> email: az...@wso2.com cell: +94 77 3320919
> blog: http://blog.afkham.org
> twitter: http://twitter.com/afkham_azeez
> linked-in: http://lk.linkedin.com/in/afkhamazeez
> 
> Lean . Enterprise . Middleware
> 
> 
> 
> 
> -- 
> Afkham Azeez
> Director of Architecture; WSO2, Inc.; http://wso2.com
> Member; Apache Software Foundation; http://www.apache.org/
> 
> email: az...@wso2.com cell: +94 77 3320919
> blog: http://blog.afkham.org
> twitter: http://twitter.com/afkham_azeez
> linked-in: http://lk.linkedin.com/in/afkhamazeez
> 
> Lean . Enterprise . Middleware
> 
> 
> 
> 
> -- 
> Afkham Azeez
> Director of Architecture; WSO2, Inc.; http://wso2.com
> Member; Apache Software Foundation; http://www.apache.org/
> 
> email: az...@wso2.com cell: +94 77 3320919
> blog: http://blog.afkham.org
> twitter: http://twitter.com/afkham_azeez
> linked-in: http://lk.linkedin.com/in/afkhamazeez
> 
> Lean . Enterprise . Middleware
> 
> 
> _______________________________________________
> Carbon-dev mailing list
> Carbon-dev@wso2.org
> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
> 
> 
> 
> 
> -- 
> Hiranya Jayathilaka
> Associate Technical Lead;
> WSO2 Inc.;  http://wso2.org
> E-mail: hira...@wso2.com;  Mobile: +94 77 633 3491
> Blog: http://techfeast-hiranya.blogspot.com
> 
> 
> 
> -- 
> Hiranya Jayathilaka
> Associate Technical Lead;
> WSO2 Inc.;  http://wso2.org
> E-mail: hira...@wso2.com;  Mobile: +94 77 633 3491
> Blog: http://techfeast-hiranya.blogspot.com
> 
> _______________________________________________
> Carbon-dev mailing list
> Carbon-dev@wso2.org
> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
> 
> 
> 
> 
> -- 
> Afkham Azeez
> Director of Architecture; WSO2, Inc.; http://wso2.com
> Member; Apache Software Foundation; http://www.apache.org/
> 
> email: az...@wso2.com cell: +94 77 3320919
> blog: http://blog.afkham.org
> twitter: http://twitter.com/afkham_azeez
> linked-in: http://lk.linkedin.com/in/afkhamazeez
> 
> Lean . Enterprise . Middleware
> 
> 
> 
> 
> -- 
> Afkham Azeez
> Director of Architecture; WSO2, Inc.; http://wso2.com
> Member; Apache Software Foundation; http://www.apache.org/
> 
> email: az...@wso2.com cell: +94 77 3320919
> blog: http://blog.afkham.org
> twitter: http://twitter.com/afkham_azeez
> linked-in: http://lk.linkedin.com/in/afkhamazeez
> 
> Lean . Enterprise . Middleware
> 
> _______________________________________________
> Carbon-dev mailing list
> Carbon-dev@wso2.org
> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
_______________________________________________
Carbon-dev mailing list
Carbon-dev@wso2.org
http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to