diff --git a/Love_Live!_Logo.png b/Love_Live!_Logo.png new file mode 100644 index 0000000..4cd1d5c Binary files /dev/null and b/Love_Live!_Logo.png differ diff --git a/out/DIRECTORY_LISTING b/out/DIRECTORY_LISTING index 39cdff9..304094e 100644 --- a/out/DIRECTORY_LISTING +++ b/out/DIRECTORY_LISTING @@ -18,12 +18,12 @@
-

Directory Listing for /

📁.. (Previous Directory)
📁articles 2022-05-05T20:16:24.546334Z gitpod 190
-
🗎codeBackground 2022-05-05T20:16:24.478334Z gitpod 2635
-
🗎otherpage.html 2022-05-05T20:16:24.522334Z gitpod 8892
-
🗎reset.css 2022-05-05T20:16:24.486334Z gitpod 1093
-
🗎sig.css 2022-05-05T20:16:24.498334Z gitpod 4702
-
🗎testfile.html 2022-05-05T20:16:24.522334Z gitpod 829
+

Directory Listing for /

📁.. (Previous Directory)
📁articles 2022-05-06T16:14:07.054613Z gitpod 190
+
🗎codeBackground 2022-05-06T16:14:07.010613Z gitpod 2635
+
🗎otherpage.html 2022-05-06T16:14:07.038613Z gitpod 8892
+
🗎reset.css 2022-05-06T16:14:07.014613Z gitpod 1093
+
🗎sig.css 2022-05-06T16:14:07.022613Z gitpod 4702
+
🗎testfile.html 2022-05-06T16:14:07.038613Z gitpod 829
diff --git a/out/articles/DIRECTORY_LISTING b/out/articles/DIRECTORY_LISTING index eb3a98b..fd35661 100644 --- a/out/articles/DIRECTORY_LISTING +++ b/out/articles/DIRECTORY_LISTING @@ -18,11 +18,11 @@
-

Directory Listing for /articles/

📁.. (Previous Directory)
🗎curabitur vel tempus ex.article 2022-05-05T20:16:24.462334Z gitpod 579
-
🗎sigplace1.article 2022-05-05T20:16:24.470334Z gitpod 3807
-
📁test articles 2022-05-05T20:16:24.538334Z gitpod 147
-
🗎curabitur vel tempus ex.article.html 2022-05-05T20:16:24.530334Z gitpod 1296
-
🗎sigplace1.article.html 2022-05-05T20:16:24.530334Z gitpod 4524
+

Directory Listing for /articles/

📁.. (Previous Directory)
🗎curabitur vel tempus ex.article 2022-05-06T16:14:06.994613Z gitpod 579
+
🗎sigplace1.article 2022-05-06T16:14:06.998613Z gitpod 3807
+
📁test articles 2022-05-06T16:14:07.050613Z gitpod 147
+
🗎curabitur vel tempus ex.article.html 2022-05-06T16:14:07.042613Z gitpod 1296
+
🗎sigplace1.article.html 2022-05-06T16:14:07.046613Z gitpod 4524
diff --git a/out/articles/test articles/DIRECTORY_LISTING b/out/articles/test articles/DIRECTORY_LISTING index f93c4be..affdcad 100644 --- a/out/articles/test articles/DIRECTORY_LISTING +++ b/out/articles/test articles/DIRECTORY_LISTING @@ -18,12 +18,12 @@
-

Directory Listing for /articles/test articles/

📁.. (Previous Directory)
🗎test1.article 2022-05-05T20:16:24.470334Z gitpod 1068
-
🗎test2.article 2022-05-05T20:16:24.474334Z gitpod 764
-
🗎test3.article 2022-05-05T20:16:24.474334Z gitpod 977
-
🗎test1.article.html 2022-05-05T20:16:24.534334Z gitpod 1785
-
🗎test2.article.html 2022-05-05T20:16:24.538334Z gitpod 1481
-
🗎test3.article.html 2022-05-05T20:16:24.538334Z gitpod 1694
+

Directory Listing for /articles/test articles/

📁.. (Previous Directory)
🗎test1.article 2022-05-06T16:14:07.002613Z gitpod 1068
+
🗎test2.article 2022-05-06T16:14:07.002613Z gitpod 764
+
🗎test3.article 2022-05-06T16:14:07.002613Z gitpod 977
+
🗎test1.article.html 2022-05-06T16:14:07.046613Z gitpod 1785
+
🗎test2.article.html 2022-05-06T16:14:07.046613Z gitpod 1481
+
🗎test3.article.html 2022-05-06T16:14:07.050613Z gitpod 1694
diff --git a/out/codeBackground b/out/codeBackground index c02f732..b1ffc55 100644 --- a/out/codeBackground +++ b/out/codeBackground @@ -37,4 +37,4 @@ } } while (!(line=in.readLine()).isBlank()) { - //System.out.println(line); + System.out.println(line); diff --git a/sigPlace.class b/sigPlace.class new file mode 100644 index 0000000..b4ef93b Binary files /dev/null and b/sigPlace.class differ diff --git a/sigServer.class b/sigServer.class new file mode 100644 index 0000000..44647ea Binary files /dev/null and b/sigServer.class differ diff --git a/sigServer.java b/sigServer.java index bc2a2de..8398570 100644 --- a/sigServer.java +++ b/sigServer.java @@ -10,7 +10,13 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.nio.file.attribute.FileTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.TextStyle; import java.util.HashMap; +import java.util.Locale; import java.util.regex.Pattern; public class sigServer { @@ -55,7 +61,7 @@ public class sigServer { } } while (!(line=in.readLine()).isBlank()) { - //System.out.println(line); + System.out.println(line); } } } catch(SocketException|NullPointerException e) { @@ -68,9 +74,17 @@ public class sigServer { } private void CreateRawRequest(OutputStream stream, String statusCode, String statusMsg, String contentType, byte[] content) { + CreateRawRequest(stream, statusCode, statusMsg, contentType, content,null); + } + + private void CreateRawRequest(OutputStream stream, String statusCode, String statusMsg, String contentType, byte[] content, FileTime lastModified) { try { stream.write(("HTTP/1.1 "+statusCode+" "+statusMsg+"\r\n").getBytes()); stream.write(("ContentType: "+contentType+"\r\n").getBytes()); + if (lastModified!=null) { + ZonedDateTime date = lastModified.toInstant().atZone(ZoneId.of("GMT")); + stream.write(("Last-Modified: "+date.format(DateTimeFormatter.RFC_1123_DATE_TIME)+"\r\n").getBytes()); + } stream.write("\r\n".getBytes()); stream.write(content); } catch (IOException e) { @@ -89,7 +103,7 @@ public class sigServer { CreateRawRequest(clientOutput,statusCode,statusMsg,"text/html",Files.readAllBytes(Paths.get(sigPlace.OUTDIR,string,sigPlace.DIRECTORYLISTING_FILENAME))); clientOutput.write(("
Webpage generated in "+(System.currentTimeMillis()-startTime)+"ms
\r\n").getBytes()); } else { - CreateRawRequest(clientOutput,statusCode,statusMsg,Files.probeContentType(file),Files.readAllBytes(file)); + CreateRawRequest(clientOutput,statusCode,statusMsg,Files.probeContentType(file),Files.readAllBytes(file),Files.getLastModifiedTime(file)); String contentType = Files.probeContentType(file); if (contentType!=null&&contentType.equals("text/html")) { clientOutput.write(("
Webpage generated in "+(System.currentTimeMillis()-startTime)+"ms
\r\n").getBytes());