Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 53685 invoked from network); 28 Sep 2007 11:45:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Sep 2007 11:45:09 -0000 Received: (qmail 75311 invoked by uid 500); 28 Sep 2007 11:44:59 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 75246 invoked by uid 500); 28 Sep 2007 11:44:59 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 75235 invoked by uid 99); 28 Sep 2007 11:44:59 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Sep 2007 04:44:59 -0700 X-ASF-Spam-Status: No, hits=-98.8 required=10.0 tests=ALL_TRUSTED,DNS_FROM_DOB,RCVD_IN_DOB X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Sep 2007 11:47:30 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6BC191A9832; Fri, 28 Sep 2007 04:44:45 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r580317 - /cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/source/util/SourceUtil.java Date: Fri, 28 Sep 2007 11:44:45 -0000 To: cvs@cocoon.apache.org From: giacomo@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20070928114445.6BC191A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: giacomo Date: Fri Sep 28 04:44:44 2007 New Revision: 580317 URL: http://svn.apache.org/viewvc?rev=580317&view=rev Log: added method needed by springified CForms Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/source/util/SourceUtil.java Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/source/util/SourceUtil.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/source/util/SourceUtil.java?rev=580317&r1=580316&r2=580317&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/source/util/SourceUtil.java (original) +++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/source/util/SourceUtil.java Fri Sep 28 04:44:44 2007 @@ -151,45 +151,78 @@ toSAX(manager, source, null, handler); } - /** - * Generates SAX events from the given source by using XMLizer. - * - *

NOTE: If the implementation can produce lexical events, - * care should be taken that handler can actually - * directly implement the LexicalHandler interface!

- * - * @param source the data - * @throws ProcessingException if no suitable converter is found - */ - public static void toSAX(ServiceManager manager, - Source source, - String mimeTypeHint, - ContentHandler handler) - throws SAXException, IOException, ProcessingException { - if (source instanceof XMLizable) { - toSAX((XMLizable) source, handler); - } else { - String mimeType = source.getMimeType(); - if (null == mimeType) { - mimeType = mimeTypeHint; - } - - XMLizer xmlizer = null; - try { - xmlizer = (XMLizer) manager.lookup(XMLizer.ROLE); - xmlizer.toSAX(source.getInputStream(), - mimeType, - source.getURI(), - handler); - } catch (SourceException e) { - throw SourceUtil.handle(e); - } catch (ServiceException e) { - throw new ProcessingException("Exception during streaming source.", e); - } finally { - manager.release(xmlizer); - } - } - } + /** + * Generates SAX events from the given source by using XMLizer. + * + *

NOTE: If the implementation can produce lexical events, + * care should be taken that handler can actually + * directly implement the LexicalHandler interface!

+ * + * @param source the data + * @throws ProcessingException if no suitable converter is found + */ + public static void toSAX(ServiceManager manager, + Source source, + String mimeTypeHint, + ContentHandler handler) + throws SAXException, IOException, ProcessingException { + if (source instanceof XMLizable) { + toSAX((XMLizable) source, handler); + } else { + String mimeType = source.getMimeType(); + if (null == mimeType) { + mimeType = mimeTypeHint; + } + + XMLizer xmlizer = null; + try { + xmlizer = (XMLizer) manager.lookup(XMLizer.ROLE); + xmlizer.toSAX(source.getInputStream(), + mimeType, + source.getURI(), + handler); + } catch (SourceException e) { + throw SourceUtil.handle(e); + } catch (ServiceException e) { + throw new ProcessingException("Exception during streaming source.", e); + } finally { + manager.release(xmlizer); + } + } + } + + /** + * Generates SAX events from the given source by using XMLizer. + * + *

NOTE: If the implementation can produce lexical events, + * care should be taken that handler can actually + * directly implement the LexicalHandler interface!

+ * + * @param source the data + * @throws ProcessingException if no suitable converter is found + */ + public static void toSAX(XMLizer xmlizer, + Source source, + String mimeTypeHint, + ContentHandler handler) + throws SAXException, IOException, ProcessingException { + if (source instanceof XMLizable) { + toSAX((XMLizable) source, handler); + } else { + String mimeType = source.getMimeType(); + if (null == mimeType) { + mimeType = mimeTypeHint; + } + try { + xmlizer.toSAX(source.getInputStream(), + mimeType, + source.getURI(), + handler); + } catch (SourceException e) { + throw SourceUtil.handle(e); + } + } + } /** * Generates character SAX events from the given source.