Skip to content
Snippets Groups Projects
Commit 83c19e1e authored by Lange, Dr. Herbert's avatar Lange, Dr. Herbert
Browse files

include token in temp report name

parent bd9850c0
Branches
No related tags found
No related merge requests found
...@@ -61,8 +61,13 @@ class CorpusThread extends Thread { ...@@ -61,8 +61,13 @@ class CorpusThread extends Thread {
this.inFile = infile; this.inFile = infile;
this.functionNames = functions ; this.functionNames = functions ;
this.props = properties; this.props = properties;
if (outfile.equals("tmp")) if (outfile.equals("tmp")) {
this.outFile = this.inFile + "/report.html"; File tmpDir = new File(System.getProperty("java.io.tmpdir") + "/" + token);
// Create parent directory if it is missing
if (!tmpDir.exists())
tmpDir.mkdirs();
this.outFile = System.getProperty("java.io.tmpdir") + "/" + token + "/report.html";
}
else else
this.outFile = outfile; this.outFile = outfile;
this.token = token ; this.token = token ;
...@@ -77,7 +82,6 @@ class CorpusThread extends Thread { ...@@ -77,7 +82,6 @@ class CorpusThread extends Thread {
CorpusIO cio = new CorpusIO(); CorpusIO cio = new CorpusIO();
report.addNote("CorpusWebServices","Starting run at " + report.addNote("CorpusWebServices","Starting run at " +
DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss").format(LocalDateTime.now())); DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss").format(LocalDateTime.now()));
try { try {
// Create corpus from given input file/folder // Create corpus from given input file/folder
Corpus corpus; Corpus corpus;
......
...@@ -2,6 +2,7 @@ package de.uni_hamburg.corpora.server; ...@@ -2,6 +2,7 @@ package de.uni_hamburg.corpora.server;
import jakarta.ws.rs.GET; import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path; import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -27,8 +28,9 @@ public class Report { ...@@ -27,8 +28,9 @@ public class Report {
* @return Response containing the file or an error code * @return Response containing the file or an error code
*/ */
@GET @GET
public Response getReport() { public Response getReport(@QueryParam("token") String token) {
String reportFileName = System.getProperty("java.io.tmpdir") + "/corpus-files/report.html"; // TODO place report somewhere else because files should be deleted after check
String reportFileName = System.getProperty("java.io.tmpdir") + "/" + token + "/report.html";
logger.info("Loading report file " + reportFileName); logger.info("Loading report file " + reportFileName);
File reportFile = new File(reportFileName); File reportFile = new File(reportFileName);
if (!reportFile.exists()) { if (!reportFile.exists()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment