Package org.apache.cocoon.environment

Examples of org.apache.cocoon.environment.Redirector


            this.sitemapExecutor.enterSitemap(this, environment.getObjectModel(), this.wrappingProcessor.source.getURI());

            // and now process
            EnvironmentHelper.enterProcessor(this, environment);
            final Redirector oldRedirector = context.getRedirector();
            try {
                // Build a redirector
                TreeProcessorRedirector redirector = new TreeProcessorRedirector(environment, context);
                context.setRedirector(redirector);
                context.service(this.manager);
View Full Code Here


                newParams.merge(callerParams);
                resolvedParams = newParams;
            }
        }

        Redirector redirector = context.getRedirector();
        SourceResolver resolver = EnvironmentHelper.getCurrentProcessor().getSourceResolver();

        try {
            Action action = (Action) getComponent();
            Map actionResult;
            try {
                actionResult = this.executor.invokeAction(this,
                                                          objectModel,
                                                          action,
                                                          redirector,
                                                          resolver,
                                                          resolvedSource,
                                                          resolvedParams);
            } finally {
                releaseComponent(action);
            }

            if (redirector.hasRedirected()) {
                return true;
            }

            if (actionResult != null) {
                // Action succeeded : process children if there are some, with the action result
View Full Code Here

                                               env.getObjectModel(),
                                               resolvedURI,
                                               this.createSession,
                                               this.global,
                                               this.permanent);
        final Redirector redirector = context.getRedirector();

        if (this.global) {
            redirector.globalRedirect(this.createSession, resolvedURI);
        } else if (this.permanent && redirector instanceof PermanentRedirector) {
            ((PermanentRedirector) redirector).permanentRedirect(this.createSession, resolvedURI);
        } else {
            redirector.redirect(this.createSession, resolvedURI);
        }

        return true;
    }
View Full Code Here

            CocoonComponentManager.enterEnvironment(environment, this.sitemapComponentManager, this);

            Map objectModel = environment.getObjectModel();

            Object oldResolver = objectModel.get(ProcessingNode.OBJECT_SOURCE_RESOLVER);
              final Redirector oldRedirector = context.getRedirector();

              // Build a redirector
              TreeProcessorRedirector redirector = new TreeProcessorRedirector(environment, context);
              setupLogger(redirector);
              context.setRedirector(redirector);
