Re: addResource to add CSS JS - Only working on PostBack

2016-04-19 Thread fischman_98
So are you confirming/agreeing that the result of an addResource call is handled in the Apply Request phase? And as to /only need to adjust the code a bit/, what code and where? I was trying in a phaselistener, are you suggesting a custom ViewHandler, custom component or ? Matt -- View this

Re: addResource to add CSS JS - Only working on PostBack

2016-04-19 Thread fischman_98
I created this simple test phaseListener before my original post and it only works an a postback, not an initial request. /Put the code in both phases just in case./ *No Luck*. package com.ngsimages.cart.phaselistener; import javax.faces.event.PhaseEvent; import javax.faces.event.PhaseId;

Re: addResource to add CSS JS - Only working on PostBack

2016-04-19 Thread Leonardo Uribe
Hi AddResource API in its default implementation use a buffer to render resources, but on render response phase, so you should aim to add your resources in that phase. A custom phase listener or a custom component using the code in encodeXXX should work. Regards, Leonardo On Apr 19, 2016 8:05

Re: addResource to add CSS JS - Only working on PostBack

2016-04-19 Thread Leonardo Uribe
Hi Add the resource in afterPhase(...) is too late in the lifecycle, because if the response was flushed the script could not be rendered. Add it in beforePhase(...) of render response should work. Just FYI, ExtensionsFilter class is the one responsible to create the buffer and then parse the

Re: addResource to add CSS JS - Only working on PostBack

2016-04-19 Thread fischman_98
Mike, Thanks...yeah were all good with the understanding of the Lifecycle... I'm just curious why the addResource call *WORKS* in an /encodeEnd /of a Custom Component, which is fired in the */Render Response/* phase, but... *DOES NOT WORK* when the addResource is called directly from a

Re: addResource to add CSS JS - Only working on PostBack

2016-04-19 Thread Mike Kienenberger
You've probably already figured it out, but for anyone reading this thread later, what Leonardo said explains it. Component encodeEnd is called during the time that the response is rendered (between before and after phase listeners). "After" is too late. On Tue, Apr 19, 2016 at 2:41 PM,

Re: addResource to add CSS JS - Only working on PostBack

2016-04-19 Thread fischman_98
*FYI*: When added the call to addResource in encodeEnd method of a Custom Component it works on both /*initial request*/ and /*postback */. Here's the initial request; RESTORE_VIEW(1) :: Before RESTORE_VIEW(1) :: After RENDER_RESPONSE(6) :: Before *AddResource Here!* RENDER_RESPONSE(6) :: After

Re: addResource to add CSS JS - Only working on PostBack

2016-04-19 Thread Mike Kienenberger
I guess it probably doesn't help -- it looks like your phase listener was already using RENDER_RESPONSE. On Tue, Apr 19, 2016 at 3:13 PM, Mike Kienenberger wrote: > There is only a RENDER_RESPONSE phase for the initial request in a > phase listener, but all of the phases in a

Re: addResource to add CSS JS - Only working on PostBack

2016-04-19 Thread Mike Kienenberger
There is only a RENDER_RESPONSE phase for the initial request in a phase listener, but all of the phases in a postback. Does that help? On Tue, Apr 19, 2016 at 2:09 PM, fischman_98 wrote: > *FYI*: When added the call to addResource in encodeEnd method of a

Re: addResource to add CSS JS - Only working on PostBack

2016-04-19 Thread fischman_98
Gentlemen, After all this (/My initial attempt at doing this was using a phaselistener after all/), I now see */WHEN /*the phaselistener solution is not working. The question now is */why/*? When I use the URL: http://localhost:8080//index.jsf -* IT WORKS* When I use the URL:

Re: addResource to add CSS JS - Only working on PostBack

2016-04-19 Thread fischman_98
OK. Moved the org.apache.myfaces.webapp.filter.*WelcomeFileFilter* after the *Extensions Filter* in the /*web.xml*/ and the *PhaseListener *approach to *addResource *seems to be working. More testing to follow and I will report any issues. That was a lot of investigation due to Filter