*) remove import java.lang

*) Added Super()
*) replaced startsWith()
*) cleaned


git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@670 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
borg-0300 20 years ago
parent b1cd1fa917
commit c0e3d18bbf

@ -41,10 +41,8 @@
package de.anomic.plasma;
import java.lang.String;
import java.util.HashMap;
import java.io.File;
import java.util.HashMap;
import de.anomic.kelondro.kelondroMSetTools;
public class plasmaURLPattern {
@ -53,6 +51,7 @@ public class plasmaURLPattern {
private HashMap hostpaths = null; // key=host, value=path; mapped url is http://host/path; path does not start with '/' here
public plasmaURLPattern(File rootPath) {
super();
this.rootPath = rootPath;
this.hostpaths = new HashMap();
}
@ -67,24 +66,26 @@ public class plasmaURLPattern {
public void loadLists(String mapname, String filenames, String sep) {
// File listsPath = new File(getRootPath(), getConfig("listsPath", "DATA/LISTS"));
String filenamesarray[] = filenames.split(",");
final String[] filenamesarray = filenames.split(",");
if(filenamesarray.length >0)
for(int i = 0; i < filenamesarray.length; i++)
if( filenamesarray.length > 0) {
for (int i = 0; i < filenamesarray.length; i++) {
hostpaths.putAll(kelondroMSetTools.loadMap(mapname, (new File(rootPath, filenamesarray[i])).toString(), sep));
}
}
}
public void remove(String host) {
hostpaths.remove(host);
}
public void add(String host, String path) {
if (path.startsWith("/")) path = path.substring(1);
if (path.length() > 0 && path.charAt(0) == '/') path = path.substring(1);
hostpaths.put(host, path);
}
public boolean isListed(String hostlow, String path) {
if (path.startsWith("/")) path = path.substring(1);
if (path.length() > 0 && path.charAt(0) == '/') path = path.substring(1);
String pp = ""; // path-pattern
// first try to match the domain with wildcard '*'

Loading…
Cancel
Save