@QueryParam("includebody") @DefaultValue("false") boolean includeBody,
@QueryParam("reverse") @DefaultValue("true") boolean reverse,
@QueryParam("start") UUID start,
@QueryParam("count") @DefaultValue("50") int count)
{
Mailbox mailbox = new Mailbox(user, domain);
byte[] response;
try {
if (withMetadata) {
response = JSONUtils.fromObject(messageDAO.getMessageIdsWithMetadata(mailbox,
labelId, start, count, reverse, includeBody));
} else {
response = JSONUtils.fromObject(messageDAO.getMessageIds(mailbox,
labelId, start, count, reverse));
}
} catch (Exception e) {
logger.error("REST get of message headers for {}/{} failed: {}",
new Object[] { mailbox.getId(), labelId, e.getMessage() });
throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
}
return Response.ok(response).build();
}