Minor TPF endpoint fixes
This commit is contained in:
parent
9cd5a1329a
commit
1426b005f2
1 changed files with 18 additions and 16 deletions
|
@ -149,10 +149,10 @@ public class VitroLinkedDataFragmentServlet extends VitroHttpServlet {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException {
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException {
|
||||||
int fileNamePos = request.getRequestURI().toLowerCase().lastIndexOf("/tpf/assets/");
|
int fileNamePos = request.getRequestURI().toLowerCase().lastIndexOf("tpf/assets/");
|
||||||
if (fileNamePos > 0) {
|
if (fileNamePos > 0) {
|
||||||
try {
|
try {
|
||||||
String fileName = request.getRequestURI().substring(fileNamePos + 12);
|
String fileName = request.getRequestURI().substring(fileNamePos + 11);
|
||||||
InputStream in = VitroLinkedDataFragmentServlet.class.getResourceAsStream(fileName);
|
InputStream in = VitroLinkedDataFragmentServlet.class.getResourceAsStream(fileName);
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
IOUtils.copy(in, response.getOutputStream());
|
IOUtils.copy(in, response.getOutputStream());
|
||||||
|
@ -243,21 +243,23 @@ public class VitroLinkedDataFragmentServlet extends VitroHttpServlet {
|
||||||
List<Ontology> onts = dao.getAllOntologies();
|
List<Ontology> onts = dao.getAllOntologies();
|
||||||
if (onts != null) {
|
if (onts != null) {
|
||||||
for (Ontology ont : onts) {
|
for (Ontology ont : onts) {
|
||||||
switch (ont.getPrefix()) {
|
if (ont != null && ont.getPrefix() != null) {
|
||||||
case "rdf":
|
switch (ont.getPrefix()) {
|
||||||
case "rdfs":
|
case "rdf":
|
||||||
case "hydra":
|
case "rdfs":
|
||||||
case "void":
|
case "hydra":
|
||||||
break;
|
case "void":
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
configJson.append(",\n");
|
configJson.append(",\n");
|
||||||
configJson.append(" \"");
|
configJson.append(" \"");
|
||||||
configJson.append(ont.getPrefix());
|
configJson.append(ont.getPrefix());
|
||||||
configJson.append("\": \"");
|
configJson.append("\": \"");
|
||||||
configJson.append(ont.getURI());
|
configJson.append(ont.getURI());
|
||||||
configJson.append("\"");
|
configJson.append("\"");
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue