Revision: 3053
http://archive-access.svn.sourceforge.net/archive-access/?rev=3053&view=rev
Author: bradtofel
Date: 2010-04-23 23:38:06 +0000 (Fri, 23 Apr 2010)
Log Message:
-----------
INITIAL REV: Filter to remove CaptureSearchResults if they contain userinfo in the original URL.
Added Paths:
-----------
trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/filters/UserInfoInAuthorityFilter.java
Added: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/filters/UserInfoInAuthorityFilter.java
===================================================================
--- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/filters/UserInfoInAuthorityFilter.java (rev 0)
+++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/filters/UserInfoInAuthorityFilter.java 2010-04-23 23:38:06 UTC (rev 3053)
@@ -0,0 +1,59 @@
+/* UserInfoInAuthorityFilter
+ *
+ * $Id$:
+ *
+ * Created on Apr 16, 2010.
+ *
+ * Copyright (C) 2006 Internet Archive.
+ *
+ * This file is part of Wayback.
+ *
+ * Wayback is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * any later version.
+ *
+ * Wayback is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser Public License
+ * along with Wayback; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package org.archive.wayback.resourceindex.filters;
+
+import org.archive.wayback.core.CaptureSearchResult;
+import org.archive.wayback.util.ObjectFilter;
+import org.archive.wayback.util.url.UrlOperations;
+
+/**
+ * Class which omits CaptureSearchResults that have and '@' in the original URL
+ * field, if that '@' is after the scheme, and before the first '/' or ':'
+ *
+ * @author brad
+ *
+ */
+public class UserInfoInAuthorityFilter implements ObjectFilter<CaptureSearchResult> {
+ private boolean wantUserInfo = false;
+ public int filterObject(CaptureSearchResult o) {
+ boolean hasUserInfo =
+ (UrlOperations.urlToUserInfo(o.getOriginalUrl()) != null);
+ return hasUserInfo == wantUserInfo
+ ? ObjectFilter.FILTER_INCLUDE : ObjectFilter.FILTER_EXCLUDE;
+ }
+ /**
+ * @return the wantUserInfo
+ */
+ public boolean isWantUserInfo() {
+ return wantUserInfo;
+ }
+ /**
+ * @param wantUserInfo the wantUserInfo to set
+ */
+ public void setWantUserInfo(boolean wantUserInfo) {
+ this.wantUserInfo = wantUserInfo;
+ }
+}
Property changes on: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/filters/UserInfoInAuthorityFilter.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Revision Id
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|