Contact Free trial Login

To Load a Static Resource

  1. Create a new project.

  2. From the Mule Palette, drag an HTTP Listener operation, to a new flow.

  3. Configure the Listener:

    • Click + and set the default host, port and base path. For example, host = 0.0.0.0, port = 8081, and no base path.

    • In General, set Path to the URL you plan to use to start the app from the browser. For example, set Path to /trigger.

    • Accept the other default Listener settings, and save the configuration.

  4. From the Mule Palette, drag HTTP > Load Static Resource to the flow.

  5. Configure the load static resource operation:

    • Set the resource base path to the path and file name of the resource. For example, set the path to /Users/max/Sites/index.html.

    • Set the default file to the name of a backup file in the same directory as the resource.

    • If you need to use a relative path to the Mule project, use the variable ${app.home} (for example, resourceBasePath="${app.home}/images/").

      In the event of a failure, the app loads the backup file.

    • Accept the other default request settings and save the configuration.

  6. Deploy the app, open a browser, and go to the URL of the Listener. For example: http://0.0.0.0:8081/trigger.

    The Listener hears the request on port 8081, and starts the app. The contents of the resource appear in the browser.

See Also

  • About the Load Static Resource Operation

  • HTTP Connector Documentation Reference

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.