Internal (to our framework) method for seeing whether a given action exists in a page flow that is somewhere in
the stack.  If so, the page flow's ModuleConfig is returned.
422469
ModuleConfig findActionInStack(String actionPath)
    {
        for ( int i = _stack.size() - 1; i >= 0; --i )
        {
            ModuleConfig moduleConfig = ((PushedPageFlow) _stack.elementAt(i)).getPageFlow().getModuleConfig();
            
            if (moduleConfig.findActionConfig(actionPath) != null) {
                return moduleConfig;
            }
        }
    
        return null;
    }
1028207
function(action, args) {
    var self = this,
      imports = this.getActionImports(action),
      config = this.getActionConfig(action),
      auth = this.getAuthProperties(),
      unpacked = {
        config : {},
        imports : {},
        auth : {}
      },
      disposition = this.dispositionDescribe(action),
      ptr;

    _.each(args, function(value, idx) {
      ptr = disposition[idx];

      if (imports.properties.hasOwnProperty(ptr.name)) {
        unpacked.imports[ptr.name] = value;
      }

      if (config.properties.hasOwnProperty(ptr.name)) {
        unpacked.config[ptr.name] = value;
      }

      if (auth.hasOwnProperty(ptr.name)) {
        unpacked.auth[ptr.name] = value;
      }

    });

    return unpacked;
  }
1123306
def has_module (name, without_error=True):
    
    try:
        importlib.import_module(name)
        return True
    except ImportError:
        return False
    except Exception:
        # some modules raise errors when intitializing
        return not without_error
663438
public static void loadPageFlow(ServletRequest request, PageFlowController pageFlow) {
        if(pageFlow != null)
            request.setAttribute(PAGE_FLOW_IMPLICIT_OBJECT_KEY, pageFlow);

        Map map = InternalUtils.getPageInputMap(request);
        request.setAttribute(PAGE_INPUT_IMPLICIT_OBJECT_KEY, map != null ? map : Collections.EMPTY_MAP);
    }
108757
Stack getLegacyStack()
    {
        Stack ret = new Stack();
        
        for ( int i = 0; i < _stack.size(); ++i )
        {
            ret.push( ( ( PushedPageFlow ) _stack.get( i ) ).getPageFlow() );
        }
        
        return ret;
    }
1154400
public function hasMethod($action) {
		return array_key_exists($action, $this->actions())
        || method_exists($this, $action.config('app.action'));
	}
337947
function (item, pageConfig) {
            var templateCfg = {
                classpath : item.template
            };
            var args = item.args || [];
            var extraArg = {};
            if (item.contentId) {
                extraArg.contents = this._getPlaceholderContents(pageConfig, item.contentId);
            }
            args.push(extraArg);

            templateCfg.args = args;
            if (item.module) {
                var module = this._rootModule.getPageModule(this.currentPageId, item.module);
                templateCfg.moduleCtrl = module;
                this._modulesInPage.push(module);
            }
            if (item.data) {
                templateCfg.data = item.data;
            }
            return templateCfg;
        }
964437
def determine_actions(self, request, view):
        """"""
        from rest_framework.generics import GenericAPIView
        actions = {}
        excluded_methods = {'HEAD', 'OPTIONS', 'PATCH', 'DELETE'}
        for method in set(view.allowed_methods) - excluded_methods:
            view.request = clone_request(request, method)
            try:
                if isinstance(view, GenericAPIView):
                    has_object = view.lookup_url_kwarg or view.lookup_field in view.kwargs
                elif method in {'PUT', 'POST'}:
                    has_object = method in {'PUT'}
                else:
                    continue
                # Test global permissions
                if hasattr(view, 'check_permissions'):
                    view.check_permissions(view.request)
                # Test object permissions
                if has_object and hasattr(view, 'get_object'):
                    view.get_object()
            except (exceptions.APIException, PermissionDenied, Http404):
                pass
            else:
                # If user has appropriate permissions for the view, include
                # appropriate metadata about the fields that should be supplied.
                serializer = view.get_serializer()
                actions[method] = self.get_serializer_info(serializer)
            finally:
                view.request = request

        return actions
