You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by en...@apache.org on 2018/07/10 19:57:28 UTC

[sling-org-apache-sling-starter-startup] branch master updated: SLING-7764 The starting up page content should be customizable

This is an automated email from the ASF dual-hosted git repository.

enorman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-starter-startup.git


The following commit(s) were added to refs/heads/master by this push:
     new 389e0cb  SLING-7764 The starting up page content should be customizable
389e0cb is described below

commit 389e0cbb58f33346f97bf730ae795269abf64d03
Author: Eric Norman <en...@apache.org>
AuthorDate: Tue Jul 10 12:42:56 2018 -0700

    SLING-7764 The starting up page content should be customizable
    
    To provide a custom page you may install a fragment bundle to this host
    bundle that contains a custom_index.html file in the root of the bundle.
---
 README.md                                                          | 2 ++
 .../java/org/apache/sling/starter/startup/impl/StartupFilter.java  | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 62213a9..d3a64f8 100644
--- a/README.md
+++ b/README.md
@@ -6,4 +6,6 @@
 
 Provides a module providing a nicer user experience during startup of the Sling Starter application.
 
+The content of the starting page may be customized for the purposes of branding or providing more specific site specific information.  To provide a custom page you may install a fragment bundle to this host bundle that contains a custom_index.html file in the root of the bundle.
+
 This module is part of the [Apache Sling](https://sling.apache.org) project.
diff --git a/src/main/java/org/apache/sling/starter/startup/impl/StartupFilter.java b/src/main/java/org/apache/sling/starter/startup/impl/StartupFilter.java
index ce3f6f3..d3de5fa 100644
--- a/src/main/java/org/apache/sling/starter/startup/impl/StartupFilter.java
+++ b/src/main/java/org/apache/sling/starter/startup/impl/StartupFilter.java
@@ -41,7 +41,12 @@ public class StartupFilter implements Filter {
     private String content;
 
     StartupFilter() {
-        InputStream is = StartupFilter.class.getClassLoader().getResourceAsStream("index.html");
+        // try a custom page (provided by a fragment bundle) first.
+    	InputStream is = StartupFilter.class.getClassLoader().getResourceAsStream("custom_index.html");
+        if (is == null) {
+            // try the standard page
+            is = StartupFilter.class.getClassLoader().getResourceAsStream("index.html");
+        }
         if (is != null) {
             BufferedReader buffer = null;
             try {