[
https://issues.jboss.org/browse/RF-11974?page=com.atlassian.jira.plugin.s...
]
Lukáš Fryč updated RF-11974:
----------------------------
Summary: Resource packaging does not work on MyFaces (was: Optimizing Resource
Loading with RichFaces 4.2 doesn't work as expected)
Description:
Was: Optimizing Resource Loading with RichFaces 4.2 doesn't work as expected
If i use resource loading optimizing, the packed js resources are included multiple times,
which is not the expected behaviour.
Here is a simple usecase:
{code:title=simplepage.xhtml}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
<h:head>
<title>JSF Test</title>
</h:head>
<h:body>
<h:form id="testForm">
<rich:panel id="mypanel">
<f:facet name="header">
Header
</f:facet>
Content
</rich:panel>
</h:form>
</h:body>
</html>
{code}
{code:title=web.xml}
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<description>jsftest web.xml</description>
<!-- myfaces config:
http://myfaces.apache.org/core20/myfaces-impl/webconfig.html
-->
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
<param-value>5</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
<param-value>2</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.resourceOptimization.enabled</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.resourceOptimization.compressionStages</param-name>
<param-value>All</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.resourceOptimization.packagingStages</param-name>
<param-value>All</param-value>
</context-param>
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.richfaces.webapp.ResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/org.richfaces.resources/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<distributable/>
</web-app>
{code}
{code:title=source code of generated html}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html
xmlns="http://www.w3.org/1999/xhtml"><head>
<title>JSF Test</title><link rel="stylesheet"
media="screen" type="text/css"
href="/jsftest/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.2.0.CR1/PackedCompressed/DEFAULT/skinning.css"
/><script type="text/javascript"
src="/jsftest/javax.faces.resource/jsf.js.jsf?ln=javax.faces"><!--
//--></script><script type="text/javascript"
src="/jsftest/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.2.0.CR1/PackedCompressed/packed/packed.js"><!--
//--></script><script type="text/javascript"
src="/jsftest/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.2.0.CR1/PackedCompressed/packed/packed.js"><!--
//--></script><script type="text/javascript"
src="/jsftest/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.2.0.CR1/PackedCompressed/packed/packed.js"><!--
//--></script><link rel="stylesheet" media="screen"
type="text/css"
href="/jsftest/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.2.0.CR1/PackedCompressed/DEFAULT/packed/packed.css"
/></head><body><form id="testForm" name="testForm"
method="post" action="/jsftest/tabtest.jsf"
enctype="application/x-www-form-urlencoded"><div class="rf-p "
id="testForm:mypanel"><div class="rf-p-hdr "
id="testForm:mypanel_header">
Header
</div><div class="rf-p-b " id="testForm:mypanel_body">
Content
</div></div><input type="hidden"
name="testForm_SUBMIT" value="1" /><input
type="hidden" name="javax.faces.ViewState"
id="javax.faces.ViewState"
value="BCdgrBds6dPVxGA5g7QTvuYJ8/PuaJifnYvMIUGHf2r4d6JJFsGNbgoWnR9/JiyT861SIhrba11L0hX4aFlyD1oAXywRv4cQTCaw23T3TN9cuUSgI1VQAx0bW+JUNFXw7+HsPg=="
/></form></body>
</html>
{code}
was:
If i use resource loading optimizing, the packed js resources are included multiple times,
which is not the expected behaviour.
Here is a simple usecase:
{code:title=simplepage.xhtml}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
<h:head>
<title>JSF Test</title>
</h:head>
<h:body>
<h:form id="testForm">
<rich:panel id="mypanel">
<f:facet name="header">
Header
</f:facet>
Content
</rich:panel>
</h:form>
</h:body>
</html>
{code}
{code:title=web.xml}
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<description>jsftest web.xml</description>
<!-- myfaces config:
http://myfaces.apache.org/core20/myfaces-impl/webconfig.html
-->
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
<param-value>5</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
<param-value>2</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.resourceOptimization.enabled</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.resourceOptimization.compressionStages</param-name>
<param-value>All</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.resourceOptimization.packagingStages</param-name>
<param-value>All</param-value>
</context-param>
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.richfaces.webapp.ResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/org.richfaces.resources/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<distributable/>
</web-app>
{code}
{code:title=source code of generated html}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html
xmlns="http://www.w3.org/1999/xhtml"><head>
<title>JSF Test</title><link rel="stylesheet"
media="screen" type="text/css"
href="/jsftest/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.2.0.CR1/PackedCompressed/DEFAULT/skinning.css"
/><script type="text/javascript"
src="/jsftest/javax.faces.resource/jsf.js.jsf?ln=javax.faces"><!--
//--></script><script type="text/javascript"
src="/jsftest/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.2.0.CR1/PackedCompressed/packed/packed.js"><!--
//--></script><script type="text/javascript"
src="/jsftest/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.2.0.CR1/PackedCompressed/packed/packed.js"><!--
//--></script><script type="text/javascript"
src="/jsftest/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.2.0.CR1/PackedCompressed/packed/packed.js"><!--
//--></script><link rel="stylesheet" media="screen"
type="text/css"
href="/jsftest/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.2.0.CR1/PackedCompressed/DEFAULT/packed/packed.css"
/></head><body><form id="testForm" name="testForm"
method="post" action="/jsftest/tabtest.jsf"
enctype="application/x-www-form-urlencoded"><div class="rf-p "
id="testForm:mypanel"><div class="rf-p-hdr "
id="testForm:mypanel_header">
Header
</div><div class="rf-p-b " id="testForm:mypanel_body">
Content
</div></div><input type="hidden"
name="testForm_SUBMIT" value="1" /><input
type="hidden" name="javax.faces.ViewState"
id="javax.faces.ViewState"
value="BCdgrBds6dPVxGA5g7QTvuYJ8/PuaJifnYvMIUGHf2r4d6JJFsGNbgoWnR9/JiyT861SIhrba11L0hX4aFlyD1oAXywRv4cQTCaw23T3TN9cuUSgI1VQAx0bW+JUNFXw7+HsPg=="
/></form></body>
</html>
{code}
> Resource packaging does not work on MyFaces
> -------------------------------------------
>
> Key: RF-11974
> URL:
https://issues.jboss.org/browse/RF-11974
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 4.2.0.CR1
> Environment: richfaces-4.2.0.CR1, myfaces-2.1.6, firefox 10
> Reporter: Rene O
> Assignee: Lukáš Fryč
> Labels: myfaces
>
> Was: Optimizing Resource Loading with RichFaces 4.2 doesn't work as expected
> If i use resource loading optimizing, the packed js resources are included multiple
times, which is not the expected behaviour.
> Here is a simple usecase:
> {code:title=simplepage.xhtml}
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html
xmlns="http://www.w3.org/1999/xhtml"
>
xmlns:h="http://java.sun.com/jsf/html"
>
xmlns:f="http://java.sun.com/jsf/core"
>
xmlns:ui="http://java.sun.com/jsf/facelets"
>
xmlns:a4j="http://richfaces.org/a4j"
>
xmlns:rich="http://richfaces.org/rich"
>
> <h:head>
> <title>JSF Test</title>
> </h:head>
> <h:body>
> <h:form id="testForm">
> <rich:panel id="mypanel">
> <f:facet name="header">
> Header
> </f:facet>
> Content
> </rich:panel>
> </h:form>
> </h:body>
> </html>
> {code}
> {code:title=web.xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
> <description>jsftest web.xml</description>
>
> <!-- myfaces config:
http://myfaces.apache.org/core20/myfaces-impl/webconfig.html -->
>
> <context-param>
> <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
> <param-value>true</param-value>
> </context-param>
>
> <context-param>
> <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
> <param-value>server</param-value>
> </context-param>
>
> <context-param>
>
<param-name>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</param-name>
> <param-value>true</param-value>
> </context-param>
>
> <context-param>
>
<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
> <param-value>true</param-value>
> </context-param>
>
> <context-param>
>
<param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
> <param-value>5</param-value>
> </context-param>
>
>
> <context-param>
> <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
> <param-value>2</param-value>
> </context-param>
>
> <context-param>
> <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
> <param-value>true</param-value>
> </context-param>
>
> <context-param>
> <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
> <param-value>.xhtml</param-value>
> </context-param>
>
> <context-param>
> <param-name>org.richfaces.resourceOptimization.enabled</param-name>
> <param-value>true</param-value>
> </context-param>
>
> <context-param>
>
<param-name>org.richfaces.resourceOptimization.compressionStages</param-name>
> <param-value>All</param-value>
> </context-param>
>
> <context-param>
>
<param-name>org.richfaces.resourceOptimization.packagingStages</param-name>
> <param-value>All</param-value>
> </context-param>
>
> <servlet>
> <servlet-name>Resource Servlet</servlet-name>
> <servlet-class>org.richfaces.webapp.ResourceServlet</servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>Resource Servlet</servlet-name>
> <url-pattern>/org.richfaces.resources/*</url-pattern>
> </servlet-mapping>
> <servlet>
> <servlet-name>FacesServlet</servlet-name>
> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>FacesServlet</servlet-name>
> <url-pattern>*.jsf</url-pattern>
> </servlet-mapping>
>
> <session-config>
> <session-timeout>30</session-timeout>
> </session-config>
>
> <distributable/>
> </web-app>
> {code}
> {code:title=source code of generated html}
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
> <html
xmlns="http://www.w3.org/1999/xhtml"><head>
> <title>JSF Test</title><link rel="stylesheet"
media="screen" type="text/css"
href="/jsftest/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.2.0.CR1/PackedCompressed/DEFAULT/skinning.css"
/><script type="text/javascript"
src="/jsftest/javax.faces.resource/jsf.js.jsf?ln=javax.faces"><!--
> //--></script><script type="text/javascript"
src="/jsftest/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.2.0.CR1/PackedCompressed/packed/packed.js"><!--
> //--></script><script type="text/javascript"
src="/jsftest/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.2.0.CR1/PackedCompressed/packed/packed.js"><!--
> //--></script><script type="text/javascript"
src="/jsftest/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.2.0.CR1/PackedCompressed/packed/packed.js"><!--
> //--></script><link rel="stylesheet" media="screen"
type="text/css"
href="/jsftest/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.2.0.CR1/PackedCompressed/DEFAULT/packed/packed.css"
/></head><body><form id="testForm" name="testForm"
method="post" action="/jsftest/tabtest.jsf"
enctype="application/x-www-form-urlencoded"><div class="rf-p "
id="testForm:mypanel"><div class="rf-p-hdr "
id="testForm:mypanel_header">
> Header
> </div><div class="rf-p-b "
id="testForm:mypanel_body">
> Content
> </div></div><input type="hidden"
name="testForm_SUBMIT" value="1" /><input
type="hidden" name="javax.faces.ViewState"
id="javax.faces.ViewState"
value="BCdgrBds6dPVxGA5g7QTvuYJ8/PuaJifnYvMIUGHf2r4d6JJFsGNbgoWnR9/JiyT861SIhrba11L0hX4aFlyD1oAXywRv4cQTCaw23T3TN9cuUSgI1VQAx0bW+JUNFXw7+HsPg=="
/></form></body>
> </html>
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira