esoe 1 year ago
parent
commit
c5392ea2a5
  1. 36
      pom.xml
  2. 32
      src/main/java/ru/molokoin/storage/api/RestStorageService.java
  3. 5
      src/main/java/ru/molokoin/storage/beans/HardDrive.java
  4. 11
      src/main/webapp/WEB-INF/web.xml
  5. 62
      src/main/webapp/index.jsp
  6. 38
      src/main/webapp/layout/styles.css
  7. BIN
      target/classes/ru/molokoin/storage/api/RestStorageService.class
  8. BIN
      target/classes/ru/molokoin/storage/beans/HardDrive.class
  9. BIN
      target/storage.war
  10. BIN
      target/storage/WEB-INF/classes/ru/molokoin/storage/api/RestStorageService.class
  11. BIN
      target/storage/WEB-INF/classes/ru/molokoin/storage/beans/HardDrive.class
  12. BIN
      target/storage/WEB-INF/lib/jakarta.el-api-5.0.0.jar
  13. BIN
      target/storage/WEB-INF/lib/jakarta.servlet.jsp.jstl-3.0.1.jar
  14. BIN
      target/storage/WEB-INF/lib/jakarta.servlet.jsp.jstl-api-3.0.0.jar
  15. 11
      target/storage/WEB-INF/web.xml
  16. 62
      target/storage/index.jsp
  17. 38
      target/storage/layout/styles.css

36
pom.xml

@ -20,6 +20,42 @@ @@ -20,6 +20,42 @@
</properties>
<dependencies>
<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>3.0.0</version>
<!-- <scope>provided</scope> -->
</dependency>
<!-- <dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>10.0.0</version>
<scope>provided</scope>
</dependency> -->
<!-- <dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>3.0.1</version>
</dependency> -->
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
<version>3.0.1</version>
</dependency>
<!-- <dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-impl</artifactId>
<version>1.2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-spec</artifactId>
<version>1.2.5</version>
<scope>provided</scope>
</dependency> -->
<dependency>
<groupId>jakarta.ejb</groupId>
<artifactId>jakarta.ejb-api</artifactId>

32
src/main/java/ru/molokoin/storage/api/RestStorageService.java

