[Carbon-dev] How to get the requested hostname from the Synapse MessageContext?
Afkham Azeez
azeez at wso2.com
Sat Jun 25 00:04:26 EDT 2011
On Sat, Jun 25, 2011 at 3:48 AM, Hiranya Jayathilaka <hiranya at wso2.com>wrote:
>
>
> On Sat, Jun 25, 2011 at 3:07 AM, Afkham Azeez <azeez at 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.
>
This just gives the part after the host & port, not the hostname.
>
> 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 <azeez at 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 <azeez at 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/
>>>> * <http://www.apache.org/>**
>>>> email: **azeez at wso2.com* <azeez at wso2.com>* cell: +94 77 3320919
>>>> blog: **http://blog.afkham.org* <http://blog.afkham.org>*
>>>> twitter: **http://twitter.com/afkham_azeez*<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/
>>> * <http://www.apache.org/>**
>>> email: **azeez at wso2.com* <azeez at wso2.com>* cell: +94 77 3320919
>>> blog: **http://blog.afkham.org* <http://blog.afkham.org>*
>>> twitter: **http://twitter.com/afkham_azeez*<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/
>> * <http://www.apache.org/>**
>> email: **azeez at wso2.com* <azeez at wso2.com>* cell: +94 77 3320919
>> blog: **http://blog.afkham.org* <http://blog.afkham.org>*
>> twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
>> *
>> linked-in: **http://lk.linkedin.com/in/afkhamazeez*
>> *
>> *
>> *Lean . Enterprise . Middleware*
>>
>>
>> _______________________________________________
>> Carbon-dev mailing list
>> Carbon-dev at wso2.org
>> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>>
>>
>
>
> --
> Hiranya Jayathilaka
> Associate Technical Lead;
> WSO2 Inc.; http://wso2.org
> E-mail: hiranya at wso2.com; Mobile: +94 77 633 3491
> Blog: http://techfeast-hiranya.blogspot.com
>
> _______________________________________________
> Carbon-dev mailing list
> Carbon-dev at 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/
* <http://www.apache.org/>**
email: **azeez at wso2.com* <azeez at wso2.com>* cell: +94 77 3320919
blog: **http://blog.afkham.org* <http://blog.afkham.org>*
twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
*
linked-in: **http://lk.linkedin.com/in/afkhamazeez*
*
*
*Lean . Enterprise . Middleware*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.wso2.org/pipermail/carbon-dev/attachments/20110625/1cb7b032/attachment-0001.html>
More information about the Carbon-dev
mailing list