|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | | -<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:spring="http://www.mulesoft.org/schema/mule/spring" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:apikit="http://www.mulesoft.org/schema/mule/mule-apikit" xmlns:http="http://www.mulesoft.org/schema/mule/http" 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://www.mulesoft.org/schema/mule/mule-apikit http://www.mulesoft.org/schema/mule/mule-apikit/current/mule-apikit.xsd |
| 2 | +<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" |
| 3 | + xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" |
| 4 | + xmlns:spring="http://www.mulesoft.org/schema/mule/spring" |
| 5 | + xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" |
| 6 | + xmlns="http://www.mulesoft.org/schema/mule/core" |
| 7 | + xmlns:apikit="http://www.mulesoft.org/schema/mule/mule-apikit" |
| 8 | + xmlns:http="http://www.mulesoft.org/schema/mule/http" |
| 9 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 10 | + 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://www.mulesoft.org/schema/mule/mule-apikit http://www.mulesoft.org/schema/mule/mule-apikit/current/mule-apikit.xsd |
3 | 11 | http://www.mulesoft.org/schema/mule/spring http://www.mulesoft.org/schema/mule/spring/current/mule-spring.xsd |
4 | 12 | http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd |
5 | 13 | http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"> |
6 | | - |
7 | | - <flow name="ui" doc:id="94b97777-bd63-4abb-8093-a5c8ac97aa17" > |
8 | | - <http:listener doc:name="Listener" doc:id="7e20b485-577c-4530-b2b1-66b6a84d5694" config-ref="${protocol}" path="/*" outputMimeType="text/html"/> |
9 | | - <http:basic-security-filter doc:name="Basic security filter" doc:id="cb77f47e-923a-4195-86fc-23bbf2f01311" realm="mule" /> |
10 | | - <spring:authorization-filter requiredAuthorities="ROLE_ADMIN" /> |
11 | | - <ee:transform doc:name="Transform Message" doc:id="610d96e5-97f6-407d-ab81-fa234a5794bc" > |
12 | | - <ee:message > |
13 | | - <ee:set-payload ><![CDATA[%dw 2.0 |
14 | | -output text/plain |
15 | 14 |
|
16 | | -var uriPath = attributes.requestPath |
17 | | -var path = if ("/" == uriPath) |
18 | | - "web/index.html" |
19 | | - else |
20 | | - "web" ++ uriPath |
21 | | ---- |
22 | | -readUrl("classpath://" ++ path, "text/plain")]]></ee:set-payload> |
| 15 | + <flow name="ui" doc:id="94b97777-bd63-4abb-8093-a5c8ac97aa17"> |
| 16 | + <http:listener doc:name="Listener" |
| 17 | + doc:id="7e20b485-577c-4530-b2b1-66b6a84d5694" config-ref="https" |
| 18 | + path="/*" outputMimeType="text/html" /> |
| 19 | + <http:basic-security-filter |
| 20 | + doc:name="Basic security filter" |
| 21 | + doc:id="cb77f47e-923a-4195-86fc-23bbf2f01311" realm="mule" /> |
| 22 | + <spring:authorization-filter |
| 23 | + requiredAuthorities="ROLE_ADMIN" /> |
| 24 | + <ee:transform doc:name="Transform Message" |
| 25 | + doc:id="610d96e5-97f6-407d-ab81-fa234a5794bc"> |
| 26 | + <ee:message> |
| 27 | + <ee:set-payload |
| 28 | + resource="dwl/setWebResourcePayload.dwl" /> |
23 | 29 | </ee:message> |
24 | | - <ee:variables > |
25 | | - <ee:set-variable variableName="mimeType" ><![CDATA[%dw 2.0 |
26 | | -output application/java |
27 | | ---- |
28 | | -splitBy(attributes.requestPath, ".")[-1] default ""]]></ee:set-variable> |
| 30 | + <ee:variables> |
| 31 | + <ee:set-variable |
| 32 | + resource="dwl/setWebResourceMimeType.dwl" variableName="mimeType" /> |
29 | 33 | </ee:variables> |
30 | 34 | </ee:transform> |
31 | | - <choice doc:name="Which MIME type?" doc:id="7fa94994-1832-4b21-b557-691274259e46" > |
| 35 | + <choice doc:name="Which MIME type?" |
| 36 | + doc:id="7fa94994-1832-4b21-b557-691274259e46"> |
32 | 37 | <when expression='#[vars.mimeType == "css"]'> |
33 | | - <set-payload value="#[payload]" doc:name="Set MIME type as CSS" doc:id="d8334850-64ab-448a-abe3-1611772f58b8" mimeType="text/css" /> |
| 38 | + <set-payload value="#[payload]" |
| 39 | + doc:name="Set MIME type as CSS" |
| 40 | + doc:id="d8334850-64ab-448a-abe3-1611772f58b8" mimeType="text/css" /> |
34 | 41 | </when> |
35 | 42 | <when expression='#[vars.mimeType == "js"]'> |
36 | | - <set-payload value="#[payload]" doc:name="Set MIME type as JavaScript" doc:id="9595f13e-4c58-4707-9818-c3bcc1d33a0a" mimeType="application/javascript" /> |
| 43 | + <set-payload value="#[payload]" |
| 44 | + doc:name="Set MIME type as JavaScript" |
| 45 | + doc:id="9595f13e-4c58-4707-9818-c3bcc1d33a0a" |
| 46 | + mimeType="application/javascript" /> |
37 | 47 | </when> |
38 | | - <otherwise > |
39 | | - <set-payload value="#[payload]" doc:name="Set MIME type as HTML" doc:id="1e21a771-c190-40db-984f-9805208c3ca2" mimeType="text/html" /> |
| 48 | + <otherwise> |
| 49 | + <set-payload value="#[payload]" |
| 50 | + doc:name="Set MIME type as HTML" |
| 51 | + doc:id="1e21a771-c190-40db-984f-9805208c3ca2" mimeType="text/html" /> |
40 | 52 | </otherwise> |
41 | 53 | </choice> |
42 | 54 | </flow> |
43 | | - <flow name="net-tools-main"> |
44 | | - <http:listener config-ref="${protocol}" path="/api/*"> |
45 | | - <http:response statusCode="#[vars.httpStatus default 200]"> |
46 | | - <http:headers>#[vars.outboundHeaders default {}]</http:headers> |
47 | | - </http:response> |
48 | | - <http:error-response statusCode="#[vars.httpStatus default 500]"> |
49 | | - <http:body>#[payload]</http:body> |
50 | | - <http:headers>#[vars.outboundHeaders default {}]</http:headers> |
51 | | - </http:error-response> |
52 | | - </http:listener> |
| 55 | + <flow name="net-tools-main" |
| 56 | + doc:id="6f86a93f-9de9-4cf8-b092-b6a4b23c42f4"> |
| 57 | + <http:listener config-ref="https" path="/api/*"> |
| 58 | + <http:response |
| 59 | + statusCode="#[vars.httpStatus default 200]"> |
| 60 | + <http:headers>#[vars.outboundHeaders default {}]</http:headers> |
| 61 | + </http:response> |
| 62 | + <http:error-response |
| 63 | + statusCode="#[vars.httpStatus default 500]"> |
| 64 | + <http:body>#[payload]</http:body> |
| 65 | + <http:headers>#[vars.outboundHeaders default {}]</http:headers> |
| 66 | + </http:error-response> |
| 67 | + </http:listener> |
53 | 68 | <http:basic-security-filter doc:name="Basic security filter" realm="mule" /> |
54 | | - <apikit:router config-ref="net-tools-config" /> |
| 69 | + <logger level="INFO" |
| 70 | + message='#["$(attributes.scheme default "") $(attributes.method default "") $(attributes.requestUri default "")"]' |
| 71 | + doc:name="Log Endpoint" /> |
| 72 | + <apikit:router config-ref="net-tools-config" /> |
55 | 73 | <error-handler> |
56 | 74 | <on-error-propagate type="APIKIT:BAD_REQUEST"> |
57 | 75 | <ee:transform xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"> |
@@ -132,36 +150,8 @@ output application/json |
132 | 150 | </ee:transform> |
133 | 151 | </on-error-propagate> |
134 | 152 | </error-handler> |
135 | | - </flow> |
136 | | - <flow name="net-tools-console"> |
137 | | - <http:listener config-ref="${protocol}" path="/console/*"> |
138 | | - <http:response statusCode="#[vars.httpStatus default 200]"> |
139 | | - <http:headers>#[vars.outboundHeaders default {}]</http:headers> |
140 | | - </http:response> |
141 | | - <http:error-response statusCode="#[vars.httpStatus default 500]"> |
142 | | - <http:body>#[payload]</http:body> |
143 | | - <http:headers>#[vars.outboundHeaders default {}]</http:headers> |
144 | | - </http:error-response> |
145 | | - </http:listener> |
146 | | - <apikit:console config-ref="net-tools-config" /> |
147 | | - <error-handler> |
148 | | - <on-error-propagate type="APIKIT:NOT_FOUND"> |
149 | | - <ee:transform xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"> |
150 | | - <ee:message> |
151 | | - <ee:set-payload><![CDATA[%dw 2.0 |
152 | | -output application/json |
153 | | ---- |
154 | | -{message: "Resource not found"}]]></ee:set-payload> |
155 | | - </ee:message> |
156 | | - <ee:variables> |
157 | | - <ee:set-variable variableName="httpStatus">404</ee:set-variable> |
158 | | - </ee:variables> |
159 | | - </ee:transform> |
160 | | - </on-error-propagate> |
161 | | - </error-handler> |
162 | 153 | </flow> |
163 | 154 | <flow name="get:\curl:net-tools-config"> |
164 | | - <logger level="INFO" message="get:\curl:net-tools-config" /> |
165 | 155 | <ee:transform doc:name="Transform Message" doc:id="c96eaddb-f56e-4f1a-81ff-ec15df7cb6d6" > |
166 | 156 | <ee:message > |
167 | 157 | <ee:set-payload ><![CDATA[%dw 2.0 |
|
0 commit comments