You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by gi...@apache.org on 2007/09/28 13:44:45 UTC
svn commit: r580317 -
/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/source/util/SourceUtil.java
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.
- *
- * <p><b>NOTE</b>: If the implementation can produce lexical events,
- * care should be taken that <code>handler</code> can actually
- * directly implement the LexicalHandler interface!</p>
- *
- * @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.
+ *
+ * <p><b>NOTE</b>: If the implementation can produce lexical events,
+ * care should be taken that <code>handler</code> can actually
+ * directly implement the LexicalHandler interface!</p>
+ *
+ * @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.
+ *
+ * <p><b>NOTE</b>: If the implementation can produce lexical events,
+ * care should be taken that <code>handler</code> can actually
+ * directly implement the LexicalHandler interface!</p>
+ *
+ * @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.