Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-26 Thread Afkham Azeez
On Sun, Jun 26, 2011 at 9:14 PM, Hiranya Jayathilaka wrote: > > > On Sun, Jun 26, 2011 at 12:26 PM, Afkham Azeez wrote: > >> It is the HTTP 1.1 spec that mandates the Host header. So, our LB as it >> stands now, will not work with HTTP 1.0. >> >> >> On Sun, Jun 26, 2011 at 11:48 AM, Afkham Azeez

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-26 Thread Hiranya Jayathilaka
On Sun, Jun 26, 2011 at 12:26 PM, Afkham Azeez wrote: > It is the HTTP 1.1 spec that mandates the Host header. So, our LB as it > stands now, will not work with HTTP 1.0. > > > On Sun, Jun 26, 2011 at 11:48 AM, Afkham Azeez wrote: > >> >> >> On Sun, Jun 26, 2011 at 11:34 AM, Hiranya Jayathilaka

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-25 Thread Afkham Azeez
It is the HTTP 1.1 spec that mandates the Host header. So, our LB as it stands now, will not work with HTTP 1.0. On Sun, Jun 26, 2011 at 11:48 AM, Afkham Azeez wrote: > > > On Sun, Jun 26, 2011 at 11:34 AM, Hiranya Jayathilaka wrote: > >> Hi, >> >> Please try applying the attached patch on Synap

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-25 Thread Afkham Azeez
Also Hiranya, Do you think the following method you have used in your patch will work when there are multiple hostnames mapped to a single machine; NhttpUtil.getHostName(httpConn.getLocalAddress()) My requirement is to simply get the Host from the request. For example, on my machine, I have appse

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-25 Thread Afkham Azeez
On Sun, Jun 26, 2011 at 11:34 AM, Hiranya Jayathilaka wrote: > Hi, > > Please try applying the attached patch on Synapse > (modules/transports/core/nhttp). It uses the Host header to construct the > full URI. If the header is not present it uses the information available in > the connection object

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-25 Thread Hiranya Jayathilaka
Hi, Please try applying the attached patch on Synapse (modules/transports/core/nhttp). It uses the Host header to construct the full URI. If the header is not present it uses the information available in the connection object. HTTP spec mandates that all requests contain the Host header. So most o

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-25 Thread Afkham Azeez
On Sat, Jun 25, 2011 at 9:47 PM, Afkham Azeez wrote: > Hiranya, > Can you please coders that. The servlet API provides such information so > this is a shortcoming of the nhttp transport. > Oops... this is what happens when you use the phone keyboard :) I meant, can you please fix this so that we

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-25 Thread Afkham Azeez
Hiranya, Can you please coders that. The servlet API provides such information so this is a shortcoming of the nhttp transport. On Jun 25, 2011 9:33 PM, "Hiranya Jayathilaka" wrote: > The original request uri is not part of the message. So we cannot obtain it from the http message. But at the tran

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-25 Thread Afkham Azeez
Folks, This is the LB we are going to use for stratoslive, so it has to work correctly. We need to implement the correct solution for this issue. Thanks Azeez On Jun 25, 2011 9:48 AM, "Afkham Azeez" wrote: > The following code works. > > Map headers = (Map)((Axis2MessageContext) > synCtx).getAxis

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-25 Thread Hiranya Jayathilaka
The original request uri is not part of the message. So we cannot obtain it from the http message. But at the transport level we can infer it by looking at the socket. Currently nhttp transport doesn't do that. We can add that bit of logic to the transport if needed. Sent from my iPhone On Jun

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-25 Thread Afkham Azeez
On Sat, Jun 25, 2011 at 8:24 PM, Hiranya Jayathilaka wrote: > This means you rely on the client to always send the Host header. Might not > always work. > Is there a way to get the originally requested URL? > > Sent from my iPhone > > On Jun 24, 2011, at 9:18 PM, Afkham Azeez wrote: > > The fol

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-25 Thread Supun Kamburugamuva
Most of the time URI contains only the path part of the URL. If we want the host name we have to get it by other means. Thanks, Supun.. On Sat, Jun 25, 2011 at 8:24 PM, Hiranya Jayathilaka wrote: > This means you rely on the client to always send the Host header. Might not > always work. > > Sen

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-25 Thread Hiranya Jayathilaka
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 wrote: > The following code works. > > Map headers = (Map)((Axis2MessageContext) > synCtx).getAxis2MessageContext().getProperty(org.apache.ax

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-24 Thread Afkham Azeez
The following code works. Map headers = (Map)((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 wrote: > > > On Sat, Jun 25, 2011 at

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-24 Thread Afkham Azeez
On Sat, Jun 25, 2011 at 4:47 AM, Hiranya Jayathilaka 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

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-24 Thread Afkham Azeez
On Sat, Jun 25, 2011 at 3:48 AM, Hiranya Jayathilaka wrote: > > > On Sat, Jun 25, 2011 at 3:07 AM, Afkham Azeez 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

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-24 Thread Hiranya Jayathilaka
I found following on simple HTTP server code: msgContext.setProperty(MessageContext.TRANSPORT_ADDR, conn.getLocalAddress().getHostAddress()); But other transports doesn't seem to be setting this. I didn't find anything relevant in servlet transport code :( Than

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-24 Thread Hiranya Jayathilaka
On Sat, Jun 25, 2011 at 3:07 AM, Afkham Azeez 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 nam

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-24 Thread Afkham Azeez
Sorry, this does not work. I had hardcoded the host for testing it, so for subsequent requests that prop was there. On Sat, Jun 25, 2011 at 2:57 AM, Afkham Azeez wrote: > I found a way to get this. Hope it is the proper way of handling this. > > > ((Axis2MessageContext)synCtx).getAxis2MessageCo

Re: [Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-24 Thread Afkham Azeez
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 wrote: > Folks, > To implement the

[Carbon-dev] How to get the requested hostname from the Synapse MessageContext?

2011-06-24 Thread Afkham Azeez
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: