From 8b6ff17603b314e50336330a195fc6186b77a229 Mon Sep 17 00:00:00 2001 From: Rob Rudin Date: Wed, 22 Feb 2017 10:01:52 -0500 Subject: [PATCH] #53 Extracted "/" as uriPrefix --- gradle.properties | 2 +- .../client/file/DefaultDocumentFileReader.java | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 4c6b05c..77e5af9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ group=com.marklogic javadocsDir=../gh-pages-marklogic-java/javadocs -version=2.12.1 +version=2.13.DEV \ No newline at end of file diff --git a/src/main/java/com/marklogic/client/file/DefaultDocumentFileReader.java b/src/main/java/com/marklogic/client/file/DefaultDocumentFileReader.java index 4e71525..c37ea4d 100644 --- a/src/main/java/com/marklogic/client/file/DefaultDocumentFileReader.java +++ b/src/main/java/com/marklogic/client/file/DefaultDocumentFileReader.java @@ -20,6 +20,7 @@ public class DefaultDocumentFileReader extends LoggingObject implements FileVisi private List fileFilters; private List documentFiles; private List documentFileProcessors; + private String uriPrefix = "/"; public DefaultDocumentFileReader() { initialize(); @@ -107,7 +108,10 @@ protected boolean acceptPath(Path path, BasicFileAttributes attrs) { protected DocumentFile buildDocumentFile(Path path, Path currentRootPath) { Path relPath = currentRootPath.relativize(path); - String uri = "/" + relPath.toString().replace("\\", "/"); + String uri = relPath.toString().replace("\\", "/"); + if (uriPrefix != null) { + uri = uriPrefix + uri; + } File f = path.toFile(); return new DocumentFile(uri, f); } @@ -172,4 +176,8 @@ public List getFileFilters() { public void setFileFilters(List fileFilters) { this.fileFilters = fileFilters; } + + public void setUriPrefix(String uriPrefix) { + this.uriPrefix = uriPrefix; + } }