}
// @todo handling remote URL implies asynchronous processing at this stage
if (location == null || !location.getProtocol().equalsIgnoreCase("file")) {
throw new RestletException("Invalid url in request", Status.CLIENT_ERROR_BAD_REQUEST);
}
FileData file;
try {
file = FileData.createFromFile(new File(location.toURI().getPath()));
} catch (Exception ex) {
throw new RuntimeException("Unexpected exception", ex);
}
if (file instanceof Directory) {
try {
file.prepare();
} catch (IOException ioe) {
String msg = "Error processing file: " + file.getFile().getAbsolutePath();
getLogger().log(Level.WARNING, msg, ioe);
throw new RestletException(msg, Status.SERVER_ERROR_INTERNAL);
}
}