mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
DS-3335 Simplify sword url construction
This commit is contained in:
@@ -316,7 +316,7 @@ public class SWORDUrlManager {
|
||||
"Unable to construct service document urls, due to missing/invalid " +
|
||||
"config in sword.servicedocument.url and/or dspace.server.url");
|
||||
}
|
||||
depositUrl = validSWORDUrl("/servicedocument");
|
||||
depositUrl = buildSWORDUrl("servicedocument");
|
||||
}
|
||||
return depositUrl;
|
||||
}
|
||||
@@ -347,7 +347,7 @@ public class SWORDUrlManager {
|
||||
"Unable to construct deposit urls, due to missing/invalid config in " +
|
||||
"sword.deposit.url and/or dspace.server.url");
|
||||
}
|
||||
depositUrl = validSWORDUrl("/deposit");
|
||||
depositUrl = buildSWORDUrl("deposit");
|
||||
}
|
||||
return depositUrl;
|
||||
}
|
||||
@@ -439,7 +439,7 @@ public class SWORDUrlManager {
|
||||
"Unable to construct media-link urls, due to missing/invalid config in " +
|
||||
"media-link.url and/or dspace.server.url");
|
||||
}
|
||||
mlUrl = validSWORDUrl("/media-link");
|
||||
mlUrl = buildSWORDUrl("media-link");
|
||||
}
|
||||
return mlUrl;
|
||||
}
|
||||
@@ -500,16 +500,12 @@ public class SWORDUrlManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure configured paths when combined are vail URLs
|
||||
* Return configured server path for SWORD url
|
||||
*
|
||||
* @param path the target SWORD endpoint
|
||||
* @return a valid sword URL
|
||||
* @return a sword URL
|
||||
*/
|
||||
private String validSWORDUrl(String path) {
|
||||
String[] splitDspaceUrl = dspaceUrl.split("//");
|
||||
String url = splitDspaceUrl[1] + "/" + swordPath + "/" + path;
|
||||
url = url.replace("///", "/");
|
||||
url = url.replace("//", "/");
|
||||
return splitDspaceUrl[0] + "//" + url;
|
||||
private String buildSWORDUrl(String path) {
|
||||
return dspaceUrl + "/" + swordPath + "/" + path;
|
||||
}
|
||||
}
|
||||
|
@@ -107,7 +107,7 @@ public class SwordUrlManager {
|
||||
"Unable to construct service document urls, due to missing/invalid " +
|
||||
"config in sword2.url and/or dspace.server.url");
|
||||
}
|
||||
sUrl = validSWORDUrl("/swordv2");
|
||||
sUrl = buildSWORDUrl("swordv2");
|
||||
}
|
||||
return sUrl;
|
||||
}
|
||||
@@ -305,7 +305,7 @@ public class SwordUrlManager {
|
||||
"Unable to construct service document urls, due to missing/invalid " +
|
||||
"config in swordv2-server.cfg servicedocument.url and/or dspace.server.url");
|
||||
}
|
||||
sdUrl = validSWORDUrl("/servicedocument");
|
||||
sdUrl = buildSWORDUrl("servicedocument");
|
||||
}
|
||||
return sdUrl;
|
||||
}
|
||||
@@ -336,7 +336,7 @@ public class SwordUrlManager {
|
||||
"Unable to construct deposit urls, due to missing/invalid config in " +
|
||||
"swordv2-server.cfg deposit.url and/or dspace.server.url");
|
||||
}
|
||||
depositUrl = validSWORDUrl("/collection");
|
||||
depositUrl = buildSWORDUrl("collection");
|
||||
}
|
||||
return depositUrl;
|
||||
}
|
||||
@@ -488,16 +488,12 @@ public class SwordUrlManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure configured paths when combined are vail URLs
|
||||
* Return configured server path for SWORD url
|
||||
*
|
||||
* @param path the target SWORD endpoint
|
||||
* @return a valid sword URL
|
||||
* @return a sword URL
|
||||
*/
|
||||
private String validSWORDUrl(String path) {
|
||||
String[] splitDspaceUrl = dspaceUrl.split("//");
|
||||
String url = splitDspaceUrl[1] + "/" + swordPath + "/" + path;
|
||||
url = url.replace("///", "/");
|
||||
url = url.replace("//", "/");
|
||||
return splitDspaceUrl[0] + "//" + url;
|
||||
private String buildSWORDUrl(String path) {
|
||||
return dspaceUrl + "/" + swordPath + "/" + path;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user