我正在使用Struts-2.5.14.1
和Struts rest插件。
除了自定义方法之外,Eveything似乎工作得很好。
索引,show和其他默认方法都有效。
但是当我提供一些不同的自定义方法时,它似乎无法工作并抛出错误。
com.opensymphony.xwork2.config.ConfigurationException:不允许使用方法发送操作消息! 在com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:203)〜[struts2-core-2.5.14.1.jar:2.5.14.1] 在com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:76)〜[struts2-core-2.5.14.1.jar:2.5.14.1] 在org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:50)〜[struts2-rest-plugin-2.5.14.1.jar:2.5.14.1] 在org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:564)[struts2-core-2.5.14.1.jar:2.5.14.1]
答案 0 :(得分:0)
答案 1 :(得分:0)
将此代码添加到struts.xml中,然后尝试:
<package ...>
<global-allowed-methods>regex:.*</global-allowed-methods>
<action ...>
...
</action>
</package>