You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2005/10/13 23:40:00 UTC

svn commit: r320930 - in /incubator/roller/branches/roller_2.0: metadata/xdoclet/ sandbox/atomprotocol/src/org/roller/presentation/atomapi/ src/org/roller/presentation/velocity/ web/WEB-INF/ web/WEB-INF/classes/ web/WEB-INF/classes/flavors/ web/images/

Author: snoopdave
Date: Thu Oct 13 14:39:54 2005
New Revision: 320930

URL: http://svn.apache.org/viewcvs?rev=320930&view=rev
Log:
Made Atom feed available at /atom, added  atommacros.vm, fixed category specific Atom feeds

Added:
    incubator/roller/branches/roller_2.0/web/WEB-INF/classes/atommacros.vm
    incubator/roller/branches/roller_2.0/web/images/atombadge.jpeg   (with props)
Modified:
    incubator/roller/branches/roller_2.0/metadata/xdoclet/filter-mappings.xml
    incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi/AtomServlet.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/FlavorServlet.java
    incubator/roller/branches/roller_2.0/web/WEB-INF/classes/flavors/atom.vm
    incubator/roller/branches/roller_2.0/web/WEB-INF/velocity.properties

Modified: incubator/roller/branches/roller_2.0/metadata/xdoclet/filter-mappings.xml
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/metadata/xdoclet/filter-mappings.xml?rev=320930&r1=320929&r2=320930&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/metadata/xdoclet/filter-mappings.xml (original)
+++ incubator/roller/branches/roller_2.0/metadata/xdoclet/filter-mappings.xml Thu Oct 13 14:39:54 2005
@@ -97,8 +97,16 @@
 -->
 <filter-mapping>
     <filter-name>IfModifiedFilter</filter-name>
+    <url-pattern>/atom/*</url-pattern>
+</filter-mapping>
+<filter-mapping>
+    <filter-name>IfModifiedFilter</filter-name>
     <url-pattern>/rss/*</url-pattern>
 </filter-mapping>
+<filter-mapping>
+    <filter-name>IfModifiedFilter</filter-name>
+    <url-pattern>/flavor/*</url-pattern>
+</filter-mapping>
 
 <filter-mapping>
     <filter-name>BreadCrumbFilter</filter-name>
@@ -120,6 +128,10 @@
 
 <filter-mapping>
     <filter-name>RssGzipFilter</filter-name>
+    <url-pattern>/atom/*</url-pattern>
+</filter-mapping>
+<filter-mapping>
+    <filter-name>RssGzipFilter</filter-name>
     <url-pattern>/rss/*</url-pattern>
 </filter-mapping>
 <filter-mapping>
@@ -140,6 +152,10 @@
 <filter-mapping>
     <filter-name>RssCacheFilter</filter-name>
     <url-pattern>/rss/*</url-pattern>
+</filter-mapping>
+<filter-mapping>
+    <filter-name>RssCacheFilter</filter-name>
+    <url-pattern>/atom/*</url-pattern>
 </filter-mapping>
 <filter-mapping>
     <filter-name>RssCacheFilter</filter-name>

Modified: incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi/AtomServlet.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi/AtomServlet.java?rev=320930&r1=320929&r2=320930&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi/AtomServlet.java (original)
+++ incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi/AtomServlet.java Thu Oct 13 14:39:54 2005
@@ -51,7 +51,7 @@
 /**
  * Atom Servlet implements Atom by calling a Roller independent handler.
  * @web.servlet name="AtomServlet"
- * @web.servlet-mapping url-pattern="/atom/*"
+ * @web.servlet-mapping url-pattern="/app05/*"
  * @author David M Johnson
  */
 public class AtomServlet extends HttpServlet

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/FlavorServlet.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/FlavorServlet.java?rev=320930&r1=320929&r2=320930&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/FlavorServlet.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/FlavorServlet.java Thu Oct 13 14:39:54 2005
@@ -37,6 +37,7 @@
   *
   * @web.servlet name="RssServlet"
   * @web.servlet-mapping url-pattern="/rss/*"
+  * @web.servlet-mapping url-pattern="/atom/*"
   * @web.servlet-mapping url-pattern="/flavor/*"
   */
 public class FlavorServlet extends VelocityServlet
@@ -93,12 +94,23 @@
 
             final String useTemplate;
             PageModel pageModel = (PageModel)ctx.get("pageModel");
