code: PageFlowController popUntil( HttpServletRequest request, Class stopAt, boolean onlyIfPresent )
      {
          if (onlyIfPresent && lastIndexOf(stopAt) == -1) {
              return null;
          }
          
          while ( ! isEmpty()  )
          {
              PageFlowController popped = pop( request ).getPageFlow();
              
              if ( popped.getClass().equals( stopAt ) )
              {
                  //
                  // If we've popped everything from the stack, remove the stack attribute from the session.
                  //
                  if ( isEmpty() ) destroy( request );
                  return popped;
              }
              else
              {
                  //
                  // We're discarding the popped page flow.  Invoke its destroy() callback, unless it's longLived.
                  //
                  if ( ! popped.isLongLived() ) popped.destroy( request.getSession( false ) );
              }
          }
  
          destroy( request );   // we're empty -- remove the attribute from the session.
          return null;
      }
docs: Pop page flows from the nesting stack until one of the given type is found.
  
  @return the last popped page flow if one of the given type was found, or <code>null</code>
  if none was found.