Author: agilliland
Date: Fri Jan 13 13:37:44 2006
New Revision: 368862

URL: http://svn.apache.org/viewcvs?rev=368862&view=rev
Log:
optionally disable referrer processing.


Modified:
    
incubator/roller/trunk/src/org/roller/presentation/filters/RefererFilter.java
    incubator/roller/trunk/web/WEB-INF/classes/roller.properties

Modified: 
incubator/roller/trunk/src/org/roller/presentation/filters/RefererFilter.java
URL: 
http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/filters/RefererFilter.java?rev=368862&r1=368861&r2=368862&view=diff
==============================================================================
--- 
incubator/roller/trunk/src/org/roller/presentation/filters/RefererFilter.java 
(original)
+++ 
incubator/roller/trunk/src/org/roller/presentation/filters/RefererFilter.java 
Fri Jan 13 13:37:44 2006
@@ -34,9 +34,11 @@
     private static Log mLogger = LogFactory.getLog(RefererFilter.class);
     private static final String ROBOT_PATTERN_PROP_NAME = 
"referrer.robotCheck.userAgentPattern";
     
-    private FilterConfig mFilterConfig = null;
     private static Pattern robotPattern = null;
     
+    private FilterConfig mFilterConfig = null;
+    private boolean processingEnabled = true;
+    
     
     /**
      * doFilter
@@ -44,6 +46,12 @@
     public void doFilter(ServletRequest req, ServletResponse res, FilterChain 
chain) 
             throws IOException, ServletException {
         
+        // if referrer processing is disabled then we are done
+        if(!this.processingEnabled) {
+            chain.doFilter(req, res);
+            return;
+        }
+        
         HttpServletRequest request = (HttpServletRequest) req;
         HttpServletResponse response = (HttpServletResponse) res;
         boolean ignoreReferrer = false;
@@ -167,8 +175,16 @@
      * init
      */
     public void init(FilterConfig filterConfig) throws ServletException {
-        mFilterConfig = filterConfig;
         
+        this.mFilterConfig = filterConfig;
+        
+        // see if built-in referrer processing is enabled
+        this.processingEnabled = 
+                
RollerConfig.getBooleanProperty("referrers.processing.enabled");
+        
+        mLogger.info("Referrer processing enabled = "+this.processingEnabled);
+        
+        // check for possible robot pattern
         String robotPatternStr = 
RollerConfig.getProperty(ROBOT_PATTERN_PROP_NAME);
         if (robotPatternStr != null && robotPatternStr.length() >0) {
             // Parse the pattern, and store the compiled form.

Modified: incubator/roller/trunk/web/WEB-INF/classes/roller.properties
URL: 
http://svn.apache.org/viewcvs/incubator/roller/trunk/web/WEB-INF/classes/roller.properties?rev=368862&r1=368861&r2=368862&view=diff
==============================================================================
--- incubator/roller/trunk/web/WEB-INF/classes/roller.properties (original)
+++ incubator/roller/trunk/web/WEB-INF/classes/roller.properties Fri Jan 13 
13:37:44 2006
@@ -208,8 +208,11 @@
 #has been reported to work well.
 #referrer.robotCheck.userAgentPattern=.*(slurp|bot|java).*
 
+# Enable built-in referrer processing?
+referrers.processing.enabled=true
+
 # Change to true if you want to process referrers asynchronously.
-# You can choose how many threads to use and sleep time (in seconds) between 
work.
+# You can choose how many threads to use and sleep time (in seconds) 
 referrers.asyncProcessing.enabled=false
 referrers.queue.numWorkers=3
 referrers.queue.sleepTime=10


Reply via email to