MyFaces Core
  1. MyFaces Core
  2. MYFACES-3234

FacesContextImpl.getPartialViewContext() does not use wrapped context but only (this)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.8, 2.1.2
    • Component/s: JSR-314
    • Labels:
      None
    • Environment:
      myfaces trunk

      Description

      example:

      CodiFacesContextWrapper extends FacesContextWrapper

      org.apache.myfaces.context.servlet.FacesContextImpl.getPartialViewContext():
      _partialViewContext = factory.getPartialViewContext(this)

      -> partial view context is created always with FacesContextImpl instance not with the wrapped one

        Activity

        Hide
        Martin Kočí added a comment -

        I don't see any "elegant" solution here: only usage of FacesContext.getCurrentInstance()

        Show
        Martin Kočí added a comment - I don't see any "elegant" solution here: only usage of FacesContext.getCurrentInstance()
        Hide
        Leonardo Uribe added a comment -

        It is ok to call FacesContext.getCurrentInstance(), because after all the created instance is cached, so in practice it is only one call per request, so the final impact is minimal. The preferred way is create a PartialViewContextFactory wrapper, but this strategy should work too (to ensure the wrapper is on top, but anyway faces-config ordering should fix that too) . Thanks to Martin Koci for provide this patch.

        Show
        Leonardo Uribe added a comment - It is ok to call FacesContext.getCurrentInstance(), because after all the created instance is cached, so in practice it is only one call per request, so the final impact is minimal. The preferred way is create a PartialViewContextFactory wrapper, but this strategy should work too (to ensure the wrapper is on top, but anyway faces-config ordering should fix that too) . Thanks to Martin Koci for provide this patch.

          People

          • Assignee:
            Martin Kočí
            Reporter:
            Martin Kočí
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development