MyFaces Portlet Bridge
  1. MyFaces Portlet Bridge
  2. PORTLETBRIDGE-51

State is lost at random and postback request is deal as new one

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.0-alpha-3
    • Component/s: None
    • Labels:
      None
    • Environment:
      Firefox 2.0.0.17
      windows xp
      running portlet demo using maven jetty plugin and pluto
      myfaces core 1.2.x running with server side state saving

      Description

      I have one machine with firefox 3.0.3 and windows vista, and the problem is not present. The machine with firefox 2.0.0.17 and windows xp has the problem.

      A correct request (firefox 3.0.3, opera 9 or IE 7) output on the log (stdout) something like this:

      2008-10-21 19:25:47.666:/portlet-bridge-demo:INFO: PortletExternalContextImpl.g
      etViewId: found jsf target viewId = view:/helloworld/index.jsp
      2008-10-21 19:25:47.681:/portlet-bridge-demo:INFO: dumpScopeId: ACTION_PHASE
      2008-10-21 19:25:47.681:/portlet-bridge-demo:INFO: Elements in scope: portlet-b
      ridge-demo:19hv18thfnrd9:view:-25ecdd41:11d21e77bb0:-7fdb
      2008-10-21 19:25:47.681:/portlet-bridge-demo:INFO: org.apache.myfaces.port
      let.faces.includeInScope.requestParameters
      2008-10-21 19:25:47.681:/portlet-bridge-demo:INFO: org.apache.myfaces.port
      let.faces.includeInScope.facesViewRoot
      2008-10-21 19:25:47.681:/portlet-bridge-demo:INFO: org.apache.myfaces.el.u
      nified.resolver.managedbean.beansUnderConstruction
      2008-10-21 19:25:47.713:/portlet-bridge-demo:INFO: org.apache.myfaces.appl
      ication.jsp.JspStateManagerImpl.RESTORED_SERIALIZED_VIEW
      2008-10-21 19:25:47.713:/portlet-bridge-demo:INFO: org.apache.myfaces.appl
      ication.DefaultViewHandlerSupport.CACHED_SERVLET_MAPPING
      2008-10-21 19:25:47.713:/portlet-bridge-demo:INFO: jsf_sequence
      2008-10-21 19:25:47.713:/portlet-bridge-demo:INFO: namebean
      2008-10-21 19:25:47.713:/portlet-bridge-demo:INFO: org.apache.myfaces.shar
      ed_impl.renderkit.RendererUtils.RenderKitImpl
      2008-10-21 19:25:47.713:/portlet-bridge-demo:INFO: end dumpScopeId
      Oct 21, 2008 7:25:47 PM org.apache.pluto.driver.PortalDriverFilter doFilter
      INFO: Forwarding to realPath: /pluto/index.jsp
      2008-10-21 19:25:47.744:/portlet-bridge-demo:INFO: Unable to locate a SAVESTATE

      _FIELD_MARKER in response. This could be because your Faces environment doesn't
      write such a marker or because the bridge doesn't know the marker in use. If t
      he later, configure the appropriate application init parameter javax.portlet.fac
      es.SAVESTATE_FIELD_MARKER.
      2008-10-21 19:25:48.760:/portlet-bridge-demo:INFO: dumpScopeId: RENDER_PHASE
      2008-10-21 19:25:48.760:/portlet-bridge-demo:INFO: Elements in scope: portlet-b
      ridge-demo:19hv18thfnrd9:view:-25ecdd41:11d21e77bb0:-7fdb
      2008-10-21 19:25:48.760:/portlet-bridge-demo:INFO: org.apache.myfaces.port
      let.faces.includeInScope.requestParameters
      2008-10-21 19:25:48.760:/portlet-bridge-demo:INFO: org.apache.myfaces.el.u
      nified.resolver.managedbean.beansUnderConstruction
      2008-10-21 19:25:48.760:/portlet-bridge-demo:INFO: org.apache.myfaces.appl
      ication.jsp.JspStateManagerImpl.RESTORED_SERIALIZED_VIEW
      2008-10-21 19:25:48.760:/portlet-bridge-demo:INFO: org.apache.myfaces.appl
      ication.DefaultViewHandlerSupport.CACHED_SERVLET_MAPPING
      2008-10-21 19:25:48.760:/portlet-bridge-demo:INFO: jsf_sequence
      2008-10-21 19:25:48.760:/portlet-bridge-demo:INFO: namebean
      2008-10-21 19:25:48.760:/portlet-bridge-demo:INFO: org.apache.myfaces.shar
      ed_impl.renderkit.RendererUtils.RenderKitImpl
      2008-10-21 19:25:48.760:/portlet-bridge-demo:INFO: end dumpScopeId

      A request using firefox 2.0.0.17 looks like this:

      2008-10-21 19:26:46.822:/portlet-bridge-demo:INFO: PortletExternalContextImpl.g
      etViewId: found jsf target viewId = view:/helloworld/index.jsp
      2008-10-21 19:26:46.837:/portlet-bridge-demo:INFO: dumpScopeId: ACTION_PHASE
      2008-10-21 19:26:46.837:/portlet-bridge-demo:INFO: Elements in scope: portlet-b
      ridge-demo:yh4tse3ctjqw:view:-25ecdd41:11d21e77bb0:-7fda
      2008-10-21 19:26:46.837:/portlet-bridge-demo:INFO: org.apache.myfaces.port
      let.faces.includeInScope.requestParameters
      2008-10-21 19:26:46.837:/portlet-bridge-demo:INFO: org.apache.myfaces.port
      let.faces.includeInScope.facesViewRoot
      2008-10-21 19:26:46.837:/portlet-bridge-demo:INFO: org.apache.myfaces.el.u
      nified.resolver.managedbean.beansUnderConstruction
      2008-10-21 19:26:46.837:/portlet-bridge-demo:INFO: org.apache.myfaces.appl
      ication.jsp.JspStateManagerImpl.RESTORED_SERIALIZED_VIEW
      2008-10-21 19:26:46.837:/portlet-bridge-demo:INFO: org.apache.myfaces.appl
      ication.DefaultViewHandlerSupport.CACHED_SERVLET_MAPPING
      2008-10-21 19:26:46.837:/portlet-bridge-demo:INFO: jsf_sequence
      2008-10-21 19:26:46.837:/portlet-bridge-demo:INFO: namebean
      2008-10-21 19:26:46.837:/portlet-bridge-demo:INFO: org.apache.myfaces.shar
      ed_impl.renderkit.RendererUtils.RenderKitImpl
      2008-10-21 19:26:46.837:/portlet-bridge-demo:INFO: end dumpScopeId
      Oct 21, 2008 7:26:46 PM org.apache.pluto.driver.PortalDriverFilter doFilter
      INFO: Forwarding to realPath: /pluto/index.jsp
      2008-10-21 19:26:46.869:/portlet-bridge-demo:INFO: Unable to locate a SAVESTATE

      _FIELD_MARKER in response. This could be because your Faces environment doesn't
      write such a marker or because the bridge doesn't know the marker in use. If t
      he later, configure the appropriate application init parameter javax.portlet.fac
      es.SAVESTATE_FIELD_MARKER.
      2008-10-21 19:26:46.869:/portlet-bridge-demo:INFO: dumpScopeId: RENDER_PHASE
      2008-10-21 19:26:46.884:/portlet-bridge-demo:INFO: Elements in scope: portlet-b
      ridge-demo:yh4tse3ctjqw:view:-25ecdd41:11d21e77bb0:-7fda
      2008-10-21 19:26:46.884:/portlet-bridge-demo:INFO: org.apache.myfaces.port
      let.faces.includeInScope.requestParameters
      2008-10-21 19:26:46.884:/portlet-bridge-demo:INFO: org.apache.myfaces.el.u
      nified.resolver.managedbean.beansUnderConstruction
      2008-10-21 19:26:46.884:/portlet-bridge-demo:INFO: org.apache.myfaces.appl
      ication.jsp.JspStateManagerImpl.RESTORED_SERIALIZED_VIEW
      2008-10-21 19:26:46.884:/portlet-bridge-demo:INFO: org.apache.myfaces.appl
      ication.DefaultViewHandlerSupport.CACHED_SERVLET_MAPPING
      2008-10-21 19:26:46.884:/portlet-bridge-demo:INFO: jsf_sequence
      2008-10-21 19:26:46.884:/portlet-bridge-demo:INFO: namebean
      2008-10-21 19:26:46.884:/portlet-bridge-demo:INFO: org.apache.myfaces.shar
      ed_impl.renderkit.RendererUtils.RenderKitImpl
      2008-10-21 19:26:46.884:/portlet-bridge-demo:INFO: end dumpScopeId
      Oct 21, 2008 7:26:48 PM org.apache.pluto.driver.PortalDriverFilter doFilter
      INFO: Forwarding to realPath: /pluto/index.jsp
      2008-10-21 19:26:48.163:/portlet-bridge-demo:INFO: PortletExternalContextImpl.g
      etViewId: found jsf target viewId = view:/helloworld/hello.jsp
      2008-10-21 19:26:48.163:/portlet-bridge-demo:INFO: History for mode: view : /he
      lloworld/hello.jsp?javax.portlet.faces.PortletMode=view&__jpfbReqScopeId=portlet
      -bridge-demo%3Ayh4tse3ctjqw%3Aview%3A-25ecdd41%3A11d21e77bb0%3A-7fda&javax.faces
      .ViewState=CX8k%2BpTXi4XRIwnlHJaWVyc31c23xqtKQKd4yZOqnb9H8Xs6FKjAxuC58ztDpvj1O2O
      1%2B8C%2F2gMMzdqOlEnLOB4LrckaiKM%2Bu3h3WzFSRkY%3D
      2008-10-21 19:26:48.179:/portlet-bridge-demo:INFO: Unable to locate a SAVESTATE

      _FIELD_MARKER in response. This could be because your Faces environment doesn't
      write such a marker or because the bridge doesn't know the marker in use. If t
      he later, configure the appropriate application init parameter javax.portlet.fac
      es.SAVESTATE_FIELD_MARKER.
      2008-10-21 19:26:48.179:/portlet-bridge-demo:INFO: dumpScopeId: RENDER_PHASE
      2008-10-21 19:26:48.179:/portlet-bridge-demo:INFO: Elements in scope: portlet-b
      ridge-demo:yh4tse3ctjqw:view:-25ecdd41:11d21e77bb0:-7fda
      2008-10-21 19:26:48.179:/portlet-bridge-demo:INFO: org.apache.myfaces.port
      let.faces.includeInScope.requestParameters
      2008-10-21 19:26:48.179:/portlet-bridge-demo:INFO: org.apache.myfaces.el.u
      nified.resolver.managedbean.beansUnderConstruction
      2008-10-21 19:26:48.179:/portlet-bridge-demo:INFO: org.apache.myfaces.appl
      ication.jsp.JspStateManagerImpl.RESTORED_SERIALIZED_VIEW
      2008-10-21 19:26:48.179:/portlet-bridge-demo:INFO: org.apache.myfaces.appl
      ication.DefaultViewHandlerSupport.CACHED_SERVLET_MAPPING
      2008-10-21 19:26:48.179:/portlet-bridge-demo:INFO: jsf_sequence
      2008-10-21 19:26:48.179:/portlet-bridge-demo:INFO: namebean
      2008-10-21 19:26:48.179:/portlet-bridge-demo:INFO: org.apache.myfaces.shar
      ed_impl.renderkit.RendererUtils.RenderKitImpl
      2008-10-21 19:26:48.179:/portlet-bridge-demo:INFO: end dumpScopeId

      The interesting thing about this is that the RENDER_PHASE is executed twice (there are not two different request, just one).

      This event happens at random, so sometimes the app works as expected, and others when you click the link or button, the state is lost and the same page is rendered (no transition occurs and the RENDER_PHASE is executed twice).

      Michael suggest this solution: If you add this params to faces-config.xml

      <bridge:excluded-attribute>org.apache.myfaces.application.jsp.JspStateManagerImpl.*</bridge:excluded-attribute>
      <bridge:excluded-attribute>org.apache.myfaces.el.unified.resolver.managedbean.*</bridge:excluded-attribute>
      <bridge:excluded-attribute>org.apache.myfaces.shared_impl.renderkit.RendererUtils.*</bridge:excluded-attribute>
      <bridge:excluded-attribute>org.apache.myfaces.application.DefaultViewHandlerSupport.*</bridge:excluded-attribute>
      <bridge:excluded-attribute>jsf_sequence</bridge:excluded-attribute>

      The problem disappear and the application works correctly.

        Activity

        Hide
        Leonardo Uribe added a comment -

        To be more explicit: the solution proposed by Michael works, and it could be good if it was committed.

        Show
        Leonardo Uribe added a comment - To be more explicit: the solution proposed by Michael works, and it could be good if it was committed.
        Hide
        Michael Freedman added a comment -

        Checked-in a new version of the bridge's faces-config.xml which excludes a number of request attributes added by MyFaces during request processing. One in particular, "jsf_sequence", is used by MyFaces as a cache of the id for the View_state to restore. By keeping this around we would revert to the prior view when refreshing a current view because MyFaces would ignore the request information and use this cached information instead.

        Show
        Michael Freedman added a comment - Checked-in a new version of the bridge's faces-config.xml which excludes a number of request attributes added by MyFaces during request processing. One in particular, "jsf_sequence", is used by MyFaces as a cache of the id for the View_state to restore. By keeping this around we would revert to the prior view when refreshing a current view because MyFaces would ignore the request information and use this cached information instead.

          People

          • Assignee:
            Michael Freedman
            Reporter:
            Leonardo Uribe
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development