-            if (    request.getServletPath().endsWith("rss")
-                 && pageModel.getPageByName("_rss") != null )
+            if (request.getServletPath().endsWith("rss"))
             {
-                // If the request specified the "/rss" mapping and the
-                // user has defined an RSS override page, we will use that.
-                useTemplate = pageModel.getPageByName("_rss").getId();
+                if (pageModel.getPageByName("_rss") != null) 
+                    // If the request specified the "/rss" mapping and the
+                    // user has defined an RSS override page, we will use that.
+                    useTemplate = pageModel.getPageByName("_rss").getId();
+                else
+                    useTemplate = "/flavors/rss.vm";
+            }
+            else if (request.getServletPath().endsWith("atom"))
+            {
+                if (pageModel.getPageByName("_atom") != null) 
+                    // If the request specified the "/atom" mapping and the
+                    // user has defined an Atom override page, we will use that.
+                    useTemplate = pageModel.getPageByName("_atom").getId();
+                else
+                    useTemplate = "/flavors/atom.vm";
             }
             else if (request.getParameter("flavor") != null)
             {

Added: incubator/roller/branches/roller_2.0/web/WEB-INF/classes/atommacros.vm
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/web/WEB-INF/classes/atommacros.vm?rev=320930&view=auto
==============================================================================
--- incubator/roller/branches/roller_2.0/web/WEB-INF/classes/atommacros.vm (added)
+++ incubator/roller/branches/roller_2.0/web/WEB-INF/classes/atommacros.vm Thu Oct 13 14:39:54 2005
@@ -0,0 +1,37 @@
+#**
+ * Atom feed links and badges.
+ * @author  Dave Johnson 
+ *#
+
+#**
+ * Show links to category feeds for categories that are immediate children
+ * of the specified category.
+ *#
+#macro( showAtomLinksForCategory $category )
+    <a href="${ctxPath}/atom/${website.handle}">$text.get("macro.rss.all")</a><br />
+    #set( $categories = $pageModel.getWeblogCategories($category) )
+    #foreach( $cat in $categories )
+        <a href="${ctxPath}/atom/${website.handle}?catname=$cat.path">$cat.path</a><br />
+    #end
+#end
+
+#**
+ * Show links to all available Atom feeds for your weblog.
+ *#
+#macro( showAtomLinks )#showAtomLinksForCategory("nil")#end
+
+#**
+ * Show Atom Autodiscovery link for your weblog.
+ *#
+#macro( showAtomAutodiscoveryLink )
+    <link rel="alternate" type="application/atom+xml"
+        title="Atom" href="$absBaseURL/atom/${website.handle}" />
+#end
+
+#**
+ * Show RSS badge with link to your weblog's main RSS feed.
+ *#
+#macro( showAtomBadge )
+    <a href="${ctxPath}/atom/${website.handle}"><img class="atombadge"
+        src="$ctxPath/images/atombadge.jpeg" alt="XML" /></a>
+#end

Modified: incubator/roller/branches/roller_2.0/web/WEB-INF/classes/flavors/atom.vm
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/web/WEB-INF/classes/flavors/atom.vm?rev=320930&r1=320929&r2=320930&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/web/WEB-INF/classes/flavors/atom.vm (original)
+++ incubator/roller/branches/roller_2.0/web/WEB-INF/classes/flavors/atom.vm Thu Oct 13 14:39:54 2005
@@ -2,16 +2,21 @@
 <feed xmlns="http://www.w3.org/2005/Atom">
     <title>$utilities.textToHTML($website.name,true)</title>
     <subtitle>$utilities.textToHTML($website.description,true)</subtitle>
+    #if( $catPath && $catPath.length() > 0) 
+       #set( $postfix = "?catname=$catPath" ) 
+    #else
+       #set( $postfix = "" ) 
+    #end
     #if( $userName != "zzz_none_zzz" )    
-    <id>$absBaseURL/flavor/${website.handle}?flavor=atom</id>
-    <link rel="alternate" type="text/html" href="$websiteURL" />
-    <link rel="self" type="application/atom+xml" 
-       href="$absBaseURL/flavor/${website.handle}?flavor=atom" />
+       <id>$absBaseURL/atom/${website.handle}</id>
+       <link rel="alternate" type="text/html" href="$websiteURL" />
+       <link rel="self" type="application/atom+xml" 
+            href="$absBaseURL/atom/${website.handle}$postfix" />
     #else
-    <id>$absBaseURL/flavor?flavor=atom</id>
-    <link rel="alternate" type="text/html" href="$websiteURL" />
-    <link rel="self" type="application/atom+xml" 
-        href="$absBaseURL/flavor?flavor=atom" />
+       <id>$absBaseURL/atom</id>
+       <link rel="alternate" type="text/html" href="$websiteURL" />
+       <link rel="self" type="application/atom+xml" 
+            href="$absBaseURL/atom$postfix" />
     #end
     <updated>$utilities.formatIso8601Date($updateTime)</updated>
     <generator uri="http://www.rollerweblogger.org" version="#showVersion() ($rollerBuildTime:$rollerBuildUser)">

Modified: incubator/roller/branches/roller_2.0/web/WEB-INF/velocity.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/web/WEB-INF/velocity.properties?rev=320930&r1=320929&r2=320930&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/web/WEB-INF/velocity.properties (original)
+++ incubator/roller/branches/roller_2.0/web/WEB-INF/velocity.properties Thu Oct 13 14:39:54 2005
@@ -36,7 +36,7 @@
 runtime.log.logsystem.log4j.category=org.apache.velocity
 
 # Override the default global library, set to blank to load no default
-velocimacro.library = roller.vm,bookmark.vm,comments.vm,navbar.vm,newsfeed.vm,referer.vm,rssmacros.vm,user.vm,weblog.vm,website.vm
+velocimacro.library = roller.vm,bookmark.vm,comments.vm,navbar.vm,newsfeed.vm,referer.vm,atommacros.vm,rssmacros.vm,user.vm,weblog.vm,website.vm
 
 # Change to false for deployment environments.
 # Caching for the 'class' & 'webapp' ResourceLoaders must be false for this to work

Added: incubator/roller/branches/roller_2.0/web/images/atombadge.jpeg
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/web/images/atombadge.jpeg?rev=320930&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/roller/branches/roller_2.0/web/images/atombadge.jpeg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream