Pass REST Path Parameters to Target

43 views
Skip to first unread message

Shannon Lal

unread,
Oct 4, 2015, 1:44:13 AM10/4/15
to membrane-monitor
I am new to Membrane Service Proxy and I am setting up a service proxy that routes a path (with rest parameters) to a target and would like to include those rest parameters.  For example I have the following path:

<serviceProxy name="test" >
   <path>/api/test/{serialNumber}/list</path>


</serviceProxy>

I assume that I can create a customer Interceptor which would parse the url and pass them in the headers, but I wanted to know if this could be forwarded in the url.

Thanks

Shannon

Shannon Lal

unread,
Oct 4, 2015, 7:35:57 PM10/4/15
to membrane-monitor
I did some research and discovered the rewrite interceptor which can be added to the serviceProxy.  I have been working with creating my own interceptor and wanted to know if there is a way to add additional parameters to a rest call in the interceptor.  

In the Interceptor I can see that I can get the destination; however, I wanted to know if there is a way to update the url (i.e. update the rest parameters).

Thanks

Shannon

Thomas Bayer

unread,
Oct 5, 2015, 9:03:33 AM10/5/15
to membrane...@googlegroups.com
Hi,
you can do that with a rewriter. See:

http://www.membrane-soa.org/service-proxy-doc/4.1/configuration/reference/rewriter-map.htm

The service proxy would look like that:

<serviceProxy name="test"> <path>/api/test/</path>
    <request >
        <rewriter>
            <map from="^/api/test/{.*}/list" to="/test/{$1}/list" /> 
        </rewriter>
    </request> <target host="www.testserver.com"/>
</serviceProxy>    

Cheers,
Thomas

Am 04.10.15 um 02:06 schrieb Shannon Lal:
--
You received this message because you are subscribed to the Google Groups "membrane-monitor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to membrane-monit...@googlegroups.com.
To post to this group, send email to membrane...@googlegroups.com.
Visit this group at http://groups.google.com/group/membrane-monitor.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages