EXTCDI-285 add intermediate page branding

and improve javadoc


git-svn-id: https://svn.apache.org/repos/asf/myfaces/extensions/cdi/trunk@1338266 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/jsf/api/config/ClientConfig.java b/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/jsf/api/config/ClientConfig.java
index bd7e781..7ea1285 100644
--- a/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/jsf/api/config/ClientConfig.java
+++ b/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/jsf/api/config/ClientConfig.java
@@ -42,6 +42,7 @@
 public class ClientConfig implements Serializable
 {
     private static final long serialVersionUID = 581351549574404793L;
+    public static final String BODY_ATTRIBUTES_PLACEHOLDER = "$$bodyAttributes$$";
 
     private boolean javaScriptEnabled = true;
 
@@ -76,9 +77,18 @@
     }
 
     /**
-     * For branding the windowhandler page - e.g. change the backgroundcolour
+     * For branding the whole windowhandler page - e.g. not only change the
+     * background color, add some images and empty menu structure
      * or the language of the message text - you can just copy the content of the
      * {@link #DEFAULT_WINDOW_HANDLER_HTML_FILE} and adopt it to your needs.
+     *
+     * The reason for this is to minimize visual side effects on browsers who do
+     * not properly support html5 localstorage.
+     *
+     * If you just like to change the default background color, then use
+     * {@link #getBodyAttributes()} instead. This will replace the
+     * {@link #BODY_ATTRIBUTES_PLACEHOLDER} on the windowhandler.html page.
+     *
      * @return the location of the <i>windowhandler.html</i> resource
      *         which should be sent to the users browser.
      */
@@ -88,6 +98,17 @@
     }
 
     /**
+     * Overwrite this method to set custom specific body attributes on the
+     * intermediate windowhandler.html page.
+     *
+     * @return
+     */
+    public String getBodyAttributes()
+    {
+        return "";
+    }
+
+    /**
      * This might return different windowhandlers based on user settings like
      * his language, an affiliation, etc
      * @return a String containing the whole windowhandler.html file.
@@ -119,6 +140,7 @@
         }
 
         windowHandlerHtml = sb.toString();
+
         return windowHandlerHtml;
     }
 
diff --git a/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/ClientSideWindowHandler.java b/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/ClientSideWindowHandler.java
index 76fc935..e949832 100644
--- a/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/ClientSideWindowHandler.java
+++ b/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/ClientSideWindowHandler.java
@@ -170,6 +170,10 @@
 
             String windowHandlerHtml = this.clientConfig.getWindowHandlerHtml();
 
+            // replace any background color or other body attribute setting
+            windowHandlerHtml = windowHandlerHtml.replace(ClientConfig.BODY_ATTRIBUTES_PLACEHOLDER,
+                                                          clientConfig.getBodyAttributes());
+
             if (windowId == null)
             {
                 windowId = UNINITIALIZED_WINDOW_ID_VALUE;
diff --git a/jee-modules/jsf-module/impl/src/main/resources/static/windowhandler.html b/jee-modules/jsf-module/impl/src/main/resources/static/windowhandler.html
index d7f0d8a..e9f6c6f 100644
--- a/jee-modules/jsf-module/impl/src/main/resources/static/windowhandler.html
+++ b/jee-modules/jsf-module/impl/src/main/resources/static/windowhandler.html
@@ -22,7 +22,7 @@
 <html>
 
 <head><title>Loading...</title></head>
-<body><div id="message" style="position:absolute;left:40%;top:40%">
+<body $$bodyAttributes$$><div id="message" style="position:absolute;left:40%;top:40%">
     Your browser does not support JavaScript.
     Click <a href="$$noscriptUrl$$">here</a> to continue without JavaScript.
 </div></body>