public void start(AcceptsOneWidget container, EventBus eventBus) {

    display.setListener(this);
    display.setLoginErrorMessage("");
    sessionID = Cookies.getCookie("sid");

    container.setWidget(display.asWidget());
  }
  @Override
  public void login(String username, String password) {

    display.setLoginErrorMessage("");
    rpcService.login(
        username,
        password,
        new AsyncCallback<String>() {
          public void onSuccess(String result) {
            if (null != result) {
              registerSessionCookie(result);

              rpcService.getLoggedInUser(
                  new AsyncCallback<LoggedInUser>() {

                    @Override
                    public void onSuccess(LoggedInUser result) {
                      Place userPlace = null;
                      if (result.isManager()) {
                        if (result.hasClients()) {
                          userPlace =
                              new LoginManagerWithClientsPlace(
                                  result.getDescription(),
                                  "" + result.getId(),
                                  result.getParentId().toString(),
                                  result.getOfficeName());
                        } else
                          userPlace =
                              new LoginManagerPlace(
                                  result.getDescription(),
                                  "" + result.getId(),
                                  result.getParentId().toString(),
                                  result.getOfficeName());
                      } else {
                        userPlace = new LoginCEPlace(result.getDescription(), "" + result.getId());
                      }
                      display.clear();
                      placeController.goTo(userPlace);
                    }

                    @Override
                    public void onFailure(Throwable caught) {
                      display.setLoginErrorMessage(
                          "Errore imprevisto, per cortesia ripetere il login");
                      display.clear();
                      placeController.goTo(new AuthenticationPlace());
                    }
                  }); // getLoggedInUser

            } else {
              display.setLoginErrorMessage("Username e/o Password non validi");
              display.clear();
            }
          }

          public void onFailure(Throwable caught) {
            display.setLoginErrorMessage(
                "Il servizio non � al momento disponibile. Riprovare pi� tardi. Ci scusiamo per il disagio.");
            display.clear();
          }
        });
  }