[Yanel-commits] rev 25357 - public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources

michi at wyona.com michi at wyona.com
Sun Jun 24 14:09:48 CEST 2007


Author: michi
Date: 2007-06-24 14:09:47 +0200 (Sun, 24 Jun 2007)
New Revision: 25357

Modified:
   public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java
Log:
error messages improved and viewable v2 implemented

Modified: public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java
===================================================================
--- public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java	2007-06-24 11:38:36 UTC (rev 25356)
+++ public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java	2007-06-24 12:09:47 UTC (rev 25357)
@@ -208,13 +208,12 @@
     }
 
     /**
-     *
+     * Get initial content as XML
      */
     private InputStream getContentXML(Repository repo, String yanelPath, String revisionName) throws Exception {
         if (yanelPath != null) {
             log.debug("Yanel Path: " + yanelPath);
-            Resource res = yanel.getResourceManager().getResource(getRequest(), getResponse(), 
-                    getRealm(), yanelPath);
+            Resource res = yanel.getResourceManager().getResource(getRequest(), getResponse(), getRealm(), yanelPath);
             if (ResourceAttributeHelper.hasAttributeImplemented(res, "Viewable", "1")) {
                 // TODO: Pass the request ...
                 String viewV1path = getRealm().getMountPoint() + yanelPath.substring(1);
@@ -224,11 +223,21 @@
                     // TODO: Shall the mime-type be transfered?
                     return view.getInputStream();
                 } else {
-                    log.warn("No XML like mime-type: " + getPath());
+                    log.error("No XML like mime-type: " + getPath() + " (yanel-path: " + yanelPath + ")");
                 }
+	    } else if (ResourceAttributeHelper.hasAttributeImplemented(res, "Viewable", "2")) {
+                // TODO: Pass the request ...
+                View view = ((ViewableV2) res).getView(null);
+                if (view.getMimeType().indexOf("xml") >= 0) {
+                    // TODO: Shall the mime-type be transfered?
+                    return view.getInputStream();
+                } else {
+                    log.error("No XML like mime-type: " + getPath() + " (yanel-path: " + yanelPath + ")");
+                }
             } else {
-                log.warn("Resource is not ViewableV1: " + getPath());
+                log.error("Resource is not ViewableV1: " + getPath() + " (yanel-path: " + yanelPath + ")");
             }
+            return null;
         }
         
         Node node;




More information about the Yanel-commits mailing list