Load static
resource in Mule 4
Static
resource in mule 4 is used to load static resource provided by path of the
resource.
Flow:
Load static
resource setting:
Method: POST
Input & Output:
XML project
code:
<?xml version="1.0"
encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<http:listener-config name="HTTP_Listener_config"
doc:name="HTTP Listener config" doc:id="f0cf83b7-a782-460f-89a0-5a3fc9ab6fdf"
>
<http:listener-connection host="0.0.0.0"
port="8085" />
</http:listener-config>
<flow name="test_static_resourceFlow"
doc:id="515e102b-b171-4e6c-bd39-cb8ab83c7936"
>
<http:listener doc:name="Listener"
doc:id="7265b04b-a16e-4bdf-b3f3-4e85e8f27e73"
config-ref="HTTP_Listener_config" path="/static"/>
<http:load-static-resource doc:name="Load static
resource" doc:id="7766073c-1e77-4c11-ab3f-f1fe7f12ebf4"
defaultFile="file.html" resourceBasePath="C:\AnypointStudio\studio-workspace\test_static_resource\src\main\resources"
/>
<logger level="INFO"
doc:name="Logger" doc:id="360b56dc-e7db-4b3f-b901-236fa6366d6a"
message="#[payload]"/>
</flow>
</mule>
No comments:
Post a Comment
If you have any doubt, please let me know