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