cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gkossakow...@apache.org
Subject svn commit: r640475 - /cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/excalibur/sourceresolve/jnet/source/SourceURLConnection.java
Date Mon, 24 Mar 2008 17:26:25 GMT
Author: gkossakowski
Date: Mon Mar 24 10:26:23 2008
New Revision: 640475

URL: http://svn.apache.org/viewvc?rev=640475&view=rev
Log:
Implemented returning of wrapped Source object by getContent() method.

Modified:
    cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/excalibur/sourceresolve/jnet/source/SourceURLConnection.java

Modified: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/excalibur/sourceresolve/jnet/source/SourceURLConnection.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/excalibur/sourceresolve/jnet/source/SourceURLConnection.java?rev=640475&r1=640474&r2=640475&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/excalibur/sourceresolve/jnet/source/SourceURLConnection.java
(original)
+++ cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/excalibur/sourceresolve/jnet/source/SourceURLConnection.java
Mon Mar 24 10:26:23 2008
@@ -144,21 +144,25 @@
         if ( !this.connected ) {
             this.connect();
         }
-        if ( this.source instanceof XMLizable && classes != null) {
-            boolean found = false;
-            int index = 0;
-            while ( !found && index < classes.length ) {
-                if ( classes[index].getName().equals(SAXResult.class.getName())) {
-                    found = true;
-                } else {
-                    index++;
-                }
-            }
-            if ( found ) {
-                return new SourceSAXResult(this.factory, this.source, (XMLizable)this.source);
-            }
+        if (this.source instanceof XMLizable && classes != null && containsClass(classes,
SAXResult.class)) {
+            return new SourceSAXResult(this.factory, this.source, (XMLizable)this.source);
+        } else if (containsClass(classes, Source.class)) {
+            return this.source;
         }
         return super.getContent(classes);
+    }
+    
+    private boolean containsClass(Class[] classes, Class classToBeFound) {
+        boolean found = false;
+        int index = 0;
+        while ( !found && index < classes.length ) {
+            if ( classes[index].getName().equals(classToBeFound.getName())) {
+                found = true;
+            } else {
+                index++;
+            }
+        }
+        return found;
     }
 
 }



Mime
View raw message