class RepositoryPermissionsJaxrsService {

    @PUT
    @Path("/{uri:.+}")
    @Consumes({"application/collection+xml", "application/collection+json"})
    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public Response updatePermissions(RepositoryPermissionListWrapper data,
            @PathParam("uri") String resourceUri) throws ErrorDescriptorException {
        List<RepositoryPermission> permissions = data.getPermissions();
        List<ObjectPermission> server = new ArrayList<ObjectPermission>(permissions.size());
        for (RepositoryPermission permission : permissions){
            server.add(converter.toServer(permission.setUri(resourceUri), null));
        }
        InternalURI internalURI = new InternalURIDefinition(Folder.SEPARATOR + resourceUri, PermissionUriProtocol.RESOURCE);
        service.putPermissions(internalURI, server);
        permissions.clear();
        for (ObjectPermission permission : server){
            permissions.add(converter.toClient(permission, null));
        }

        return Response.ok().entity(new RepositoryPermissionListWrapper(permissions)).build();
    }

}