gwtp-sample-basic-spring示例中的RPC Cookie错误

时间:2015-08-12 10:07:06

标签: java spring gwt cookies rpc

我克隆了this example

运行时,我收到以下错误

  

发生错误:RPC提供的Cookie与请求Cookie不匹配,       中止行动,可能是XSRF攻击。 (也许你忘了设置       安全cookie?)执行操作时:          com.gwtplatform.samples.basicspring.shared.dispatch.SendTextToServerAction

如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

最后,在谷歌搜索3天后,我找到了解决方案。

在SendTextToServerAction calss:

中覆盖isSecured方法
public class SendTextToServerAction extends ActionImpl<SendTextToServerResult> {
    private String textToServer;

    public SendTextToServerAction(final String textToServer) {
        this.textToServer = textToServer;
    }
    /**
     * For serialization only.
     */
    @SuppressWarnings("unused")
    private SendTextToServerAction() {
    }

    public String getTextToServer() {
        return textToServer;
    }

    @Override
    public boolean isSecured() {
        return false;
    }