[Yanel-commits] rev 45856 - public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet

michi at wyona.com michi at wyona.com
Sat Dec 5 09:38:44 CET 2009


Author: michi
Date: 2009-12-05 09:38:43 +0100 (Sat, 05 Dec 2009)
New Revision: 45856

Modified:
   public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java
Log:
do the suffix or rather mime type check at the very beginning because of performance

Modified: public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java
===================================================================
--- public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java	2009-12-04 23:33:01 UTC (rev 45855)
+++ public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java	2009-12-05 08:38:43 UTC (rev 45856)
@@ -202,8 +202,12 @@
             if (log.isDebugEnabled()) log.debug("Access granted: " + request.getServletPath());
         }
 
-        // TODO: Only HTML pages and PDFs etc. should be logged, but no images, CSS, etc.
-        if(logAccessEnabled) doLogAccess(request, response);
+        if(logAccessEnabled) {
+            // TODO: Only HTML pages and PDFs etc. should be logged, but no images, CSS, etc. Check the mime-type instead the suffix or use JavaScript or Pixel
+            if (request.getRequestURL().toString().endsWith("html")) {
+                doLogAccess(request, response);
+            }
+        }
 
         // Check for requests re policies
         String policyRequestPara = request.getParameter(YANEL_ACCESS_POLICY_USECASE);
@@ -2248,15 +2252,11 @@
                  - Log analysis (no special tracking required)
 */
                 String requestURL = request.getRequestURL().toString();
-                if (requestURL.endsWith("html")) { // TODO: Check the mime-type instead the suffix or use JavaScript or Pixel
-                    logAccess.info(requestURL + " r:" + realm.getID() + " c:" + cookie.getValue() + " u:" + identity.getUsername());
-                }
+                logAccess.info(requestURL + " r:" + realm.getID() + " c:" + cookie.getValue() + " u:" + identity.getUsername());
             } else {
                 // NOTE: Log access of anonymous user
                 String requestURL = request.getRequestURL().toString();
-                if (requestURL.endsWith("html")) { // TODO: Check the mime-type instead the suffix or use JavaScript or Pixel
-                    logAccess.info(requestURL + " r:" + realm.getID() + " c:" + cookie.getValue());
-                }
+                logAccess.info(requestURL + " r:" + realm.getID() + " c:" + cookie.getValue());
             }
             //log.warn("DEBUG: Referer: " + request.getHeader(HTTP_REFERRER));
         } catch(Exception e) { // Catch all exceptions, because we do not want to throw exceptions because of logging browser history



More information about the Yanel-commits mailing list