URL Rewrite Mediator
The URL rewrite mediator is used to modify and transform the URL values available in the message.
Figure1: Rewrite Mediator
Properties
- In Property :
By default 'rewrite' mediator will take the 'To' header of the message and will apply the provided rewrite rules on it.
If user specify a 'inPorperty' attribute, the mediator will take the value of the specified property as the input URL.
- Out Property :
Similarly the mediator by default sets the transformed URL as the 'To' header of the message.
Alternatively user can use the 'outProperty' attribute to instruct the mediator to set the resulting URL as a property.
Rules
The rewrite mediator applies URL transformations by evaluating a set of rules on the message
Figure2: Rules
- Condition:- A rule can consist of an optional condition. If the condition is provided it will be evaluated first
- Action:- It states which type of action should be executed on the URL. This defaults to 'set' value
- Fragment:- This attribute can be used to specify the URL fragment on which the action should be executed. For port and full-uri options those actions are not applicable. User should provide the correct port number/full-uri, which will be set.
- Value/Expression:- The value to 'set', 'append' or 'prepend' must be specified using either the 'value' attribute or the 'xpath' attribute.
One of these two attributes are always needed unless the value of the 'type' attribute is set to 'remove'
- Regex:- When user set action to 'replace' an additional 'regex'
attribute must be specified which indicates the portion that should be replaced with the given value.