/** * Delete label * * @param account * @param labelId * @return */ @DELETE @Path("{id}") @Produces(MediaType.APPLICATION_JSON) public Response deleteLabel( @PathParam("user") String user, @PathParam("domain") String domain, @PathParam("id") Integer labelId) { Mailbox mailbox = new Mailbox(user, domain); try { labelDAO.delete(mailbox, labelId); } catch (IllegalLabelException ile) { throw new BadRequestException(ile.getMessage()); } catch (Exception e) { logger.error("Deleting label failed", e); throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR); } return Response.noContent().build(); }