Package org.apache.cocoon

Examples of org.apache.cocoon.Processor


        this.hasRedirected = true;
    }

    private void cocoonRedirect(boolean sessionMode, String uri)
    throws IOException, ProcessingException {
        Processor actualProcessor = null;
        try {
            boolean rawMode = false;
            String prefix;

            // remove the protocol
            int protocolEnd = uri.indexOf(':');
            if (protocolEnd != -1) {
                uri = uri.substring(protocolEnd + 1);
                // check for subprotocol
                if (uri.startsWith("raw:")) {
                    uri = uri.substring(4);
                    rawMode = true;
                }
            }

            Processor usedProcessor;

            // Does the uri point to this sitemap or to the root sitemap?
            if (uri.startsWith("//")) {
                uri = uri.substring(2);
                prefix = ""; // start at the root
                try {
                    actualProcessor = (Processor)this.manager.lookup(Processor.ROLE);
                    usedProcessor = actualProcessor;
                } catch (ComponentException e) {
                    throw new ProcessingException("Cannot get Processor instance", e);
                }

            } else if (uri.startsWith("/")) {
                prefix = null; // means use current prefix
                uri = uri.substring(1);
                usedProcessor = this.processor;

            } else {
                throw new ProcessingException("Malformed cocoon URI.");
            }

            // create the queryString (if available)
            String queryString = null;
            int queryStringPos = uri.indexOf('?');
            if (queryStringPos != -1) {
                queryString = uri.substring(queryStringPos + 1);
                uri = uri.substring(0, queryStringPos);
            }

            // build the request uri which is relative to the context
            String requestURI = (prefix == null ? env.getURIPrefix() + uri : uri);

            ForwardEnvironmentWrapper newEnv =
                new ForwardEnvironmentWrapper(env, requestURI, queryString, getLogger(), rawMode);
            newEnv.setURI(prefix, uri);

            boolean processingResult;

            // FIXME - What to do here?
            Object processKey = CocoonComponentManager.startProcessing(newEnv);
            try {
               
                if ( !this.internal ) {
                    processingResult = usedProcessor.process(newEnv);
                } else {
                    ProcessingPipeline pp = usedProcessor.processInternal(newEnv);
                    if (pp != null) pp.release();
                    processingResult = pp != null;
                }
            } finally {
                CocoonComponentManager.endProcessing(newEnv, processKey);
View Full Code Here


    wrapper.setAttribute("bean-dict", biz);

    // Attermpt to start processing the wrapper environment
    Object key = CocoonComponentManager.startProcessing(wrapper);

    Processor processor = null;
    boolean result = false;
    try {
        // Retrieve a processor instance
        processor = (Processor)this.manager.lookup(Processor.ROLE);

        // Enter the environment
        CocoonComponentManager.enterEnvironment(wrapper, this.manager, processor);

        // Process the subrequest
        result = processor.process(wrapper);
        wrapper.commitResponse();
        out.flush();

        // Return whatever the processor returned us
        return(result);
View Full Code Here

        }

        // does the uri point to this sitemap or to the root sitemap?
        if (uri.startsWith("//")) {
            uri = uri.substring(2);
            Processor processor = null;
            try {
                processor = (Processor)this.manager.lookup(Processor.ROLE);
            } catch (ComponentException e) {
                throw new ProcessingException("Cannot get Processor instance", e);
            }
View Full Code Here

        }

        // does the uri point to this sitemap or to the root sitemap?
        if (uri.startsWith("//")) {
            uri = uri.substring(2);
            Processor processor = null;
            try {
                processor = (Processor)this.manager.lookup(Processor.ROLE);
            } catch (ComponentException e) {
                throw new ProcessingException("Cannot get Processor instance", e);
            }
View Full Code Here

        wrapper.setAttribute("bean-dict", biz);

        // Attermpt to start processing the wrapper environment
        Object key = CocoonComponentManager.startProcessing(wrapper);

        Processor processor = null;
        boolean result = false;
        try {
            // Retrieve a processor instance
            processor = (Processor)this.manager.lookup(Processor.ROLE);

            // Enter the environment
            CocoonComponentManager.enterEnvironment(wrapper, this.manager, processor);

            // Process the subrequest
            result = processor.process(wrapper);
            wrapper.commitResponse();
            out.flush();

            // Return whatever the processor returned us
            return(result);
View Full Code Here

       
        // enter & leave environment, as a manager is looked up using
        // the processing context stack
        MockEnvironment env = new
        MockEnvironment(null);
        Processor processor = (Processor)this.manager.lookup(Processor.ROLE);
       
        CocoonComponentManager.enterEnvironment(
        env, this.manager, processor);
       
        assertEqual( load(result),
View Full Code Here

       
        // enter & leave environment, as a manager is looked up using
        // the processing context stack
        MockEnvironment env = new
        MockEnvironment(null);
        Processor processor = (Processor)this.manager.lookup(Processor.ROLE);
       
        CocoonComponentManager.enterEnvironment(
        env, this.manager, processor);
       
        assertEqual( load(result),
View Full Code Here

       
        // enter & leave environment, as a manager is looked up using
        // the processing context stack
        MockEnvironment env = new
        MockEnvironment(null);
        Processor processor = (Processor)this.manager.lookup(Processor.ROLE);
       
        CocoonComponentManager.enterEnvironment(
        env, this.manager, processor);
       
        assertEqual( load(result),
View Full Code Here

       
        // enter & leave environment, as a manager is looked up using
        // the processing context stack
        MockEnvironment env = new
        MockEnvironment(null);
        Processor processor = (Processor)this.manager.lookup(Processor.ROLE);
       
        CocoonComponentManager.enterEnvironment(
        env, this.manager, processor);
       
        assertEqual( load(result),
View Full Code Here

       
        // enter & leave environment, as a manager is looked up using
        // the processing context stack
        MockEnvironment env = new
        MockEnvironment(null);
        Processor processor = (Processor)this.manager.lookup(Processor.ROLE);
       
        CocoonComponentManager.enterEnvironment(
        env, this.manager, processor);
       
        assertEqual( load(result),
View Full Code Here

TOP

Related Classes of org.apache.cocoon.Processor

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.