fixes to war building

This commit is contained in:
Johannes Theiner 2019-06-03 00:24:00 +02:00
parent 97d8eb73bf
commit 018589c78d
6 changed files with 15 additions and 6 deletions

View File

@ -5,7 +5,7 @@
## minimal Requirements
- Java 11
- Java 8
- Maven 3
- Tomcat 9

View File

@ -13,7 +13,7 @@
<packaging>war</packaging>
<properties>
<java.version>11</java.version>
<java.version>1.8</java.version>
<checkstyle_file>checkstyle.xml</checkstyle_file>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.sources>src/main</sonar.sources>

View File

@ -54,7 +54,7 @@ public class AuthorizationFilter implements Filter {
HttpServletResponse res = (HttpServletResponse) response;
HttpSession session = req.getSession(false);
String url = req.getRequestURI();
if (url.contains("login") || url.contains("logo") || url.contains("js/")) {
if (url.contains("login") || url.contains("logo") || url.contains("js/") || url.contains("version.jsp")) {
chain.doFilter(request, response);
} else if (session == null || session.getAttribute("authentication") == null
|| !((boolean) session.getAttribute("authentication"))) { //checking whether the session exists and if authentication succeed

View File

@ -120,7 +120,7 @@ public class DatasetManagement {
@Contract(pure = true)
@NotNull
private static String getFileName(@NotNull UUID uuid) {
return uuid + ".csv";
return System.getProperty("catalina.base") + "/" + uuid + ".csv";
}

View File

@ -11,8 +11,12 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
/**
* authenticates users.
@ -34,7 +38,11 @@ public class LoginServlet extends HttpServlet {
*/
@Override
protected void doPost(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response) throws ServletException, IOException {
String pw = Files.readString(Paths.get("password.txt"));
List<String> list = new ArrayList<>();
try (Stream<String> lines = Files.lines(Paths.get("password.txt"), StandardCharsets.UTF_8)) {
lines.forEach(list::add);
}
String pw = list.get(0);
String password = request.getParameter("password");
if (pw.equals(password)) {

View File

@ -5,4 +5,5 @@ Servlet version: <%= application.getMajorVersion() %>.<%= application.getMinorVe
JSP version: <%= JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() %><br>
Java version: <%= System.getProperty("java.version") %><br>
Weka version: <%= Version.VERSION %><br>
File root: <%= new File("").getAbsolutePath() %>
File root: <%= new File("").getAbsolutePath() %><br>
Catalina base : <%= System.getProperty("catalina.base") %>