Compare commits

..

No commits in common. "master" and "web-server" have entirely different histories.

3 changed files with 7 additions and 32 deletions

View File

@ -11,7 +11,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static spark.Spark.*;
import static spark.Spark.get;
import static spark.Spark.port;
public class App {
@ -20,34 +21,9 @@ public class App {
get("/search", (req, res) -> {
Gson gson = new Gson();
String[] words = req.queryParams("s").split("/+");
System.out.println("Request : " + req.queryParams("s"));
ArrayList<Result> results = getResults(words);
String json = gson.toJson(results);
System.out.println(json);
return json;
return gson.toJson(results);
});
options("/*",
(request, response) -> {
String accessControlRequestHeaders = request
.headers("Access-Control-Request-Headers");
if (accessControlRequestHeaders != null) {
response.header("Access-Control-Allow-Headers",
accessControlRequestHeaders);
}
String accessControlRequestMethod = request
.headers("Access-Control-Request-Method");
if (accessControlRequestMethod != null) {
response.header("Access-Control-Allow-Methods",
accessControlRequestMethod);
}
return "OK";
});
before((request, response) -> response.header("Access-Control-Allow-Origin", "*"));
}
private static ArrayList<Result> getResults(String[] words) throws Exception {

View File

@ -6,6 +6,9 @@ RUN apt-get update; apt-get install -y git wget;
RUN cd /root; wget https://download.java.net/openjdk/jdk11/ri/openjdk-11+28_linux-x64_bin.tar.gz; wget http://mirror.navercorp.com/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz
RUN echo "export JAVA_HOME=/root/jdk-11" \
echo "export PATH=$PATH:/root/jdk-11/bin:/root/apache-maven-3.6.1/bin"
RUN cd /root; tar -xsvf openjdk-11+28_linux-x64_bin.tar.gz; tar -xsvf apache-maven-3.6.1-bin.tar.gz
EXPOSE 8080

6
docker/start.sh Executable file → Normal file
View File

@ -1,10 +1,6 @@
#!/bin/bash
rm -rdf /root/nlp
export JAVA_HOME=/root/jdk-11
export PATH=$PATH:/root/jdk-11/bin:/root/apache-maven-3.6.1/bin
rm -rdf
git clone https://git.sanchezm.fr/mathieu/CAU-NLP-Spring-2019-PQ-Man-Server.git /root/nlp
cd /root/nlp/CAu_NLP_2019