code: public static WebResource getAnnisWebResource(String uri, AnnisUser user)
    {
  
      if (user != null)
      {
        try
        {
          return user.getClient().resource(uri);
        }
        catch (LoginDataLostException ex)
        {
          log.error(
            "Could not restore the login-data from session, user will invalidated",
            ex);
          setUser(null);
          UI ui = UI.getCurrent();
          if (ui instanceof AnnisBaseUI)
          {
            ((AnnisBaseUI) ui).getLoginDataLostBus().post(ex);
          }
        }
      }
  
      // use the anonymous client
      if (anonymousClient.get() == null)
      {
        // anonymous client not created yet
        anonymousClient.set(createRESTClient());
      }
  
      return anonymousClient.get().resource(uri);
    }
docs: Gets or creates a web resource to the ANNIS service.
  
  @param uri The URI where the service can be found
  @param user The user object or null (should be of type {@link AnnisUser}).
  @return A reference to the ANNIS service root resource.