Package org.apache.cocoon.bean.helpers

Examples of org.apache.cocoon.bean.helpers.DelayedOutputStream


            linkCount = translatedLinks.size();
        }

        try {
            // Process URI
            DelayedOutputStream output = new DelayedOutputStream();
            try {
                status =
                    getPage(
                        deparameterizedURI,
                        getLastModified(target, filename),
                        parameters,
                        confirmExtension ? translatedLinks : null,
                        gatheredLinks,
                        output);

                if (status >= 400) {
                    throw new ProcessingException(
                        "Resource not found: " + status);
                }

                if (followLinks && !confirmExtension) {
                    for (Iterator it = gatheredLinks.iterator();
                        it.hasNext();
                        ) {
                        String link = (String) it.next();
                        if (link.startsWith("?")) {
                            link = pageURI + link;
                        }
                        String absoluteLink =
                            NetUtils.normalize(NetUtils.absolutize(path, link));
                        {
                            final TreeMap p = new TreeMap();
                            absoluteLink =
                                NetUtils.parameterize(
                                    NetUtils.deparameterize(absoluteLink, p),
                                    p);
                        }
                        if (isIncluded(absoluteLink)) {
                            absoluteLinks.add(absoluteLink);
                        } else {
                            // @TODO@ Log/report skipped link
                        }
                    }
                    linkCount = gatheredLinks.size();
                }

                pageGenerated(uri, linkCount, 0); // @todo@ get the number of pages remaining here
            } catch (ProcessingException pe) {
                output.close();
                output = null;
                this.resourceUnavailable(target, uri, filename);
                this.sendBrokenLinkWarning(
                    filename,
                    DefaultNotifyingBuilder.getRootCause(pe).getMessage());
            } finally {
                if (output != null && status != -1) {

                    ModifiableSource source = getSource(target, filename);
                    try {
                        OutputStream stream = source.getOutputStream();

                        output.setFileOutputStream(stream);
                        output.flush();
                        output.close();
                    } catch (IOException ioex) {
                        log.warn(ioex.toString());
                    } finally {
                        releaseSource(source);
                    }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.bean.helpers.DelayedOutputStream

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.