Return-Path: Delivered-To: apmail-incubator-roller-commits-archive@www.apache.org Received: (qmail 61111 invoked from network); 12 Jul 2006 01:39:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 Jul 2006 01:39:48 -0000 Received: (qmail 69453 invoked by uid 500); 12 Jul 2006 01:39:48 -0000 Delivered-To: apmail-incubator-roller-commits-archive@incubator.apache.org Received: (qmail 69412 invoked by uid 500); 12 Jul 2006 01:39:48 -0000 Mailing-List: contact roller-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: roller-dev@incubator.apache.org Delivered-To: mailing list roller-commits@incubator.apache.org Received: (qmail 69401 invoked by uid 99); 12 Jul 2006 01:39:48 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Jul 2006 18:39:48 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Jul 2006 18:39:47 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 3B0921A981A; Tue, 11 Jul 2006 18:39:27 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r421070 - /incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PlanetFeedServlet.java Date: Wed, 12 Jul 2006 01:39:26 -0000 To: roller-commits@incubator.apache.org From: agilliland@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060712013927.3B0921A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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); } + } -