Examples of Redirector


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) {
            interpreter.handleContinuation(continuation, params, redirector);
            if (!redirector.hasRedirected()) {
                throw new ProcessingException("<map:call continuation> did not send a response, at " +
                                              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) {
            interpreter.callFunction(name, params, redirector);
            if (!redirector.hasRedirected()) {
                throw new ProcessingException("<map:call function> did not send a response, at " +
                                              getLocation());
            }
            return true;
        }
View Full Code Here

Examples of org.apache.cocoon.environment.Redirector

        // 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 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

Examples of org.apache.cocoon.environment.Redirector

        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

Examples of org.apache.cocoon.environment.Redirector

     * @see org.apache.forrest.locationmap.lm.AbstractNode#locate(java.util.Map, org.apache.cocoon.components.treeprocessor.InvokeContext)
     */
    public String locate(Map objectModel, InvokeContext context) throws Exception {
        this.resolver = (SourceResolver)CocoonComponentManager.getCurrentEnvironment();
        Parameters parameters = resolveParameters(context,objectModel);
        Redirector redirector = context.getRedirector();
        m_src = m_varResolver.resolve(context,objectModel);
       
        Map substitutions = m_action.act(redirector, resolver, objectModel, m_src, parameters);
        if (substitutions != null) {
            if (getLogger().isDebugEnabled()) {
View Full Code Here

Examples of org.apache.cocoon.environment.Redirector

        if (SourceUtil.indexOfSchemeColon(uri) == -1) {
            uri = "cocoon:/" + uri;
            Map objectModel = environment.getObjectModel();
            FlowHelper.setWebContinuation(objectModel, continuation);
            FlowHelper.setContextObject(objectModel, bizData);
            Redirector redirector = PipelinesNode.getRedirector(environment);
            if (redirector.hasRedirected()) {
                throw new IllegalStateException("Pipeline has already been processed for this request");
            }
            redirector.redirect(false, uri);
        } else {
            throw new Exception("uri is not allowed to contain a scheme (cocoon:/ is always automatically used)");
        }
    }
View Full Code Here

Examples of org.apache.cocoon.environment.Redirector

        // 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 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

Examples of org.apache.cocoon.environment.Redirector

    public final boolean invoke(Environment env, InvokeContext context)
      throws Exception {

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

        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

Examples of org.apache.cocoon.environment.Redirector

     */
    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);
        List           mapStack       = context.getMapStack();

        String cocoonAction = env.getAction();

View Full Code Here

Examples of org.apache.cocoon.environment.Redirector

            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

Examples of org.apache.cocoon.environment.Redirector

     * @see org.apache.forrest.locationmap.lm.AbstractNode#locate(java.util.Map, org.apache.cocoon.components.treeprocessor.InvokeContext)
     */
    public String locate(Map objectModel, InvokeContext context) throws Exception {
        this.resolver = (SourceResolver)m_manager.lookup(SourceResolver.ROLE);
        Parameters parameters = resolveParameters(context,objectModel);
        Redirector redirector = context.getRedirector();
        m_src = m_varResolver.resolve(context,objectModel);
       
        Map substitutions = m_action.act(redirector, resolver, objectModel, m_src, parameters);
        if (substitutions != null) {
            if (getLogger().isDebugEnabled()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.