class CatalogRest {

    @GET
    @Path("{catalogId}/records/{recordId}/branches/{branchId}/commits/head")
    @Produces(MediaType.APPLICATION_JSON)
    @RolesAllowed("user")
    @ApiOperation("Gets the HEAD Commit for a specific Branch.")
    @ResourceId(type = ValueType.PATH, value = "recordId")
    public Response getHead(@PathParam("catalogId") String catalogId,
                     @PathParam("recordId") String recordId,
                     @PathParam("branchId") String branchId,
                     @DefaultValue("jsonld") @QueryParam("format") String format) {
        long start = System.currentTimeMillis();
        try {
            Commit headCommit = catalogManager.getHeadCommit(vf.createIRI(catalogId), vf.createIRI(recordId),
                    vf.createIRI(branchId));
            return createCommitResponse(headCommit, catalogManager.getCommitDifference(headCommit.getResource()),
                    format, transformer, bNodeService);
        } catch (IllegalArgumentException ex) {
            throw ErrorUtils.sendError(ex, ex.getMessage(), Response.Status.BAD_REQUEST);
        } catch (IllegalStateException | MobiException ex) {
            throw ErrorUtils.sendError(ex, ex.getMessage(), Response.Status.INTERNAL_SERVER_ERROR);
        } finally {
            LOG.trace("getHead took {}ms", System.currentTimeMillis() - start);
        }
    }

}