How to incorporate Spring security using open id into a GWT project
Well its simple, Basically I want to follow GWT's "One Page" paradigm and yet integrate Spring security into the application. What i understand that if the cookie is not found in the system, spring will redirect user to a Open id referrer page asking for login else it would simply send my server the user's open url id.
This is what i trid in GWT:
开发者_如何学编程 final FormPanel formPanel = new FormPanel();
RootPanel.get("openId").add(formPanel);
VerticalPanel openIdContainer = new VerticalPanel();
formPanel.add(openIdContainer);
TextBox url = new TextBox();
url.setText("https://www.google.com/accounts/o8/id");
url.setName("j_username");
openIdContainer.add(url);
formPanel.setAction("j_spring_openid_security_check");
formPanel.setMethod(FormPanel.METHOD_POST);
Button btn = new Button("Open ID");
btn.addClickListener(new ClickListener() {
public void onClick(Widget sender)
{
formPanel.submit();
}
});
openIdContainer.add(btn);
formPanel.addFormHandler(new FormHandler() {
public void onSubmit(FormSubmitEvent event)
{
System.out.println("On Submit invoked " +event.isCancelled());
}
public void onSubmitComplete(FormSubmitCompleteEvent event)
{
System.out.println("On Submit Complete invoked " + event.toString());
}
});
corresponding output : On Submit invoked false On Submit Complete invoked null
As I understand, the html received is null. How else should I do it ? GWT 1.5 does not have a simple form (one that indeed refreshes the page on submit) and an input tag with the type as submit. Will i have to hard code this into HTML widget ? I tried setting another frame as this form panel's target but still unable to get any fruitful results.
As far as I can tell you are not setting the correct upload URL:
formPanel.setAction(uploadServiceUrl);
/**
* Sets the 'action' associated with this form. This is the URL to which it
* will be submitted.
*
* @param url the form's action
*/
public void setAction(String url) {
getFormElement().setAction(url);
}
精彩评论