I need to create a logon webservice in a wicket application and call it from jQuery $.ajax() function. I've found wicketstuff-restannotations and tried this code:
public static class DestinationUrl implements Serializable
{
private String authorizedUrl;
public String getAuthorizedUrl()
{
return authorizedUrl;
}
public void setAuthorizedUrl(String authorizedUrl)
{
this.authorizedUrl = authorizedUrl;
}
}
public static class GsonLogonService extends GsonRestResource implements Serializable
{
private AuthenticatedWebSession session;
public AuthenticatedWebSession getSession()
{
return session;
}
public void setSession(AuthenticatedWebSession session)
{
this.session = session;
}
@MethodMapping(value = "/loginService", httpMethod = HttpMethod.POST)
public DestinationUrl logonService(@RequestBody String username, @RequestBody String password)
{
DestinationUrl result = new DestinationUrl();
if (session.signIn(username, password))
result.setAuthorizedUrl(RequestCycle.get().getRequest().getOriginalUrl().toString());
else
result.setAuthorizedUrl("/");
return result;
}
}
But what else should I do in order to make that service appear under /logonService or /MyContext/logonService? Calling either of those with $.ajax() or $.get() yelds 404...