roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r354894 - /incubator/roller/trunk/src/org/roller/presentation/velocity/FlavorServlet.java
Date Wed, 07 Dec 2005 23:06:46 GMT
Author: agilliland
Date: Wed Dec  7 15:06:38 2005
New Revision: 354894

URL: http://svn.apache.org/viewcvs?rev=354894&view=rev
Log:
updating code formatting.


Modified:
    incubator/roller/trunk/src/org/roller/presentation/velocity/FlavorServlet.java

Modified: incubator/roller/trunk/src/org/roller/presentation/velocity/FlavorServlet.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/velocity/FlavorServlet.java?rev=354894&r1=354893&r2=354894&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/velocity/FlavorServlet.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/velocity/FlavorServlet.java Wed Dec
 7 15:06:38 2005
@@ -52,13 +52,19 @@
     private static Log mLogger = LogFactory.getLog(FlavorServlet.class);
     
     public Template handleRequest(HttpServletRequest request,
-            HttpServletResponse response, Context ctx) {
+                                HttpServletResponse response, 
+                                Context ctx) 
+            throws IOException {
         
         RollerRequest rreq = null;
         Template outty = null;
         
+        // first off lets parse the incoming request and validate it
         try {
-            rreq = RollerRequest.getRollerRequest(request,getServletContext());
+            PageContext pageContext =
+                    JspFactory.getDefaultFactory().getPageContext(
+                    this, request,  response, "", true, 8192, true);
+            rreq = RollerRequest.getRollerRequest(pageContext);
             
             // This is an ugly hack to fix the following bug:
             // ROL-547: "Site wide RSS feed is your own if you are logged in"
@@ -68,20 +74,17 @@
                 rreq.setWebsite(null);
             }
         } catch (RollerException e) {
+            
             // An error initializing the request is considered to be a 404
-            response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+            response.sendError(HttpServletResponse.SC_NOT_FOUND);
             request.setAttribute("DisplayException", e);
             
             return null;
         }
         
+        
+        // request appears to be valid, lets render
         try {
-            // Needed to init request attributes, etc.
-            PageContext pageContext =
-                    JspFactory.getDefaultFactory().getPageContext(
-                    this, request,  response, "", true, 8192, true);
-            rreq.setPageContext(pageContext);
-            
             // get update time before loading context
             // TODO: this should really be handled elsewhere
             if(rreq.getWebsite() != null) {
@@ -126,17 +129,18 @@
             }
             
             outty = getTemplate(useTemplate);
+            
         } catch(ResourceNotFoundException rnfe) {
-            response.setStatus(HttpServletResponse.SC_NOT_FOUND);
-            request.setAttribute("DisplayException", rnfe);
             
-            mLogger.error("ResourceNotFound: "+ request.getRequestURL());
+            response.sendError(HttpServletResponse.SC_NOT_FOUND);
+            request.setAttribute("DisplayException", rnfe);
+            mLogger.warn("ResourceNotFound: "+ request.getRequestURL());
             mLogger.debug(rnfe);
-            
         } catch(Exception e) {
-            response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+            
+            response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
             request.setAttribute("DisplayException", e);
-            mLogger.error(e);
+            mLogger.error("Unexpected exception", e);
         }
         
         return outty;



Mime
View raw message