Skip to content

Commit

Permalink
*) soap-service: adding function to check if a specific url is blackl…
Browse files Browse the repository at this point in the history
…isted

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3014 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
theli committed Nov 26, 2006
1 parent 0b9370a commit eb20ec3
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 68 deletions.
25 changes: 23 additions & 2 deletions source/de/anomic/soap/services/BlacklistService.java
Expand Up @@ -52,6 +52,7 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
Expand All @@ -67,7 +68,10 @@
import org.w3c.dom.Document;

import de.anomic.data.listManager;
import de.anomic.http.httpd;
import de.anomic.net.URL;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.plasma.urlPattern.plasmaURLPattern;
import de.anomic.server.serverObjects;
import de.anomic.soap.AbstractService;

Expand All @@ -85,8 +89,25 @@ public class BlacklistService extends AbstractService {
private static final String TEMPLATE_BLACKLIST_XML = "xml/blacklists_p.xml";




public boolean urlIsBlacklisted(String blacklistType, String urlString) throws AxisFault, MalformedURLException {
if (blacklistType == null || blacklistType.length() == 0) throw new IllegalArgumentException("The blacklist type must not be null or empty.");
if (urlString == null || urlString.length() == 0) throw new IllegalArgumentException("The url must not be null or empty.");

// extracting the message context
extractMessageContext(AUTHENTICATION_NEEDED);

// check if we know all type passed to this function
checkForKnownBlacklistTypes(new String[]{blacklistType});

// check for url validity
URL url = new URL(urlString);
String hostlow = url.getHost().toLowerCase();
String file = url.getFile();

// check if the specified url is listed
return (plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_PROXY, hostlow, file));
}

public Document getBlacklistList() throws Exception {
try {
// extracting the message context
Expand Down

0 comments on commit eb20ec3

Please sign in to comment.