HTTP Redirection or Forwarding using Mule App
This document covers a Mule Application code that is capable to taking some input parameters or payload and after some kind of processing, it can redirect or forward the flow to another URL. Such implementation is made possible with HTTP Listener and can be useful in a variety of use-cases.
Let’s begin...
Pre-requisites
- Postman
- Anypoint Studio
Anypoint Studio Code
Create a new Mule Application project in Anypoint Studio. Open the project’s main *.xml file and use the following XML code to setup a listener flow -
This code will look like this -
You will have to create a Listener configuration too. For that, you can use the following code -
You may have already noticed the place where http status code and the redirect URL is being configured. In the GUI you can find them in the Listener Properties > Responses tab as shown -
Run the Mule Application now.
It would be best to test this in a Browser. So just open http://localhost:8081 in your Browser and you'll see that it will redirect you to my website https://www.loveleshkalonia.com.
This completes the demo.
Troubleshooting Common Issues
I don’t think anyone will encounter any issues using this guide so I will leave the common issues part blank this time :)
Comments
Post a Comment