Package org.apache.cocoon.environment

Examples of org.apache.cocoon.environment.Redirector


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

        // Need redirector in any case
        Redirector redirector = context.getRedirector();

        // If the continuation id is not null, it takes precedence over
        // the function call, so we invoke it here.
        String continuation = continuationId.resolve(context, env.getObjectModel());
        if (continuation != null && continuation.length() > 0) {
            try {
                interpreter.handleContinuation(continuation, params, redirector);
            } catch(Exception e) {
                throw ProcessingException.throwLocated("Sitemap: error calling continuation", e, getLocation());
            }
            if (!redirector.hasRedirected()) {
                throw new ProcessingException("Sitemap: <map:call continuation> did not send a response", getLocation());
            }
            return true;
        }

        // We don't have a continuation id passed in <map:call>, so invoke
        // the specified function
        String name = functionName.resolve(context, env.getObjectModel());
        if (name != null && name.length() > 0) {
            try {
                interpreter.callFunction(name, params, redirector);
            } catch(Exception e) {
                throw ProcessingException.throwLocated("Sitemap: error calling function '" + name + "'", e, getLocation());
            }
            if (!redirector.hasRedirected()) {
                throw new ProcessingException("Sitemap: <map:call function> did not send a response", getLocation());
            }
            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 = context.getRedirector();
        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 new Parameters object, 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 succeeded : process children if there are some, with the action result
View Full Code Here

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

        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

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

        // Need redirector in any case
        Redirector redirector = context.getRedirector();

        // If the continuation id is not null, it takes precedence over
        // the function call, so we invoke it here.
        String continuation = continuationId.resolve(context, env.getObjectModel());
        if (continuation != null && continuation.length() > 0) {
            try {
                interpreter.handleContinuation(continuation, params, redirector);
            } catch(Exception e) {
                throw ProcessingException.throwLocated("Sitemap: error calling continuation", e, getLocation());
            }
            if (!redirector.hasRedirected()) {
                throw new ProcessingException("Sitemap: <map:call continuation> did not send a response", getLocation());
            }
            return true;
        }

        // We don't have a continuation id passed in <map:call>, so invoke
        // the specified function
        String name = functionName.resolve(context, env.getObjectModel());
        if (name != null && name.length() > 0) {
            try {
                interpreter.callFunction(name, params, redirector);
            } catch(Exception e) {
                throw ProcessingException.throwLocated("Sitemap: error calling function '" + name + "'", e, getLocation());
            }
            if (!redirector.hasRedirected()) {
                throw new ProcessingException("Sitemap: <map:call function> did not send a response", getLocation());
            }
            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 = context.getRedirector();
        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 new Parameters object, 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 succeeded : process children if there are some, with the action result
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

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

        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

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.