javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-2446

Mojara doesn't propagate set in request map values through lifecycle phases

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.1.7, 2.1.8, 2.1.9
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      Tested with last Mojarra versions 2.1.7-2.1.9 and Jetty server. No other frameworks, only plain JSF impl.

      Description

      I'm a component developer and found a bad issue in my opinion. Assume, we have a custom component, say MasterDetail, which puts some value under some key into request map. It happens on PostRestoreState (1. JSF phase).

      @ListenerFor(systemEventClass = PostRestoreStateEvent.class)
      public class MasterDetail extends UIComponentBase {
          ...
      	
          @Override
          public void processEvent(ComponentSystemEvent event) throws AbortProcessingException {
              super.processEvent(event);
      
              if (!(event instanceof PostRestoreStateEvent)) {
                  return;
              }
      
              Map<String, Object> requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
              requestMap.put("someVar", "someValue");
          }
      }
      

      Using in XHTML looks like

      <pe:masterDetail ....>
          ...
      	<h:commandButton action="#{doSomething(someVar)}" .../>
          ...
      </pe:dynaForm>
      

      If you would debug now components inside MasterDetail, you will see that the request map, accessible in this components, doesn't have set in MasterDetail values. In our example, it doesn't contain "someVar" with "someValue" when you would access it in processDecodes, processValidators or processUpdates (or somewhere else) of command button. The result, someVar parameter in doSomething() action is NULL.

      MyFaces impl. is fine here. MyFaces propagate set in request map values through lifecycle phases. Only Mojarra is affected. Does get request map overwritten by any reason? Can you fix this issue please? Thanks in advance!

        Activity

        Hide
        ova2 added a comment - - edited

        I would like to provide a more exact description. This issue seems to be only happen when child components are processed within narrower area than parent (custom) component. In the example above if we have

        <pe:masterDetail id="masterDetail" ...>
            ...
        	<h:commandButton id="doButton" action="#{doSomething(someVar)}" ...>
        	    <f:ajax execute="doButton" .../>
        	</h:commandButton>
            ...
        </pe:masterDetail>
        

        or (PrimeFaces ajaxified command button)

        <pe:masterDetail id="masterDetail" ...>
            ...
        	<p:commandButton process="@this" action="#{doSomething(someVar)}" .../>
            ...
        </pe:masterDetail>
        

        someVar object is not available (NULL) although processEvent() is fired on PostRestoreStateEvent and

        requestMap.put("someVar", "someValue");
        

        is called of course. But when "execute" / "process" points to ID "masterDetail", everything is fine (someVar is not NULL). As I said, MyFaces works fine; don't matter what the area to be processed is - only @this or wider.

        Show
        ova2 added a comment - - edited I would like to provide a more exact description. This issue seems to be only happen when child components are processed within narrower area than parent (custom) component. In the example above if we have <pe:masterDetail id= "masterDetail" ...> ... <h:commandButton id= "doButton" action= "#{doSomething(someVar)}" ...> <f:ajax execute= "doButton" .../> </h:commandButton> ... </pe:masterDetail> or (PrimeFaces ajaxified command button) <pe:masterDetail id= "masterDetail" ...> ... <p:commandButton process= "@this" action= "#{doSomething(someVar)}" .../> ... </pe:masterDetail> someVar object is not available (NULL) although processEvent() is fired on PostRestoreStateEvent and requestMap.put( "someVar" , "someValue" ); is called of course. But when "execute" / "process" points to ID "masterDetail", everything is fine (someVar is not NULL). As I said, MyFaces works fine; don't matter what the area to be processed is - only @this or wider.
        Hide
        rogerk added a comment -

        Can you provide a small test app (case) for us to debug with?
        Also, can you check if you have experienced the problem with 2.1.6?

        Show
        rogerk added a comment - Can you provide a small test app (case) for us to debug with? Also, can you check if you have experienced the problem with 2.1.6?
        Hide
        ova2 added a comment -

        Yes, of course!

        I have actually a project to check out and debug, but it's too big http://code.google.com/p/primefaces-extensions/source/checkout

        I will try to provide a small test web app. Do you prefer Maven or Ant? I will also test with 2.1.3-2.1.6, but I think it was ok there. I can't remember that we had problems.

        Show
        ova2 added a comment - Yes, of course! I have actually a project to check out and debug, but it's too big http://code.google.com/p/primefaces-extensions/source/checkout I will try to provide a small test web app. Do you prefer Maven or Ant? I will also test with 2.1.3-2.1.6, but I think it was ok there. I can't remember that we had problems.
        Hide
        ova2 added a comment -

        After debugging I found a problem in third-party components which don't buffer prev. set values in request map. This is not a Mojarra bug. Please close this issue. Thanks. P.S. Just a wonder how it was working in MyFaces.

        Show
        ova2 added a comment - After debugging I found a problem in third-party components which don't buffer prev. set values in request map. This is not a Mojarra bug. Please close this issue. Thanks. P.S. Just a wonder how it was working in MyFaces.
        Hide
        rogerk added a comment -

        Per latest comments.

        Show
        rogerk added a comment - Per latest comments.

          People

          • Assignee:
            rogerk
            Reporter:
            ova2
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: