myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1569988 - /myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java
Date Wed, 19 Feb 2014 23:51:55 GMT
Author: lu4242
Date: Wed Feb 19 23:51:55 2014
New Revision: 1569988

URL: http://svn.apache.org/r1569988
Log:
MYFACES-3847 HtmlStylesheetRenderer doesn't ignore additional link parameters when checking
for the resource

Modified:
    myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java

Modified: myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java?rev=1569988&r1=1569987&r2=1569988&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java
(original)
+++ myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlStylesheetRenderer.java
Wed Feb 19 23:51:55 2014
@@ -189,6 +189,14 @@ public class HtmlStylesheetRenderer exte
             return;
         }
         
+        String additionalQueryParams = null;
+        int index = resourceName.indexOf('?');
+        if (index >= 0)
+        {
+            additionalQueryParams = resourceName.substring(index + 1);
+            resourceName = resourceName.substring(0, index);
+        }
+        
         Resource resource;
         if (libraryName == null)
         {
@@ -240,8 +248,13 @@ public class HtmlStylesheetRenderer exte
             writer.writeAttribute(HTML.TYPE_ATTR, 
                     (resource.getContentType() == null ? HTML.STYLE_TYPE_TEXT_CSS
                             : resource.getContentType()) , null);
+            String path = resource.getRequestPath();
+            if (additionalQueryParams != null)
+            {
+                path = path + ((path.indexOf('?') >= 0) ? "&" : "?") + additionalQueryParams;
+            }
             writer.writeURIAttribute(HTML.HREF_ATTR,
-                    facesContext.getExternalContext().encodeResourceURL(resource.getRequestPath()),
null);
+                    facesContext.getExternalContext().encodeResourceURL(path), null);
             writer.endElement(HTML.LINK_ELEM);
         }
     }



Mime
View raw message