490734
private AFTPClient actionExistsDir() throws PageException, IOException {
	required("directory", directory);

	AFTPClient client = getClient();
	boolean res = existsDir(client, directory);
	Struct cfftp = writeCfftp(client);

	cfftp.setEL(RETURN_VALUE, Caster.toBoolean(res));
	cfftp.setEL(SUCCEEDED, Boolean.TRUE);

	stoponerror = false;
	return client;
    }
164543
public static String getToken(HttpServletRequest request, String action)
    {
        FlowController flowController = PageFlowUtils.getCurrentPageFlow(request);

        if (flowController != null) {
            MappingAndController mac = getActionMapping(request, flowController, action);
            if (mac != null) return getToken(request, mac.mapping);
        }

        return null;
    }
826988
public static ModuleConfig ensureModuleConfig( String modulePath, ServletContext context )
    {
        try
        {
            ModuleConfig ret = getModuleConfig( modulePath, context );

            if ( ret != null )
            {
                return ret;
            }
            else
            {
                ActionServlet as = getActionServlet( context );

                if ( as instanceof AutoRegisterActionServlet )
                {
                    return ( ( AutoRegisterActionServlet ) as ).ensureModuleRegistered( modulePath );
                }
            }
        }
        catch ( IOException e )
        {
            _log.error( "Error while registering Struts module " + modulePath, e );
        }
        catch ( ServletException e )
        {
            _log.error( "Error while registering Struts module " + modulePath, e );
        }

        return null;
    }
267545
protected void processForwardConfig( HttpServletRequest request, HttpServletResponse response, ForwardConfig fwd )
            throws IOException, ServletException
    {
        ServletContext servletContext = getServletContext();
        ForwardRedirectHandler fwdRedirectHandler = _handlers.getForwardRedirectHandler();
        FlowController fc = PageFlowRequestWrapper.get( request ).getCurrentFlowController();
        FlowControllerHandlerContext context = new FlowControllerHandlerContext( request, response, fc );

        // Register this module as the one that's handling the action.
        if ( fc != null )
        {
            InternalUtils.setForwardingModule( request, fc.getModulePath() );
        }

        //
        // The following is similar to what's in super.processForwardConfig(), but it avoids putting
        // a slash in front of absolute URLs (e.g., ones that start with "http:").
        //
        if ( fwd != null )
        {
            if ( LOG.isDebugEnabled() ) LOG.debug( "processForwardConfig(" + fwd + ')' );

            //
            // Try to process a tiles definition. If the forward doesn't contain a
            // a tiles definition, continue on.
            //
            if ( processTilesDefinition( fwd.getPath(), fwd.getContextRelative(), request, response ) )
            {
                if ( log.isDebugEnabled() )
                {
                    log.debug( "  '" + fwd.getPath() + "' - processed as definition" );
                }
                return;
            }

            //
            // If this is a "special" page flow forward, create a Forward to handle it and pass
            // it to the current page flow.  This should only happen when processValidate()
            // calls this method (or if a plain Struts action forwards to this forward) --
            // otherwise, the page flow should be using a Forward already.
            //
            if ( fwd instanceof PageFlowActionForward )
            {
                ActionMapping mapping = ( ActionMapping ) request.getAttribute( Globals.MAPPING_KEY );
                assert mapping != null;
                ActionForm form = InternalUtils.getFormBean( mapping, request );
                Forward pfFwd = new Forward( ( ActionForward ) fwd, servletContext );
                ActionForwardHandler handler = _handlers.getActionForwardHandler();
                fwd = handler.processForward( context, pfFwd, mapping, null, InternalUtils.getActionName( mapping ),
                                              null, form );
            }

            String path = fwd.getPath();
            boolean startsWithSlash = path.length() > 0 && path.charAt( 0 ) == '/';

            //
            // If the URI is absolute (e.g., starts with "http:"), do a redirect to it no matter what.
            //
            if ( FileUtils.isAbsoluteURI( path ) )
            {
                fwdRedirectHandler.redirect( context, addScopeParams( path, request ) );
            }
            else if ( fwd.getRedirect() )
            {
                String redirectURI;

                if ( startsWithSlash && fwd instanceof Forward && ( ( Forward ) fwd ).isExplicitPath() )
                {
                    redirectURI = path;
                }
                else if ( fwd instanceof Forward && ( ( Forward ) fwd ).isExternalRedirect() )
                {
                    assert startsWithSlash : path; // compiler should ensure path starts with '/'
                    redirectURI = path;
                }
                else
                {
                    redirectURI = request.getContextPath() + RequestUtils.forwardURL( request, fwd );
                }

                fwdRedirectHandler.redirect( context, addScopeParams( redirectURI, request ) );
            }
            else
            {
                String fwdURI;

                if ( startsWithSlash && fwd instanceof Forward && ( ( Forward ) fwd ).isExplicitPath() )
                {
                    fwdURI = path;
                }
                else
                {
                    fwdURI = RequestUtils.forwardURL( request, fwd );

                    //
                    // First, see if the current module is a Shared Flow module.  If so, unless this is a forward to
                    // another action in the shared flow, we need to translate the local path so it makes sense (strip
                    // off the shared flow module prefix "/-" and replace it with "/").
                    //
                    ModuleConfig mc = ( ModuleConfig ) request.getAttribute( Globals.MODULE_KEY );

                    if ( InternalUtils.isSharedFlowModule( mc ) && ! fwdURI.endsWith( ACTION_EXTENSION )
                         && fwdURI.startsWith( SHARED_FLOW_MODULE_PREFIX ) )
                    {
                        fwdURI = '/' + fwdURI.substring( SHARED_FLOW_MODULE_PREFIX_LEN );
                    }
                }

                doForward( fwdURI, request, response );
            }
        }
    }
