我创建了两个模块
当我尝试将表单从GWTAppAuth发送到j_spring_security_check时,什么都没有发生。
Firebug显示在控制台中
"Failed to load source for:http://127.0.0.1:8888/j_spring_security_check"但是如果我在此之后尝试手动访问GWTApp,它就能工作了。有人知道怎么回事吗?
看起来Security不会重定向到第二个(GWTApp)。
我该怎么查?
在托管模式下运行应用程序尝试访问GWTApp.html
在这个地方,如果我们检查一下萤火虫日志,我们可以看到
"POST //127.0.0.1:8888/j_spring_security_check"以及回应-
"Failed to load source for: http://127.0.0.1:8888/j_spring_security_check"然后下一个记录-
"GET //127.0.0.1:8888/GWT/GWTApp.html?gwt.codesvr=127.0.0.1:9997"获取所有需要的资源
现在我可以手动输入
"//127.0.0.1:8888/GWT/GWTApp.html" 现在我可以访问GWTApp.html了
发布于 2011-10-27 12:05:44
我找到了解决办法。
例如,您应该使用html表单并提交按钮,而不是GWT提供的小部件:
<form action="/j_spring_security_check" method="post">
<g:Label>
login
</g:Label>
<g:TextBox name="j_username" width="200" />
<g:Label>
password
</g:Label>
<g:PasswordTextBox name="j_password" width="200" />
<input name="submit" type="submit" value="Login" />
</form>或者捕捉表单提交完成的事件,以防您使用GWT FormPanel小部件:
public class LoginFormB extends Composite {
private static LoginFormBUiBinder uiBinder = GWT.create(LoginFormBUiBinder.class);
interface LoginFormBUiBinder extends UiBinder<Widget, LoginFormB> {}
@UiField
FormPanel formPanel;
public LoginFormB() {
formPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() {
@Override
public void onSubmitComplete(SubmitCompleteEvent arg0) {
// Redirect to needed page
redirect("needed url");
}
});
initWidget(uiBinder.createAndBindUi(this));
}
public static native void redirect(String url)/*-{
$wnd.location = url;
}-*/;
}发布于 2011-02-23 11:39:19
我认为您不能在同一个应用程序中直接集成Security和GWT。你需要一些中间的东西来粘合它们。
试着检查这些教程:http://krams915.blogspot.com/2011/01/spring-and-gwt-integration-using-maven.html
http://krams915.blogspot.com/2011/01/spring-and-gwt-security-via-spring.html
https://stackoverflow.com/questions/4944588
复制相似问题