incubator-droids-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jav...@apache.org
Subject svn commit: r1188880 - /incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/helper/factories/URLFiltersFactory.java
Date Tue, 25 Oct 2011 19:50:50 GMT
Author: javier
Date: Tue Oct 25 19:50:49 2011
New Revision: 1188880

URL: http://svn.apache.org/viewvc?rev=1188880&view=rev
Log:
Code refactorization. DROIDS-149

Modified:
    incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/helper/factories/URLFiltersFactory.java

Modified: incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/helper/factories/URLFiltersFactory.java
URL: http://svn.apache.org/viewvc/incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/helper/factories/URLFiltersFactory.java?rev=1188880&r1=1188879&r2=1188880&view=diff
==============================================================================
--- incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/helper/factories/URLFiltersFactory.java
(original)
+++ incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/helper/factories/URLFiltersFactory.java
Tue Oct 25 19:50:49 2011
@@ -34,6 +34,10 @@ public class URLFiltersFactory extends G
    * @return true if filter plugin accept the url, false if excluded.
    */
   public boolean accept(String urlString) {
+  	if (urlString == null) {
+  		return false;
+  	}
+  		
     for (String key : getMap().keySet()) {
       if(!accept(urlString, key)) {
       	return false;
@@ -52,13 +56,23 @@ public class URLFiltersFactory extends G
    * @return true if filter plugin accept the url, false if excluded.
    */
   public boolean accept(String urlString, String filterName) {
-    if (urlString == null) {
-      return false;
-    }
-    urlString = getMap().get(filterName).filter(urlString);
-    if (urlString == null) {
+    if (urlString == null ||
+    		doFilter(urlString, filterName) == null) {
       return false;
     }
     return true;
   }
+
+  /**
+   * Check string against filters list
+   * 
+   * @param urlString -
+   *                url to test
+   * @param filterName -
+   *                name of the specific filter class.
+   * @return the URL if it's allowed, NULL otherwise
+   */
+	protected String doFilter(String urlString, String filterName) {
+	  return getMap().get(filterName).filter(urlString);
+  }
 }



Mime
View raw message