roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ghu...@apache.org
Subject svn commit: r1552626 - /roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/ResourceServlet.java
Date Fri, 20 Dec 2013 12:49:21 GMT
Author: ghuber
Date: Fri Dec 20 12:49:21 2013
New Revision: 1552626

URL: http://svn.apache.org/r1552626
Log:
firefox freezing on lots of 404's

Modified:
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/ResourceServlet.java

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/ResourceServlet.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/ResourceServlet.java?rev=1552626&r1=1552625&r2=1552626&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/ResourceServlet.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/ResourceServlet.java
Fri Dec 20 12:49:21 2013
@@ -21,12 +21,14 @@ package org.apache.roller.weblogger.ui.r
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
@@ -34,8 +36,8 @@ import org.apache.roller.weblogger.busin
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.pojos.MediaFile;
 import org.apache.roller.weblogger.pojos.ThemeResource;
-import org.apache.roller.weblogger.pojos.WeblogTheme;
 import org.apache.roller.weblogger.pojos.Weblog;
+import org.apache.roller.weblogger.pojos.WeblogTheme;
 import org.apache.roller.weblogger.ui.rendering.util.ModDateHeaderUtil;
 import org.apache.roller.weblogger.ui.rendering.util.WeblogResourceRequest;
 
@@ -45,6 +47,8 @@ import org.apache.roller.weblogger.ui.re
  */
 public class ResourceServlet extends HttpServlet {
 
+    private static final long serialVersionUID = 1350679411381917714L;
+
     private static Log log = LogFactory.getLog(ResourceServlet.class);
 
     private ServletContext context = null;
@@ -65,9 +69,9 @@ public class ResourceServlet extends Htt
             throws ServletException, IOException {
 
         Weblog weblog = null;
-        String ctx = request.getContextPath();
-        String servlet = request.getServletPath();
-        String reqURI = request.getRequestURI();
+        //String ctx = request.getContextPath();
+        //String servlet = request.getServletPath();
+        //String reqURI = request.getRequestURI();
 
         WeblogResourceRequest resourceRequest = null;
         try {
@@ -82,6 +86,9 @@ public class ResourceServlet extends Htt
 
         } catch (Exception e) {
             // invalid resource request or weblog doesn't exist
+            if (!response.isCommitted()) {
+                response.reset();
+            }
             log.debug("error creating weblog resource request", e);
             response.sendError(HttpServletResponse.SC_NOT_FOUND);
             return;
@@ -106,6 +113,9 @@ public class ResourceServlet extends Htt
             }
         } catch (Exception ex) {
             // hmmm, some kind of error getting theme. that's an error.
+            if (!response.isCommitted()) {
+                response.reset();
+            }
             response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
             return;
         }
@@ -122,6 +132,9 @@ public class ResourceServlet extends Htt
 
             } catch (Exception ex) {
                 // still not found? then we don't have it, 404.
+                if (!response.isCommitted()) {
+                    response.reset();
+                }
                 log.debug("Unable to get resource", ex);
                 response.sendError(HttpServletResponse.SC_NOT_FOUND);
                 return;
@@ -158,8 +171,8 @@ public class ResourceServlet extends Htt
         } catch (Exception ex) {
             if (!response.isCommitted()) {
                 response.reset();
-                response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
             }
+            response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
         } finally {
             // make sure stream to resource file is closed
             resourceStream.close();



Mime
View raw message