Hi,
I am trying to get XSRF Protected Services to work with my GWT project.
I've coded everything and am trying to test. I get a strange error in
JavaScript Console as follows:
Uncaught com.google.gwt.user.client.rpc.RpcTokenException: Invalid RPC
token (Invalid RpcToken type: expected
'com.google.gwt.user.client.rpc.XsrfToken' but got 'class
com.google.gwt.user.client.rpc.XsrfToken')
I downloaded the GWT 2.6 code using GIT and have grepped the code. I see
that the file that is doing this is
com.google.gwt.user.rebind.rpc.ProxyCreator.java
in the method generateCheckRpcTokenTypeOverride. However, I'm at a loss to
what it means. I have checked my class path for duplicate instances of
XsrfToken but it is only found in gwt-servlet.jar in my war file.
Any ideas? Below is the copied generateCheckRpcTokenTypeOverride method.
Thanks in advance!
Patrick
protected void generateCheckRpcTokenTypeOverride(SourceWriter srcWriter,
TypeOracle typeOracle,
SerializableTypeOracle typesSentFromBrowser) {
JClassType rpcTokenType = typeOracle.findType(RpcToken.class.getName());
JClassType[] rpcTokenSubtypes = rpcTokenType.getSubtypes();
String rpcTokenImplementation = "";
for (JClassType rpcTokenSubtype : rpcTokenSubtypes) {
if (typesSentFromBrowser.isSerializable(rpcTokenSubtype)) {
if (rpcTokenImplementation.length() > 0) {
// >1 implematation of RpcToken, bail
rpcTokenImplementation = "";
break;
} else {
rpcTokenImplementation = rpcTokenSubtype.getQualifiedSourceName();
}
}
}
if (rpcTokenImplementation.length() > 0) {
srcWriter.println("@Override");
srcWriter.println("protected void checkRpcTokenType(RpcToken token) {"
);
srcWriter.indent();
srcWriter.println("if (!(token instanceof " + rpcTokenImplementation
+ ")) {");
srcWriter.indent();
srcWriter.println("throw new RpcTokenException(\"Invalid RpcToken
type: " + "expected '"
+ rpcTokenImplementation + "' but got '\" + " + "token.getClass()
+ \"'\");");
srcWriter.outdent();
srcWriter.println("}");
srcWriter.outdent();
srcWriter.println("}");
}
}
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.