1

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...

Lucio Crusca
  • 1,277
  • 3
  • 15
  • 41
  • Hi I have the same problem. Could you tag this question as a wicket question? Maybe that way it will get more answers. – melanzane May 09 '19 at 09:01

0 Answers0