IUserContentAccess access = CdeEnvironment.getUserContentAccess();
if ( access.hasAccess( path, FileAccess.WRITE )
|| ( createNew && access.hasAccess( FilenameUtils.getFullPath( path ), FileAccess.WRITE ) ) ) {
if ( access.saveFile( path, new ByteArrayInputStream( contents.getBytes( ENCODING ) ) ) ) {
// saved ok
writeOut( out, "file '" + path + "' saved ok" );
} else {
// error
logger.error( "writeFile: failed saving " + path );