4. Interceptors/Features

rewriter

Rewrites or redirects the path of incoming requests based on a mapping.



Can be used in:

serviceProxy, api, stompProxy, swaggerProxy, if, registration, wsStompReassembler, interceptor, bean, internalProxy, transport and soapProxy

Syntax

<rewriter>
  <map from="..." to="..." do="..." >*
</rewriter>

Sample

The first mapping in the example below shows a simple mapping from the path /home to /index.

In the second mapping a regexp group captures everything after /bank/. The $1 in the rewritten URI will be substituted with the content of the captured group.

In the third mapping, a group captures everything after /search/ and redirects the user to some example search portal searching for the content of the group.

<serviceProxy port="80">
  <rewriter>
    <map from="^/home" to="/index" />
    <map from="^/bank/(.*)" to="/axis2/$1" />
	<map from="^/search/(.*)" to="http://www.example.com/search?q=$1" do="redirect" />
  </rewriter>
</serviceProxy>

Child Elements

ElementsDescriptionCardinality
map Defines a regex and a replacement for the rewriting of the URI. 0..*