832038
public static ActionConfig findActionConfig( String actionConfigPath, String modulePath, ServletContext context )
    {
        ModuleConfig moduleConfig = getModuleConfig( modulePath, context );
        assert moduleConfig != null;
        return moduleConfig.findActionConfig( actionConfigPath );
    }
320720
public static String getModulePathFromReqAttr( HttpServletRequest request )
    {
        //
        // If a config was in the request, use its associated prefix; otherwise, fall back to the URI.
        //
        ModuleConfig config = ( ModuleConfig ) request.getAttribute( Globals.MODULE_KEY );
        return config != null ? config.getPrefix() : PageFlowUtils.getModulePath( request );
    }
762569
function callAction(request, response, callback) {
    if (typeof callback == 'function') {
      return Promive.resolve()
        .then(callback.bind(null, request, response));
    }

    try {
      var Action = require(ACTION_PATH + '/' + callback.action + '.js');
    } catch (error) {
      if (error.message == 'Cannot find module \'' + ACTION_PATH + '/' + callback.action + '.js\'') {
        return Promise.reject('Action ' + callback.action + ' does not exist.')
          .catch(this.onPageNotFound.bind(this, request, response));
      }
      return Promise.reject(error)
        .catch(this.onError.bind(this, request, response));
    }

    var instance = new Action(request, response);
    // Test if method exists
    if (!instance[callback.method]) {
      return Promise.reject(new Error('Method "' + callback.method + '" not found in action "' + callback.action + '"'));
    }

    var promise = Promise.resolve();
    if (instance.init && 'function' == typeof instance.init) {
      promise = promise.then(function () {
        return instance.init();
      });
    }

    promise = promise.then(function () {
      return instance[callback.method].apply(instance, callback.arguments);
    });

    if (instance.onError && 'function' == typeof instance.onError) {
      promise = promise.catch(function (error) {
        return instance.onError.call(instance, error)
      });
    }

    promise = promise.catch(this.onError.bind(this, request, response));

    return promise;
  }
209212
def action(action_callback=None, **kwargs):
    

    if action_callback is None:
        return lambda fn: action(fn, **kwargs)
    else:
        return Action(action_callback, **kwargs).decorate_module(action_callback)
180956
def is_relevant(self, action, subject):
        
        return self.matches_action(action) and self.matches_subject(subject)