extension = assetName.substring(assetName.lastIndexOf(".")+1);
} else {
fileName = assetName;
}
AssetItem ai = repository.loadPackage(packageName).addAsset(fileName, "");
ai.checkout();
ai.updateBinaryContentAttachmentFileName(fileName);
if(extension != null) {
ai.updateFormat(extension);
}
ai.updateBinaryContentAttachment(is);
ai.getPackage().updateBinaryUpToDate(false);
ai.checkin("update binary");
repository.save();
return ToAssetEntryAbdera(ai, uriInfo);
} catch (Exception e) {
//catch RulesRepositoryException and other exceptions. For example when the package already exists.
throw new WebApplicationException(e);