"Failed to create resource "+
name +" : "+
"Unable to create the appropriate file:"+
request.getURLPath()+
" this media type is not supported");
throw new HTTPException (error);
}
} else { //FORBIDDEN IN WEBDAV
Reply error = request.makeReply(HTTP.CONFLICT) ;
error.setContent(name +" does not exists!");
throw new HTTPException (error);
}
} else if (rr == null) {
Reply error = request.makeReply(HTTP.FORBIDDEN) ;
error.setContent("You are not allowed to create resource "+
name +" : "+
dresource.getIdentifier()+
" is not extensible.");
throw new HTTPException (error);
}
} else if (request.getMethod().equals("MKCOL")) {
String name = ls.peekNextComponent() ;
ResourceReference rr = dresource.lookup(name);
if (rr == null) {
if (ls.countRemainingComponents() == 1) {
request.setState(REMAINING_PATH, name);
return true;
} else {
Reply error = request.makeReply(HTTP.CONFLICT) ;
error.setContent("Can't create "+
ls.getRemainingPath(true));
throw new HTTPException (error);
}
}
}
}
// normal lookup
if ( super.lookupOther(ls, lr) ) {
if ( ! ls.isDirectory() && ! ls.isInternal() ) {
// The directory lookup URL doesn't end with a slash:
if ( request == null ) {
lr.setTarget(null);
return true;
} else if (! acceptRedirect(request)) {
return true;
}
URL url = null;
try {
if ((request != null ) &&
request.hasState(Request.ORIG_URL_STATE)) {
URL oldurl;
oldurl = (URL)request.getState(Request.ORIG_URL_STATE);
url = new URL(oldurl, oldurl.getFile() + "/");
} else {
url = (ls.hasRequest()
? getURL(request)
: new URL(getServer().getURL(),
resource.getURLPath()));
}
} catch (MalformedURLException ex) {
getServer().errlog(this, "unable to build full URL.");
throw new HTTPException("Internal server error");
}
String msg = "Invalid requested URL: the directory resource "+
" you are trying to reach is available only through "+
" its full URL: <a href=\""+
url + "\">" + url + "</a>.";