Skip to content

Commit

Permalink
added rogerwlucas patch for static files - mitro-co/mitro#128 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
tpizah committed Aug 17, 2015
1 parent bafea46 commit 1151c18
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
5 changes: 3 additions & 2 deletions centos/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ RUN mkdir -p /mitrocore_secrets/sign_keyczar
WORKDIR /srv/mitro
RUN git clone https://github.com/mitro-co/mitro.git /srv/mitro

# apply browser-ext patch
# apply browser-ext patch and static files patch
COPY ./lru_patch.diff /srv/mitro/
COPY ./static_files.diff /srv/mitro/
RUN git apply lru_patch.diff
RUN git apply static_files.diff

WORKDIR /srv/mitro/mitro-core
RUN ./build.sh

COPY ./docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
Expand Down
30 changes: 30 additions & 0 deletions centos/static_files.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/mitro-core/java/server/src/co/mitro/core/server/Main.java b/mitro-core/java/server/src/co/mitro/core/server/Main.java
index 7ff7b94..2abd624 100644
--- a/mitro-core/java/server/src/co/mitro/core/server/Main.java
+++ b/mitro-core/java/server/src/co/mitro/core/server/Main.java
@@ -50,6 +50,7 @@ import org.eclipse.jetty.server.Slf4jRequestLog;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.server.handler.RequestLogHandler;
+import org.eclipse.jetty.server.handler.ResourceHandler;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.component.LifeCycle;
@@ -394,9 +395,15 @@ public class Main {
requestLog.setLogTimeZone("UTC");
requestLogHandler.setRequestLog(requestLog);

- // Install both the servlet handler and the logging handler
+ // Handle static file requests
+ ResourceHandler staticFiles = new ResourceHandler();
+ staticFiles.setDirectoriesListed(true);
+ staticFiles.setWelcomeFiles(new String[]{"index.html"});
+ staticFiles.setResourceBase("html");
+
+ // Install the servlet handler, logging handler and static file support
HandlerCollection handlers = new HandlerCollection();
- handlers.setHandlers(new Handler[]{context, requestLogHandler});
+ handlers.setHandlers(new Handler[]{context, requestLogHandler, staticFiles});

OldJsonData ojd = OldJsonData.createFromStream(
Main.class.getResourceAsStream("service_list.json"));
10 changes: 10 additions & 0 deletions centos/templates/verified.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<HTML>
<HEAD>
<TITLE>Password verified</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<HR>
<P><CENTER>Thank you, your password has been verified.</CENTER>
<HR>
</BODY>
</HTML>

0 comments on commit 1151c18

Please sign in to comment.