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/06/28 19:24:49 UTC

svn commit: r417822 - in /incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets: CommentAuthenticatorServlet.java ResourceServlet.java

Author: agilliland
Date: Wed Jun 28 10:24:48 2006
New Revision: 417822

URL: http://svn.apache.org/viewvc?rev=417822&view=rev
Log:
a little bit of code cleanup.  add/remove comments, variable renaming, etc.  no functional changes.


Modified:
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/CommentAuthenticatorServlet.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/ResourceServlet.java

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/CommentAuthenticatorServlet.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/CommentAuthenticatorServlet.java?rev=417822&r1=417821&r2=417822&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/CommentAuthenticatorServlet.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/CommentAuthenticatorServlet.java Wed Jun 28 10:24:48 2006
@@ -38,7 +38,7 @@
  * so that we can cache full pages and still set the comment authentication
  * section dynamically.
  *
- * @web.servlet name="CommentAuthenticatorServlet"
+ * @web.servlet name="CommentAuthenticatorServlet" load-on-startup="7"
  * @web.servlet-mapping url-pattern="/CommentAuthenticatorServlet"
  */
 public class CommentAuthenticatorServlet extends HttpServlet {
@@ -67,6 +67,7 @@
      * Initialization.
      */
     public void init(ServletConfig config) throws ServletException {
+        
         super.init(config);
         
         // lookup the authenticator we are going to use and instantiate it

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/ResourceServlet.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/ResourceServlet.java?rev=417822&r1=417821&r2=417822&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/ResourceServlet.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/ResourceServlet.java Wed Jun 28 10:24:48 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.servlets;
 
 import java.io.File;
@@ -42,14 +43,12 @@
  * context we need a way to serve them up.  This servlet assumes that
  * resources are stored on a filesystem in the "uploads.dir" directory.
  *
- * @author Allen Gilliland
- *
- * @web.servlet name="ResourcesServlet"
+ * @web.servlet name="ResourcesServlet" load-on-startup="5"
  * @web.servlet-mapping url-pattern="/roller-ui/rendering/resources/*"
  */
 public class ResourceServlet extends HttpServlet {
     
-    private static Log mLogger = LogFactory.getLog(ResourceServlet.class);
+    private static Log log = LogFactory.getLog(ResourceServlet.class);
     
     private String upload_dir = null;
     private ServletContext context = null;
@@ -59,12 +58,16 @@
         
         super.init(config);
         
+        log.info("Initializing ResourceServlet");
+        
         this.context = config.getServletContext();
         
         try {
             this.upload_dir = RollerFactory.getRoller().getFileManager().getUploadDir();
-            mLogger.debug("upload dir is ["+this.upload_dir+"]");
-        } catch(Exception e) { mLogger.warn(e); }
+            log.debug("upload dir is ["+this.upload_dir+"]");
+        } catch(Exception e) { 
+            log.error(e);
+        }
         
     }
     
@@ -98,8 +101,8 @@
         String resource_path = this.upload_dir + reqResource;
         File resource = new File(resource_path);
         
-        mLogger.debug("Resource requested ["+reqURI+"]");
-        mLogger.debug("Real path is ["+resource.getAbsolutePath()+"]");
+        log.debug("Resource requested ["+reqURI+"]");
+        log.debug("Real path is ["+resource.getAbsolutePath()+"]");
         
         // do a quick check to make sure the resource exits, otherwise 404
         if(!resource.exists() || !resource.canRead() || resource.isDirectory()) {
@@ -118,7 +121,7 @@
         Date ifModDate = new Date(request.getDateHeader("If-Modified-Since"));
         Date lastMod = new Date(resource.lastModified());
         if(lastMod.compareTo(ifModDate) <= 0) {
-            mLogger.debug("Resource unmodified ... sending 304");
+            log.debug("Resource unmodified ... sending 304");
             response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
             return;
         }
@@ -140,12 +143,6 @@
         // cleanup
         out.close();
         resource_file.close();
-    }
-    
-    
-    public void doPost(HttpServletRequest request, HttpServletResponse response)
-            throws ServletException, IOException {
-        doGet(request, response);
     }
     
 }