1

How can I catch ConnectException to inform the user, if the server is down (not available).

I build a login with this code:

Form form = new Form()
            .param("username", userName)
            .param("password", password);
        try {
            return ClientBuilder
                .newClient()
                .target(LOGIN_URL)
                .request()
                .post(Entity.form(form), User.class);
        } catch (NotAuthorizedException e) {
            logger.error(e.getMessage(), e);
        }
        return null;

How can I know, when the backend is down?

Sajjad
  • 853
  • 2
  • 15
  • 32
emoleumassi
  • 4,881
  • 13
  • 67
  • 93

0 Answers0