Examples of CachingOutputStream


Examples of com.volantis.shared.io.CachingOutputStream

            // Create the result.
            final OutputStream actualOutput;
            if (stepType.isLast() || logger.isDebugEnabled()) {
                // Caching a copy of the marshalled data for validation or dumping
                actualOutput = new CachingOutputStream(output);
            } else {
                actualOutput = output;
            }
            Result outputResult = new StreamResult(actualOutput);

            // Do the transform.
            Transformer transform = templates.newTransformer();
            transform.setErrorListener(new LoggingListener());
            transform.transform(inputSource, outputResult);

            // Dump the output of this migrator for debugging
            if (logger.isDebugEnabled()) {
                logger.debug("Output from migrator");

                CachingOutputStream cachedOutput =
                        ((CachingOutputStream) actualOutput);
                InputStream is = cachedOutput.getCacheInputStream();
                dumpStream(is);
            }

            if (stepType.isLast()) {
                // Do validation of the output.

                CachingOutputStream cachedOutput =
                        ((CachingOutputStream) actualOutput);
                InputStream reader = cachedOutput.getCacheInputStream();
                ContentInput content = new BinaryContentInput(reader);

                try {
                    outputSchemaValidator.validate(content);
                } catch (SAXException e) {
View Full Code Here

Examples of org.apache.cocoon.caching.CachingOutputStream

            try {
                OutputStream os = null;

                if (this.cacheCompleteResponse && this.toCacheKey != null) {
                    os = new CachingOutputStream(environment.getOutputStream(this.outputBufferSize));
                }

                if (super.serializer != super.lastConsumer) {
                    if (os == null) {
                        os = environment.getOutputStream(this.outputBufferSize);
View Full Code Here

Examples of org.apache.cocoon.caching.CachingOutputStream

                            }
                        }

                        if (readerValidity != null) {
                            outputStream = environment.getOutputStream(this.outputBufferSize);
                            outputStream = new CachingOutputStream(outputStream);
                        }
                    }

                    setMimeTypeForReader(environment);
                    if (this.reader.shouldSetContentLength()) {
View Full Code Here

Examples of org.apache.cocoon.caching.CachingOutputStream

            try {
                OutputStream os = null;

                if (this.cacheCompleteResponse && this.toCacheKey != null) {
                    os = new CachingOutputStream(environment.getOutputStream(this.outputBufferSize));
                }

                if (super.serializer != super.lastConsumer) {
                    if (os == null) {
                        os = environment.getOutputStream(this.outputBufferSize);
View Full Code Here

Examples of org.apache.cocoon.caching.CachingOutputStream

                        }
                    }

                    if (readerValidity != null) {
                        outputStream = environment.getOutputStream(this.outputBufferSize);
                        outputStream = new CachingOutputStream(outputStream);
                    } else {
                        pcKey = null;
                    }
                }
View Full Code Here

Examples of org.apache.cocoon.caching.CachingOutputStream

   
                        cachedData = baos.toByteArray();
                        environment.setContentLength(cachedData.length);
                        os.write(cachedData);
                    } else {
                        CachingOutputStream os = new CachingOutputStream( environment.getOutputStream(this.outputBufferSize) );
                        // set the output stream
                        this.serializer.setOutputStream( os );
                        this.generator.generate();
                       
                        cachedData = os.getContent();
                    }
   
                } else {
                    this.generator.generate();
                    cachedData = (byte[])this.xmlSerializer.getSAXFragment();
View Full Code Here

Examples of org.apache.cocoon.caching.CachingOutputStream

                    cachedData = baos.toByteArray();
                    environment.setContentLength(cachedData.length);
                    os.write(cachedData);
                } else {
                    final CachingOutputStream os = new CachingOutputStream( environment.getOutputStream(this.outputBufferSize) );
                    // set the output stream
                    this.reader.setOutputStream( os );
                    this.reader.generate();
                   
                    cachedData = os.getContent();
                }

                //
                // Now that we have processed the pipeline,
                // we do the actual caching
View Full Code Here

Examples of org.apache.cocoon.caching.CachingOutputStream

            }
            try {
                OutputStream os = null;
               
                if (this.cacheCompleteResponse && this.toCacheKey != null) {
                    os = new CachingOutputStream(environment.getOutputStream(
                            this.outputBufferSize));
                }
                if (super.serializer != super.lastConsumer) {
                    if (os == null) {
                        os = environment.getOutputStream(this.outputBufferSize);
View Full Code Here

Examples of org.apache.cocoon.caching.CachingOutputStream

                            }
                        }
                    }
                    if (readerValidity != null) {
                        outputStream = environment.getOutputStream(this.outputBufferSize);
                        outputStream = new CachingOutputStream(outputStream);
                    } else {
                        pcKey = null;
                    }
                }
View Full Code Here

Examples of org.apache.cocoon.caching.CachingOutputStream

     * @throws Exception - if pipeline is not available or returned OutputStream couldn't be closed
     *       
     */
    protected InputStream process(String uri) throws Exception {
        // use the CachingOutputStream because it buffers all bytes written
        CachingOutputStream os =
            new CachingOutputStream(new NullOutputStream());
        File c = new File(this.context.getRealPath("/"));
        BackgroundEnvironment env =
            new BackgroundEnvironment(uri, "", c, os, this.getLogger());
        process(uri, env);
        os.close();
        return new ByteArrayInputStream(os.getContent());
    }
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.