假设Double
动作中有一个变量,如果请求正文中发送的值类似于
{"dblField":""}
interceptorStack
看起来像:
<action name="save" class="actions.MyAction" method="save">
<interceptor-ref name="jsonValidationWorkflowStack">
</interceptor-ref>
<!--<interceptor-ref name="loginStack"/>-->
<!-- I've tried using each of the above two separately, but both failed -->
<interceptor-ref name="json">
<param name="enableSMD">true</param>
</interceptor-ref>
<result type="json" name="*">
<param name="excludeProperties">
idIo
</param>
</result>
</action>
然后动作抛出一个NumberFormatException
,根据插件源代码这里没问题。
但是这个异常并没有在插件中处理,因此,从抛出异常的动作中返回,这会导致global-exception-handler
.
如果使用查询字符串发送相同的请求,?dblField=
则操作返回INPUT
。
那么,我怎样才能使 json-plugin 以相同的方式返回INPUT
并设置适当fieldErrors
的而不是抛出NumberFormatException
和触发globalExceptionHandler
?