Using GWT 2.3 and SmartGWT 2.5 (I know, we should upgrade) with Spring security.
When my session expired I wan't to do a Relogin. According to to the Quickstart guide and API docs, is just have to add the LoginRequiredMarker in my login.html and handle whatever I need to do in setLoginRequiredCallback.
However, nothing seems to happen. When I make an call from my datasource the onFailure method is called with an InvocationTargetException. The message in the exception actually consists of my login page (including the marker).
I can't seem to figure out what I'm doing wrong.
login.html:
My Entrypoint, but the loginRequired method is never called:
My Datasource
The SC.say(t.getMessage()); renders my login page, but it is not what I intended.
Can anyone see what I'm missing?
When my session expired I wan't to do a Relogin. According to to the Quickstart guide and API docs, is just have to add the LoginRequiredMarker in my login.html and handle whatever I need to do in setLoginRequiredCallback.
However, nothing seems to happen. When I make an call from my datasource the onFailure method is called with an InvocationTargetException. The message in the exception actually consists of my login page (including the marker).
I can't seem to figure out what I'm doing wrong.
login.html:
Code:
<body>
<SCRIPT>
//'"]]>>isc_loginRequired
//
// Embed this whole script block VERBATIM into your login page to enable
// SmartClient RPC relogin.
if (!window.isc && (window.opener != null || window.top != window)) {
while (document.domain.indexOf(".") != -1) {
try {
if (window.opener && window.opener.isc)
break;
if (window.top.isc)
break;
} catch (e) {
try {
document.domain = document.domain.replace(/.*?\./, '');
} catch (ee) {
break;
}
}
}
}
var isc = top.isc ? top.isc : window.opener ? window.opener.isc : null;
if (isc)
{
isc.RPCManager.delayCall("handleLoginRequired", [window]);
}
</SCRIPT>
<form name='f' action='/MyApp/j_spring_security_check' method='POST'>
<table>
<tr><td>User:</td><td><input type='text' name='j_username' value=''></td></tr>
<tr><td>Password:</td><td><input type='password' name='j_password'/></td></tr>
<tr><td colspan='2'><input name="submit" type="submit"/></td></tr>
<tr><td colspan='2'><input name="reset" type="reset"/></td></tr>
</table>
</form>
</body>Code:
public void onModuleLoad()
{
RPCManager.setCredentialsURL("/j_spring_security_check");
RPCManager.setLoginRequiredCallback(new LoginRequiredCallback()
{
public void loginRequired(int transactionNum, RPCRequest request, RPCResponse response)
{
SC.say("Redirect!");
Window.Location.replace("/login.html");
}
});
this.controller.createCanvas();
}Code:
protected void executeFetch(final String requestId, DSRequest request, final DSResponse response)
{
EmployeeRemoteServiceAsync service = GWT.create(EmployeeRemoteService.class);
service.fetchEmployees(new AsyncCallback<List<Employee>>()
{
public void onSuccess(List<Employee> employees)
{
EmployeeRecord[] records = new EmployeeRecord[employees.size()];
int idx = 0;
for (Employee employee : employees)
{
records[idx++] = new EmployeeRecord(employee);
}
response.setData(records);
response.setStatus(DSResponse.STATUS_SUCCESS);
processResponse(requestId, response);
}
public void onFailure(Throwable t)
{
GWT.log("Could not retreive employees", t);
SC.say(t.getMessage());
}
});
}Can anyone see what I'm missing?