lines = new ArrayList<>();
+ String result = "";
+
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(path.toString()), "windows-1251"))) {
+/* try (BufferedReader reader = Files.newBufferedReader(path)) {*/
+ String line;
+ while ((line = reader.readLine()) != null) {
+ lines.add(line);
+ }
+ } catch (UnsupportedEncodingException e) {
+ result = "Unknown Encoding!";
+ } catch (IOException e) {
+ result = "Error open file!";
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ result = "Unknown exception!";
+ }
+ req.getSession().setAttribute("opened", result);
+ if (result.equals("")) {
+ req.setAttribute("lines", lines);
+ req.setAttribute("backPath", path.getParent().toString());
+ req.setAttribute("filename", path.getFileName());
+ req.getRequestDispatcher("/WEB-INF/jsp/viewFile.jsp").forward(req, resp);
+ } else {
+ resp.sendRedirect("/dir/view");
+ }
+ }
+}
diff --git a/src/main/webapp/WEB-INF/jsp/footer.jsp b/src/main/webapp/WEB-INF/jsp/footer.jsp
new file mode 100644
index 0000000..d583d9b
--- /dev/null
+++ b/src/main/webapp/WEB-INF/jsp/footer.jsp
@@ -0,0 +1,5 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/jsp/header.jsp b/src/main/webapp/WEB-INF/jsp/header.jsp
new file mode 100644
index 0000000..4192bd7
--- /dev/null
+++ b/src/main/webapp/WEB-INF/jsp/header.jsp
@@ -0,0 +1,5 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
diff --git a/src/main/webapp/WEB-INF/jsp/viewDirectory.jsp b/src/main/webapp/WEB-INF/jsp/viewDirectory.jsp
new file mode 100644
index 0000000..f725496
--- /dev/null
+++ b/src/main/webapp/WEB-INF/jsp/viewDirectory.jsp
@@ -0,0 +1,111 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+
+
+
+ Remote File Manager
+
+
+
+
+
+ <%--append file opened message--%>
+
+ ${sessionScope.opened}
+ ${sessionScope.opened = ""}
+
+
+ <%--append file deleted message--%>
+
+ ${sessionScope.deleted}
+ ${sessionScope.deleted = ""}
+
+
+ <%--append file created message--%>
+
+ ${sessionScope.created}
+ ${sessionScope.created = ""}
+
+
+
+ <%--"back" link--%>
+
+
+ |
+
+ |
+
+
+
+ <%--append "New File" menu--%>
+
+ |
+
+ |
+
+
+ <%--append current path--%>
+
+ |
+
+ ${sessionScope.path}
+
+ |
+
+
+ <%--append current path--%>
+
+
+ |
+
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+
+
+
diff --git a/src/main/webapp/WEB-INF/jsp/viewFile.jsp b/src/main/webapp/WEB-INF/jsp/viewFile.jsp
new file mode 100644
index 0000000..b2fcf9b
--- /dev/null
+++ b/src/main/webapp/WEB-INF/jsp/viewFile.jsp
@@ -0,0 +1,28 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+
+ File View
+
+
+
+
+ <%--"back" link--%>
+
+
+
+
+ File: ${requestScope.filename}
+
+
+ Contents:
+
+ ${line}
+
+
+
+
+
diff --git a/web/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
similarity index 100%
rename from web/WEB-INF/web.xml
rename to src/main/webapp/WEB-INF/web.xml
diff --git a/src/main/webapp/css/styles.css b/src/main/webapp/css/styles.css
new file mode 100644
index 0000000..2333a3f
--- /dev/null
+++ b/src/main/webapp/css/styles.css
@@ -0,0 +1,62 @@
+table, tr, td {
+ background-color: #BCD2EE;
+ width: 800px;
+ margin: auto;
+}
+
+input[type=submit] {
+ background: none;
+ padding: 0;
+ border: none;
+ color: #0000FF;
+ font: 100% Arial;
+ cursor: pointer;
+}
+input[type=submit]:hover {
+ color: #D02090;
+}
+input[type=submit].dir {
+ color: #B03060;
+ font-weight: bold;
+}
+
+.row {
+ background-color: white;
+ padding: 5px;
+ border: solid 1px black;
+ height: 15px;
+}
+.menu {
+ background: #EED5B7;
+ padding: 5px 20px 5px 5px;
+ border: solid 1px black;
+}
+.path{
+ background: #BCD2EE;
+}
+
+.message {
+ background-color: lightgoldenrodyellow;
+ color: green;
+ text-align: center;
+ padding: 2px 5px;
+ border: solid 1px green;
+ margin: 0 auto;
+}
+
+section {
+ background-color: #e3e3e3;
+ padding: 5px 20px;
+ border: solid 1px cornflowerblue;
+}
+
+.copy {
+ color: gray;
+ font-style: italic;
+ font-size: small;
+ text-align: center;
+}
+
+header {
+ text-align: center;
+}
\ No newline at end of file
diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp
new file mode 100644
index 0000000..bde806e
--- /dev/null
+++ b/src/main/webapp/index.jsp
@@ -0,0 +1,9 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
+ Remote File Manager
+
+
+
+
+