Номинально, URL http://www.google.com/accounts/RatePassword?Passwd=aaaaa может использоваться для проверки надежности пароля aaaaa
.Я пытаюсь использовать его в своей системе GWT, используя RequestBuilder
, чтобы получить значение, которое может быть между 1 и 4, но я не получаю значение.Может кто-нибудь угадать, в чем проблема?
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
"http://www.google.com/accounts/RatePassword?Passwd=aaaaa");
try {
Request response = builder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
//error
}
public void onResponseReceived(Request request, Response response) {
Window.alert(""+response.getText());
}
});
} catch (RequestException e) {
// Code omitted for clarity
}
Я делаю это:
class PasswordStrength extends JavaScriptObject {
protected PasswordStrength() {}
public final native String getRating() /*-{
return this.rating;
}-*/;
}
JsonpRequestBuilder builder = new JsonpRequestBuilder ();
builder.requestObject(URL.encode(
"https://www.google.com/accounts/RatePassword?Passwd=aaa"),
new AsyncCallback <PasswordStrength>(){
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
Window.alert("Error");
}
@Override
public void onSuccess(PasswordStrength result) {
// TODO Auto-generated method stub
Window.alert("NotError");
}});
Но я получаю эту ошибку:
java.lang.ClassFormatError: Illegal method name "<init>$" in class com/BiddingSystem/client/BiddingSystem$1PasswordStrength
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.lang.ClassLoader.defineClass(ClassLoader.java:466)
at com.google.gwt.dev.shell.CompilingClassLoader.findClass(CompilingClassLoader.java:1011)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at com.BiddingSystem.client.BiddingSystem$1.onSuccess(BiddingSystem.java:1)
at com.google.gwt.jsonp.client.JsonpRequest.onSuccess(JsonpRequest.java:201)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:662)