java - Display JSON file in browser with Mule -
i using json file show schema , have give config:
<flow name="api-schema" doc:name="api-schema"> <http:inbound-endpoint exchange-pattern="request-response" host="0.0.0.0" port="8080" path="schema" doc:name="http"/> <logger level="info" doc:name="logger"/> <http:static-resource-handler resourcebase="${app.home}/src/main/resources/" defaultfile="schema" doc:name="http static resource handler"/> </flow>
but when running it, asking download file. have tried in chrome , safari both. how can instruct mule display content on browser , don't download?
the way browser determines resource looking @ content-type header. can set header creating outbound property name "content-type" , value "application/json" so:
<set-property propertyname="content-type" value="application/json" />
since static-resource-handler deprecated, switch parse-template processor:
<parse-template location="#[message.inboundproperties['http.listener.path']]" />