You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@synapse.apache.org by Alexey Ousov <ao...@gmail.com> on 2008/07/17 18:44:24 UTC

get-property('To') full url

Hello All.
I need to examine full URL which is requested from synapse, but 
unfortunately get-property('To') returns only path 
"/te/processes/ViewUser". My task is the following: start two HTTP 
servers on the same synapse service, and then route some messages from 
one port, and other messages from another port. It is achieved with 
following configuration:
axis2.xml:
    <transportReceiver name="http" 
class="org.apache.synapse.transport.nhttp.HttpCoreNIOListener">
        <parameter name="port">8084</parameter>
        <parameter name="non-blocking">true</parameter>
    </transportReceiver>
    <transportReceiver name="http-internal" 
class="org.apache.synapse.transport.nhttp.HttpCoreNIOListener">
        <parameter name="port">8280</parameter>
        <parameter name="non-blocking">true</parameter>
    </transportReceiver>
synapse.xml:
        <filter source="get-property('To')" 
regex="^http://[^:]+:8280/te/processes/loginService$">
            <send>
                <endpoint>
                    <loadbalance>
...
...
        <filter source="get-property('To')" 
regex="^http://[^:]+:8084/te/processes/taskUpdater$">
            <send>
                <endpoint>
                    <loadbalance>
...
...
But as I said before this doesn't work, because get-property('To') 
doesn't return full address, but only path part. Is there a way to 
determine address, or maybe transport receiver name such as "http" or 
"http-internal"? Or all I can do is start 2 instances of synapse with 2 
different configurations?

Regards,
Alexey Ousov.

Re: get-property('To') full url

Posted by Paul Fremantle <pz...@gmail.com>.
Alexey

If the client is set to use Synapse as an HTTP proxy, then the full
URL comes in. Otherwise you have to create it from other information.

Paul

On Fri, Jul 18, 2008 at 3:50 AM, Alexey Ousov <ao...@gmail.com> wrote:
> Hello Asankha
>>
>> Hi Alexy
>>>
>>> I need to examine full URL which is requested from synapse, but
>>> unfortunately get-property('To') returns only path "/te/processes/ViewUser".
>>
>> Use get-property('axis2', 'TransportInURL') which will give you the full
>> URL path from the request
>>
>> You can also combine this with get-property('transport', 'Host') to get
>> the http 'Host' header, which will contain the server hostname and port for
>> HTTP 1.1 requests
>
> I've done some debugging and determined, that it is Axis2 itself doesn't
> give full URL, it stores only <path> part which came with HTTP request "POST
> <path>". So there is no way to determine full URL, the only opportunities
> are: use 2 different synapse servers, use Axis2 on Tomcat (Tomcat engine
> constructs full URL) or rely on HTTP 1.1 "Host" header. Probably I will
> choose first one.
>
> Regards,
> Alexey Ousov.
>



-- 
Paul Fremantle
Co-Founder and CTO, WSO2
Apache Synapse PMC Chair
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

Re: get-property('To') full url

Posted by Alexey Ousov <ao...@gmail.com>.
Hello Asankha
> Hi Alexy
>> I need to examine full URL which is requested from synapse, but 
>> unfortunately get-property('To') returns only path 
>> "/te/processes/ViewUser".
> Use get-property('axis2', 'TransportInURL') which will give you the 
> full URL path from the request
>
> You can also combine this with get-property('transport', 'Host') to 
> get the http 'Host' header, which will contain the server hostname and 
> port for HTTP 1.1 requests
I've done some debugging and determined, that it is Axis2 itself doesn't 
give full URL, it stores only <path> part which came with HTTP request 
"POST <path>". So there is no way to determine full URL, the only 
opportunities are: use 2 different synapse servers, use Axis2 on Tomcat 
(Tomcat engine constructs full URL) or rely on HTTP 1.1 "Host" header. 
Probably I will choose first one.

Regards,
Alexey Ousov.

Re: get-property('To') full url

Posted by "Asankha C. Perera" <as...@wso2.com>.
Hi Alexy
> I need to examine full URL which is requested from synapse, but 
> unfortunately get-property('To') returns only path 
> "/te/processes/ViewUser".
Use get-property('axis2', 'TransportInURL') which will give you the full 
URL path from the request

You can also combine this with get-property('transport', 'Host') to get 
the http 'Host' header, which will contain the server hostname and port 
for HTTP 1.1 requests

Hope this helps
asankha
-- 
Asankha C. Perera

WSO2 - http://wso2.org
http://esbmagic.blogspot.com