class CatalogRest {

    @POST
    @Path("{catalogId}/records/{recordId}/distributions")
    @Produces(MediaType.TEXT_PLAIN)
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    @RolesAllowed("user")
    @ApiOperation("Creates a new Distribution for the provided UnversionedRecord.")
    public Response createUnversionedDistribution(@Context ContainerRequestContext context,
                                           @PathParam("catalogId") String catalogId,
                                           @PathParam("recordId") String recordId,
                                           @FormDataParam("title") String title,
                                           @FormDataParam("description") String description,
                                           @FormDataParam("format") String format,
                                           @FormDataParam("accessURL") String accessURL,
                                           @FormDataParam("downloadURL") String downloadURL) {
        try {
            Distribution newDistribution = createDistribution(title, description, format, accessURL, downloadURL,
                    context);
            catalogManager.addUnversionedDistribution(vf.createIRI(catalogId), vf.createIRI(recordId), newDistribution);
            return Response.status(201).entity(newDistribution.getResource().stringValue()).build();
        } catch (IllegalArgumentException ex) {
            throw ErrorUtils.sendError(ex, ex.getMessage(), Response.Status.BAD_REQUEST);
        } catch (MobiException ex) {
            throw ErrorUtils.sendError(ex, ex.getMessage(), Response.Status.INTERNAL_SERVER_ERROR);
        }
    }

}