in wagon-providers/wagon-webdav-jackrabbit/src/main/java/org/apache/maven/wagon/providers/webdav/WebDavWagon.java [105:138]
protected void mkdirs(String dir) throws IOException {
Repository repository = getRepository();
String basedir = repository.getBasedir();
String baseUrl = repository.getProtocol() + "://" + repository.getHost();
if (repository.getPort() != WagonConstants.UNKNOWN_PORT) {
baseUrl += ":" + repository.getPort();
}
// create relative path that will always have a leading and trailing slash
String relpath = FileUtils.normalize(getPath(basedir, dir) + "/");
PathNavigator navigator = new PathNavigator(relpath);
// traverse backwards until we hit a directory that already exists (OK/NOT_ALLOWED), or that we were able to
// create (CREATED), or until we get to the top of the path
int status = -1;
do {
String url = baseUrl + "/" + navigator.getPath();
status = doMkCol(url);
if (status == HttpStatus.SC_CREATED || status == HttpStatus.SC_METHOD_NOT_ALLOWED) {
break;
}
} while (navigator.backward());
// traverse forward creating missing directories
while (navigator.forward()) {
String url = baseUrl + "/" + navigator.getPath();
status = doMkCol(url);
if (status != HttpStatus.SC_CREATED) {
throw new IOException("Unable to create collection: " + url + "; status code = " + status);
}
}
}