You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sv...@apache.org on 2005/08/17 15:01:42 UTC

svn commit: r233169 - /myfaces/tomahawk/trunk/src/java/org/apache/myfaces/component/html/util/AddResource.java

Author: svieujot
Date: Wed Aug 17 06:01:39 2005
New Revision: 233169

URL: http://svn.apache.org/viewcvs?rev=233169&view=rev
Log:
MYFACES-416, Thanks to Peter Mahoney who doesn't write <head> in his html ;-).

Modified:
    myfaces/tomahawk/trunk/src/java/org/apache/myfaces/component/html/util/AddResource.java

Modified: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/component/html/util/AddResource.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/component/html/util/AddResource.java?rev=233169&r1=233168&r2=233169&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/component/html/util/AddResource.java (original)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/component/html/util/AddResource.java Wed Aug 17 06:01:39 2005
@@ -287,6 +287,13 @@
         return request.getAttribute(ADDITIONAL_HEADER_INFO_REQUEST_ATTRUBITE_NAME) != null;
     }
 
+    /**
+     * Add the resources to the &lt;head&gt; of the page.
+     * If the head tag is missing, but the &lt;body&gt; tag is present, the head tag is added.
+     * If both are missing, no resources is added.
+     * 
+     * TODO : Change the ordering so that the user header CSS & JS override MyFaces' ones.
+     */
     static public void writeWithFullHeader(HttpServletRequest request,
             ExtensionsResponseWrapper responseWrapper,
             HttpServletResponse response) throws IOException{
@@ -345,7 +352,7 @@
         if(insertPosition>=0 && addHeaderTags)
             writer.write("</head>");
 
-        writer.write( originalResponse.substring(insertPosition) );
+        writer.write( insertPosition > 0 ? originalResponse.substring(insertPosition) : originalResponse );
     }
 
     private static class AdditionalHeaderInfoToRender{