myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Danny Robinson" <dannyjrobin...@gmail.com>
Subject [Trinidad] PPR Optimization - Would this work?
Date Mon, 14 May 2007 13:07:50 GMT
Adam,

Great to finally meet face-to-face at JavaOne.  During our conversation we
talked about PPR performance and how we could make some optimizations.  One
suggestion you had was to implement a naming container that didn't render
its children during a PPR request, unless one of its children was registered
for ppr update.  I've implemented this and it *seems* to be working fine.
However, I just wanted to double-check if this approach wouldn't interfere
with the saved state of the component model or any other area of the
framework?  The code  implemented is below.

Thanks,

Danny

    boolean renderChildren = true;

    if (RequestContext.getCurrentInstance().isPartialRequest(context))
    {

      if (_LOG.isInfo())
        _LOG.info("Checking partialZone: " + component.getClientId
(context));

      // Default to not render during PPR...
      renderChildren = false;
      for (Iterator iter = RenderingContext.getCurrentInstance()
          .getPartialPageContext().getPartialTargets(); iter.hasNext();)
      {
        String partialTarget = (String) iter.next();

        if (partialTarget.startsWith(component.getClientId(context)))
        {
          // ...Unless the container has a ppr registered child
          renderChildren = true;
          if (_LOG.isInfo())
            _LOG.info("Target found, container will render. Target: " +
component.getClientId(context));
          break;
        }
      }
    }

    if (renderChildren)
      super.encodeChildren(context, component);


-- 
Chordiant Software Inc.
www.chordiant.com

Mime
View raw message