Example #1
0
 public static WebApplicationException preconditionFailed(String format, Object... args) {
   String msg = String.format(format, args);
   if (log.isDebugEnabled()) log.debug("returning 412 preconditionFailed(" + msg + ")");
   throw new WebApplicationException(
       Response.status(Response.Status.PRECONDITION_FAILED)
           .type(MediaType.APPLICATION_JSON_TYPE)
           .entity(ApiError.builder().message(msg).build())
           .build());
 }
Example #2
0
 public static WebApplicationException notFound(String format, Object... args) {
   String msg = String.format(format, args);
   if (log.isDebugEnabled())
     log.debug("returning 404 notFound(" + msg + ") - may be a stale browser session");
   throw new WebApplicationException(
       Response.status(Response.Status.NOT_FOUND)
           .type(MediaType.APPLICATION_JSON_TYPE)
           .entity(ApiError.builder().message(msg).build())
           .build());
 }