For the record, Brian's code is correct to support exploded deployments. To get the path, just use the File API:
String urlString = new File(url.toURI()).getAbsolutePath();
contentItem.get(PATH).set(urlString);
contentItem.get(ARCHIVE).set(false);
I tested this and it worked in AS 7.1.1.Final.