Merge r5997 from nihvivo-rel-1.1-maint
This commit is contained in:
parent
c7024c37bc
commit
535691ee11
2 changed files with 9 additions and 8 deletions
|
@ -54,6 +54,12 @@ public class ApplicationDaoJena extends JenaBaseDao implements ApplicationDao {
|
||||||
RDFNode node = nodes.next();
|
RDFNode node = nodes.next();
|
||||||
if (node.isLiteral()) {
|
if (node.isLiteral()) {
|
||||||
String namespace = ((Literal)node).getLexicalForm();
|
String namespace = ((Literal)node).getLexicalForm();
|
||||||
|
// org.openrdf.model.impl.URIImpl.URIImpl.getNamespace() returns a
|
||||||
|
// namespace with a final slash, so this makes matching easier.
|
||||||
|
// It also accords with the way the default namespace is defined.
|
||||||
|
if (!namespace.endsWith("/")) {
|
||||||
|
namespace = namespace + "/";
|
||||||
|
}
|
||||||
externallyLinkedNamespaces.add(namespace);
|
externallyLinkedNamespaces.add(namespace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,11 +167,11 @@ public class URLRewritingHttpServletResponse implements HttpServletResponse {
|
||||||
// remove the ugly uri parameter
|
// remove the ugly uri parameter
|
||||||
indexToRemove = qpIndex;
|
indexToRemove = qpIndex;
|
||||||
} else if (isExternallyLinkedNamespace(namespace)) {
|
} else if (isExternallyLinkedNamespace(namespace)) {
|
||||||
namespace = removeFinalSlash(namespace);
|
|
||||||
log.debug("Found externally linked namespace " + namespace);
|
log.debug("Found externally linked namespace " + namespace);
|
||||||
// Use the externally linked namespace in the url
|
// Use the externally linked namespace in the url
|
||||||
url.pathParts = new ArrayList<String>();
|
url.pathParts = new ArrayList<String>();
|
||||||
url.pathParts.add(namespace);
|
// toString() will join elements with a slash, so remove this one.
|
||||||
|
url.pathParts.add(namespace.replaceAll("/$", ""));
|
||||||
url.pathParts.add(localName);
|
url.pathParts.add(localName);
|
||||||
// remove the ugly uri parameter
|
// remove the ugly uri parameter
|
||||||
indexToRemove = qpIndex;
|
indexToRemove = qpIndex;
|
||||||
|
@ -470,13 +470,8 @@ public class URLRewritingHttpServletResponse implements HttpServletResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isExternallyLinkedNamespace(String namespace) {
|
private boolean isExternallyLinkedNamespace(String namespace) {
|
||||||
namespace = removeFinalSlash(namespace);
|
|
||||||
List<String> externallyLinkedNamespaces = wadf.getApplicationDao().getExternallyLinkedNamespaces();
|
List<String> externallyLinkedNamespaces = wadf.getApplicationDao().getExternallyLinkedNamespaces();
|
||||||
return externallyLinkedNamespaces.contains(namespace);
|
return externallyLinkedNamespaces.contains(namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String removeFinalSlash(String str) {
|
|
||||||
return str.replaceAll("/$", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue