The URLRewrite Mediator is used to modify and transform the URL values available in messages. This can be done by defining a rewrite action for each fragment of a selected property value. Alternatively, you can rewrite the entire URL string at once.
Info |
---|
The URLRewrite mediator is a content aware mediator. |
...
Table of Contents | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Parameter Name | Description | ||
---|---|---|---|
Action | This parameter is used to specify the action to be performed by the rewrite action. Each rewrite action is performed on a fragment entered in the Fragment parameter. Possible values are as follows.
| ||
Fragment | The fragment of the in property (i.e. input URL) for which the rewrite action should be performed. The available fragments are as follows.
| ||
Option | This parameter is used to define the result value of the rewrite action. Select one of the following.
| ||
Value/Expression | This parameter is used to enter the result value of the URLRewrite mediator as a static value or an expression, depending on what you selected for the Option parameter. | ||
Namespace Editor | You can click this link to add namespaces when you are providing an expression. Then the Namespace Editor panel would appear where you can provide any number of namespace prefixes and URLs used in the XPath expression. | ||
Regex | This parameter is used to specify which part of the in property value fragment should be replaced by the result value if you selected Replace for the Action parameter. | ||
Delete | Click Delete in the relevant row to remove a rewrite action. |
Info | ||
---|---|---|
| ||
You can configure the mediator using XML. Click switch to source view in the Mediator window. |
Example
In this example, the URLRewrite mediator has a rewrite action which replaces the value soap
with value services
in the fragment path
of the input URL. Since no in property or an out property is specified, the To
header of the request is both the input to which the rewrite rule is applied and the target where the result URL is set. This configuration is typically used when the address URL of a request contains the context soap
which needs to be converted since all the services are deployed under a context named services
in the ESB server. Thus, the URL http://localhost:8280/soap/StockQuoteProxy1
is rewritten as http://localhost:8280/services
/StockQuoteProxy1
to ensure that the requests are successfully delivered to the server.
...