View Full Code Here

    public Scriptable jsFunction_callAction(String type,
                                            String source,
                                            Scriptable parameters)
        throws Exception
    {
        Redirector redirector = new SitemapRedirector(this.environment);
        SourceResolver resolver = (SourceResolver)this.environment.getObjectModel()
            .get(OBJECT_SOURCE_RESOLVER);
        ComponentManager sitemapManager = CocoonComponentManager.getSitemapComponentManager();
        ComponentSelector actionSelector
            = (ComponentSelector)sitemapManager.lookup(Action.ROLE + "Selector");
View Full Code Here

    public void compose(ComponentManager manager) {
        this.manager = manager;
    }

    public boolean invoke(Environment env, InvokeContext context) throws Exception {
        Redirector redirector = PipelinesNode.getRedirector(env);
       
        List params = null;

        // Resolve parameters
        if (parameters != null)
            params = resolveList(parameters, manager, context, env.getObjectModel());

        String continuation;
        if (continuationResolver != null) {
            // Need to resolve the function name at runtime
            continuation = continuationResolver.resolve(context, env.getObjectModel());
        } else {
            continuation = continuationId;
        }

        // If the continuation id is not null, it takes precedence over
        // the function call, so we invoke it here.
        if (continuation != null) {
            interpreter.handleContinuation(continuation, params, env);
            // FIXME (SW) : is a flow allowed not to redirect ?
            // If not, we should throw a RNFE here.
            return redirector.hasRedirected();
        }

        // We don't have a continuation id passed in <map:call>, so invoke
        // the specified function

        String name;
        if (functionNameResolver != null) {
            // Need to resolve the function name at runtime
            name = functionNameResolver.resolve(context, env.getObjectModel());
        } else
            name = functionName;

        if (name != null) {
            interpreter.callFunction(name, params, env);
            // FIXME (SW) : is a flow allowed not to redirect ?
            return redirector.hasRedirected();
        }

        return false;
    }
View Full Code Here

      // Perform any common invoke functionality
      super.invoke(env, context);

        // Prepare data needed by the action
        Map            objectModel    = env.getObjectModel();
        Redirector     redirector     = PipelinesNode.getRedirector(env);
        SourceResolver resolver       = getSourceResolver(objectModel);
        String         resolvedSource = source.resolve(context, objectModel);
        Parameters     resolvedParams = VariableResolver.buildParameters(this.parameters, context, objectModel);

        Map actionResult;
       
        // If in action set, merge parameters
        if (inActionSet) {
            Parameters callerParams = (Parameters)env.getAttribute(ActionSetNode.CALLER_PARAMETERS);
            if (resolvedParams == Parameters.EMPTY_PARAMETERS) {
                // Just swap
                resolvedParams = callerParams;
            } else if (callerParams != Parameters.EMPTY_PARAMETERS) {
                // Build a new Parameters object since the both we hare are read-only
                Parameters newParams = new Parameters();
                // And merge both
                newParams.merge(resolvedParams);
                newParams.merge(callerParams);
                resolvedParams = newParams;
            }
        }

        // If action is ThreadSafe, avoid select() and try/catch block (faster !)
        if (this.threadSafeAction != null) {
            actionResult = this.threadSafeAction.act(
                redirector, resolver, objectModel, resolvedSource, resolvedParams);
        } else {
            Action action = (Action)this.selector.select(this.componentName);
            try {
                actionResult = action.act(
                redirector, resolver, objectModel, resolvedSource, resolvedParams);

            } finally {
                this.selector.release(action);
            }
        }

        if (redirector.hasRedirected()) {
            return true;
        }

        if (actionResult == null) {
            // Action failed
View Full Code Here

        if (getLogger().isInfoEnabled()) {
            getLogger().info("Redirecting to '" + resolvedURI + "' at " + this.getLocation());
        }

        final Redirector redirector = PipelinesNode.getRedirector(env);

        if( this.global ) {
            redirector.globalRedirect(this.createSession, resolvedURI);
        } else if (this.permanent && redirector instanceof PermanentRedirector) {
            ((PermanentRedirector)redirector).permanentRedirect(this.createSession, resolvedURI);
        } else {
            redirector.redirect(this.createSession, resolvedURI);
        }

        return true;
    }
View Full Code Here

      // Perform any common invoke functionality
      super.invoke(env, context);

        // Prepare data needed by the action
        Map            objectModel    = env.getObjectModel();
        Redirector     redirector     = PipelinesNode.getRedirector(env);
        SourceResolver resolver       = getSourceResolver(objectModel);
        String         resolvedSource = source.resolve(context, objectModel);
        Parameters     resolvedParams = VariableResolver.buildParameters(this.parameters, context, objectModel);

        Map actionResult;

        // If action is ThreadSafe, avoid select() and try/catch block (faster !)
        if (this.threadSafeAction != null) {
            actionResult = this.threadSafeAction.act(
                redirector, resolver, objectModel, resolvedSource, resolvedParams );

        } else {
            Action action = (Action)this.selector.select(this.componentName);
            try {
                actionResult = action.act(
                redirector, resolver, objectModel, resolvedSource, resolvedParams );

            } finally {
                this.selector.release(action);
            }
        }

        if (redirector.hasRedirected()) {
            return true;
        }

        if (actionResult == null) {
            // Action failed
View Full Code Here

     */
    public final Map call(Environment env, InvokeContext context, Parameters params) throws Exception {

        // Prepare data needed by the actions
        Map            objectModel    = env.getObjectModel();
        Redirector     redirector     = PipelinesNode.getRedirector(env);
        SourceResolver resolver       = getSourceResolver(objectModel);

        String cocoonAction = env.getAction();

        Map result = null;
View Full Code Here

TOP

Related Classes of org.apache.cocoon.environment.Redirector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.