gwtp-sample-basic-spring 示例中的 RPC Cookie 错误
RPC Cookie error in gwtp-sample-basic-spring example
我克隆了this example
当运行它时,我得到以下错误
An error occured: Cookie provided by RPC doesn't match request cookie,
aborting action, possible XSRF attack. (Maybe you forgot to set the
security cookie?) While executing action:
com.gwtplatform.samples.basicspring.shared.dispatch.SendTextToServerAction
如何解决这个问题?
经过 3 天的谷歌搜索,我终于找到了解决方案。
覆盖 SendTextToServerAction 类中的 unSecured 方法:
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;
}
我克隆了this example
当运行它时,我得到以下错误
An error occured: Cookie provided by RPC doesn't match request cookie, aborting action, possible XSRF attack. (Maybe you forgot to set the security cookie?) While executing action: com.gwtplatform.samples.basicspring.shared.dispatch.SendTextToServerAction
如何解决这个问题?
经过 3 天的谷歌搜索,我终于找到了解决方案。
覆盖 SendTextToServerAction 类中的 unSecured 方法:
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;
}