You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2006/07/12 03:39:26 UTC

svn commit: r421070 - /incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PlanetFeedServlet.java

Author: agilliland
Date: Tue Jul 11 18:39:26 2006
New Revision: 421070

URL: http://svn.apache.org/viewvc?rev=421070&view=rev
Log:
code reformatting.


Modified:
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PlanetFeedServlet.java

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PlanetFeedServlet.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PlanetFeedServlet.java?rev=421070&r1=421069&r2=421070&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PlanetFeedServlet.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PlanetFeedServlet.java Tue Jul 11 18:39:26 2006
@@ -1,20 +1,21 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*  contributor license agreements.  The ASF licenses this file to You
-* under the Apache License, Version 2.0 (the "License"); you may not
-* use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.  For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
 package org.apache.roller.ui.rendering.velocity;
 
 import java.io.IOException;
@@ -34,97 +35,80 @@
 import org.apache.roller.ui.core.RollerRequest;
 import org.apache.roller.util.Utilities;
 
-/////////////////////////////////////////////////////////////////////////////
+
 /**
- * Planet Roller (i.e. NOT for Planet Tool) RSS feed. 
- * @author David M Johnson
+ * Planet Roller (i.e. NOT for Planet Tool) RSS feed.
+ *
  * @web.servlet name="PlanetFeedServlet"
  * @web.servlet-mapping url-pattern="/planetrss/*"
  */
-public class PlanetFeedServlet extends VelocityServlet
-{
-    private static Log mLogger = 
-        LogFactory.getFactory().getInstance(RollerRequest.class);
+public class PlanetFeedServlet extends VelocityServlet {
+    
+    private static Log mLogger = LogFactory.getLog(RollerRequest.class);
+    
     
     public Template handleRequest(HttpServletRequest request,
-                                  HttpServletResponse response, Context context)
-    {
+            HttpServletResponse response, Context context) {
+        
         RollerRequest rreq = null;
-        try
-        {
+        try {
             rreq = RollerRequest.getRollerRequest(request, getServletContext());
-        }
-        catch (RollerException e)
-        {
+        } catch (RollerException e) {
             // An error initializing the request is considered to be a 404
-            if (mLogger.isDebugEnabled())
-            {
+            if (mLogger.isDebugEnabled()) {
                 mLogger.debug("RollerRequest threw Exception", e);
             }
-            try
-            {
+            try {
                 response.sendError(HttpServletResponse.SC_NOT_FOUND);
-            }
-            catch (IOException e1)
-            {
-                if (mLogger.isDebugEnabled())
-                {
+            } catch (IOException e1) {
+                if (mLogger.isDebugEnabled()) {
                     mLogger.debug("IOException sending error", e);
                 }
             }
             return null;
         }
-        try
-        {
+        try {
             response.setContentType("application/rss+xml;charset=utf-8");
-            PlanetManager planet = 
-                RollerFactory.getRoller().getPlanetManager();
-            if (request.getParameter("group") != null) 
-            {
-                context.put("group", 
+            PlanetManager planet =
+                    RollerFactory.getRoller().getPlanetManager();
+            if (request.getParameter("group") != null) {
+                context.put("group",
                         planet.getGroup(request.getParameter("group")));
             }
             context.put("planet", planet);
             context.put("date", new Date());
             context.put("utilities", new Utilities());
             
-            int entryCount = 
-                RollerRuntimeConfig.getIntProperty("site.newsfeeds.defaultEntries");
-            int maxEntries = 
-                RollerRuntimeConfig.getIntProperty("site.newsfeeds.maxEntries");
+            int entryCount =
+                    RollerRuntimeConfig.getIntProperty("site.newsfeeds.defaultEntries");
+            int maxEntries =
+                    RollerRuntimeConfig.getIntProperty("site.newsfeeds.maxEntries");
             String sCount = request.getParameter("count");
-            if (sCount!=null)
-            {
-                try
-                {
+            if (sCount!=null) {
+                try {
                     entryCount = Integer.parseInt(sCount);
-                }
-                catch (NumberFormatException e)
-                {
+                } catch (NumberFormatException e) {
                     mLogger.warn("Improperly formatted count parameter");
                 }
                 if ( entryCount > maxEntries ) entryCount = maxEntries;
                 if ( entryCount < 0 ) entryCount = 0;
             }
-            context.put("entryCount", new Integer(entryCount));            
+            context.put("entryCount", new Integer(entryCount));
             
             return getTemplate("templates/planet/planetrss.vm");
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             mLogger.error("ERROR in PlanetFeedServlet", e);
         }
         return null;
     }
-
-    //------------------------------------------------------------------------
+    
+    
     /**
      * Handle error in Velocity processing.
      */
     protected void error( HttpServletRequest req, HttpServletResponse res,
-        Exception e) throws ServletException, IOException
-    {
+            Exception e) throws ServletException, IOException {
         mLogger.warn("ERROR in PlanetFeedServlet",e);
     }
+    
 }
-