DynaView Error & Loop

Splash Forums PrettyFaces Users DynaView Error & Loop

This topic contains 7 replies, has 3 voices, and was last updated by  clemmonsm 5 years, 10 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #18097

    clemmonsm
    Participant

    Gentlemen, thank you for your help this week. Now that my issues around my upgrade from v3.3.0 to v3.3.2 are in the past, I can ask the question I have been attempting to address this week regarding DynaViews.

    The v3.3.3 snapshot resolves one of the issues I was having with v3.3.0 where parameters were null inside the the DynaView view-id method. I saw this referenced in another thread on the forum where I believe this issue was addressed in v3.3.1.

    The behavior I am still experiencing with DynaView is as follows: the view-id method is called and the return is processed, instead of the page being loaded, the error detailed below is received and the method is called again. This pattern continues resulting in an infinite loop. I initially thought the root cause might be similar to a previous issue I was having where the “_adf.ctrl-state” parameter needed to be explicitly appended to the url string, but doing so did not resolve the issue (see commented code). Is there anything you see in the trace that may provide insight?

    URL-MAPPING:

    <url-mapping id="community">
    <pattern value="/new-homes/#{state:siteTasks.state}/#{city:siteTasks.city}/find/communities/#{community:siteTasks.community}/" />
    <view-id value="#{siteTasks.getCmNbViewPath}" />
    </url-mapping>

    CODE:

    public String getCmNbViewPath() {

    //HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();

    ...code that sets contentType...

    if (contentType.equals("neighborhood")) {
    return "/faces/pages/neighborhood.jspx";
    //return "/faces/pages/neighborhood.jspx?_adf.ctrl-state=" + request.getParameterValues("_adf.ctrl-state")[0];
    }
    return "/faces/pages/community.jspx";
    //return "/faces/pages/community.jspx?_adf.ctrl-state=" + request.getParameterValues("_adf.ctrl-state")[0];
    }

    TRACE (full trace here: http://pastebin.com/uiywzzt2):

    <PrettyNavigationHandler> <handleNavigation> Navigation requested: fromAction [pretty:community], outcome [pretty:community]
    <PrettyContext> <getCurrentInstance> Retrieved PrettyContext from Request
    <PrettyRedirector> <redirect> Redirecting to mappingId [community], [/dreeshomes/new-homes/state/cincinnati/find/communities/ashford_village/]
    <ADFContext> <getApplicationName> Returns default Name
    <PrettyContext> <<init>> Initialized PrettyContext
    <PrettyContext> <<init>> Initialized PrettyContext
    <PrettyFilter> <doFilter> Forwarding mapped request [/new-homes/state/cincinnati/find/communities/ashford_village/] to dynaviewId [#{siteTasks.getCmNbViewPath}]
    <PrettyContext> <<init>> Initialized PrettyContext
    <PrettyContext> <<init>> Initialized PrettyContext
    <PrettyFilter> <doFilter> Request is not mapped using PrettyFaces. Continue.
    <ADFContext> <getApplicationName> Returns default Name
    <ADFContext> <getApplicationName> Returns default Name
    <PrettyContext> <getCurrentInstance> Retrieved PrettyContext from Request
    <PrettyContext> <getCurrentInstance> Retrieved PrettyContext from Request
    <ParameterValidator> <validateParameters> Validating parameters.
    <PrettyContext> <getCurrentInstance> Retrieved PrettyContext from Request
    <ParameterInjector> <injectParameters> Injecting parameters
    <PrettyContext> <getCurrentInstance> Retrieved PrettyContext from Request
    <DynaviewEngine> <processDynaView> Requesting DynaView processing for: /new-homes/state/cincinnati/find/communities/ashford_village/
    <DynaviewEngine> <processDynaView> Invoking DynaView method: #{siteTasks.getCmNbViewPath}
    <PrettyContext> <getCurrentInstance> Retrieved PrettyContext from Request
    <PrettyContext> <getCurrentInstance> Retrieved PrettyContext from Request
    Source breakpoint occurred at line 2264 of siteTasks.java.
    Source breakpoint occurred at line 2276 of siteTasks.java.
    <DynaviewEngine> <processDynaView> Forwarding to DynaView: /faces/pages/neighborhood.jspx
    <PrettyContext> <<init>> Initialized PrettyContext
    <PrettyContext> <<init>> Initialized PrettyContext
    <PrettyFilter> <doFilter> Request is not mapped using PrettyFaces. Continue.
    <PrettyContext> <getCurrentInstance> Retrieved PrettyContext from Request
    <LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RESTORE_VIEW 1
    oracle.adf.controller.ControllerException: ADFC-12013: Controller state has not been initialized for the current request.
    at oracle.adfinternal.controller.state.ControllerState.getInstance(ControllerState.java:202)
    at oracle.adfinternal.controller.application.SyncNavigationStateListener.afterPhase(SyncNavigationStateListener.java:48)
    at oracle.adfinternal.controller.lifecycle.ADFLifecycleImpl$PagePhaseListenerWrapper.afterPhase(ADFLifecycleImpl.java:531)
    at oracle.adfinternal.controller.lifecycle.LifecycleImpl.internalDispatchAfterEvent(LifecycleImpl.java:120)
    at oracle.adfinternal.controller.lifecycle.LifecycleImpl.dispatchAfterPagePhaseEvent(LifecycleImpl.java:168)
    at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$PhaseInvokerImpl.dispatchAfterPagePhaseEvent(ADFPhaseListener.java:131)
    at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.afterPhase(ADFPhaseListener.java:74)
    at oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.afterPhase(ADFLifecyclePhaseListener.java:53)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:399)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:186)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:175)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:126)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:524)
    at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:253)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:101)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    <Nov 16, 2011 10:59:35 AM EST> <Error> <HTTP> <BEA-101020> <[ServletContext@1755525045[app:dreeshomes module:dreeshomes path:/dreeshomes spec-version:2.5]] Servlet failed with Exception
    oracle.adf.controller.ControllerException: ADFC-12013: Controller state has not been initialized for the current request.
    at oracle.adfinternal.controller.state.ControllerState.getInstance(ControllerState.java:202)
    at oracle.adfinternal.controller.application.SyncNavigationStateListener.afterPhase(SyncNavigationStateListener.java:48)
    at oracle.adfinternal.controller.lifecycle.ADFLifecycleImpl$PagePhaseListenerWrapper.afterPhase(ADFLifecycleImpl.java:531)
    at oracle.adfinternal.controller.lifecycle.LifecycleImpl.internalDispatchAfterEvent(LifecycleImpl.java:120)
    at oracle.adfinternal.controller.lifecycle.LifecycleImpl.dispatchAfterPagePhaseEvent(LifecycleImpl.java:168)
    Truncated. see log file for complete stacktrace
    >
    <Nov 16, 2011 10:59:35 AM EST> <Notice> <Diagnostics> <BEA-320068> <Watch 'UncheckedException' with severity 'Notice' on server 'DefaultServer' has triggered at Nov 16, 2011 10:59:35 AM EST. Notification details:
    WatchRuleType: Log
    WatchRule: (SEVERITY = 'Error') AND ((MSGID = 'WL-101020') OR (MSGID = 'WL-101017') OR (MSGID = 'WL-000802') OR (MSGID = 'BEA-101020') OR (MSGID = 'BEA-101017') OR (MSGID = 'BEA-000802'))
    WatchData: DATE = Nov 16, 2011 10:59:35 AM EST SERVER = DefaultServer MESSAGE = [ServletContext@1755525045[app:dreeshomes module:dreeshomes path:/dreeshomes spec-version:2.5]] Servlet failed with Exception
    oracle.adf.controller.ControllerException: ADFC-12013: Controller state has not been initialized for the current request.
    at oracle.adfinternal.controller.state.ControllerState.getInstance(ControllerState.java:202)
    at oracle.adfinternal.controller.application.SyncNavigationStateListener.afterPhase(SyncNavigationStateListener.java:48)
    at oracle.adfinternal.controller.lifecycle.ADFLifecycleImpl$PagePhaseListenerWrapper.afterPhase(ADFLifecycleImpl.java:531)
    at oracle.adfinternal.controller.lifecycle.LifecycleImpl.internalDispatchAfterEvent(LifecycleImpl.java:120)
    at oracle.adfinternal.controller.lifecycle.LifecycleImpl.dispatchAfterPagePhaseEvent(LifecycleImpl.java:168)
    at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$PhaseInvokerImpl.dispatchAfterPagePhaseEvent(ADFPhaseListener.java:131)
    at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.afterPhase(ADFPhaseListener.java:74)
    at oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.afterPhase(ADFLifecyclePhaseListener.java:53)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:399)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:186)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:175)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:126)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:524)
    at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:253)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:101)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    SUBSYSTEM = HTTP USERID = <WLS Kernel> SEVERITY = Error THREAD = [ACTIVE] ExecuteThread: '16' for queue: 'weblogic.kernel.Default (self-tuning)' MSGID = BEA-101020 MACHINE = mattc.local TXID = CONTEXTID = 9714c4774095e37d:5a49a91b:133ad182642:-8000-0000000000000069 TIMESTAMP = 1321459175424
    WatchAlarmType: AutomaticReset
    WatchAlarmResetPeriod: 30000
    >
    <PrettyContext> <<init>> Initialized PrettyContext
    <PrettyContext> <<init>> Initialized PrettyContext
    <PrettyFilter> <doFilter> Forwarding mapped request [/new-homes/state/cincinnati/find/communities/ashford_village/] to dynaviewId [#{siteTasks.getCmNbViewPath}]
    <PrettyContext> <<init>> Initialized PrettyContext
    <PrettyContext> <<init>> Initialized PrettyContext
    <PrettyFilter> <doFilter> Request is not mapped using PrettyFaces. Continue.
    <ADFContext> <getApplicationName> Returns default Name
    <ADFContext> <getApplicationName> Returns default Name
    <PrettyContext> <getCurrentInstance> Retrieved PrettyContext from Request
    <PrettyContext> <getCurrentInstance> Retrieved PrettyContext from Request
    <ParameterValidator> <validateParameters> Validating parameters.
    <PrettyContext> <getCurrentInstance> Retrieved PrettyContext from Request
    <ParameterInjector> <injectParameters> Injecting parameters
    <PrettyContext> <getCurrentInstance> Retrieved PrettyContext from Request
    <DynaviewEngine> <processDynaView> Requesting DynaView processing for: /new-homes/state/cincinnati/find/communities/ashford_village/
    <DynaviewEngine> <processDynaView> Invoking DynaView method: #{siteTasks.getCmNbViewPath}
    <PrettyContext> <getCurrentInstance> Retrieved PrettyContext from Request
    <PrettyContext> <getCurrentInstance> Retrieved PrettyContext from Request

    #21701

    clemmonsm
    Participant

    I am calling the view-id method from an h:commandLink and saw this in the documentation:

    8.3. Using JSF standard components

    Caution: Mappings using DynaView functionality will not function with JSF link components.

    Could this be the issue?

    #21703

    Hmm, that documentation is outdated. It should work fine with links now (unless you do some weird stuff like duplicate mappings.)

    It’s very possible that this is the same issue that you experienced before, because DynaView does a servlet forward to a custom view-ID with no parameters, which prettyfaces then intercepts, and forwards again to the calculated URL. This would be an issue possibly because ADF may be invoking itself first (and crashing), which does not give prettyfaces a chance to do its work properly and send the proper request back to ADF.

    I’m not sure how to resolve this one, though, if that’s the case, because this would imply that PrettyFaces needs knowledge of how ADF works, which, in this case, seems to be pretty unforunate ;)

    Let me see if I can bring any of the ADF guys to take a look at this issue for you.

    #21704

    clemmonsm
    Participant

    Lincoln,

    Thank you for the response and for looping your ADF guys in. The scenario you detail sounds like it may be what is happening, I look forward to hearing their feedback.

    In the meantime, I thought I would provide additional details around my use case for good measure:

    The site pages for which I am attempting to use DynaViews are to show community and neighborhood details. Some neighborhoods are part of larger communities and some are not.

    For the community page, the URL is as follows:

    <url-mapping id="community">
    <pattern value="/new-homes/#{bean.state}/#{bean.city}/find/communities/#{bean.community}/" />
    <view-id value="/faces/pages/community.jspx" />
    </url-mapping>

    For the n’hoods that are part of this larger community, the URL is to include the community and neighborhood names, like so:

    <url-mapping id="neighborhood">
    <pattern value="/new-homes/#{bean.state}/#{bean.city}/find/communities/#{bean.community}/#{bean.neighborhood}/" />
    <view-id value="/faces/pages/neighborhood.jspx" />
    </url-mapping>

    For the n’hoods that are not part of larger communities, the URL is to contain the neighborhood name, but no community name:

    <url-mapping id="neighborhood-nocommunity">
    <pattern value="/new-homes/#{bean.state}/#{bean.city}/find/communities/#{bean.neighborhood}/" />
    <view-id value="/faces/pages/neighborhood.jspx" />
    </url-mapping>

    …and this is where I discovered the need for a DynaView. Initially, I attempted to redirect to “community” and “neighborhood-nocommunity” via Java code and quickly discovered that when I redirected to “neighborhood-nocommunity,” community.jspx was the page being loaded.

    Assuming DynaViews are not compatible with ADF, is seems the most direct workaround would be to lobby for a business requirement change and redefine the n’hood only URL pattern to something like:

    <url-mapping id="neighborhood-nocommunity">
    <pattern value="/new-homes/#{bean.state}/#{bean.city}/find/neighborhood/#{bean.neighborhood}/" />
    <view-id value="/faces/pages/neighborhood.jspx" />
    </url-mapping>

    #21705

    aschwart
    Participant

    Hi All –

    I took a quick peek at the ADF code corresponding to the exception but had a tough time figuring out exactly what is happening to cause ADF to reach this funky state.

    Just to make sure I understand the scope of the problem… It sounds like simple (non-dynamic) mappings are working okay (using the workaround that clemmonsm has documented to preserve ADF’s controller state). However, switching the same mapping to a dynamic view id blows up with the exception reported above.

    If that is the case, I am curious whether there are any subtle differences in how PrettyFaces treats:

    <url-mapping id="community">

    <pattern value="/new-homes/#{bean.state}/#{bean.city}/find/communities/#{bean.community}/" />

    <view-id value="/faces/pages/community.jspx" />

    </url-mapping>

    versus:

    <url-mapping id="community">

    <pattern value="/new-homes/#{bean.state}/#{bean.city}/find/communities/#{bean.community}/" />

    <view-id>#{bean.getPath}</view-id>

    </url-mapping>

    Where #{bean} resolves to:

    @Named("bean")

    @RequestScoped

    public class BoringBean {

    public String getPath() {

    return "faces/pages/community.jspx";

    }

    }

    Do these result in the same RequestDispatcher.forward() call?

    Andy

    #21706

    So the difference is that in the latter case of <view-id>#{bean.getPath}</view-id>, PrettyFaces actually does something different.

    *Here is the flow:*

    GET /new-homes/state/city/find/communities/4

    FORWARD /com.ocpsoft.DynaView.jsf (or whatever your faces mapping is)

    – Before RESTORE_VIEW (set a ViewRoot manually, then call facesContext.responseComplete())

    – After RESTORE_VIEW

    — Invoke #{bean.getPath} and Calculate new ViewID

    — FORWARD to new ViewID “/faces/pages/community.jspx”

    You can see the full Dynaview mechanism here: https://github.com/ocpsoft/prettyfaces/blob/master/core/src/main/java/com/ocpsoft/pretty/faces/event/PrettyPhaseListener.java

    #21707

    aschwart
    Participant

    Ah, thanks Lincoln! This is starting to make a lot more sense now. :-)

    Looking back at your earlier comment:

    This would be an issue possibly because ADF may be invoking itself first (and crashing), which does not give prettyfaces a chance to do its work properly and send the proper request back to ADF.

    Yep, nailed it.

    At the point in time where we hit the ADF ControllerException, PrettyFaces has yet to do this:

    – After RESTORE_VIEW

    — Invoke #{bean.getPath} and Calculate new ViewID

    — FORWARD to new ViewID “/faces/pages/community.jspx”

    Which explains why clemmonsm’s attempt to insert the controller state token:

    //return “/faces/pages/neighborhood.jspx?_adf.ctrl-state=” + request.getParameterValues(“_adf.ctrl-state”)[0];

    Was unsuccessful.

    The deal is that at the point of the failure, we are not processing the dynamic view id (has yet to be calculated). Instead, ADF sees the special PrettyFaces dynamic view id (“/com.ocpsoft.DynaView.jsf”), which of course does not contain the _adf.ctrl-state query parameter that ADF requires.

    One thing (ie. hack) that might be interesting to play around with would be to see what happens if we reverse the order of the PrettyFaces and ADF phase listeners. Note: I am not suggesting that this is a proper fix/workaround or that it will even have any real impact. My guess: we’ll still hit the same exception after the forward returns, though possible that results will be more interesting. Just thinking it might be an worthwhile data point to collect.

    @clemmonsm

    How do you feel about hacking your test case? :-)

    Since you are on JSF 1.2, ordering of faces-config.xml loading is determined by jar file names. Temporarily munging the PrettyFaces jar file name to something like “aaprettyfaces.jar” should force the PrettyFaces phase listener to be registered/called before any of the ADF phase listeners.

    This may just cause other unrelated ordering problems to arise, but might be worth exploring.

    If you do decide to test this out, don’t forget that you might need to uncomment your code that tacks on the _adf.ctrl-state query parameter. (Though it is possible that your PrettyFacesAdfProcessor will cover this case for you.)

    And, yeah, again, not a fix – just a debugging tool to gather more info.

    Regarding getting a proper fix from ADF, assuming we are unable to identify some workaround: I suspect that is going to require interaction with Oracle Support. Don’t suppose you have access?

    Andy

    #21708

    clemmonsm
    Participant

    @aschwart, thanks for the detailed response! I do have Oracle Support access on my current project and I would like to try the hack. For the time being, I have successfully lobbied to have the business requirement changed that required the DynaView. That said, once I have time, I will try out the workaround and report back. Thanks!

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.

Comments are closed.