0 Replies Latest reply on Dec 13, 2012 3:28 AM by esteve

    Picket Box + CDI authentication exception handler

    esteve

      Hi,

      I would like to know how can we handle or catch a @UserLoggedIn exception thrown when a user is not logged in to produce a response in JAX-RS like this:

      log.error("Error loading club for userAccountId "+  userAccountId, e); Map<String, Object> errors = new HashMap<String, Object>(); errors.put("errors", Collections.singletonList(e.getMessage())); throw new RestServiceException(Response.status(Response.Status.UNAUTHORIZED).entity(errors).build());
      Map<String, Object> errors = new HashMap<String, Object>();

      errors.put("errors", Collections.singletonList(e.getMessage()));

      throw new RestServiceException(Response.status(Response.Status.UNAUTHORIZED).entity(errors).build());

      Thanks in advance

      Esteve