[Yanel-commits] rev 21242 - public/yanel/trunk/src/contributions/resources/calendar/src/java/org/wyona/yanel/impl/resources

michi at wyona.com michi at wyona.com
Fri Dec 29 10:19:01 CET 2006


Author: michi
Date: 2006-12-29 10:19:00 +0100 (Fri, 29 Dec 2006)
New Revision: 21242

Modified:
   public/yanel/trunk/src/contributions/resources/calendar/src/java/org/wyona/yanel/impl/resources/CalendarResource.java
Log:
use properties

Modified: public/yanel/trunk/src/contributions/resources/calendar/src/java/org/wyona/yanel/impl/resources/CalendarResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/calendar/src/java/org/wyona/yanel/impl/resources/CalendarResource.java	2006-12-29 09:18:32 UTC (rev 21241)
+++ public/yanel/trunk/src/contributions/resources/calendar/src/java/org/wyona/yanel/impl/resources/CalendarResource.java	2006-12-29 09:19:00 UTC (rev 21242)
@@ -58,7 +58,11 @@
         log.error("DEBUG: " + categories + " " + classes + " " + userIds);
 
         org.wyona.yarep.core.Repository dataRepo = getRealm().getRepository();
-        org.wyona.yarep.core.Path[] children = dataRepo.getChildren(new org.wyona.yarep.core.Path(getPath().toString()));
+        String eventsPath = getRTI().getProperty("events-path");
+        if (eventsPath == null) {
+            eventsPath = getPath().toString();
+        }
+        org.wyona.yarep.core.Path[] children = dataRepo.getChildren(new org.wyona.yarep.core.Path(eventsPath));
         //org.wyona.yarep.core.Path[] children = dataRepo.search("categories", categories);
 
         StringBuffer calendar = new StringBuffer("<?xml version=\"1.0\"?>\n<calendar>");
@@ -96,7 +100,6 @@
             return view;
         } else {
             String xslt = getRTD().getConfigFile().getParent() + File.separator + "xslt" + File.separator + "xml2ics.xsl";
-            log.error("DEBUG: XSLT: " + xslt);
             java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();
             try {
                 Transformer transformer = TransformerFactory.newInstance().newTransformer(new StreamSource(new File(xslt)));
@@ -109,7 +112,12 @@
 
             View view = new View();
             //view.setResponse(false);
-	    view.setMimeType("text/plain");
+            String mimeType = getRTI().getProperty("mime-type");
+            if (mimeType != null) {
+	        view.setMimeType(mimeType);
+	    } else {
+	        view.setMimeType("text/calendar");
+            }
 	    view.setInputStream(new java.io.ByteArrayInputStream(out.toByteArray()));
             return view;
         }




More information about the Yanel-commits mailing list