默认的Mule APIKit映射异常策略包含406和415的映射,如下所示:
<apikit:mapping statusCode="415">
<apikit:exception value="org.mule.module.apikit.exception.UnsupportedMediaTypeException" />
<set-property propertyName="Content-Type" value="application/json" doc:name="Content-Type : application/json" />
<set-payload value="{ "message": "Unsupported media type" }" doc:name="message : Unsupported media type" />
</apikit:mapping>
<apikit:mapping statusCode="406">
<apikit:exception value="org.mule.module.apikit.exception.NotAcceptableException" />
<set-property propertyName="Content-Type" value="application/json" doc:name="Content-Type : application/json" />
<set-payload value="{ "message": "Not acceptable" }" doc:name="message : Not acceptable" />
</apikit:mapping>我不清楚是什么导致了这两种类型的异常。有人能解释一下吗?
发布于 2015-05-14 06:16:10
这个想法是让您在希望生成响应状态时抛出这些异常类型。
https://stackoverflow.com/questions/30175092
复制相似问题