Package org.apache.cocoon

Examples of org.apache.cocoon.Processor


                    throw new CascadingRuntimeException("No context found", e);
                } catch (MalformedURLException e) {
                    // Unlikely to happen
                    throw new CascadingRuntimeException("Invalid URL", e);
                }
                Processor processor;
                try {
                    processor = (Processor) manager.lookup(Processor.ROLE);
                } catch (ServiceException e) {
                    throw new CascadingRuntimeException("No processor found", e);
                }
View Full Code Here


        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.buildPipeline(newEnv);
                    if (pp != null) pp.release();
                    processingResult = pp != null;
                }
            } finally {
                CocoonComponentManager.endProcessing(newEnv, processKey);
View Full Code Here

        FlowHelper.setContextObject(objectModel, 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

                    uri = uri.substring(4);
                    rawMode = true;
                }
            }
   
            Processor actualProcessor;
           
            // 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);
                } 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);
                actualProcessor = 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;
           
            if (this.eventPipe == null && this.streamPipe == null) {
                processingResult = actualProcessor.process(newEnv);
            } else {
                processingResult = actualProcessor.process(newEnv, this.streamPipe, this.eventPipe);
            }
           
            if (!processingResult) {
                throw new ProcessingException("Couldn't process URI " + requestURI);
            }
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.lookup(Processor.ROLE);
       
        CocoonComponentManager.enterEnvironment(
        env, new WrapperComponentManager(this.getManager()), 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.lookup(Processor.ROLE);
       
        CocoonComponentManager.enterEnvironment(
        env, new WrapperComponentManager(this.getManager()), 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.lookup(Processor.ROLE);
       
        CocoonComponentManager.enterEnvironment(
        env, new WrapperComponentManager(this.getManager()), 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.lookup(Processor.ROLE);
       
        CocoonComponentManager.enterEnvironment(
        env, new WrapperComponentManager(this.getManager()), 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.lookup(Processor.ROLE);
       
        CocoonComponentManager.enterEnvironment(
        env, new WrapperComponentManager(this.getManager()), 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.lookup(Processor.ROLE);
       
        CocoonComponentManager.enterEnvironment(
        env, new WrapperComponentManager(this.getManager()), 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.