Fixed ContextPath issue
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/nlphub@167415 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
7860fc347b
commit
186e910618
2
pom.xml
2
pom.xml
|
@ -1,7 +1,7 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube</groupId>
|
||||
<groupId>org.gcube.data.analysis</groupId>
|
||||
<artifactId>nlphub</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub;
|
||||
package org.gcube.data.analysis.nlphub;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
|
@ -15,11 +15,11 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.gcube.nlphub.legacy.Constants;
|
||||
import org.gcube.nlphub.legacy.JsonManager;
|
||||
import org.gcube.nlphub.nlp.NlpAsyncNerRunner;
|
||||
import org.gcube.nlphub.nlp.NlpParameter;
|
||||
import org.gcube.nlphub.nlp.RunnerCommander;
|
||||
import org.gcube.data.analysis.nlphub.legacy.Constants;
|
||||
import org.gcube.data.analysis.nlphub.legacy.JsonManager;
|
||||
import org.gcube.data.analysis.nlphub.nlp.NlpAsyncNerRunner;
|
||||
import org.gcube.data.analysis.nlphub.nlp.NlpParameter;
|
||||
import org.gcube.data.analysis.nlphub.nlp.RunnerCommander;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub;
|
||||
package org.gcube.data.analysis.nlphub;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
|
@ -15,12 +15,12 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.gcube.nlphub.workspace.WorkspaceManager;
|
||||
import org.gcube.nlphub.mapper.JsonMapper;
|
||||
import org.gcube.nlphub.legacy.Constants;
|
||||
import org.gcube.nlphub.legacy.JsonManager;
|
||||
import org.gcube.nlphub.legacy.NlpHubException;
|
||||
import org.gcube.nlphub.mapper.DefaultMapper;
|
||||
import org.gcube.data.analysis.nlphub.legacy.Constants;
|
||||
import org.gcube.data.analysis.nlphub.legacy.JsonManager;
|
||||
import org.gcube.data.analysis.nlphub.legacy.NlpHubException;
|
||||
import org.gcube.data.analysis.nlphub.mapper.DefaultMapper;
|
||||
import org.gcube.data.analysis.nlphub.mapper.JsonMapper;
|
||||
import org.gcube.data.analysis.nlphub.workspace.WorkspaceManager;
|
||||
|
||||
/**
|
||||
* Servlet implementation class NlpMapper
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub;
|
||||
package org.gcube.data.analysis.nlphub;
|
||||
|
||||
//import static org.gcube.common.authorization.client.Constants.authorizationService;
|
||||
|
||||
|
@ -15,12 +15,12 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import javax.servlet.http.Part;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.gcube.nlphub.legacy.Constants;
|
||||
import org.gcube.nlphub.legacy.JsonManager;
|
||||
import org.gcube.nlphub.legacy.NlpHubException;
|
||||
import org.gcube.nlphub.nlp.NLpLanguageRecognizer;
|
||||
import org.gcube.nlphub.nlp.NlpUtils;
|
||||
import org.gcube.nlphub.workspace.WorkspaceManager;
|
||||
import org.gcube.data.analysis.nlphub.legacy.Constants;
|
||||
import org.gcube.data.analysis.nlphub.legacy.JsonManager;
|
||||
import org.gcube.data.analysis.nlphub.legacy.NlpHubException;
|
||||
import org.gcube.data.analysis.nlphub.nlp.NLpLanguageRecognizer;
|
||||
import org.gcube.data.analysis.nlphub.nlp.NlpUtils;
|
||||
import org.gcube.data.analysis.nlphub.workspace.WorkspaceManager;
|
||||
|
||||
/**
|
||||
* Servlet implementation class NLPUploader
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub.legacy;
|
||||
package org.gcube.data.analysis.nlphub.legacy;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
@ -7,7 +7,7 @@ import java.net.URL;
|
|||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.gcube.nlphub.nlp.NlpParameter;
|
||||
import org.gcube.data.analysis.nlphub.nlp.NlpParameter;
|
||||
|
||||
public class AsyncHttpRequest extends Thread {
|
||||
private String baseUrl, finalUrl, result, method;
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub.legacy;
|
||||
package org.gcube.data.analysis.nlphub.legacy;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public class Constants {
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub.legacy;
|
||||
package org.gcube.data.analysis.nlphub.legacy;
|
||||
|
||||
class DataminerClientException extends Exception {
|
||||
public DataminerClientException(String message, Throwable throwable) {
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub.legacy;
|
||||
package org.gcube.data.analysis.nlphub.legacy;
|
||||
|
||||
|
||||
import java.io.Reader;
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub.legacy;
|
||||
package org.gcube.data.analysis.nlphub.legacy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import com.google.gson.JsonArray;
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub.legacy;
|
||||
package org.gcube.data.analysis.nlphub.legacy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import com.google.gson.JsonArray;
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub.legacy;
|
||||
package org.gcube.data.analysis.nlphub.legacy;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub.legacy;
|
||||
package org.gcube.data.analysis.nlphub.legacy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import com.google.gson.JsonArray;
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub.legacy;
|
||||
package org.gcube.data.analysis.nlphub.legacy;
|
||||
|
||||
public class NlpHubException extends Exception {
|
||||
public NlpHubException(String message, Throwable throwable) {
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub.mapper;
|
||||
package org.gcube.data.analysis.nlphub.mapper;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
@ -11,9 +11,9 @@ import com.google.gson.JsonParser;
|
|||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.gcube.nlphub.legacy.NerAlgorithm;
|
||||
import org.gcube.nlphub.legacy.NerAnnotationData;
|
||||
import org.gcube.nlphub.legacy.NerEntity;
|
||||
import org.gcube.data.analysis.nlphub.legacy.NerAlgorithm;
|
||||
import org.gcube.data.analysis.nlphub.legacy.NerAnnotationData;
|
||||
import org.gcube.data.analysis.nlphub.legacy.NerEntity;
|
||||
|
||||
public class DefaultMapper implements JsonMapper {
|
||||
private Logger logger = Logger.getLogger(DefaultMapper.class.getSimpleName());
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub.mapper;
|
||||
package org.gcube.data.analysis.nlphub.mapper;
|
||||
|
||||
public interface JsonMapper {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub.nlp;
|
||||
package org.gcube.data.analysis.nlphub.nlp;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
@ -12,9 +12,9 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.gcube.nlphub.legacy.Constants;
|
||||
import org.gcube.nlphub.legacy.JsonManager;
|
||||
import org.gcube.nlphub.legacy.NlpHubException;
|
||||
import org.gcube.data.analysis.nlphub.legacy.Constants;
|
||||
import org.gcube.data.analysis.nlphub.legacy.JsonManager;
|
||||
import org.gcube.data.analysis.nlphub.legacy.NlpHubException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.w3c.dom.Node;
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub.nlp;
|
||||
package org.gcube.data.analysis.nlphub.nlp;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -12,8 +12,8 @@ import java.util.ArrayList;
|
|||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.gcube.nlphub.legacy.AsyncHttpRequest;
|
||||
import org.gcube.nlphub.legacy.Constants;
|
||||
import org.gcube.data.analysis.nlphub.legacy.AsyncHttpRequest;
|
||||
import org.gcube.data.analysis.nlphub.legacy.Constants;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub.nlp;
|
||||
package org.gcube.data.analysis.nlphub.nlp;
|
||||
|
||||
public class NlpParameter {
|
||||
public static String ANNOTATION_LIST = "annotations";
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub.nlp;
|
||||
package org.gcube.data.analysis.nlphub.nlp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub.nlp;
|
||||
package org.gcube.data.analysis.nlphub.nlp;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
|
@ -6,8 +6,8 @@ import java.util.ArrayList;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.gcube.nlphub.legacy.Constants;
|
||||
import org.gcube.nlphub.legacy.JsonManager;
|
||||
import org.gcube.data.analysis.nlphub.legacy.Constants;
|
||||
import org.gcube.data.analysis.nlphub.legacy.JsonManager;
|
||||
|
||||
public class RunnerCommander extends Thread {
|
||||
private HttpServletResponse response = null;
|
|
@ -1,4 +1,4 @@
|
|||
package org.gcube.nlphub.workspace;
|
||||
package org.gcube.data.analysis.nlphub.workspace;
|
||||
|
||||
import static org.gcube.common.authorization.client.Constants.authorizationService;
|
||||
|
||||
|
@ -13,9 +13,9 @@ import java.net.URLEncoder;
|
|||
import javax.servlet.http.Part;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.gcube.nlphub.NLPUploader;
|
||||
import org.gcube.nlphub.legacy.Constants;
|
||||
import org.gcube.nlphub.legacy.NlpHubException;
|
||||
import org.gcube.data.analysis.nlphub.NLPUploader;
|
||||
import org.gcube.data.analysis.nlphub.legacy.Constants;
|
||||
import org.gcube.data.analysis.nlphub.legacy.NlpHubException;
|
||||
|
||||
public class WorkspaceManager {
|
||||
private Logger logger = Logger.getLogger(WorkspaceManager.class.getSimpleName());
|
|
@ -0,0 +1,9 @@
|
|||
<application mode="online">
|
||||
|
||||
<name>nlphub</name>
|
||||
<group>org.gcube.data.analysis</group>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<description>NLPHub webapp</description>
|
||||
|
||||
</application>
|
|
@ -1,4 +1,4 @@
|
|||
<%@ page import="org.gcube.nlphub.legacy.Constants" %>
|
||||
<%@ page import="org.gcube.data.analysis.nlphub.legacy.Constants" %>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
@ -25,6 +25,7 @@
|
|||
var inputFile = '<%= ((request.getParameter(Constants.INPUT_FILE_PARAMETER) == null) ? "" : "" + request.getParameter(Constants.INPUT_FILE_PARAMETER)) %>';
|
||||
var gCubeToken = '<%= ((request.getParameter(Constants.TOKEN_PARAMETER) == null) ? "" : "" + request.getParameter(Constants.TOKEN_PARAMETER)) %>';
|
||||
var scheme = '<%= request.getScheme() %>';
|
||||
var contextPath = '<%= request.getContextPath() %>';
|
||||
</script>
|
||||
</head>
|
||||
<body style="padding: 0 15px;">
|
||||
|
|
|
@ -15,7 +15,8 @@ var checkedAnnotation = "";
|
|||
var algIndexedArray = [];
|
||||
var computedLanguage = "";
|
||||
var dataMiner = "";
|
||||
var appRoot = ".";
|
||||
var appLocation = window.location.href;
|
||||
var appRoot = "";
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
// Starting point: get the csv file with algorithm parameters and set the page
|
||||
|
@ -23,6 +24,9 @@ var appRoot = ".";
|
|||
// ------------------------------------------------------------------------------------------------------
|
||||
|
||||
$(document).ready(function() {
|
||||
console.log('HREF: '+appLocation);
|
||||
appRoot=contextPath;
|
||||
console.log('appRoot: '+ appRoot );
|
||||
$(".popup-text").hide();
|
||||
disableExecuteButton();
|
||||
showAnnotationsList();
|
||||
|
@ -1006,26 +1010,31 @@ getIndices = function() {
|
|||
var indices = [];
|
||||
// get indices
|
||||
for (var i = 0; i < jsonContent.output.result.length; i++) {
|
||||
// filter on algorithm
|
||||
var found = false;
|
||||
for (var j = 0; j < checkedAlgs.length; j++) {
|
||||
if (checkedAlgs[j].getAttribute("named") == jsonContent.output.result[i].algorithm) {
|
||||
found = true;
|
||||
break;
|
||||
if (typeof jsonContent.output.result[i] === 'undefined'
|
||||
|| jsonContent.output.result[i] == null) {
|
||||
console.log("No result for " + i);
|
||||
} else {
|
||||
// filter on algorithm
|
||||
var found = false;
|
||||
for (var j = 0; j < checkedAlgs.length; j++) {
|
||||
if (checkedAlgs[j].getAttribute("named") == jsonContent.output.result[i].algorithm) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
continue;
|
||||
if (!found)
|
||||
continue;
|
||||
|
||||
var entities = jsonContent.output.result[i].entities;
|
||||
for (var j = 0; j < entities.length; j++) {
|
||||
// filter on annotation
|
||||
a = entities[j][checkedAnnotation];
|
||||
if (typeof a != 'undefined') {
|
||||
indices[i] = [];
|
||||
for (var k = 0; k < a.length; k++) {
|
||||
var index = a[k].indices;
|
||||
indices[i][k] = index;
|
||||
var entities = jsonContent.output.result[i].entities;
|
||||
for (var j = 0; j < entities.length; j++) {
|
||||
// filter on annotation
|
||||
a = entities[j][checkedAnnotation];
|
||||
if (typeof a != 'undefined') {
|
||||
indices[i] = [];
|
||||
for (var k = 0; k < a.length; k++) {
|
||||
var index = a[k].indices;
|
||||
indices[i][k] = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue