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

michi at wyona.com michi at wyona.com
Tue Feb 13 15:33:42 CET 2007


Author: michi
Date: 2007-02-13 15:33:41 +0100 (Tue, 13 Feb 2007)
New Revision: 22615

Modified:
   public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java
Log:
source view added

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-02-13 14:32:14 UTC (rev 22614)
+++ public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java	2007-02-13 14:33:41 UTC (rev 22615)
@@ -82,7 +82,13 @@
      *
      */
     public ViewDescriptor[] getViewDescriptors() {
-        return null;
+        ViewDescriptor[] vd = new ViewDescriptor[2];
+        vd[0] = new ViewDescriptor("default");
+        // NOTE: depends on XSLT ...
+        vd[0].setMimeType(null);
+        vd[1] = new ViewDescriptor("source");
+        vd[1].setMimeType("application/xml");
+        return vd;
     }
 
     public View getView(String viewId) throws Exception {
@@ -100,11 +106,16 @@
         String yanelPath = getResourceConfigProperty("yanel-path");
         //if (yanelPath == null) yanelPath = path.toString();
 
-        String xsltPath = getXSLTPath(getPath());
-
         try {
             Repository repo = getRealm().getRepository();
 
+            if (viewId != null && viewId.equals("source")) {
+                defaultView.setInputStream(getContentXML(repo, yanelPath, revisionName));
+                defaultView.setMimeType("application/xml");
+                return defaultView;
+            }
+
+            String xsltPath = getXSLTPath(getPath());
             if (xsltPath != null) {
                 TransformerFactory tf = TransformerFactory.newInstance();
                 //tf.setURIResolver(null);
@@ -424,6 +435,7 @@
      *
      */
     public void create(HttpServletRequest request) {
+        // TODO: XHTML template should not be hardcoded!
         try {
             Repository repo = getRealm().getRepository();
             Writer writer = new java.io.OutputStreamWriter(repo.getNode(getPath()).getOutputStream());
@@ -440,7 +452,6 @@
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
-        log.warn("Not implemented yet!");
     }
 
     /**




More information about the Yanel-commits mailing list