@ -60,7 +60,7 @@ public class RestStorageService { @@ -60,7 +60,7 @@ public class RestStorageService {
System.out.println("Передача данных о контенте из файловой системы ...");
Collection<ContentEntity> cce = new ArrayList<>();
try {
Set<String> list = HardDrive.listFiles(HardDrive.getRoot());
Set<String> list = HardDrive.listFiles();
int i = 1;
for (String path : list) {
ContentEntity ce = new ContentEntity();
@ -85,7 +85,7 @@ public class RestStorageService { @@ -85,7 +85,7 @@ public class RestStorageService {
Collection<ContentEntity> cce = new ArrayList<>();
ContentEntity ce = new ContentEntity();
try {
Set<String> list = HardDrive.listFiles(HardDrive.getRoot());
Set<String> list = HardDrive.listFiles();
int i = 1;
for (String path : list) {
if (id == i) {
@ -103,34 +103,6 @@ public class RestStorageService { @@ -103,34 +103,6 @@ public class RestStorageService {
return ce;
}
// @GET
// @Path("{id}")
// @Produces(MediaType.APPLICATION_OCTET_STREAM)
// //@Produces(MediaType.MULTIPART_FORM_DATA)
// public Response getContent(@PathParam("id") Integer id, @Context HttpServletResponse response){
// System.out.println("Передача байткода по id файла ...");
// return storage.findContentById(id);
// }
// @GET
// @Path("{id}")
// @Produces(MediaType.APPLICATION_OCTET_STREAM)
// public File getFile(@PathParam("id") Integer id, @Context HttpServletResponse response) {
// ContentEntity ce = getInfoById(1, response);
// File file = new File(ce.getLocation()); // Initialize this to the File path you want to serve.
// // return Response.ok(file, MediaType.APPLICATION_OCTET_STREAM)
// // .header("Content-Disposition", "attachment; filename=\"" + file.getName() + "\"" ) //optional
// // .build();
// return file;
// }
/**
* Получение файла (*.pdf) на просмотр по id
* !!! добавить возможность открытия файлов других типов

5
src/main/java/ru/molokoin/storage/beans/HardDrive.java

@ -31,7 +31,8 @@ public class HardDrive { @@ -31,7 +31,8 @@ public class HardDrive {
* @return
* @throws IOException
*/
public static Set<String> listFiles(String path) throws IOException{
public static Set<String> listFiles() throws IOException{
String path = root;
Stream<Path> stream = Files.list(Paths.get(path));
Set<String> list = stream
.filter(file -> !Files.isDirectory(file))
@ -62,7 +63,7 @@ public class HardDrive { @@ -62,7 +63,7 @@ public class HardDrive {
public static Path getFileById(int id) throws IOException{
Path path = null;
Set<String> set = listFiles(root);
Set<String> set = listFiles();
int i = 0;
for (String s : set) {
i++;

11
src/main/webapp/WEB-INF/web.xml

@ -1,7 +1,10 @@ @@ -1,7 +1,10 @@
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
version="5.0">
<web-app>
<display-name>Archetype Created Web Application</display-name>
</web-app>

62
src/main/webapp/index.jsp

@ -1,5 +1,65 @@ @@ -1,5 +1,65 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@page import="java.util.Set"%>
<jsp:useBean id="hd" class="ru.molokoin.storage.beans.HardDrive" scope="page" />
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>storage</title>
<link href="layout/styles.css" rel="stylesheet">
</head>
<body>
<h2>Hello World!</h2>
<header>
<h2>STORAGE:FACE</h2>
</header>
<aside>
<!-- <p><c:out value="${2+2}" /></p> -->
</aside>
<main>
<div>
<div class="guide container" >
<h1>LIST of FILES:</h1>
<!-- <c:forEach items="${hd.listFiles()}" var="file">
<p>
<c:out value="${file}"/>
</p>
</c:forEach>
<br> -->
<c:import url="http://www.molokoin.ru:8080/storage/api/content" var="xmlFile"></c:import>
<x:parse xml="${xmlFile}" var="xmlData"></x:parse>
<x:forEach select="$xmlData/collection/storage">
<x:out select="id"/>
<x:out select="filename"/>
<x:out select="location"/>
<br/>
</x:forEach>
<!-- <x:out select="$xmlData/collection/storage[7]/filename"/> -->
</div>
<div class="conteiner">
<iframe
src="http://www.molokoin.ru:8080/storage/api/content/7"
name="name"
scrolling="yes"
frameborder="0"
id="Iframe"
>
</iframe>
</div>
</div>
<!-- sandbox="allow-same-origin" -->
<!-- allowTransparency="false" -->
<!-- allow="fullscreen" -->
</main>
<footer></footer>
</body>
</html>

38
src/main/webapp/layout/styles.css

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
body {
background-color: #abe;
padding: 0;
margin: 0;
}
header {
display: block;
width: 100%;
/* height: 50px; */
}
main {
background-color: black;
}
.container {
background-color: blueviolet;
position: relative;
/* overflow: hidden; */
width: 100%;
/* height: 100%; */
/* padding-top: 56.25%; //16:9 Aspect Ratio */
}
.guide {
display: block;
width: 100%;
/* height: 100%; */
background-color: rgb(63, 106, 236);
}
iframe {
/* position: relative; */
top: 0;
left: 0;
bottom: 0;
right: 0;
width: 100%;
height: 100%;
}

BIN
target/classes/ru/molokoin/storage/api/RestStorageService.class

Binary file not shown.

BIN
target/classes/ru/molokoin/storage/beans/HardDrive.class

Binary file not shown.

BIN
target/storage.war

Binary file not shown.

BIN
target/storage/WEB-INF/classes/ru/molokoin/storage/api/RestStorageService.class

Binary file not shown.

BIN
target/storage/WEB-INF/classes/ru/molokoin/storage/beans/HardDrive.class

Binary file not shown.

BIN
target/storage/WEB-INF/lib/jakarta.el-api-5.0.0.jar

Binary file not shown.

BIN
target/storage/WEB-INF/lib/jakarta.servlet.jsp.jstl-3.0.1.jar

Binary file not shown.

BIN
target/storage/WEB-INF/lib/jakarta.servlet.jsp.jstl-api-3.0.0.jar

Binary file not shown.

11
target/storage/WEB-INF/web.xml

@ -1,7 +1,10 @@ @@ -1,7 +1,10 @@
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
version="5.0">
<web-app>
<display-name>Archetype Created Web Application</display-name>
</web-app>

62
target/storage/index.jsp

@ -1,5 +1,65 @@ @@ -1,5 +1,65 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@page import="java.util.Set"%>
<jsp:useBean id="hd" class="ru.molokoin.storage.beans.HardDrive" scope="page" />
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>storage</title>
<link href="layout/styles.css" rel="stylesheet">
</head>
<body>
<h2>Hello World!</h2>
<header>
<h2>STORAGE:FACE</h2>
</header>
<aside>
<!-- <p><c:out value="${2+2}" /></p> -->
</aside>
<main>
<div>
<div class="guide container" >
<h1>LIST of FILES:</h1>
<!-- <c:forEach items="${hd.listFiles()}" var="file">
<p>
<c:out value="${file}"/>
</p>
</c:forEach>
<br> -->
<c:import url="http://www.molokoin.ru:8080/storage/api/content" var="xmlFile"></c:import>
<x:parse xml="${xmlFile}" var="xmlData"></x:parse>
<x:forEach select="$xmlData/collection/storage">
<x:out select="id"/>
<x:out select="filename"/>
<x:out select="location"/>
<br/>
</x:forEach>
<!-- <x:out select="$xmlData/collection/storage[7]/filename"/> -->
</div>
<div class="conteiner">
<iframe
src="http://www.molokoin.ru:8080/storage/api/content/7"
name="name"
scrolling="yes"
frameborder="0"
id="Iframe"
>
</iframe>
</div>
</div>
<!-- sandbox="allow-same-origin" -->
<!-- allowTransparency="false" -->
<!-- allow="fullscreen" -->
</main>
<footer></footer>
</body>
</html>

38
target/storage/layout/styles.css

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
body {
background-color: #abe;
padding: 0;
margin: 0;
}
header {
display: block;
width: 100%;
/* height: 50px; */
}
main {
background-color: black;
}
.container {
background-color: blueviolet;
position: relative;
/* overflow: hidden; */
width: 100%;
/* height: 100%; */
/* padding-top: 56.25%; //16:9 Aspect Ratio */
}
.guide {
display: block;
width: 100%;
/* height: 100%; */
background-color: rgb(63, 106, 236);
}
iframe {
/* position: relative; */
top: 0;
left: 0;
bottom: 0;
right: 0;
width: 100%;
height: 100%;
}
Loading…
Cancel
Save