diff --git a/src/main/java/de/hsel/spm/baudas/web/UploadServlet.java b/src/main/java/de/hsel/spm/baudas/web/UploadServlet.java index 3f09c45..dacf593 100644 --- a/src/main/java/de/hsel/spm/baudas/web/UploadServlet.java +++ b/src/main/java/de/hsel/spm/baudas/web/UploadServlet.java @@ -60,6 +60,7 @@ public class UploadServlet extends HttpServlet { protected void doPost(@NotNull HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding(StandardCharsets.UTF_8.name()); + Part filePart = req.getPart("file"); if (filePart == null) { @@ -113,7 +114,7 @@ public class UploadServlet extends HttpServlet { */ private void error(@NotNull HttpServletResponse response, @NotNull ErrorCode code) { try { - response.sendRedirect("error.jsp?code=" + code); + response.getWriter().write(code.getMessage()); } catch (IOException e) { BauDas.getLogger().throwing(this.getClass().getName(), this.getClass().getEnclosingMethod().getName(), e); } diff --git a/src/main/webapp/error.jsp b/src/main/webapp/error.jsp deleted file mode 100644 index a137dce..0000000 --- a/src/main/webapp/error.jsp +++ /dev/null @@ -1,32 +0,0 @@ -<%@ page import="de.hsel.spm.baudas.web.ErrorCode" %> -<%@ page import="java.nio.charset.StandardCharsets" %> -<%@ page import="java.util.List" %> -<%@ page import="java.util.Arrays" %> -<%@ page import="java.util.ArrayList" %> -<%@ page contentType="text/html;charset=UTF-8" %> -<%@include file="emptyHeader.jsp"%> -<% response.setCharacterEncoding(StandardCharsets.UTF_8.name()); %> -<% request.setCharacterEncoding(StandardCharsets.UTF_8.name()); %> - -<% - String code = request.getParameter("code"); - - if(code != null && ErrorCode.exists(code)){ - ErrorCode errorCode = ErrorCode.valueOf(code); -%> - -