Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

refactoring: - removed the plasma package. The name of that package came from a very early pre-version of YaCy, even before YaCy was named AnomicHTTPProxy. The Proxy project introduced search for cache contents using class files that had been developed during the plasma project. Information from 2002 about plasma can be found here: http://web.archive.org/web/20020802110827/http://anomic.de/AnomicPlasma/index.html We stil have one class that comes mostly unchanged from the plasma project, the Condenser class. But this is now part of the document package and all other classes in the plasma package can be assigned to other packages. - cleaned up the http package: better structure of that class and clean isolation of server and client classes. The old HTCache becomes part of the client sub-package of http. - because the plasmaSwitchboard is now part of the search package all servlets had to be touched to declare a different package source.

orbiter1d8d51075c56
diff --git a/htroot/AccessTracker_p.java b/htroot/AccessTracker_p.java
index d66cd1cd1..30a0fd961 100644
--- a/htroot/AccessTracker_p.java
+++ b/htroot/AccessTracker_p.java
@@ -35,10 +35,10 @@ import java.util.TreeSet;
import java.util.Map.Entry;
import java.text.SimpleDateFormat;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.net.natLib;
-import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.search.QueryParams;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -56,8 +56,8 @@ public class AccessTracker_p {
return accessClone;
}
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
diff --git a/htroot/Banner.java b/htroot/Banner.java
index 59e098c32..ea1c6e82b 100644
--- a/htroot/Banner.java
+++ b/htroot/Banner.java
@@ -31,20 +31,20 @@ import java.io.IOException;
import javax.imageio.ImageIO;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaGrafics;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacySeed;
+import de.anomic.ymage.NetworkGraph;
import de.anomic.ymage.ymageMatrix;
/** draw a banner with information about the peer */
public class Banner {
- public static ymageMatrix respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) throws IOException {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static ymageMatrix respond(final RequestHeader header, final serverObjects post, final serverSwitch env) throws IOException {
+ final Switchboard sb = (Switchboard) env;
final String IMAGE = "htroot/env/grafics/yacy.gif";
int width = 468;
int height = 60;
@@ -66,7 +66,7 @@ public class Banner {
int myppm = 0;
double myqph = 0;
String type = "";
- final String network = env.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "unspecified").toUpperCase();
+ final String network = env.getConfig(SwitchboardConstants.NETWORK_NAME, "unspecified").toUpperCase();
final int peers = sb.peers.sizeConnected() + 1; // the '+ 1': the own peer is not included in sizeConnected()
long nlinks = sb.peers.countActiveURL();
long nwords = sb.peers.countActiveRWI();
@@ -103,12 +103,12 @@ public class Banner {
}
}
- if (!plasmaGrafics.logoIsLoaded()) {
+ if (!NetworkGraph.logoIsLoaded()) {
final BufferedImage logo = ImageIO.read(new File(IMAGE));
- return plasmaGrafics.getBannerPicture(1000, width, height, bgcolor, textcolor, bordercolor, name, links, words, type, myppm, network, peers, nlinks, nwords, nqph, nppm, logo);
+ return NetworkGraph.getBannerPicture(1000, width, height, bgcolor, textcolor, bordercolor, name, links, words, type, myppm, network, peers, nlinks, nwords, nqph, nppm, logo);
}
- return plasmaGrafics.getBannerPicture(1000, width, height, bgcolor, textcolor, bordercolor, name, links, words, type, myppm, network, peers, nlinks, nwords, nqph, nppm);
+ return NetworkGraph.getBannerPicture(1000, width, height, bgcolor, textcolor, bordercolor, name, links, words, type, myppm, network, peers, nlinks, nwords, nqph, nppm);
}
}
diff --git a/htroot/BlacklistCleaner_p.java b/htroot/BlacklistCleaner_p.java
index cc71ba08f..ffc90d377 100644
--- a/htroot/BlacklistCleaner_p.java
+++ b/htroot/BlacklistCleaner_p.java
@@ -49,8 +49,8 @@ import de.anomic.data.AbstractBlacklist;
import de.anomic.data.Blacklist;
import de.anomic.data.DefaultBlacklist;
import de.anomic.data.listManager;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.logging.Log;
@@ -75,11 +75,11 @@ public class BlacklistCleaner_p {
DefaultBlacklist.class
};
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
// initialize the list manager
- listManager.switchboard = (plasmaSwitchboard) env;
+ listManager.switchboard = (Switchboard) env;
listManager.listsPath = new File(env.getRootPath(), env.getConfig("listManager.listsPath", "DATA/LISTS"));
String blacklistToUse = null;
@@ -113,10 +113,10 @@ public class BlacklistCleaner_p {
}
// list illegal entries
- final HashMap<String, Integer> ies = getIllegalEntries(blacklistToUse, plasmaSwitchboard.urlBlacklist);
+ final HashMap<String, Integer> ies = getIllegalEntries(blacklistToUse, Switchboard.urlBlacklist);
prop.put(RESULTS + "blList", blacklistToUse);
prop.put(RESULTS + "entries", ies.size());
- prop.putHTML(RESULTS + "blEngine", plasmaSwitchboard.urlBlacklist.getEngineInfo());
+ prop.putHTML(RESULTS + "blEngine", Switchboard.urlBlacklist.getEngineInfo());
prop.put(RESULTS + "disabled", (ies.size() == 0) ? "1" : "0");
if (ies.size() > 0) {
prop.put(RESULTS + DISABLED + "entries", ies.size());
@@ -137,7 +137,7 @@ public class BlacklistCleaner_p {
private static void putBlacklists(final serverObjects prop, final List<String> lists, final String selected) {
boolean supported = false;
for (int i=0; i<supportedBLEngines.length && !supported; i++) {
- supported |= (plasmaSwitchboard.urlBlacklist.getClass() == supportedBLEngines[i]);
+ supported |= (Switchboard.urlBlacklist.getClass() == supportedBLEngines[i]);
}
if (supported) {
@@ -295,7 +295,7 @@ public class BlacklistCleaner_p {
final String host = (s.indexOf("/") == -1) ? s : s.substring(0, s.indexOf("/"));
final String path = (s.indexOf("/") == -1) ? ".*" : s.substring(s.indexOf("/") + 1);
try {
- plasmaSwitchboard.urlBlacklist.remove(supportedBlacklistTypes[blTypes],
+ Switchboard.urlBlacklist.remove(supportedBlacklistTypes[blTypes],
host,path);
} catch (final RuntimeException e) {
//System.err.println(e.getMessage() + ": " + host + "/" + path);
@@ -332,7 +332,7 @@ public class BlacklistCleaner_p {
pw.println(host + "/" + path);
for (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) {
if (listManager.listSetContains(supportedBlacklistTypes[blTypes] + ".BlackLists",blacklistToUse)) {
- plasmaSwitchboard.urlBlacklist.add(
+ Switchboard.urlBlacklist.add(
supportedBlacklistTypes[blTypes],
host,
path);
diff --git a/htroot/BlacklistImpExp_p.java b/htroot/BlacklistImpExp_p.java
index 35cee7115..954e9046a 100644
--- a/htroot/BlacklistImpExp_p.java
+++ b/htroot/BlacklistImpExp_p.java
@@ -34,8 +34,8 @@ import java.util.Iterator;
import java.util.TreeMap;
import de.anomic.data.listManager;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacySeed;
@@ -44,11 +44,11 @@ import java.util.List;
public class BlacklistImpExp_p {
private final static String DISABLED = "disabled_";
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
// initialize the list manager
- listManager.switchboard = (plasmaSwitchboard) env;
+ listManager.switchboard = (Switchboard) env;
listManager.listsPath = new File(listManager.switchboard.getRootPath(),listManager.switchboard.getConfig("listManager.listsPath", "DATA/LISTS"));
// loading all blacklist files located in the directory
@@ -56,7 +56,7 @@ public class BlacklistImpExp_p {
String blacklistToUse = null;
final serverObjects prop = new serverObjects();
- prop.putHTML("blacklistEngine", plasmaSwitchboard.urlBlacklist.getEngineInfo());
+ prop.putHTML("blacklistEngine", Switchboard.urlBlacklist.getEngineInfo());
// if we have not chosen a blacklist until yet we use the first file
if (blacklistToUse == null && dirlist != null && dirlist.size() > 0) {
diff --git a/htroot/BlacklistTest_p.java b/htroot/BlacklistTest_p.java
index 957475501..3e6051be7 100644
--- a/htroot/BlacklistTest_p.java
+++ b/htroot/BlacklistTest_p.java
@@ -34,22 +34,22 @@ import java.net.MalformedURLException;
import de.anomic.data.Blacklist;
import de.anomic.data.listManager;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyURL;
public class BlacklistTest_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// initialize the list manager
- listManager.switchboard = (plasmaSwitchboard) env;
+ listManager.switchboard = (Switchboard) env;
listManager.listsPath = new File(listManager.switchboard.getRootPath(),listManager.switchboard.getConfig("listManager.listsPath", "DATA/LISTS"));
final serverObjects prop = new serverObjects();
- prop.putHTML("blacklistEngine", plasmaSwitchboard.urlBlacklist.getEngineInfo());
+ prop.putHTML("blacklistEngine", Switchboard.urlBlacklist.getEngineInfo());
// do all post operations
if(post != null && post.containsKey("testList")) {
@@ -62,17 +62,17 @@ public class BlacklistTest_p {
} catch (final MalformedURLException e) { testurl = null; }
if(testurl != null) {
prop.putHTML("testlist_url",testurl.toString());
- if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_CRAWLER, testurl))
+ if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_CRAWLER, testurl))
prop.put("testlist_listedincrawler", "1");
- if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_DHT, testurl))
+ if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_DHT, testurl))
prop.put("testlist_listedindht", "1");
- if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_NEWS, testurl))
+ if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_NEWS, testurl))
prop.put("testlist_listedinnews", "1");
- if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_PROXY, testurl))
+ if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_PROXY, testurl))
prop.put("testlist_listedinproxy", "1");
- if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SEARCH, testurl))
+ if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SEARCH, testurl))
prop.put("testlist_listedinsearch", "1");
- if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SURFTIPS, testurl))
+ if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SURFTIPS, testurl))
prop.put("testlist_listedinsurftips", "1");
}
else prop.put("testlist_url","not valid");
diff --git a/htroot/Blacklist_p.java b/htroot/Blacklist_p.java
index fd31a2c1f..de7da3c8d 100644
--- a/htroot/Blacklist_p.java
+++ b/htroot/Blacklist_p.java
@@ -42,9 +42,9 @@ import java.util.List;
import de.anomic.data.AbstractBlacklist;
import de.anomic.data.Blacklist;
import de.anomic.data.listManager;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.search.QueryEvent;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyURL;
@@ -59,10 +59,10 @@ public class Blacklist_p {
private final static String BLACKLIST_FILENAME_FILTER = "^.*\\.black$";
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// initialize the list manager
- listManager.switchboard = (plasmaSwitchboard) env;
+ listManager.switchboard = (Switchboard) env;
listManager.listsPath = new File(listManager.switchboard.getRootPath(),listManager.switchboard.getConfig("listManager.listsPath", "DATA/LISTS"));
// clean up all search events in case that a (new) blacklist entry denies previously returned results
@@ -77,7 +77,7 @@ public class Blacklist_p {
String blacklistToUse = null;
final serverObjects prop = new serverObjects();
- prop.putHTML("blacklistEngine", plasmaSwitchboard.urlBlacklist.getEngineInfo());
+ prop.putHTML("blacklistEngine", Switchboard.urlBlacklist.getEngineInfo());
// do all post operations
if (post != null) {
@@ -94,17 +94,17 @@ public class Blacklist_p {
} catch (final MalformedURLException e) { testurl = null; }
if(testurl != null) {
prop.putHTML("testlist_url",testurl.toString());
- if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_CRAWLER, testurl))
+ if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_CRAWLER, testurl))
prop.put("testlist_listedincrawler", "1");
- if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_DHT, testurl))
+ if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_DHT, testurl))
prop.put("testlist_listedindht", "1");
- if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_NEWS, testurl))
+ if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_NEWS, testurl))
prop.put("testlist_listedinnews", "1");
- if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_PROXY, testurl))
+ if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_PROXY, testurl))
prop.put("testlist_listedinproxy", "1");
- if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SEARCH, testurl))
+ if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SEARCH, testurl))
prop.put("testlist_listedinsearch", "1");
- if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SURFTIPS, testurl))
+ if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SURFTIPS, testurl))
prop.put("testlist_listedinsurftips", "1");
}
else prop.put("testlist_url","not valid");
@@ -512,7 +512,7 @@ public class Blacklist_p {
* @return null if no error occured, else a String to put into LOCATION
*/
private static String addBlacklistEntry(final String blacklistToUse, String newEntry,
- final httpRequestHeader header, final String[] supportedBlacklistTypes) {
+ final RequestHeader header, final String[] supportedBlacklistTypes) {
if (blacklistToUse == null || blacklistToUse.trim().length() == 0) {
return "";
@@ -560,7 +560,7 @@ public class Blacklist_p {
// add to blacklist
for (int blTypes = 0; blTypes < supportedBlacklistTypes.length; blTypes++) {
if (listManager.listSetContains(supportedBlacklistTypes[blTypes] + ".BlackLists", blacklistToUse)) {
- plasmaSwitchboard.urlBlacklist.add(supportedBlacklistTypes[blTypes], newEntry.substring(0, pos), newEntry.substring(pos + 1));
+ Switchboard.urlBlacklist.add(supportedBlacklistTypes[blTypes], newEntry.substring(0, pos), newEntry.substring(pos + 1));
}
}
}
@@ -577,7 +577,7 @@ public class Blacklist_p {
* @return null if no error occured, else a String to put into LOCATION
*/
private static String deleteBlacklistEntry(final String blacklistToUse, String oldEntry,
- final httpRequestHeader header, final String[] supportedBlacklistTypes) {
+ final RequestHeader header, final String[] supportedBlacklistTypes) {
if (blacklistToUse == null || blacklistToUse.trim().length() == 0) {
return "";
@@ -610,7 +610,7 @@ public class Blacklist_p {
}
for (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) {
if (listManager.listSetContains(supportedBlacklistTypes[blTypes] + ".BlackLists",blacklistToUse)) {
- plasmaSwitchboard.urlBlacklist.remove(supportedBlacklistTypes[blTypes],oldEntry.substring(0, pos), oldEntry.substring(pos + 1));
+ Switchboard.urlBlacklist.remove(supportedBlacklistTypes[blTypes],oldEntry.substring(0, pos), oldEntry.substring(pos + 1));
}
}
diff --git a/htroot/Blog.java b/htroot/Blog.java
index 6f0e0c220..4b1e82708 100644
--- a/htroot/Blog.java
+++ b/htroot/Blog.java
@@ -36,10 +36,10 @@ import java.util.Iterator;
import de.anomic.data.blogBoard;
import de.anomic.data.userDB;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyNewsPool;
@@ -56,8 +56,8 @@ public class Blog {
return SimpleFormatter.format(date);
}
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
blogBoard.BlogEntry page = null;
@@ -68,7 +68,7 @@ public class Blog {
prop.put("display", 1); // Fixed to 1
- final boolean xml = (header.get(httpHeader.CONNECTION_PROP_PATH)).endsWith(".xml");
+ final boolean xml = (header.get(HeaderFramework.CONNECTION_PROP_PATH)).endsWith(".xml");
final String address = sb.peers.mySeed().getPublicAddress();
if(hasRights) {
@@ -87,7 +87,7 @@ public class Blog {
final int num = post.getInt("num",10); //indicates how many entries should be shown
if(!hasRights){
- final userDB.Entry userentry = sb.userDB.proxyAuth(header.get(httpRequestHeader.AUTHORIZATION, "xxxxxx"));
+ final userDB.Entry userentry = sb.userDB.proxyAuth(header.get(RequestHeader.AUTHORIZATION, "xxxxxx"));
if(userentry != null && userentry.hasRight(userDB.Entry.BLOG_RIGHT)){
hasRights=true;
} else if(post.containsKey("login")) {
@@ -97,7 +97,7 @@ public class Blog {
}
String pagename = post.get("page", DEFAULT_PAGE);
- final String ip = header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "127.0.0.1");
+ final String ip = header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "127.0.0.1");
String StrAuthor = post.get("author", "");
@@ -265,7 +265,7 @@ public class Blog {
private static serverObjects putBlogDefault(
final serverObjects prop,
- final plasmaSwitchboard switchboard,
+ final Switchboard switchboard,
final String address,
int start,
int num,
diff --git a/htroot/BlogComments.java b/htroot/BlogComments.java
index d1bfa8323..a8115f42e 100644
--- a/htroot/BlogComments.java
+++ b/htroot/BlogComments.java
@@ -40,10 +40,10 @@ import de.anomic.data.blogBoardComments;
import de.anomic.data.messageBoard;
import de.anomic.data.userDB;
import de.anomic.data.blogBoard.BlogEntry;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyCore;
@@ -58,8 +58,8 @@ public class BlogComments {
return SimpleFormatter.format(date);
}
- public static serverObjects respond(final httpRequestHeader header, serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
blogBoard.BlogEntry page = null;
boolean hasRights = sb.verifyAuthentication(header, true);
@@ -73,7 +73,7 @@ public class BlogComments {
}
if(!hasRights){
- final userDB.Entry userentry = sb.userDB.proxyAuth(header.get(httpRequestHeader.AUTHORIZATION, "xxxxxx"));
+ final userDB.Entry userentry = sb.userDB.proxyAuth(header.get(RequestHeader.AUTHORIZATION, "xxxxxx"));
if(userentry != null && userentry.hasRight(userDB.Entry.BLOG_RIGHT)){
hasRights=true;
}
@@ -84,7 +84,7 @@ public class BlogComments {
}
final String pagename = post.get("page", "blog_default");
- final String ip = post.get(httpHeader.CONNECTION_PROP_CLIENTIP, "127.0.0.1");
+ final String ip = post.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "127.0.0.1");
String StrAuthor = post.get("author", "anonymous");
@@ -321,7 +321,7 @@ public class BlogComments {
return prop;
}
- private static void messageForwardingViaEmail(final plasmaSwitchboard sb, final messageBoard.entry msgEntry) {
+ private static void messageForwardingViaEmail(final Switchboard sb, final messageBoard.entry msgEntry) {
try {
if (!Boolean.valueOf(sb.getConfig("msgForwardingEnabled","false")).booleanValue()) return;
diff --git a/htroot/Bookmarks.java b/htroot/Bookmarks.java
index 961430190..8811cc179 100644
--- a/htroot/Bookmarks.java
+++ b/htroot/Bookmarks.java
@@ -41,11 +41,11 @@ import de.anomic.data.listManager;
import de.anomic.data.userDB;
import de.anomic.data.bookmarksDB.Tag;
import de.anomic.document.Document;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.search.SnippetCache;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyNewsPool;
@@ -57,7 +57,7 @@ import de.anomic.yacy.logging.Log;
public class Bookmarks {
private static final serverObjects prop = new serverObjects();
- private static plasmaSwitchboard sb = null;
+ private static Switchboard sb = null;
private static userDB.Entry user = null;
private static boolean isAdmin = false;
@@ -67,7 +67,7 @@ public class Bookmarks {
final static boolean TAGS = false;
final static boolean FOLDERS = true;
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
int max_count = 10;
int start=0;
@@ -76,7 +76,7 @@ public class Bookmarks {
String username="";
prop.clear();
- sb = (plasmaSwitchboard) env;
+ sb = (Switchboard) env;
user = sb.userDB.getUser(header);
isAdmin=(sb.verifyAuthentication(header, true) || user!= null && user.hasRight(userDB.Entry.BOOKMARK_RIGHT));
diff --git a/htroot/CacheResource_p.java b/htroot/CacheResource_p.java
index d79e459b2..395b1e67c 100644
--- a/htroot/CacheResource_p.java
+++ b/htroot/CacheResource_p.java
@@ -27,23 +27,23 @@
import java.io.File;
import java.io.IOException;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class CacheResource_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard switchboard = (Switchboard) env;
final serverObjects prop = new serverObjects();
final String path = ((post == null) ? "" : post.get("path", ""));
// we dont need check the path, because we have do that in plasmaSwitchboard.java - Borg-0300
- final File cache = switchboard.getConfigPath(plasmaSwitchboardConstants.HTCACHE_PATH, plasmaSwitchboardConstants.HTCACHE_PATH_DEFAULT);
+ final File cache = switchboard.getConfigPath(SwitchboardConstants.HTCACHE_PATH, SwitchboardConstants.HTCACHE_PATH_DEFAULT);
final File f = new File(cache, path);
byte[] resource;
diff --git a/htroot/Collage.java b/htroot/Collage.java
index 1386ee81e..2187b051e 100755
--- a/htroot/Collage.java
+++ b/htroot/Collage.java
@@ -21,8 +21,8 @@
import java.util.Random;
import de.anomic.crawler.ResultImages;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -43,9 +43,9 @@ public class Collage {
private static long imgZIndex[] = new long[fifoMax];
private static final Random rand = new Random();
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final boolean authenticated = sb.verifyAuthentication(header, false);
final ResultImages.OriginEntry nextOrigin = ResultImages.next(!authenticated);
int posXMax = 800;
diff --git a/htroot/ConfigAccounts_p.java b/htroot/ConfigAccounts_p.java
index eb9a38010..1dce46bad 100644
--- a/htroot/ConfigAccounts_p.java
+++ b/htroot/ConfigAccounts_p.java
@@ -31,19 +31,19 @@ import java.util.HashMap;
import java.util.Iterator;
import de.anomic.data.userDB;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.http.httpd;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.server.HTTPDemon;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.order.Digest;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class ConfigAccounts_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
- final plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
+ final Switchboard sb = Switchboard.getSwitchboard();
userDB.Entry entry=null;
// admin password
@@ -57,7 +57,7 @@ public class ConfigAccounts_p {
// may be overwritten if new password is given
if ((user.length() > 0) && (pw1.length() > 3) && (pw1.equals(pw2))) {
// check passed. set account:
- env.setConfig(httpd.ADMIN_ACCOUNT_B64MD5, Digest.encodeMD5Hex(Base64Order.standardCoder.encodeString(user + ":" + pw1)));
+ env.setConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, Digest.encodeMD5Hex(Base64Order.standardCoder.encodeString(user + ":" + pw1)));
env.setConfig("adminAccount", "");
}
@@ -71,22 +71,22 @@ public class ConfigAccounts_p {
sb.setConfig("adminAccountForLocalhost", true);
// if an localhost access is configured, check if a local password is given
// if not, set a random password
- if (post != null && env.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() == 0) {
+ if (post != null && env.getConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, "").length() == 0) {
// make a 'random' password
- env.setConfig(httpd.ADMIN_ACCOUNT_B64MD5, "0000" + Digest.encodeMD5Hex(System.getProperties().toString() + System.currentTimeMillis()));
+ env.setConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, "0000" + Digest.encodeMD5Hex(System.getProperties().toString() + System.currentTimeMillis()));
env.setConfig("adminAccount", "");
}
}
} else {
sb.setConfig("adminAccountForLocalhost", false);
- if (env.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").startsWith("0000")) {
+ if (env.getConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, "").startsWith("0000")) {
// make shure that the user can still use the interface after a random password was set
- env.setConfig(httpd.ADMIN_ACCOUNT_B64MD5, "");
+ env.setConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, "");
}
}
}
- if (env.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() == 0 && !env.getConfigBool("adminAccountForLocalhost", false)) {
+ if (env.getConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, "").length() == 0 && !env.getConfigBool("adminAccountForLocalhost", false)) {
prop.put("passwordNotSetWarning", 1);
}
diff --git a/htroot/ConfigAppearance_p.java b/htroot/ConfigAppearance_p.java
index ec8964f21..232d40871 100644
--- a/htroot/ConfigAppearance_p.java
+++ b/htroot/ConfigAppearance_p.java
@@ -36,20 +36,20 @@ import java.util.List;
import de.anomic.crawler.retrieval.HTTPLoader;
import de.anomic.data.listManager;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.client.Client;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyURL;
public class ConfigAppearance_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final String skinPath = new File(env.getRootPath(), env.getConfig("skinPath", "DATA/SKINS")).toString();
// Fallback
@@ -90,9 +90,9 @@ public class ConfigAppearance_p {
ArrayList<String> skinVector;
try {
final yacyURL u = new yacyURL(url, null);
- final httpRequestHeader reqHeader = new httpRequestHeader();
- reqHeader.put(httpHeader.USER_AGENT, HTTPLoader.yacyUserAgent);
- skinVector = FileUtils.strings(httpClient.wget(u.toString(), reqHeader, 10000), "UTF-8");
+ final RequestHeader reqHeader = new RequestHeader();
+ reqHeader.put(HeaderFramework.USER_AGENT, HTTPLoader.yacyUserAgent);
+ skinVector = FileUtils.strings(Client.wget(u.toString(), reqHeader, 10000), "UTF-8");
} catch (final IOException e) {
prop.put("status", "1");// unable to get URL
prop.put("status_url", url);
@@ -133,7 +133,7 @@ public class ConfigAppearance_p {
return prop;
}
- private static boolean changeSkin(final plasmaSwitchboard sb, final String skinPath, final String skin) {
+ private static boolean changeSkin(final Switchboard sb, final String skinPath, final String skin) {
final File htdocsDir = new File(sb.getConfigPath("htDocsPath", "DATA/HTDOCS"), "env");
final File styleFile = new File(htdocsDir, "style.css");
final File skinFile = new File(skinPath, skin);
diff --git a/htroot/ConfigBasic.java b/htroot/ConfigBasic.java
index 4dbaab0d9..4ca45b0f2 100644
--- a/htroot/ConfigBasic.java
+++ b/htroot/ConfigBasic.java
@@ -32,13 +32,13 @@ import java.io.File;
import java.util.regex.Pattern;
import de.anomic.data.translator;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.http.httpd;
-import de.anomic.http.httpdFileHandler;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.server.HTTPDemon;
+import de.anomic.http.server.HTTPDFileHandler;
import de.anomic.net.UPnP;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverCore;
import de.anomic.server.serverDomains;
import de.anomic.server.serverInstantBusyThread;
@@ -54,10 +54,10 @@ public class ConfigBasic {
private static final int NEXTSTEP_PEERPORT = 3;
private static final int NEXTSTEP_RECONNECT = 4;
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
final String langPath = env.getConfigPath("locale.work", "DATA/LOCALE/locales").getAbsolutePath();
String lang = env.getConfig("locale.language", "default");
@@ -103,8 +103,8 @@ public class ConfigBasic {
boolean upnp = false;
if(post != null && post.containsKey("port")) { // hack to allow checkbox
if (post.containsKey("enableUpnp")) upnp = true;
- if (upnp && !sb.getConfigBool(plasmaSwitchboardConstants.UPNP_ENABLED, false)) UPnP.addPortMapping();
- sb.setConfig(plasmaSwitchboardConstants.UPNP_ENABLED, upnp);
+ if (upnp && !sb.getConfigBool(SwitchboardConstants.UPNP_ENABLED, false)) UPnP.addPortMapping();
+ sb.setConfig(SwitchboardConstants.UPNP_ENABLED, upnp);
if(!upnp) UPnP.deletePortMapping();
}
@@ -122,8 +122,8 @@ public class ConfigBasic {
if (upnp) UPnP.addPortMapping();
String host = null;
- if (header.containsKey(httpHeader.HOST)) {
- host = header.get(httpHeader.HOST);
+ if (header.containsKey(HeaderFramework.HOST)) {
+ host = header.get(HeaderFramework.HOST);
final int idx = host.indexOf(":");
if (idx != -1) host = host.substring(0,idx);
} else {
@@ -149,28 +149,28 @@ public class ConfigBasic {
}
// set a use case
- String networkName = sb.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "");
+ String networkName = sb.getConfig(SwitchboardConstants.NETWORK_NAME, "");
if (post != null && post.containsKey("usecase")) {
if (post.get("usecase", "").equals("freeworld") && !networkName.equals("freeworld")) {
// switch to freeworld network
sb.switchNetwork("defaults/yacy.network.freeworld.unit");
// switch to p2p mode
- sb.setConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW, true);
- sb.setConfig(plasmaSwitchboardConstants.INDEX_RECEIVE_ALLOW, true);
+ sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW, true);
+ sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, true);
}
if (post.get("usecase", "").equals("portal") && !networkName.equals("webportal")) {
// switch to webportal network
sb.switchNetwork("defaults/yacy.network.webportal.unit");
// switch to robinson mode
- sb.setConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW, false);
- sb.setConfig(plasmaSwitchboardConstants.INDEX_RECEIVE_ALLOW, false);
+ sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW, false);
+ sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false);
}
if (post.get("usecase", "").equals("intranet") && !networkName.equals("intranet")) {
// switch to intranet network
sb.switchNetwork("defaults/yacy.network.intranet.unit");
// switch to p2p mode: enable ad-hoc networks between intranet users
- sb.setConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW, false);
- sb.setConfig(plasmaSwitchboardConstants.INDEX_RECEIVE_ALLOW, false);
+ sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW, false);
+ sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false);
}
if (post.get("usecase", "").equals("intranet")) {
String repositoryPath = post.get("repositoryPath", "/DATA/HTROOT/repository");
@@ -181,7 +181,7 @@ public class ConfigBasic {
}
}
- networkName = sb.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "");
+ networkName = sb.getConfig(SwitchboardConstants.NETWORK_NAME, "");
if (networkName.equals("freeworld")) {
prop.put("setUseCase", 1);
prop.put("setUseCase_freeworldChecked", 1);
@@ -198,14 +198,14 @@ public class ConfigBasic {
prop.put("setUseCase_repositoryPath", sb.getConfig("repositoryPath", "/DATA/HTROOT/repository"));
// check if values are proper
- final boolean properPassword = (sb.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() > 0) || sb.getConfigBool("adminAccountForLocalhost", false);
+ final boolean properPassword = (sb.getConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, "").length() > 0) || sb.getConfigBool("adminAccountForLocalhost", false);
final boolean properName = (env.getConfig("peerName","").length() >= 3) && (!(yacySeed.isDefaultPeerName(env.getConfig("peerName",""))));
final boolean properPort = (sb.peers.mySeed().isSenior()) || (sb.peers.mySeed().isPrincipal());
if ((env.getConfig("defaultFiles", "").startsWith("ConfigBasic.html,"))) {
env.setConfig("defaultFiles", env.getConfig("defaultFiles", "").substring(17));
env.setConfig("browserPopUpPage", "Status.html");
- httpdFileHandler.initDefaultPath();
+ HTTPDFileHandler.initDefaultPath();
}
prop.put("statusName", properName ? "1" : "0");
@@ -222,7 +222,7 @@ public class ConfigBasic {
prop.put("nextStep", NEXTSTEP_FINISHED);
}
- final boolean upnp_enabled = env.getConfigBool(plasmaSwitchboardConstants.UPNP_ENABLED, false);
+ final boolean upnp_enabled = env.getConfigBool(SwitchboardConstants.UPNP_ENABLED, false);
prop.put("upnp", "1");
prop.put("upnp_enabled", upnp_enabled ? "1" : "0");
if (upnp_enabled) prop.put("upnp_success", (UPnP.getMappedPort() > 0) ? "2" : "1");
diff --git a/htroot/ConfigLanguage_p.java b/htroot/ConfigLanguage_p.java
index e58a1f226..514a791ba 100644
--- a/htroot/ConfigLanguage_p.java
+++ b/htroot/ConfigLanguage_p.java
@@ -39,9 +39,9 @@ import java.util.List;
import de.anomic.crawler.retrieval.HTTPLoader;
import de.anomic.data.listManager;
import de.anomic.data.translator;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.client.Client;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.FileUtils;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -50,7 +50,7 @@ import de.anomic.yacy.yacyURL;
public class ConfigLanguage_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
//listManager.switchboard = (plasmaSwitchboard) env;
final serverObjects prop = new serverObjects();
final String langPath = env.getConfigPath("locale.work", "DATA/LOCALE/locales").getAbsolutePath();
@@ -80,9 +80,9 @@ public class ConfigLanguage_p {
ArrayList<String> langVector;
try{
final yacyURL u = new yacyURL(url, null);
- final httpRequestHeader reqHeader = new httpRequestHeader();
- reqHeader.put(httpHeader.USER_AGENT, HTTPLoader.yacyUserAgent);
- langVector = FileUtils.strings(httpClient.wget(u.toString(), reqHeader, 10000), "UTF-8");
+ final RequestHeader reqHeader = new RequestHeader();
+ reqHeader.put(HeaderFramework.USER_AGENT, HTTPLoader.yacyUserAgent);
+ langVector = FileUtils.strings(Client.wget(u.toString(), reqHeader, 10000), "UTF-8");
}catch(final IOException e){
prop.put("status", "1");//unable to get url
prop.put("status_url", url);
diff --git a/htroot/ConfigLiveSearch.java b/htroot/ConfigLiveSearch.java
index 580acbfd8..a44cbac0a 100644
--- a/htroot/ConfigLiveSearch.java
+++ b/htroot/ConfigLiveSearch.java
@@ -21,16 +21,16 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class ConfigLiveSearch {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
prop.putHTML("ip", sb.peers.mySeed().getIP());
prop.putHTML("port", sb.getConfig("port", "8080"));
diff --git a/htroot/ConfigNetwork_p.java b/htroot/ConfigNetwork_p.java
index 26f527296..5b5fd8c45 100644
--- a/htroot/ConfigNetwork_p.java
+++ b/htroot/ConfigNetwork_p.java
@@ -28,11 +28,11 @@
import java.io.File;
import java.util.HashSet;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.http.httpd;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.server.HTTPDemon;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverBusyThread;
import de.anomic.server.serverCodings;
import de.anomic.server.serverObjects;
@@ -40,9 +40,9 @@ import de.anomic.server.serverSwitch;
public class ConfigNetwork_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
int commit = 0;
@@ -63,7 +63,7 @@ public class ConfigNetwork_p {
commit = 1;
sb.switchNetwork(networkDefinition);
// check if the password is given
- if (sb.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() == 0) {
+ if (sb.getConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, "").length() == 0) {
prop.put("commitPasswordWarning", "1");
}
}
@@ -105,28 +105,28 @@ public class ConfigNetwork_p {
}
if (indexDistribute) {
- sb.setConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW, true);
+ sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW, true);
} else {
- sb.setConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW, false);
+ sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW, false);
}
if (post.get("indexDistributeWhileCrawling","").equals("on")) {
- sb.setConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW_WHILE_CRAWLING, true);
+ sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_CRAWLING, true);
} else {
- sb.setConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW_WHILE_CRAWLING, false);
+ sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_CRAWLING, false);
}
if (post.get("indexDistributeWhileIndexing","").equals("on")) {
- sb.setConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, true);
+ sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, true);
} else {
- sb.setConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, false);
+ sb.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, false);
}
if (indexReceive) {
- sb.setConfig(plasmaSwitchboardConstants.INDEX_RECEIVE_ALLOW, true);
+ sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, true);
sb.peers.mySeed().setFlagAcceptRemoteIndex(true);
} else {
- sb.setConfig(plasmaSwitchboardConstants.INDEX_RECEIVE_ALLOW, false);
+ sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false);
sb.peers.mySeed().setFlagAcceptRemoteIndex(false);
}
@@ -151,20 +151,20 @@ public class ConfigNetwork_p {
final long newBusySleep = Math.max(100, 60000 / newppm);
// propagate to crawler
- final serverBusyThread rct = sb.getThread(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
- sb.setConfig(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_BUSYSLEEP, newBusySleep);
- sb.setConfig(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_IDLESLEEP, newBusySleep * 3);
+ final serverBusyThread rct = sb.getThread(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
+ sb.setConfig(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_BUSYSLEEP, newBusySleep);
+ sb.setConfig(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_IDLESLEEP, newBusySleep * 3);
rct.setBusySleep(newBusySleep);
rct.setIdleSleep(newBusySleep * 3);
// propagate to loader
- final serverBusyThread rcl = sb.getThread(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER);
- sb.setConfig(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER_BUSYSLEEP, newBusySleep * 5);
- sb.setConfig(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER_IDLESLEEP, newBusySleep * 10);
+ final serverBusyThread rcl = sb.getThread(SwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER);
+ sb.setConfig(SwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER_BUSYSLEEP, newBusySleep * 5);
+ sb.setConfig(SwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER_IDLESLEEP, newBusySleep * 10);
rcl.setBusySleep(newBusySleep * 5);
rcl.setIdleSleep(newBusySleep * 10);
- sb.setConfig(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_BUSYSLEEP, Long.toString(newBusySleep));
+ sb.setConfig(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_BUSYSLEEP, Long.toString(newBusySleep));
sb.setConfig("cluster.peers.ipport", checkIPPortList(post.get("cluster.peers.ipport", "")));
sb.setConfig("cluster.peers.yacydomain", checkYaCyDomainList(post.get("cluster.peers.yacydomain", "")));
@@ -181,18 +181,18 @@ public class ConfigNetwork_p {
prop.put("crawlResponse", sb.getConfigBool("crawlResponse", false) ? "1" : "0");
long RTCbusySleep = 100;
try {
- RTCbusySleep = Math.max(1, Integer.parseInt(env.getConfig(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_BUSYSLEEP, "100")));
+ RTCbusySleep = Math.max(1, Integer.parseInt(env.getConfig(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_BUSYSLEEP, "100")));
} catch (final NumberFormatException e) {}
final int RTCppm = (int) (60000L / RTCbusySleep);
prop.put("acceptCrawlLimit", RTCppm);
- final boolean indexDistribute = sb.getConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW, "true").equals("true");
- final boolean indexReceive = sb.getConfig(plasmaSwitchboardConstants.INDEX_RECEIVE_ALLOW, "true").equals("true");
+ final boolean indexDistribute = sb.getConfig(SwitchboardConstants.INDEX_DIST_ALLOW, "true").equals("true");
+ final boolean indexReceive = sb.getConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, "true").equals("true");
prop.put("indexDistributeChecked", (indexDistribute) ? "1" : "0");
- prop.put("indexDistributeWhileCrawling.on", (sb.getConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW_WHILE_CRAWLING, "true").equals("true")) ? "1" : "0");
- prop.put("indexDistributeWhileCrawling.off", (sb.getConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW_WHILE_CRAWLING, "true").equals("true")) ? "0" : "1");
- prop.put("indexDistributeWhileIndexing.on", (sb.getConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, "true").equals("true")) ? "1" : "0");
- prop.put("indexDistributeWhileIndexing.off", (sb.getConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, "true").equals("true")) ? "0" : "1");
+ prop.put("indexDistributeWhileCrawling.on", (sb.getConfig(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_CRAWLING, "true").equals("true")) ? "1" : "0");
+ prop.put("indexDistributeWhileCrawling.off", (sb.getConfig(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_CRAWLING, "true").equals("true")) ? "0" : "1");
+ prop.put("indexDistributeWhileIndexing.on", (sb.getConfig(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, "true").equals("true")) ? "1" : "0");
+ prop.put("indexDistributeWhileIndexing.off", (sb.getConfig(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, "true").equals("true")) ? "0" : "1");
prop.put("indexReceiveChecked", (indexReceive) ? "1" : "0");
prop.put("indexReceiveBlockBlacklistChecked.on", (sb.getConfig("indexReceiveBlockBlacklist", "true").equals("true")) ? "1" : "0");
prop.put("indexReceiveBlockBlacklistChecked.off", (sb.getConfig("indexReceiveBlockBlacklist", "true").equals("true")) ? "0" : "1");
@@ -220,7 +220,7 @@ public class ConfigNetwork_p {
// set network configuration
prop.putHTML("network.unit.definition", sb.getConfig("network.unit.definition", ""));
- prop.putHTML("network.unit.name", sb.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, ""));
+ prop.putHTML("network.unit.name", sb.getConfig(SwitchboardConstants.NETWORK_NAME, ""));
prop.putHTML("network.unit.description", sb.getConfig("network.unit.description", ""));
prop.putHTML("network.unit.domain", sb.getConfig("network.unit.domain", ""));
prop.putHTML("network.unit.dht", sb.getConfig("network.unit.dht", ""));
diff --git a/htroot/ConfigPHPBB3Search.java b/htroot/ConfigPHPBB3Search.java
index f9088c9ea..d2948cc5d 100644
--- a/htroot/ConfigPHPBB3Search.java
+++ b/htroot/ConfigPHPBB3Search.java
@@ -24,23 +24,23 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class ConfigPHPBB3Search {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
// define visible variables
String a = sb.peers.mySeed().getPublicAddress();
if (a == null) a = "localhost:" + sb.getConfig("port", "8080");
- boolean intranet = sb.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "").equals("intranet");
+ boolean intranet = sb.getConfig(SwitchboardConstants.NETWORK_NAME, "").equals("intranet");
String repository = "http://" + a + "/repository/";
prop.put("starturl", (intranet) ? repository : "http://");
prop.put("address", a);
diff --git a/htroot/ConfigParser.java b/htroot/ConfigParser.java
index c79476fff..5c3296971 100644
--- a/htroot/ConfigParser.java
+++ b/htroot/ConfigParser.java
@@ -23,19 +23,19 @@
import de.anomic.document.Idiom;
import de.anomic.document.Parser;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class ConfigParser {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
if (post != null) {
@@ -53,7 +53,7 @@ public class ConfigParser {
Parser.grantMime(mimeType, post.get("mimename_" + mimeType, "").equals("on"));
}
}
- env.setConfig(plasmaSwitchboardConstants.PARSER_MIME_DENY, Parser.getDenyMime());
+ env.setConfig(SwitchboardConstants.PARSER_MIME_DENY, Parser.getDenyMime());
}
}
diff --git a/htroot/ConfigPortal.java b/htroot/ConfigPortal.java
index d45b49411..94c4bcd4a 100644
--- a/htroot/ConfigPortal.java
+++ b/htroot/ConfigPortal.java
@@ -21,21 +21,21 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class ConfigPortal {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
if (post != null) {
// AUTHENTICATE
- if (!header.containsKey(httpRequestHeader.AUTHORIZATION)) {
+ if (!header.containsKey(RequestHeader.AUTHORIZATION)) {
prop.putHTML("AUTHENTICATE","log-in");
return prop;
}
@@ -43,36 +43,36 @@ public class ConfigPortal {
if (post.containsKey("popup")) {
String popup = post.get("popup", "status");
if (popup.equals("front")) {
- sb.setConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "index.html?display=2");
+ sb.setConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "index.html?display=2");
} else if (popup.equals("search")) {
- sb.setConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "yacysearch.html?display=2");
+ sb.setConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "yacysearch.html?display=2");
} else if (popup.equals("interactive")) {
- sb.setConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "yacyinteractive.html?display=2");
+ sb.setConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "yacyinteractive.html?display=2");
} else {
- sb.setConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "Status.html");
+ sb.setConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "Status.html");
}
}
if (post.containsKey("searchpage_set")) {
- sb.setConfig(plasmaSwitchboardConstants.GREETING, post.get(plasmaSwitchboardConstants.GREETING, ""));
- sb.setConfig(plasmaSwitchboardConstants.GREETING_HOMEPAGE, post.get(plasmaSwitchboardConstants.GREETING_HOMEPAGE, ""));
- sb.setConfig(plasmaSwitchboardConstants.GREETING_LARGE_IMAGE, post.get(plasmaSwitchboardConstants.GREETING_LARGE_IMAGE, ""));
- sb.setConfig(plasmaSwitchboardConstants.GREETING_SMALL_IMAGE, post.get(plasmaSwitchboardConstants.GREETING_SMALL_IMAGE, ""));
+ sb.setConfig(SwitchboardConstants.GREETING, post.get(SwitchboardConstants.GREETING, ""));
+ sb.setConfig(SwitchboardConstants.GREETING_HOMEPAGE, post.get(SwitchboardConstants.GREETING_HOMEPAGE, ""));
+ sb.setConfig(SwitchboardConstants.GREETING_LARGE_IMAGE, post.get(SwitchboardConstants.GREETING_LARGE_IMAGE, ""));
+ sb.setConfig(SwitchboardConstants.GREETING_SMALL_IMAGE, post.get(SwitchboardConstants.GREETING_SMALL_IMAGE, ""));
}
if (post.containsKey("searchpage_default")) {
- sb.setConfig(plasmaSwitchboardConstants.GREETING, "P2P Web Search");
- sb.setConfig(plasmaSwitchboardConstants.GREETING_HOMEPAGE, "http://yacy.net");
- sb.setConfig(plasmaSwitchboardConstants.GREETING_LARGE_IMAGE, "/env/grafics/YaCyLogo_120ppi.png");
- sb.setConfig(plasmaSwitchboardConstants.GREETING_SMALL_IMAGE, "/env/grafics/YaCyLogo_60ppi.png");
- sb.setConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "Status.html");
+ sb.setConfig(SwitchboardConstants.GREETING, "P2P Web Search");
+ sb.setConfig(SwitchboardConstants.GREETING_HOMEPAGE, "http://yacy.net");
+ sb.setConfig(SwitchboardConstants.GREETING_LARGE_IMAGE, "/env/grafics/YaCyLogo_120ppi.png");
+ sb.setConfig(SwitchboardConstants.GREETING_SMALL_IMAGE, "/env/grafics/YaCyLogo_60ppi.png");
+ sb.setConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "Status.html");
}
}
- prop.putHTML(plasmaSwitchboardConstants.GREETING, sb.getConfig(plasmaSwitchboardConstants.GREETING, ""));
- prop.putHTML(plasmaSwitchboardConstants.GREETING_HOMEPAGE, sb.getConfig(plasmaSwitchboardConstants.GREETING_HOMEPAGE, ""));
- prop.putHTML(plasmaSwitchboardConstants.GREETING_LARGE_IMAGE, sb.getConfig(plasmaSwitchboardConstants.GREETING_LARGE_IMAGE, ""));
- prop.putHTML(plasmaSwitchboardConstants.GREETING_SMALL_IMAGE, sb.getConfig(plasmaSwitchboardConstants.GREETING_SMALL_IMAGE, ""));
+ prop.putHTML(SwitchboardConstants.GREETING, sb.getConfig(SwitchboardConstants.GREETING, ""));
+ prop.putHTML(SwitchboardConstants.GREETING_HOMEPAGE, sb.getConfig(SwitchboardConstants.GREETING_HOMEPAGE, ""));
+ prop.putHTML(SwitchboardConstants.GREETING_LARGE_IMAGE, sb.getConfig(SwitchboardConstants.GREETING_LARGE_IMAGE, ""));
+ prop.putHTML(SwitchboardConstants.GREETING_SMALL_IMAGE, sb.getConfig(SwitchboardConstants.GREETING_SMALL_IMAGE, ""));
- final String browserPopUpPage = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "ConfigBasic.html");
+ final String browserPopUpPage = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "ConfigBasic.html");
prop.put("popupFront", 0);
prop.put("popupSearch", 0);
prop.put("popupInteractive", 0);
diff --git a/htroot/ConfigProfile_p.java b/htroot/ConfigProfile_p.java
index fc9b61058..49a516480 100644
--- a/htroot/ConfigProfile_p.java
+++ b/htroot/ConfigProfile_p.java
@@ -35,8 +35,8 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyNewsPool;
@@ -44,8 +44,8 @@ import de.anomic.yacy.yacyNewsRecord;
public class ConfigProfile_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
final Properties profile = new Properties();
FileInputStream fileIn = null;
diff --git a/htroot/ConfigProperties_p.java b/htroot/ConfigProperties_p.java
index 6fac6d437..d0e11bcc0 100644
--- a/htroot/ConfigProperties_p.java
+++ b/htroot/ConfigProperties_p.java
@@ -33,13 +33,13 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class ConfigProperties_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
int count=0;
diff --git a/htroot/ConfigRobotsTxt_p.java b/htroot/ConfigRobotsTxt_p.java
index 6dccc106a..176e275c7 100644
--- a/htroot/ConfigRobotsTxt_p.java
+++ b/htroot/ConfigRobotsTxt_p.java
@@ -29,55 +29,55 @@
// javac -classpath .:../classes ConfigRobotsTxt_p.java
// if the shell's current path is HTROOT
-import de.anomic.http.httpRequestHeader;
-import de.anomic.http.httpdRobotsTxtConfig;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.server.RobotsTxtConfig;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.servletProperties;
public class ConfigRobotsTxt_p {
- public static servletProperties respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static servletProperties respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final servletProperties prop = new servletProperties();
- final httpdRobotsTxtConfig rbc = ((plasmaSwitchboard)env).robotstxtConfig;
+ final RobotsTxtConfig rbc = ((Switchboard)env).robotstxtConfig;
prop.put("clientname", sb.peers.mySeed().getPublicAddress());
if (post != null) {
if (post.containsKey("save")) {
- rbc.setAllDisallowed(post.containsKey(httpdRobotsTxtConfig.ALL));
- rbc.setBlogDisallowed(post.containsKey(httpdRobotsTxtConfig.BLOG));
- rbc.setBookmarksDisallowed(post.containsKey(httpdRobotsTxtConfig.BOOKMARKS));
- rbc.setDirsDisallowed(post.containsKey(httpdRobotsTxtConfig.DIRS));
- rbc.setFileshareDisallowed(post.containsKey(httpdRobotsTxtConfig.FILESHARE));
- rbc.setHomepageDisallowed(post.containsKey(httpdRobotsTxtConfig.HOMEPAGE));
- rbc.setLockedDisallowed(post.containsKey(httpdRobotsTxtConfig.LOCKED));
- rbc.setNetworkDisallowed(post.containsKey(httpdRobotsTxtConfig.NETWORK));
- rbc.setNewsDisallowed(post.containsKey(httpdRobotsTxtConfig.NEWS));
- rbc.setStatusDisallowed(post.containsKey(httpdRobotsTxtConfig.STATUS));
- rbc.setSurftipsDisallowed(post.containsKey(httpdRobotsTxtConfig.SURFTIPS));
- rbc.setWikiDisallowed(post.containsKey(httpdRobotsTxtConfig.WIKI));
- rbc.setProfileDisallowed(post.containsKey(httpdRobotsTxtConfig.PROFILE));
- env.setConfig(plasmaSwitchboardConstants.ROBOTS_TXT, rbc.toString());
+ rbc.setAllDisallowed(post.containsKey(RobotsTxtConfig.ALL));
+ rbc.setBlogDisallowed(post.containsKey(RobotsTxtConfig.BLOG));
+ rbc.setBookmarksDisallowed(post.containsKey(RobotsTxtConfig.BOOKMARKS));
+ rbc.setDirsDisallowed(post.containsKey(RobotsTxtConfig.DIRS));
+ rbc.setFileshareDisallowed(post.containsKey(RobotsTxtConfig.FILESHARE));
+ rbc.setHomepageDisallowed(post.containsKey(RobotsTxtConfig.HOMEPAGE));
+ rbc.setLockedDisallowed(post.containsKey(RobotsTxtConfig.LOCKED));
+ rbc.setNetworkDisallowed(post.containsKey(RobotsTxtConfig.NETWORK));
+ rbc.setNewsDisallowed(post.containsKey(RobotsTxtConfig.NEWS));
+ rbc.setStatusDisallowed(post.containsKey(RobotsTxtConfig.STATUS));
+ rbc.setSurftipsDisallowed(post.containsKey(RobotsTxtConfig.SURFTIPS));
+ rbc.setWikiDisallowed(post.containsKey(RobotsTxtConfig.WIKI));
+ rbc.setProfileDisallowed(post.containsKey(RobotsTxtConfig.PROFILE));
+ env.setConfig(SwitchboardConstants.ROBOTS_TXT, rbc.toString());
}
}
- prop.put(httpdRobotsTxtConfig.ALL + ".checked", (rbc.isAllDisallowed()) ? "1" : "0");
- prop.put(httpdRobotsTxtConfig.BLOG + ".checked", (rbc.isBlogDisallowed()) ? "1" : "0");
- prop.put(httpdRobotsTxtConfig.BOOKMARKS + ".checked", (rbc.isBookmarksDisallowed()) ? "1" : "0");
- prop.put(httpdRobotsTxtConfig.DIRS + ".checked", (rbc.isDirsDisallowed()) ? "1" : "0");
- prop.put(httpdRobotsTxtConfig.FILESHARE + ".checked", (rbc.isFileshareDisallowed()) ? "1" : "0");
- prop.put(httpdRobotsTxtConfig.HOMEPAGE + ".checked", (rbc.isHomepageDisallowed()) ? "1" : "0");
- prop.put(httpdRobotsTxtConfig.LOCKED + ".checked", (rbc.isLockedDisallowed()) ? "1" : "0");
- prop.put(httpdRobotsTxtConfig.NETWORK + ".checked", (rbc.isNetworkDisallowed()) ? "1" : "0");
- prop.put(httpdRobotsTxtConfig.NEWS + ".checked", (rbc.isNewsDisallowed()) ? "1" : "0");
- prop.put(httpdRobotsTxtConfig.STATUS + ".checked", (rbc.isStatusDisallowed()) ? "1" : "0");
- prop.put(httpdRobotsTxtConfig.SURFTIPS + ".checked", (rbc.isSurftipsDisallowed()) ? "1" : "0");
- prop.put(httpdRobotsTxtConfig.WIKI + ".checked", (rbc.isWikiDisallowed()) ? "1" : "0");
- prop.put(httpdRobotsTxtConfig.PROFILE + ".checked", (rbc.isProfileDisallowed()) ? "1" : "0");
+ prop.put(RobotsTxtConfig.ALL + ".checked", (rbc.isAllDisallowed()) ? "1" : "0");
+ prop.put(RobotsTxtConfig.BLOG + ".checked", (rbc.isBlogDisallowed()) ? "1" : "0");
+ prop.put(RobotsTxtConfig.BOOKMARKS + ".checked", (rbc.isBookmarksDisallowed()) ? "1" : "0");
+ prop.put(RobotsTxtConfig.DIRS + ".checked", (rbc.isDirsDisallowed()) ? "1" : "0");
+ prop.put(RobotsTxtConfig.FILESHARE + ".checked", (rbc.isFileshareDisallowed()) ? "1" : "0");
+ prop.put(RobotsTxtConfig.HOMEPAGE + ".checked", (rbc.isHomepageDisallowed()) ? "1" : "0");
+ prop.put(RobotsTxtConfig.LOCKED + ".checked", (rbc.isLockedDisallowed()) ? "1" : "0");
+ prop.put(RobotsTxtConfig.NETWORK + ".checked", (rbc.isNetworkDisallowed()) ? "1" : "0");
+ prop.put(RobotsTxtConfig.NEWS + ".checked", (rbc.isNewsDisallowed()) ? "1" : "0");
+ prop.put(RobotsTxtConfig.STATUS + ".checked", (rbc.isStatusDisallowed()) ? "1" : "0");
+ prop.put(RobotsTxtConfig.SURFTIPS + ".checked", (rbc.isSurftipsDisallowed()) ? "1" : "0");
+ prop.put(RobotsTxtConfig.WIKI + ".checked", (rbc.isWikiDisallowed()) ? "1" : "0");
+ prop.put(RobotsTxtConfig.PROFILE + ".checked", (rbc.isProfileDisallowed()) ? "1" : "0");
return prop;
}
}
diff --git a/htroot/ConfigUpdate_p.java b/htroot/ConfigUpdate_p.java
index d3e780570..9ad85cb34 100644
--- a/htroot/ConfigUpdate_p.java
+++ b/htroot/ConfigUpdate_p.java
@@ -29,9 +29,9 @@ import java.io.IOException;
import java.util.Date;
import java.util.TreeSet;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.serverSystem;
@@ -42,10 +42,10 @@ import de.anomic.yacy.yacyVersion;
public class ConfigUpdate_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
// set if this should be visible
if (yacyBuildProperties.isPkgManager()) {
diff --git a/htroot/ConfigWikiSearch.java b/htroot/ConfigWikiSearch.java
index 7d8488224..6c05ec841 100644
--- a/htroot/ConfigWikiSearch.java
+++ b/htroot/ConfigWikiSearch.java
@@ -24,23 +24,23 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class ConfigWikiSearch {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
// define visible variables
String a = sb.peers.mySeed().getPublicAddress();
if (a == null) a = "localhost:" + sb.getConfig("port", "8080");
- boolean intranet = sb.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "").equals("intranet");
+ boolean intranet = sb.getConfig(SwitchboardConstants.NETWORK_NAME, "").equals("intranet");
String repository = "http://" + a + "/repository/";
prop.put("starturl", (intranet) ? repository : "http://");
prop.put("address", a);
diff --git a/htroot/Connections_p.java b/htroot/Connections_p.java
index be0b6369a..06568f90e 100644
--- a/htroot/Connections_p.java
+++ b/htroot/Connections_p.java
@@ -33,13 +33,13 @@ import java.net.URLEncoder;
import java.util.Properties;
import java.util.Set;
-import de.anomic.http.HttpConnectionInfo;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.http.httpd;
+import de.anomic.http.client.ConnectionInfo;
+import de.anomic.http.client.Client;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.server.HTTPDemon;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverCore;
import de.anomic.server.serverHandler;
import de.anomic.server.serverObjects;
@@ -50,9 +50,9 @@ import de.anomic.yacy.yacySeed;
public final class Connections_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
@@ -141,17 +141,17 @@ public final class Connections_p {
String dest = null;
String prot = null;
final serverHandler cmdObj = currentSession.getCommandObj();
- if (cmdObj instanceof httpd) {
+ if (cmdObj instanceof HTTPDemon) {
prot = isSSL ? "https":"http";
// getting the http command object
- final httpd currentHttpd = (httpd)cmdObj;
+ final HTTPDemon currentHttpd = (HTTPDemon)cmdObj;
// getting the connection properties of this session
final Properties conProp = (Properties) currentHttpd.getConProp().clone();
// getting the destination host
- dest = conProp.getProperty(httpHeader.CONNECTION_PROP_HOST);
+ dest = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HOST);
if (dest==null)continue;
}
@@ -209,12 +209,12 @@ public final class Connections_p {
// client sessions
- final Set<HttpConnectionInfo> allConnections = HttpConnectionInfo.getAllConnections();
+ final Set<ConnectionInfo> allConnections = ConnectionInfo.getAllConnections();
// TODO sorting
// Arrays.sort(a, httpc.connectionTimeComparatorInstance);
int c = 0;
synchronized (allConnections) {
- for (final HttpConnectionInfo conInfo: allConnections) {
+ for (final ConnectionInfo conInfo: allConnections) {
prop.put("clientList_" + c + "_clientProtocol", conInfo.getProtocol());
prop.putNum("clientList_" + c + "_clientLifetime", conInfo.getLifetime());
prop.putNum("clientList_" + c + "_clientIdletime", conInfo.getIdletime());
@@ -225,7 +225,7 @@ public final class Connections_p {
}
}
prop.put("clientList", c);
- prop.put("clientActive", httpClient.connectionCount());
+ prop.put("clientActive", Client.connectionCount());
// return rewrite values for templates
return prop;
diff --git a/htroot/ContentIntegrationPHPBB3_p.java b/htroot/ContentIntegrationPHPBB3_p.java
index a889c9235..d689f1295 100644
--- a/htroot/ContentIntegrationPHPBB3_p.java
+++ b/htroot/ContentIntegrationPHPBB3_p.java
@@ -27,17 +27,17 @@ import java.io.File;
import de.anomic.content.dao.Dao;
import de.anomic.content.dao.ImportDump;
import de.anomic.content.dao.PhpBB3Dao;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class ContentIntegrationPHPBB3_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
prop.put("check", 0);
prop.put("export", 0);
diff --git a/htroot/CookieMonitorIncoming_p.java b/htroot/CookieMonitorIncoming_p.java
index d9df472f0..93bc0fc20 100644
--- a/htroot/CookieMonitorIncoming_p.java
+++ b/htroot/CookieMonitorIncoming_p.java
@@ -28,16 +28,16 @@ import java.util.Date;
import java.util.Iterator;
import java.util.Map;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class CookieMonitorIncoming_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch sb) {
- final plasmaSwitchboard switchboard = (plasmaSwitchboard) sb;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch sb) {
+ final Switchboard switchboard = (Switchboard) sb;
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
diff --git a/htroot/CookieMonitorOutgoing_p.java b/htroot/CookieMonitorOutgoing_p.java
index fb3226803..adc1bccf2 100644
--- a/htroot/CookieMonitorOutgoing_p.java
+++ b/htroot/CookieMonitorOutgoing_p.java
@@ -28,16 +28,16 @@ import java.util.Date;
import java.util.Iterator;
import java.util.Map;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class CookieMonitorOutgoing_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch sb) {
- final plasmaSwitchboard switchboard = (plasmaSwitchboard) sb;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch sb) {
+ final Switchboard switchboard = (Switchboard) sb;
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
diff --git a/htroot/CookieTest_p.java b/htroot/CookieTest_p.java
index b2cdc9e23..8cc9cd26a 100644
--- a/htroot/CookieTest_p.java
+++ b/htroot/CookieTest_p.java
@@ -30,14 +30,14 @@
import java.util.Iterator;
import java.util.Map;
-import de.anomic.http.httpResponseHeader;
+import de.anomic.http.metadata.ResponseHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.servletProperties;
public class CookieTest_p {
- public static serverObjects respond(final httpResponseHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final ResponseHeader header, final serverObjects post, final serverSwitch env) {
// case if no values are requested
@@ -50,7 +50,7 @@ public class CookieTest_p {
final servletProperties prop = new servletProperties();
if(post.containsKey("act")&&post.get("act").equals("clear_cookie")) {
- final httpResponseHeader outgoingHeader = new httpResponseHeader();
+ final ResponseHeader outgoingHeader = new ResponseHeader();
final Iterator<Map.Entry<String, String>> it = header.entrySet().iterator();
Map.Entry<String, String> e;
while (it.hasNext()) {
@@ -77,7 +77,7 @@ public class CookieTest_p {
{
final String cookieName = post.get("cookie_name").trim();
final String cookieValue = post.get("cookie_value").trim();
- final httpResponseHeader outgoingHeader=new httpResponseHeader();
+ final ResponseHeader outgoingHeader=new ResponseHeader();
outgoingHeader.setCookie(cookieName,cookieValue);
prop.setOutgoingHeader(outgoingHeader);
diff --git a/htroot/CrawlProfileEditor_p.java b/htroot/CrawlProfileEditor_p.java
index b17a68bac..35c800891 100644
--- a/htroot/CrawlProfileEditor_p.java
+++ b/htroot/CrawlProfileEditor_p.java
@@ -32,8 +32,8 @@ import java.util.Iterator;
import de.anomic.crawler.CrawlProfile;
import de.anomic.crawler.CrawlSwitchboard;
import de.anomic.crawler.CrawlProfile.entry;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.servletProperties;
@@ -79,9 +79,9 @@ public class CrawlProfileEditor_p {
labels.add(new eentry(entry.XPSTOPW, "Parent stop-words", false, eentry.BOOLEAN));
}
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final servletProperties prop = new servletProperties();
- final plasmaSwitchboard sb = (plasmaSwitchboard)env;
+ final Switchboard sb = (Switchboard)env;
// read post for handle
final String handle = (post == null) ? "" : post.get("handle", "");
diff --git a/htroot/CrawlResults.java b/htroot/CrawlResults.java
index 1db9933af..bcdc30fa0 100644
--- a/htroot/CrawlResults.java
+++ b/htroot/CrawlResults.java
@@ -30,9 +30,9 @@ import java.util.Date;
import java.util.Iterator;
import java.util.Locale;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.tools.nxTools;
@@ -42,9 +42,9 @@ import de.anomic.yacy.logging.Log;
public class CrawlResults {
- public static serverObjects respond(final httpRequestHeader header, serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
int lines = 500;
@@ -77,7 +77,7 @@ public class CrawlResults {
if (((tabletype > 0) && (tabletype < 6)) ||
(post != null && (post.containsKey("clearlist") ||
post.containsKey("deleteentry")))) {
- final String authorization = (header.get(httpRequestHeader.AUTHORIZATION, "xxxxxx"));
+ final String authorization = (header.get(RequestHeader.AUTHORIZATION, "xxxxxx"));
if (authorization.length() != 0) {
if (! sb.verifyAuthentication(header, true)){
// force log-in (again, because wrong password was given)
diff --git a/htroot/CrawlStart_p.java b/htroot/CrawlStart_p.java
index 2eed7b1a9..483e03ba4 100644
--- a/htroot/CrawlStart_p.java
+++ b/htroot/CrawlStart_p.java
@@ -25,22 +25,22 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import de.anomic.crawler.CrawlProfile;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class CrawlStart_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
// define visible variables
String a = sb.peers.mySeed().getPublicAddress();
- boolean intranet = sb.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "").equals("intranet");
+ boolean intranet = sb.getConfig(SwitchboardConstants.NETWORK_NAME, "").equals("intranet");
String repository = "http://" + ((a == null) ? "localhost:" + sb.getConfig("port", "8080") : a) + "/repository/";
prop.put("starturl", (intranet) ? repository : "http://");
prop.put("proxyPrefetchDepth", env.getConfig("proxyPrefetchDepth", "0"));
@@ -67,7 +67,7 @@ public class CrawlStart_p {
prop.put("indexingMediaChecked", env.getConfig("indexMedia", "").equals("true") ? "1" : "0");
prop.put("crawlOrderChecked", env.getConfig("crawlOrder", "").equals("true") ? "1" : "0");
- final long LCbusySleep = Integer.parseInt(env.getConfig(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL_BUSYSLEEP, "100"));
+ final long LCbusySleep = Integer.parseInt(env.getConfig(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL_BUSYSLEEP, "100"));
final int LCppm = (LCbusySleep == 0) ? 1000 : (int) (60000L / LCbusySleep);
prop.put("crawlingSpeedMaxChecked", (LCppm >= 1000) ? "1" : "0");
prop.put("crawlingSpeedCustChecked", ((LCppm > 10) && (LCppm < 1000)) ? "1" : "0");
diff --git a/htroot/FeedReader_p.java b/htroot/FeedReader_p.java
index d2af2f211..215b47cfc 100644
--- a/htroot/FeedReader_p.java
+++ b/htroot/FeedReader_p.java
@@ -27,7 +27,7 @@ import java.net.MalformedURLException;
import de.anomic.content.RSSMessage;
import de.anomic.document.parser.xml.RSSFeed;
import de.anomic.document.parser.xml.RSSReader;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.servletProperties;
@@ -38,7 +38,7 @@ import de.anomic.yacy.yacyURL;
public class FeedReader_p {
- public static servletProperties respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static servletProperties respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final servletProperties prop = new servletProperties();
prop.put("page", "0");
diff --git a/htroot/Help.java b/htroot/Help.java
index 8ae4f0eb3..87de9721e 100644
--- a/htroot/Help.java
+++ b/htroot/Help.java
@@ -1,4 +1,4 @@
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.servletProperties;
@@ -6,7 +6,7 @@ import de.anomic.server.servletProperties;
//dummy class
public class Help {
- public static servletProperties respond(final httpRequestHeader requestHeader, final serverObjects post, final serverSwitch env) {
+ public static servletProperties respond(final RequestHeader requestHeader, final serverObjects post, final serverSwitch env) {
final servletProperties prop = new servletProperties();
return prop;
}
diff --git a/htroot/IndexCleaner_p.java b/htroot/IndexCleaner_p.java
index f92224736..1055091a8 100755
--- a/htroot/IndexCleaner_p.java
+++ b/htroot/IndexCleaner_p.java
@@ -24,10 +24,10 @@
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.text.MetadataRepository;
import de.anomic.kelondro.text.Segment;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -35,15 +35,15 @@ public class IndexCleaner_p {
private static MetadataRepository.BlacklistCleaner urldbCleanerThread = null;
private static Segment.ReferenceCleaner indexCleanerThread = null;
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
prop.put("title", "DbCleanup_p");
if (post!=null) {
//prop.putHTML("bla", "post!=null");
if (post.get("action").equals("ustart")) {
if (urldbCleanerThread==null || !urldbCleanerThread.isAlive()) {
- urldbCleanerThread = sb.indexSegment.urlMetadata().getBlacklistCleaner(plasmaSwitchboard.urlBlacklist);
+ urldbCleanerThread = sb.indexSegment.urlMetadata().getBlacklistCleaner(Switchboard.urlBlacklist);
urldbCleanerThread.start();
}
else {
diff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.java
index e30963ffd..6cad77a1b 100644
--- a/htroot/IndexControlRWIs_p.java
+++ b/htroot/IndexControlRWIs_p.java
@@ -41,7 +41,7 @@ import de.anomic.data.Blacklist;
import de.anomic.data.listManager;
import de.anomic.document.Condenser;
import de.anomic.document.Word;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.order.Bitfield;
import de.anomic.kelondro.text.Reference;
import de.anomic.kelondro.text.ReferenceContainer;
@@ -51,10 +51,10 @@ import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;
import de.anomic.kelondro.text.referencePrototype.WordReference;
import de.anomic.kelondro.text.referencePrototype.WordReferenceRow;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.search.QueryParams;
import de.anomic.search.QueryEvent;
import de.anomic.search.RankingProcess;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyClient;
@@ -64,9 +64,9 @@ import de.anomic.yacy.dht.PeerSelection;
public class IndexControlRWIs_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
prop.putHTML("keystring", "");
@@ -292,7 +292,7 @@ public class IndexControlRWIs_p {
pw.println(url.getHost() + "/" + url.getFile());
for (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) {
if (listManager.listSetContains(supportedBlacklistTypes[blTypes] + ".BlackLists", blacklist)) {
- plasmaSwitchboard.urlBlacklist.add(
+ Switchboard.urlBlacklist.add(
supportedBlacklistTypes[blTypes],
url.getHost(),
url.getFile());
@@ -320,7 +320,7 @@ public class IndexControlRWIs_p {
pw.println(url.getHost() + "/.*");
for (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) {
if (listManager.listSetContains(supportedBlacklistTypes[blTypes] + ".BlackLists", blacklist)) {
- plasmaSwitchboard.urlBlacklist.add(
+ Switchboard.urlBlacklist.add(
supportedBlacklistTypes[blTypes],
url.getHost(), ".*");
}
@@ -411,7 +411,7 @@ public class IndexControlRWIs_p {
((entry.word().flags().get(WordReferenceRow.flag_app_emphasized)) ? "appears emphasized, " : "") +
((yacyURL.probablyRootURL(entry.word().metadataHash())) ? "probably root url" : "")
);
- if (plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_DHT, url)) {
+ if (Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_DHT, url)) {
prop.put("genUrlList_urlList_"+i+"_urlExists_urlhxChecked", "1");
}
i++;
@@ -460,7 +460,7 @@ public class IndexControlRWIs_p {
return b;
}
- public static void listHosts(final serverObjects prop, final byte[] startHash, final plasmaSwitchboard sb) {
+ public static void listHosts(final serverObjects prop, final byte[] startHash, final Switchboard sb) {
// list known hosts
yacySeed seed;
int hc = 0;
@@ -477,7 +477,7 @@ public class IndexControlRWIs_p {
prop.put("searchresult_hosts", hc);
}
- public static RankingProcess genSearchresult(final serverObjects prop, final plasmaSwitchboard sb, final byte[] keyhash, final Bitfield filter) {
+ public static RankingProcess genSearchresult(final serverObjects prop, final Switchboard sb, final byte[] keyhash, final Bitfield filter) {
final QueryParams query = new QueryParams(new String(keyhash), -1, sb.getRanking(), filter);
final RankingProcess ranked = new RankingProcess(sb.indexSegment, query, Integer.MAX_VALUE, 1);
ranked.execQuery();
diff --git a/htroot/IndexControlURLs_p.java b/htroot/IndexControlURLs_p.java
index c7ecb1d50..bab4ecbfc 100644
--- a/htroot/IndexControlURLs_p.java
+++ b/htroot/IndexControlURLs_p.java
@@ -30,13 +30,13 @@ import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Iterator;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.order.RotateIterator;
import de.anomic.kelondro.text.MetadataRepository;
import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacySeedDB;
@@ -44,9 +44,9 @@ import de.anomic.yacy.yacyURL;
public class IndexControlURLs_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
prop.put("urlstring", "");
@@ -285,7 +285,7 @@ public class IndexControlURLs_p {
return prop;
}
- private static serverObjects genUrlProfile(final plasmaSwitchboard switchboard, final URLMetadataRow entry, final String urlhash) {
+ private static serverObjects genUrlProfile(final Switchboard switchboard, final URLMetadataRow entry, final String urlhash) {
final serverObjects prop = new serverObjects();
if (entry == null) {
prop.put("genUrlProfile", "1");
diff --git a/htroot/IndexCreateLoaderQueue_p.java b/htroot/IndexCreateLoaderQueue_p.java
index 2ac8eb719..87fc9145c 100644
--- a/htroot/IndexCreateLoaderQueue_p.java
+++ b/htroot/IndexCreateLoaderQueue_p.java
@@ -25,17 +25,17 @@
// if the shell's current path is HTROOT
import de.anomic.crawler.retrieval.Request;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacySeed;
public class IndexCreateLoaderQueue_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
diff --git a/htroot/IndexCreateParserErrors_p.java b/htroot/IndexCreateParserErrors_p.java
index 872aad724..33972ac92 100644
--- a/htroot/IndexCreateParserErrors_p.java
+++ b/htroot/IndexCreateParserErrors_p.java
@@ -21,8 +21,8 @@
import de.anomic.crawler.ZURL;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacySeed;
@@ -30,9 +30,9 @@ import de.anomic.yacy.yacyURL;
public class IndexCreateParserErrors_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
prop.put("rejected", "0");
int showRejectedCount = 100;
diff --git a/htroot/IndexCreateWWWGlobalQueue_p.java b/htroot/IndexCreateWWWGlobalQueue_p.java
index 52573812f..4e6d7665f 100644
--- a/htroot/IndexCreateWWWGlobalQueue_p.java
+++ b/htroot/IndexCreateWWWGlobalQueue_p.java
@@ -32,8 +32,8 @@ import java.util.Locale;
import de.anomic.crawler.CrawlProfile;
import de.anomic.crawler.NoticedURL;
import de.anomic.crawler.retrieval.Request;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacySeed;
@@ -46,9 +46,9 @@ public class IndexCreateWWWGlobalQueue_p {
return dayFormatter.format(date);
}
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
int showLimit = 100;
diff --git a/htroot/IndexCreateWWWLocalQueue_p.java b/htroot/IndexCreateWWWLocalQueue_p.java
index 52302b191..9c0935489 100644
--- a/htroot/IndexCreateWWWLocalQueue_p.java
+++ b/htroot/IndexCreateWWWLocalQueue_p.java
@@ -35,10 +35,10 @@ import java.util.regex.PatternSyntaxException;
import de.anomic.crawler.CrawlProfile;
import de.anomic.crawler.NoticedURL;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.crawler.CrawlSwitchboard;
import de.anomic.crawler.retrieval.Request;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacySeed;
@@ -59,9 +59,9 @@ public class IndexCreateWWWLocalQueue_p {
private static final int INITIATOR = 5;
private static final int MODIFIED = 6;
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
int showLimit = 100;
diff --git a/htroot/IndexCreateWWWRemoteQueue_p.java b/htroot/IndexCreateWWWRemoteQueue_p.java
index 6bb79a1cf..cd42a1c82 100644
--- a/htroot/IndexCreateWWWRemoteQueue_p.java
+++ b/htroot/IndexCreateWWWRemoteQueue_p.java
@@ -32,8 +32,8 @@ import java.util.Locale;
import de.anomic.crawler.CrawlProfile;
import de.anomic.crawler.NoticedURL;
import de.anomic.crawler.retrieval.Request;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.servletProperties;
@@ -47,9 +47,9 @@ public class IndexCreateWWWRemoteQueue_p {
return dayFormatter.format(date);
}
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final servletProperties prop = new servletProperties();
- final plasmaSwitchboard sb = (plasmaSwitchboard)env;
+ final Switchboard sb = (Switchboard)env;
int showLimit = 100;
if (post != null) {
diff --git a/htroot/IndexImportWikimedia_p.java b/htroot/IndexImportWikimedia_p.java
index 544657f46..8b6cac6bf 100644
--- a/htroot/IndexImportWikimedia_p.java
+++ b/htroot/IndexImportWikimedia_p.java
@@ -25,17 +25,17 @@
import java.io.File;
import java.net.MalformedURLException;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.tools.mediawikiIndex;
public class IndexImportWikimedia_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
if (mediawikiIndex.job != null && mediawikiIndex.job.isAlive()) {
// one import is running, no option to insert anything
diff --git a/htroot/IndexImport_p.java b/htroot/IndexImport_p.java
index ac5f16393..26455b792 100644
--- a/htroot/IndexImport_p.java
+++ b/htroot/IndexImport_p.java
@@ -34,18 +34,18 @@ import java.util.Date;
import de.anomic.crawler.Importer;
import de.anomic.crawler.NoticeURLImporter;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.ByteBuffer;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public final class IndexImport_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
+ final Switchboard switchboard = (Switchboard) env;
final serverObjects prop = new serverObjects();
int activeCount = 0;
diff --git a/htroot/IndexShare_p.java b/htroot/IndexShare_p.java
index 17e4a9b3d..5a035cbd6 100644
--- a/htroot/IndexShare_p.java
+++ b/htroot/IndexShare_p.java
@@ -28,17 +28,17 @@
//import java.net.*;
//import java.io.*;
//import de.anomic.tools.*;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class IndexShare_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
+ final Switchboard switchboard = (Switchboard) env;
final serverObjects prop = new serverObjects();
if(switchboard == null) {
@@ -61,7 +61,7 @@ public class IndexShare_p {
}
if (post.containsKey("indexsharesetting")) {
- switchboard.setConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW, (post.containsKey("distribute")) ? "true" : "false");
+ switchboard.setConfig(SwitchboardConstants.INDEX_DIST_ALLOW, (post.containsKey("distribute")) ? "true" : "false");
switchboard.setConfig("allowReceiveIndex", (post.containsKey("receive")) ? "true" : "false");
switchboard.setConfig("defaultLinkReceiveFrequency", post.get("linkfreq", "30"));
switchboard.setConfig("defaultWordReceiveFrequency", post.get("wordfreq", "10"));
diff --git a/htroot/LogStatistics_p.java b/htroot/LogStatistics_p.java
index b4e3f4df6..d451ac0a4 100644
--- a/htroot/LogStatistics_p.java
+++ b/htroot/LogStatistics_p.java
@@ -29,7 +29,7 @@
import java.util.HashSet;
import java.util.Hashtable;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.logging.LogParser;
@@ -39,7 +39,7 @@ public class LogStatistics_p {
private static final String RESULTS = "results_";
@SuppressWarnings({ "unchecked", "boxing" })
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
diff --git a/htroot/MessageSend_p.java b/htroot/MessageSend_p.java
index b8f50b12e..6510ddc77 100644
--- a/htroot/MessageSend_p.java
+++ b/htroot/MessageSend_p.java
@@ -30,8 +30,8 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyClient;
@@ -45,8 +45,8 @@ public class MessageSend_p {
}
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
if ((post == null) || (post.get("hash","").length() == 0)) {
diff --git a/htroot/Messages_p.java b/htroot/Messages_p.java
index cfa628a7d..d5423bb19 100644
--- a/htroot/Messages_p.java
+++ b/htroot/Messages_p.java
@@ -33,11 +33,11 @@ import java.util.Iterator;
import java.util.TreeMap;
import de.anomic.data.messageBoard;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.DateFormatter;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacySeed;
@@ -51,8 +51,8 @@ public class Messages_p {
return SimpleFormatter.format(date);
}
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
// set peer address / name
@@ -127,7 +127,7 @@ public class Messages_p {
prop.putXML("mode_messages_"+count+"_key", key);
prop.put("mode_messages_"+count+"_hash", message.authorHash());
- if ((header.get(httpHeader.CONNECTION_PROP_PATH)).endsWith(".rss")) {
+ if ((header.get(HeaderFramework.CONNECTION_PROP_PATH)).endsWith(".rss")) {
// set the peer address
prop.put("mode_messages_"+count+"_peerAddress", peerAddress);
diff --git a/htroot/Network.java b/htroot/Network.java
index 1885c67fc..8e6767351 100644
--- a/htroot/Network.java
+++ b/htroot/Network.java
@@ -36,11 +36,11 @@ import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import de.anomic.crawler.retrieval.HTTPLoader;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.client.Client;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverCodings;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -54,15 +54,15 @@ public class Network {
private static final String STR_TABLE_LIST = "table_list_";
- public static serverObjects respond(final httpRequestHeader requestHeader, final serverObjects post, final serverSwitch switchboard) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) switchboard;
+ public static serverObjects respond(final RequestHeader requestHeader, final serverObjects post, final serverSwitch switchboard) {
+ final Switchboard sb = (Switchboard) switchboard;
final long start = System.currentTimeMillis();
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
prop.setLocalized(!(requestHeader.get("PATH")).endsWith(".xml"));
prop.putHTML("page_networkTitle", sb.getConfig("network.unit.description", "unspecified"));
- prop.putHTML("page_networkName", sb.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "unspecified"));
+ prop.putHTML("page_networkName", sb.getConfig(SwitchboardConstants.NETWORK_NAME, "unspecified"));
final boolean overview = (post == null) || (post.get("page", "0").equals("0"));
final String mySeedType = sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN);
@@ -145,7 +145,7 @@ public class Network {
prop.put("table_my-url", seed.get(yacySeed.SEEDLIST, ""));
// generating the location string
- prop.putHTML("table_my-location", httpClient.generateLocation());
+ prop.putHTML("table_my-location", Client.generateLocation());
}
// overall results: Network statistics
@@ -174,7 +174,7 @@ public class Network {
if (post.containsKey("addPeer")) {
// AUTHENTICATE
- if (!requestHeader.containsKey(httpRequestHeader.AUTHORIZATION)) {
+ if (!requestHeader.containsKey(RequestHeader.AUTHORIZATION)) {
prop.putHTML("AUTHENTICATE","log-in");
return prop;
}
@@ -348,7 +348,7 @@ public class Network {
userAgent = null;
if (seed.hash != null && seed.hash.equals(sb.peers.mySeed().hash)) {
userAgent = HTTPLoader.yacyUserAgent;
- location = httpClient.generateLocation();
+ location = Client.generateLocation();
} else {
userAgent = sb.peers.peerActions.getUserAgent(seed.getIP());
location = parseLocationInUserAgent(userAgent);
diff --git a/htroot/NetworkPicture.java b/htroot/NetworkPicture.java
index 8fb5d0d48..c9bdb0d66 100644
--- a/htroot/NetworkPicture.java
+++ b/htroot/NetworkPicture.java
@@ -24,26 +24,26 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaGrafics;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
+import de.anomic.ymage.NetworkGraph;
import de.anomic.ymage.ymageMatrix;
/** draw a picture of the yacy network */
public class NetworkPicture {
- public static ymageMatrix respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static ymageMatrix respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
int width = 768;
int height = 576;
int passiveLimit = 300;
int potentialLimit = 300;
int maxCount = 1000;
- String bgcolor = plasmaGrafics.COL_BACKGROUND;
+ String bgcolor = NetworkGraph.COL_BACKGROUND;
boolean corona = true;
if (post != null) {
@@ -64,7 +64,7 @@ public class NetworkPicture {
if (passiveLimit > 1000000) passiveLimit = 1000000;
if (potentialLimit > 1000000) potentialLimit = 1000000;
if (maxCount > 1000) maxCount = 1000;
- return plasmaGrafics.getNetworkPicture(sb.peers, 10000, width, height, passiveLimit, potentialLimit, maxCount, corona, env.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "unspecified"), env.getConfig("network.unit.description", "unspecified"), bgcolor);
+ return NetworkGraph.getNetworkPicture(sb.peers, 10000, width, height, passiveLimit, potentialLimit, maxCount, corona, env.getConfig(SwitchboardConstants.NETWORK_NAME, "unspecified"), env.getConfig("network.unit.description", "unspecified"), bgcolor);
}
}
diff --git a/htroot/News.java b/htroot/News.java
index 197d35add..55a08cdcd 100644
--- a/htroot/News.java
+++ b/htroot/News.java
@@ -29,9 +29,9 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyNewsPool;
@@ -40,8 +40,8 @@ import de.anomic.yacy.yacySeed;
public class News {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
final boolean overview = (post == null) || (post.get("page", "0").equals("0"));
final int tableID = (overview) ? -1 : (post == null ? 0 : Integer.parseInt(post.get("page", "0"))) - 1;
diff --git a/htroot/PeerLoadPicture.java b/htroot/PeerLoadPicture.java
index 44c5b33c9..c6d55b700 100644
--- a/htroot/PeerLoadPicture.java
+++ b/htroot/PeerLoadPicture.java
@@ -3,17 +3,17 @@ import java.awt.Image;
import java.util.HashMap;
import java.util.Iterator;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaGrafics;
-import de.anomic.plasma.plasmaSwitchboardConstants;
-import de.anomic.plasma.plasmaGrafics.CircleThreadPiece;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverBusyThread;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
+import de.anomic.ymage.NetworkGraph;
+import de.anomic.ymage.NetworkGraph.CircleThreadPiece;
public class PeerLoadPicture {
- public static Image respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static Image respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
int width = 800;
int height = 600;
@@ -29,8 +29,8 @@ public class PeerLoadPicture {
final CircleThreadPiece misc = new CircleThreadPiece("Misc.", new Color(190, 50, 180));
final HashMap<String, CircleThreadPiece> pieces = new HashMap<String, CircleThreadPiece>();
pieces.put(null, idle);
- pieces.put(plasmaSwitchboardConstants.INDEX_DIST, new CircleThreadPiece("DHT-Distribution", new Color(119, 136, 153)));
- pieces.put(plasmaSwitchboardConstants.PEER_PING, new CircleThreadPiece("YaCy Core", new Color(255, 230, 160)));
+ pieces.put(SwitchboardConstants.INDEX_DIST, new CircleThreadPiece("DHT-Distribution", new Color(119, 136, 153)));
+ pieces.put(SwitchboardConstants.PEER_PING, new CircleThreadPiece("YaCy Core", new Color(255, 230, 160)));
final Iterator<String> threads = env.threadNames();
String threadname;
@@ -75,7 +75,7 @@ public class PeerLoadPicture {
if (width > 1920) width = 1920;
if (height < 30) height = 30;
if (height > 1440) height = 1440;
- return plasmaGrafics.getPeerLoadPicture(
+ return NetworkGraph.getPeerLoadPicture(
5000,
width,
height,
diff --git a/htroot/PerformanceConcurrency_p.java b/htroot/PerformanceConcurrency_p.java
index eb3bdcf4e..e8d56cd79 100644
--- a/htroot/PerformanceConcurrency_p.java
+++ b/htroot/PerformanceConcurrency_p.java
@@ -21,14 +21,14 @@
import java.util.Iterator;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverProcessor;
import de.anomic.server.serverSwitch;
public class PerformanceConcurrency_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch sb) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch sb) {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
diff --git a/htroot/PerformanceGraph.java b/htroot/PerformanceGraph.java
index 86af900b5..bbd25b32d 100644
--- a/htroot/PerformanceGraph.java
+++ b/htroot/PerformanceGraph.java
@@ -24,24 +24,24 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaProfiling;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
+import de.anomic.ymage.ProfilingGraph;
import de.anomic.ymage.ymageMatrix;
public class PerformanceGraph {
- public static ymageMatrix respond(final httpRequestHeader header, serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static ymageMatrix respond(final RequestHeader header, serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
if (post == null) post = new serverObjects();
final int width = post.getInt("width", 660);
final int height = post.getInt("height", 240);
- return plasmaProfiling.performanceGraph(width, height, sb.indexSegment.urlMetadata().size() + " URLS / " + sb.indexSegment.termIndex().sizesMax() + " WORDS IN INDEX / " + sb.indexSegment.termIndex().getBufferSize() + " WORDS IN CACHE");
+ return ProfilingGraph.performanceGraph(width, height, sb.indexSegment.urlMetadata().size() + " URLS / " + sb.indexSegment.termIndex().sizesMax() + " WORDS IN INDEX / " + sb.indexSegment.termIndex().getBufferSize() + " WORDS IN CACHE");
}
}
\ No newline at end of file
diff --git a/htroot/PerformanceMemory_p.java b/htroot/PerformanceMemory_p.java
index 924dac635..0d9d9fc0b 100644
--- a/htroot/PerformanceMemory_p.java
+++ b/htroot/PerformanceMemory_p.java
@@ -29,12 +29,12 @@ import java.io.File;
import java.util.Iterator;
import java.util.Map;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.index.Cache;
import de.anomic.kelondro.table.Table;
import de.anomic.kelondro.util.MemoryControl;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverDomains;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -46,7 +46,7 @@ public class PerformanceMemory_p {
private static final long MB = 1024 * KB;
private static Map<String, String> defaultSettings = null;
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
if (defaultSettings == null) {
@@ -163,7 +163,7 @@ public class PerformanceMemory_p {
prop.putNum("namecache.hit", amount);
amount = serverDomains.nameCacheNoCachingListSize();
prop.putNum("namecache.noCache", amount);
- amount = plasmaSwitchboard.urlBlacklist.blacklistCacheSize();
+ amount = Switchboard.urlBlacklist.blacklistCacheSize();
prop.putNum("blacklistcache.size", amount);
// return rewrite values for templates
return prop;
diff --git a/htroot/PerformanceQueues_p.java b/htroot/PerformanceQueues_p.java
index f6a638935..0190da218 100644
--- a/htroot/PerformanceQueues_p.java
+++ b/htroot/PerformanceQueues_p.java
@@ -29,10 +29,10 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverBusyThread;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
@@ -52,9 +52,9 @@ public class PerformanceQueues_p {
performanceProfiles.put("defaults/performance_dht.profile", "prefer DHT");
}
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch sb) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch sb) {
// return variable that accumulates replacements
- final plasmaSwitchboard switchboard = (plasmaSwitchboard) sb;
+ final Switchboard switchboard = (Switchboard) sb;
final serverObjects prop = new serverObjects();
File defaultSettingsFile = new File(switchboard.getRootPath(), "defaults/yacy.init");
if(post != null) {
@@ -170,13 +170,13 @@ public class PerformanceQueues_p {
onTheFlyReconfiguration(switchboard, threadName, idlesleep, busysleep, memprereq);
} if (setProfile) {
- if (threadName.equals(plasmaSwitchboardConstants.PEER_PING)
- || threadName.equals(plasmaSwitchboardConstants.SEED_UPLOAD)
- || threadName.equals(plasmaSwitchboardConstants.CLEANUP)
+ if (threadName.equals(SwitchboardConstants.PEER_PING)
+ || threadName.equals(SwitchboardConstants.SEED_UPLOAD)
+ || threadName.equals(SwitchboardConstants.CLEANUP)
|| threadName.equals("autoReCrawl")
) { /* do not change any values */ }
- else if (threadName.equals(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER)
- || threadName.equals(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL)) {
+ else if (threadName.equals(SwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER)
+ || threadName.equals(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL)) {
switchboard.setRemotecrawlPPM(Math.max(1, (int) (switchboard.getConfigLong("network.unit.remotecrawl.speed", 60) / multiplier)));
}
else {
@@ -228,7 +228,7 @@ public class PerformanceQueues_p {
if ((post != null) && (post.containsKey("cacheSizeSubmit"))) {
final int wordCacheMaxCount = post.getInt("wordCacheMaxCount", 20000);
- switchboard.setConfig(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, Integer.toString(wordCacheMaxCount));
+ switchboard.setConfig(SwitchboardConstants.WORDCACHE_MAX_COUNT, Integer.toString(wordCacheMaxCount));
switchboard.indexSegment.termIndex().setBufferMaxWordCount(wordCacheMaxCount);
}
@@ -241,7 +241,7 @@ public class PerformanceQueues_p {
int maxBusy = Integer.parseInt(post.get("Crawler Pool_maxActive","8"));
// storing the new values into configfile
- switchboard.setConfig(plasmaSwitchboardConstants.CRAWLER_THREADS_ACTIVE_MAX,maxBusy);
+ switchboard.setConfig(SwitchboardConstants.CRAWLER_THREADS_ACTIVE_MAX,maxBusy);
//switchboard.setConfig("crawler.MinIdleThreads",minIdle);
/*
@@ -266,9 +266,9 @@ public class PerformanceQueues_p {
}
if ((post != null) && (post.containsKey("onlineCautionSubmit"))) {
- switchboard.setConfig(plasmaSwitchboardConstants.PROXY_ONLINE_CAUTION_DELAY, Integer.toString(post.getInt("crawlPauseProxy", 30000)));
- switchboard.setConfig(plasmaSwitchboardConstants.LOCALSEACH_ONLINE_CAUTION_DELAY, Integer.toString(post.getInt("crawlPauseLocalsearch", 30000)));
- switchboard.setConfig(plasmaSwitchboardConstants.REMOTESEARCH_ONLINE_CAUTION_DELAY, Integer.toString(post.getInt("crawlPauseRemotesearch", 30000)));
+ switchboard.setConfig(SwitchboardConstants.PROXY_ONLINE_CAUTION_DELAY, Integer.toString(post.getInt("crawlPauseProxy", 30000)));
+ switchboard.setConfig(SwitchboardConstants.LOCALSEACH_ONLINE_CAUTION_DELAY, Integer.toString(post.getInt("crawlPauseLocalsearch", 30000)));
+ switchboard.setConfig(SwitchboardConstants.REMOTESEARCH_ONLINE_CAUTION_DELAY, Integer.toString(post.getInt("crawlPauseRemotesearch", 30000)));
}
if ((post != null) && (post.containsKey("minimumDeltaSubmit"))) {
@@ -291,10 +291,10 @@ public class PerformanceQueues_p {
prop.putNum("maxAgeOfCache", switchboard.indexSegment.termIndex().getBufferMaxAge() / 1000 / 60); // minutes
prop.putNum("minAgeOfCache", switchboard.indexSegment.termIndex().getBufferMinAge() / 1000 / 60); // minutes
prop.putNum("maxWaitingWordFlush", switchboard.getConfigLong("maxWaitingWordFlush", 180));
- prop.put("wordCacheMaxCount", switchboard.getConfigLong(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, 20000));
- prop.put("crawlPauseProxy", switchboard.getConfigLong(plasmaSwitchboardConstants.PROXY_ONLINE_CAUTION_DELAY, 30000));
- prop.put("crawlPauseLocalsearch", switchboard.getConfigLong(plasmaSwitchboardConstants.LOCALSEACH_ONLINE_CAUTION_DELAY, 30000));
- prop.put("crawlPauseRemotesearch", switchboard.getConfigLong(plasmaSwitchboardConstants.REMOTESEARCH_ONLINE_CAUTION_DELAY, 30000));
+ prop.put("wordCacheMaxCount", switchboard.getConfigLong(SwitchboardConstants.WORDCACHE_MAX_COUNT, 20000));
+ prop.put("crawlPauseProxy", switchboard.getConfigLong(SwitchboardConstants.PROXY_ONLINE_CAUTION_DELAY, 30000));
+ prop.put("crawlPauseLocalsearch", switchboard.getConfigLong(SwitchboardConstants.LOCALSEACH_ONLINE_CAUTION_DELAY, 30000));
+ prop.put("crawlPauseRemotesearch", switchboard.getConfigLong(SwitchboardConstants.REMOTESEARCH_ONLINE_CAUTION_DELAY, 30000));
prop.putNum("crawlPauseProxyCurrent", (System.currentTimeMillis() - switchboard.proxyLastAccess) / 1000);
prop.putNum("crawlPauseLocalsearchCurrent", (System.currentTimeMillis() - switchboard.localSearchLastAccess) / 1000);
prop.putNum("crawlPauseRemotesearchCurrent", (System.currentTimeMillis() - switchboard.remoteSearchLastAccess) / 1000);
@@ -333,7 +333,7 @@ public class PerformanceQueues_p {
* @param busysleep
* @param memprereq
*/
- private static void onTheFlyReconfiguration(final plasmaSwitchboard switchboard, final String threadName, final long idlesleep,
+ private static void onTheFlyReconfiguration(final Switchboard switchboard, final String threadName, final long idlesleep,
final long busysleep, final long memprereq) {
// on-the-fly re-configuration
switchboard.setThreadPerformance(threadName, idlesleep, busysleep, memprereq);
diff --git a/htroot/PerformanceSearch_p.java b/htroot/PerformanceSearch_p.java
index 674fa6d9b..0244161a6 100644
--- a/htroot/PerformanceSearch_p.java
+++ b/htroot/PerformanceSearch_p.java
@@ -27,26 +27,26 @@
import java.util.Date;
import java.util.Iterator;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaProfiling;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverProfiling;
import de.anomic.server.serverSwitch;
+import de.anomic.ymage.ProfilingGraph;
public class PerformanceSearch_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch sb) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch sb) {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
final Iterator<serverProfiling.Event> events = serverProfiling.history("SEARCH");
int c = 0;
serverProfiling.Event event;
- plasmaProfiling.searchEvent search;
+ ProfilingGraph.searchEvent search;
long lastt = 0;
while (events.hasNext()) {
event = events.next();
- search = (plasmaProfiling.searchEvent) event.payload;
+ search = (ProfilingGraph.searchEvent) event.payload;
prop.put("table_" + c + "_query", search.queryID);
prop.put("table_" + c + "_event", search.processName);
prop.putNum("table_" + c + "_count", search.resultCount);
diff --git a/htroot/Performance_p.java b/htroot/Performance_p.java
index 833925791..a6b979152 100644
--- a/htroot/Performance_p.java
+++ b/htroot/Performance_p.java
@@ -24,13 +24,13 @@
//javac -classpath .:../classes Network.java
//if the shell's current path is HTROOT
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class Performance_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch sb) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch sb) {
return PerformanceQueues_p.respond(header, post, sb);
}
diff --git a/htroot/ProxyIndexingMonitor_p.java b/htroot/ProxyIndexingMonitor_p.java
index f39a17b20..19d22ca66 100644
--- a/htroot/ProxyIndexingMonitor_p.java
+++ b/htroot/ProxyIndexingMonitor_p.java
@@ -30,10 +30,10 @@
import java.io.File;
import java.io.IOException;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaHTCache;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.http.client.Cache;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.logging.Log;
@@ -45,9 +45,9 @@ public class ProxyIndexingMonitor_p {
// if (date == null) return ""; else return dayFormatter.format(date);
// }
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
// int showIndexedCount = 20;
@@ -64,7 +64,7 @@ public class ProxyIndexingMonitor_p {
if (post.containsKey("proxyprofileset")) try {
// read values and put them in global settings
final boolean proxyYaCyOnly = post.containsKey("proxyYacyOnly");
- env.setConfig(plasmaSwitchboardConstants.PROXY_YACY_ONLY, (proxyYaCyOnly) ? "true" : "false");
+ env.setConfig(SwitchboardConstants.PROXY_YACY_ONLY, (proxyYaCyOnly) ? "true" : "false");
int newProxyPrefetchDepth = post.getInt("proxyPrefetchDepth", 0);
if (newProxyPrefetchDepth < 0) newProxyPrefetchDepth = 0;
if (newProxyPrefetchDepth > 20) newProxyPrefetchDepth = 20; // self protection ?
@@ -80,22 +80,22 @@ public class ProxyIndexingMonitor_p {
// added proxyCache, proxyCacheSize - Borg-0300
// proxyCache - check and create the directory
- oldProxyCachePath = env.getConfig(plasmaSwitchboardConstants.HTCACHE_PATH, plasmaSwitchboardConstants.HTCACHE_PATH_DEFAULT);
- newProxyCachePath = post.get("proxyCache", plasmaSwitchboardConstants.HTCACHE_PATH_DEFAULT);
+ oldProxyCachePath = env.getConfig(SwitchboardConstants.HTCACHE_PATH, SwitchboardConstants.HTCACHE_PATH_DEFAULT);
+ newProxyCachePath = post.get("proxyCache", SwitchboardConstants.HTCACHE_PATH_DEFAULT);
newProxyCachePath = newProxyCachePath.replace('\\', '/');
if (newProxyCachePath.endsWith("/")) {
newProxyCachePath = newProxyCachePath.substring(0, newProxyCachePath.length() - 1);
}
- env.setConfig(plasmaSwitchboardConstants.HTCACHE_PATH, newProxyCachePath);
- final File cache = env.getConfigPath(plasmaSwitchboardConstants.HTCACHE_PATH, oldProxyCachePath);
+ env.setConfig(SwitchboardConstants.HTCACHE_PATH, newProxyCachePath);
+ final File cache = env.getConfigPath(SwitchboardConstants.HTCACHE_PATH, oldProxyCachePath);
if (!cache.isDirectory() && !cache.isFile()) cache.mkdirs();
// proxyCacheSize
- oldProxyCacheSize = getStringLong(env.getConfig(plasmaSwitchboardConstants.PROXY_CACHE_SIZE, "64"));
- newProxyCacheSize = getStringLong(post.get(plasmaSwitchboardConstants.PROXY_CACHE_SIZE, "64"));
+ oldProxyCacheSize = getStringLong(env.getConfig(SwitchboardConstants.PROXY_CACHE_SIZE, "64"));
+ newProxyCacheSize = getStringLong(post.get(SwitchboardConstants.PROXY_CACHE_SIZE, "64"));
if (getLong(newProxyCacheSize) < 4) { newProxyCacheSize = "4"; }
- env.setConfig(plasmaSwitchboardConstants.PROXY_CACHE_SIZE, newProxyCacheSize);
- plasmaHTCache.setCacheSize(Long.parseLong(newProxyCacheSize) * 1024 * 1024);
+ env.setConfig(SwitchboardConstants.PROXY_CACHE_SIZE, newProxyCacheSize);
+ Cache.setCacheSize(Long.parseLong(newProxyCacheSize) * 1024 * 1024);
// implant these settings also into the crawling profile for the proxy
if (sb.crawler.defaultProxyProfile == null) {
@@ -149,15 +149,15 @@ public class ProxyIndexingMonitor_p {
}
}
- final boolean yacyonly = env.getConfigBool(plasmaSwitchboardConstants.PROXY_YACY_ONLY, false);
+ final boolean yacyonly = env.getConfigBool(SwitchboardConstants.PROXY_YACY_ONLY, false);
prop.put("proxyYacyOnly", yacyonly ? "1" : "0");
prop.put("proxyPrefetchDepth", env.getConfigLong("proxyPrefetchDepth", 0));
prop.put("proxyStoreHTCacheChecked", env.getConfig("proxyStoreHTCache", "").equals("true") ? "1" : "0");
prop.put("proxyIndexingRemote", env.getConfig("proxyIndexingRemote", "").equals("true") ? "1" : "0");
prop.put("proxyIndexingLocalText", env.getConfig("proxyIndexingLocalText", "").equals("true") ? "1" : "0");
prop.put("proxyIndexingLocalMedia", env.getConfig("proxyIndexingLocalMedia", "").equals("true") ? "1" : "0");
- prop.put("proxyCache", env.getConfig(plasmaSwitchboardConstants.HTCACHE_PATH, plasmaSwitchboardConstants.HTCACHE_PATH_DEFAULT));
- prop.put("proxyCacheSize", env.getConfigLong(plasmaSwitchboardConstants.PROXY_CACHE_SIZE, 64));
+ prop.put("proxyCache", env.getConfig(SwitchboardConstants.HTCACHE_PATH, SwitchboardConstants.HTCACHE_PATH_DEFAULT));
+ prop.put("proxyCacheSize", env.getConfigLong(SwitchboardConstants.PROXY_CACHE_SIZE, 64));
// return rewrite properties
return prop;
}
diff --git a/htroot/QuickCrawlLink_p.java b/htroot/QuickCrawlLink_p.java
index e79520909..0ce24d830 100644
--- a/htroot/QuickCrawlLink_p.java
+++ b/htroot/QuickCrawlLink_p.java
@@ -36,9 +36,9 @@ import java.util.Date;
import de.anomic.crawler.CrawlProfile;
import de.anomic.crawler.retrieval.Request;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyURL;
@@ -53,17 +53,17 @@ public class QuickCrawlLink_p {
* @param env the serverSwitch object holding all runtime-data
* @return the rewrite-properties for the template
*/
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
if (post == null) {
// send back usage example
prop.put("mode", "0");
// getting the http host header
- final String hostSocket = header.get(httpHeader.CONNECTION_PROP_HOST);
+ final String hostSocket = header.get(HeaderFramework.CONNECTION_PROP_HOST);
//String host = hostSocket;
int port = 80;
diff --git a/htroot/Ranking_p.java b/htroot/Ranking_p.java
index 8bcc3a584..3152a9c25 100644
--- a/htroot/Ranking_p.java
+++ b/htroot/Ranking_p.java
@@ -29,11 +29,11 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.search.QueryParams;
import de.anomic.search.RankingProfile;
import de.anomic.search.QueryEvent;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.tools.crypt;
@@ -128,8 +128,8 @@ public class Ranking_p {
}
}
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
// clean up all search events
QueryEvent.cleanupEvents(true);
diff --git a/htroot/SearchEventPicture.java b/htroot/SearchEventPicture.java
index 7e77dcfbc..70b6c1d9d 100644
--- a/htroot/SearchEventPicture.java
+++ b/htroot/SearchEventPicture.java
@@ -25,23 +25,23 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaGrafics;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.search.QueryEvent;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
+import de.anomic.ymage.NetworkGraph;
import de.anomic.ymage.ymageMatrix;
// draw a picture of the yacy network
public class SearchEventPicture {
- public static ymageMatrix respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static ymageMatrix respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final String eventID = header.get("event", QueryEvent.lastEventID);
if (eventID == null) return null;
- final ymageMatrix yp = plasmaGrafics.getSearchEventPicture(sb.peers, eventID);
+ final ymageMatrix yp = NetworkGraph.getSearchEventPicture(sb.peers, eventID);
if (yp == null) return new ymageMatrix(1, 1, ymageMatrix.MODE_SUB, "000000"); // empty image
return yp;
diff --git a/htroot/SettingsAck_p.java b/htroot/SettingsAck_p.java
index 5c4870ee2..ce93b654b 100644
--- a/htroot/SettingsAck_p.java
+++ b/htroot/SettingsAck_p.java
@@ -35,14 +35,14 @@ import java.util.StringTokenizer;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.http.httpRemoteProxyConfig;
-import de.anomic.http.httpd;
-import de.anomic.http.httpdProxyHandler;
+import de.anomic.http.client.RemoteProxyConfig;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.server.HTTPDemon;
+import de.anomic.http.server.HTTPDProxyHandler;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.order.Digest;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -55,13 +55,13 @@ public class SettingsAck_p {
private static boolean nothingChanged = false;
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
// get referer for backlink
- final String referer = header.get(httpRequestHeader.REFERER);
+ final String referer = header.get(RequestHeader.REFERER);
prop.put("referer", (referer == null) ? "Settings_p.html" : referer);
//if (post == null) System.out.println("POST: NULL"); else System.out.println("POST: " + post.toString());
@@ -91,7 +91,7 @@ public class SettingsAck_p {
return prop;
}
// check passed. set account:
- env.setConfig(httpd.ADMIN_ACCOUNT_B64MD5, Digest.encodeMD5Hex(Base64Order.standardCoder.encodeString(user + ":" + pw1)));
+ env.setConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, Digest.encodeMD5Hex(Base64Order.standardCoder.encodeString(user + ":" + pw1)));
env.setConfig("adminAccount", "");
prop.put("info", "5");//admin account changed
prop.putHTML("info_user", user);
@@ -190,14 +190,14 @@ public class SettingsAck_p {
if (post.containsKey("httpNetworking")) {
// set transparent proxy flag
- httpdProxyHandler.isTransparentProxy = post.containsKey("isTransparentProxy");
- env.setConfig("isTransparentProxy", httpdProxyHandler.isTransparentProxy ? "true" : "false");
- prop.put("info_isTransparentProxy", httpdProxyHandler.isTransparentProxy ? "on" : "off");
+ HTTPDProxyHandler.isTransparentProxy = post.containsKey("isTransparentProxy");
+ env.setConfig("isTransparentProxy", HTTPDProxyHandler.isTransparentProxy ? "true" : "false");
+ prop.put("info_isTransparentProxy", HTTPDProxyHandler.isTransparentProxy ? "on" : "off");
// setting the keep alive property
- httpd.keepAliveSupport = post.containsKey("connectionKeepAliveSupport");
- env.setConfig("connectionKeepAliveSupport", httpd.keepAliveSupport ? "true" : "false");
- prop.put("info_connectionKeepAliveSupport", httpd.keepAliveSupport ? "on" : "off");
+ HTTPDemon.keepAliveSupport = post.containsKey("connectionKeepAliveSupport");
+ env.setConfig("connectionKeepAliveSupport", HTTPDemon.keepAliveSupport ? "true" : "false");
+ prop.put("info_connectionKeepAliveSupport", HTTPDemon.keepAliveSupport ? "on" : "off");
// setting via header property
env.setConfig("proxy.sendViaHeader", post.containsKey("proxy.sendViaHeader")?"true":"false");
@@ -324,7 +324,7 @@ public class SettingsAck_p {
/* ====================================================================
* Enabling settings
* ==================================================================== */
- httpRemoteProxyConfig.init(sb);
+ RemoteProxyConfig.init(sb);
prop.put("info", "15"); // The remote-proxy setting has been changed
return prop;
diff --git a/htroot/Settings_p.java b/htroot/Settings_p.java
index c02dcff3e..c4f13306c 100644
--- a/htroot/Settings_p.java
+++ b/htroot/Settings_p.java
@@ -25,9 +25,9 @@
import java.util.HashMap;
import java.util.Iterator;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyCore;
@@ -36,10 +36,10 @@ import de.anomic.yacy.yacySeedUploader;
public final class Settings_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
//if (post == null) System.out.println("POST: NULL"); else System.out.println("POST: " + post.toString());
@@ -156,7 +156,7 @@ public final class Settings_p {
}
// clientIP
- prop.putXML("clientIP", header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "<unknown>")); // read an artificial header addendum
+ prop.putXML("clientIP", header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "<unknown>")); // read an artificial header addendum
/*
* seed upload settings
diff --git a/htroot/Status.java b/htroot/Status.java
index 2058e7ca9..13c41e461 100644
--- a/htroot/Status.java
+++ b/htroot/Status.java
@@ -30,14 +30,14 @@
import java.net.InetAddress;
import java.util.Date;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.http.httpd;
-import de.anomic.http.httpdByteCountInputStream;
-import de.anomic.http.httpdByteCountOutputStream;
+import de.anomic.http.io.ByteCountInputStream;
+import de.anomic.http.io.ByteCountOutputStream;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.server.HTTPDemon;
import de.anomic.kelondro.util.DateFormatter;
import de.anomic.kelondro.util.MemoryControl;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverCore;
import de.anomic.server.serverDomains;
import de.anomic.server.serverObjects;
@@ -52,10 +52,10 @@ public class Status {
private static final String SEEDSERVER = "seedServer";
private static final String PEERSTATUS = "peerStatus";
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
if (post != null) {
if (sb.adminAuthenticated(header) < 2) {
@@ -69,20 +69,20 @@ public class Status {
} else if (post.containsKey("pauseCrawlJob")) {
final String jobType = post.get("jobType");
if (jobType.equals("localCrawl"))
- sb.pauseCrawlJob(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
+ sb.pauseCrawlJob(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
else if (jobType.equals("remoteTriggeredCrawl"))
- sb.pauseCrawlJob(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
+ sb.pauseCrawlJob(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
redirect = true;
} else if (post.containsKey("continueCrawlJob")) {
final String jobType = post.get("jobType");
if (jobType.equals("localCrawl"))
- sb.continueCrawlJob(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
+ sb.continueCrawlJob(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
else if (jobType.equals("remoteTriggeredCrawl"))
- sb.continueCrawlJob(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
+ sb.continueCrawlJob(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
redirect = true;
} else if (post.containsKey("ResetTraffic")) {
- httpdByteCountInputStream.resetCount();
- httpdByteCountOutputStream.resetCount();
+ ByteCountInputStream.resetCount();
+ ByteCountOutputStream.resetCount();
redirect = true;
} else if (post.containsKey("popup")) {
final String trigger_enabled = post.get("popup");
@@ -121,7 +121,7 @@ public class Status {
}
// password protection
- if ((sb.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() == 0) && (!sb.getConfigBool("adminAccountForLocalhost", false))) {
+ if ((sb.getConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, "").length() == 0) && (!sb.getConfigBool("adminAccountForLocalhost", false))) {
prop.put("protection", "0"); // not protected
prop.put("urgentSetPassword", "1");
} else {
@@ -143,11 +143,11 @@ public class Status {
prop.put("versionpp", versionstring);
// place some more hints
- if ((adminaccess) && (sb.getThread(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL).getJobCount() == 0)) {
+ if ((adminaccess) && (sb.getThread(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL).getJobCount() == 0)) {
prop.put("hintCrawlStart", "1");
}
- if ((adminaccess) && (sb.getThread(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL).getJobCount() > 500)) {
+ if ((adminaccess) && (sb.getThread(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL).getJobCount() > 500)) {
prop.put("hintCrawlMonitor", "1");
}
@@ -204,10 +204,10 @@ public class Status {
}
}
final String peerStatus = ((sb.peers.mySeed() == null) ? yacySeed.PEERTYPE_VIRGIN : sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN));
- if (peerStatus.equals(yacySeed.PEERTYPE_VIRGIN) && sb.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "").equals("freeworld")) {
+ if (peerStatus.equals(yacySeed.PEERTYPE_VIRGIN) && sb.getConfig(SwitchboardConstants.NETWORK_NAME, "").equals("freeworld")) {
prop.put(PEERSTATUS, "0");
prop.put("urgentStatusVirgin", "1");
- } else if (peerStatus.equals(yacySeed.PEERTYPE_JUNIOR) && sb.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "").equals("freeworld")) {
+ } else if (peerStatus.equals(yacySeed.PEERTYPE_JUNIOR) && sb.getConfig(SwitchboardConstants.NETWORK_NAME, "").equals("freeworld")) {
prop.put(PEERSTATUS, "1");
prop.put("warningStatusJunior", "1");
} else if (peerStatus.equals(yacySeed.PEERTYPE_SENIOR)) {
@@ -277,8 +277,8 @@ public class Status {
// proxy traffic
//prop.put("trafficIn",bytesToString(httpdByteCountInputStream.getGlobalCount()));
- prop.put("trafficProxy", Formatter.bytesToString(httpdByteCountOutputStream.getAccountCount("PROXY")));
- prop.put("trafficCrawler", Formatter.bytesToString(httpdByteCountInputStream.getAccountCount("CRAWLER")));
+ prop.put("trafficProxy", Formatter.bytesToString(ByteCountOutputStream.getAccountCount("PROXY")));
+ prop.put("trafficCrawler", Formatter.bytesToString(ByteCountInputStream.getAccountCount("CRAWLER")));
// connection information
final serverCore httpd = (serverCore) sb.getThread("10_httpd");
@@ -287,17 +287,17 @@ public class Status {
// Queue information
final int loaderJobCount = sb.crawlQueues.size();
- final int loaderMaxCount = Integer.parseInt(sb.getConfig(plasmaSwitchboardConstants.CRAWLER_THREADS_ACTIVE_MAX, "10"));
+ final int loaderMaxCount = Integer.parseInt(sb.getConfig(SwitchboardConstants.CRAWLER_THREADS_ACTIVE_MAX, "10"));
final int loaderPercent = (loaderMaxCount==0)?0:loaderJobCount*100/loaderMaxCount;
prop.putNum("loaderQueueSize", loaderJobCount);
prop.putNum("loaderQueueMax", loaderMaxCount);
prop.put("loaderQueuePercent", (loaderPercent>100) ? 100 : loaderPercent);
- prop.putNum("localCrawlQueueSize", sb.getThread(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL).getJobCount());
- prop.put("localCrawlPaused",sb.crawlJobIsPaused(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL) ? "1" : "0");
+ prop.putNum("localCrawlQueueSize", sb.getThread(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL).getJobCount());
+ prop.put("localCrawlPaused",sb.crawlJobIsPaused(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL) ? "1" : "0");
- prop.putNum("remoteTriggeredCrawlQueueSize", sb.getThread(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL).getJobCount());
- prop.put("remoteTriggeredCrawlPaused",sb.crawlJobIsPaused(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL) ? "1" : "0");
+ prop.putNum("remoteTriggeredCrawlQueueSize", sb.getThread(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL).getJobCount());
+ prop.put("remoteTriggeredCrawlPaused",sb.crawlJobIsPaused(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL) ? "1" : "0");
prop.putNum("stackCrawlQueueSize", sb.crawlStacker.size());
diff --git a/htroot/Steering.java b/htroot/Steering.java
index dd7de8a6b..c4d0b2d0a 100644
--- a/htroot/Steering.java
+++ b/htroot/Steering.java
@@ -29,18 +29,18 @@
import java.io.File;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyRelease;
public class Steering {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch ss) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch ss) {
if (post == null || ss == null) { return new serverObjects(); }
- final plasmaSwitchboard sb = (plasmaSwitchboard) ss;
+ final Switchboard sb = (Switchboard) ss;
final serverObjects prop = new serverObjects();
prop.put("info", "0"); //no information submitted
if (prop == null) { return null; }
diff --git a/htroot/Supporter.java b/htroot/Supporter.java
index a6baaadc5..8ae91d87e 100644
--- a/htroot/Supporter.java
+++ b/htroot/Supporter.java
@@ -32,13 +32,13 @@ import java.util.HashMap;
import java.util.Iterator;
import de.anomic.data.Blacklist;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.index.Row;
import de.anomic.kelondro.index.Row.Entry;
import de.anomic.kelondro.order.NaturalOrder;
import de.anomic.kelondro.util.DateFormatter;
import de.anomic.kelondro.util.ScoreCluster;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.tools.crypt;
@@ -50,8 +50,8 @@ import de.anomic.yacy.yacyURL;
public class Supporter {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
final boolean authenticated = sb.adminAuthenticated(header) >= 2;
@@ -125,7 +125,7 @@ public class Supporter {
url = row.getColString(0, null);
try {
- if (plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SURFTIPS ,new yacyURL(url, urlhash))) continue;
+ if (Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SURFTIPS ,new yacyURL(url, urlhash))) continue;
} catch(final MalformedURLException e) {continue;}
title = row.getColString(1,"UTF-8");
description = row.getColString(2,"UTF-8");
@@ -167,7 +167,7 @@ public class Supporter {
return (int) Math.max(0, 10 - ((System.currentTimeMillis() - created.getTime()) / 24 / 60 / 60 / 1000));
}
- private static void accumulateVotes(final plasmaSwitchboard sb, final HashMap<String, Integer> negativeHashes, final HashMap<String, Integer> positiveHashes, final int dbtype) {
+ private static void accumulateVotes(final Switchboard sb, final HashMap<String, Integer> negativeHashes, final HashMap<String, Integer> positiveHashes, final int dbtype) {
final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype));
yacyNewsRecord record;
final Iterator<yacyNewsRecord> recordIterator = sb.peers.newsPool.recordIterator(dbtype, true);
@@ -195,7 +195,7 @@ public class Supporter {
}
private static void accumulateSupporter(
- final plasmaSwitchboard sb,
+ final Switchboard sb,
final HashMap<String, Entry> Supporter, final ScoreCluster<String> ranking, final Row rowdef,
final HashMap<String, Integer> negativeHashes, final HashMap<String, Integer> positiveHashes, final int dbtype) {
final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype));
diff --git a/htroot/Surftips.java b/htroot/Surftips.java
index 2072754a3..5885e547f 100644
--- a/htroot/Surftips.java
+++ b/htroot/Surftips.java
@@ -32,13 +32,13 @@ import java.util.HashMap;
import java.util.Iterator;
import de.anomic.data.Blacklist;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.index.Row;
import de.anomic.kelondro.index.Row.Entry;
import de.anomic.kelondro.order.NaturalOrder;
import de.anomic.kelondro.util.DateFormatter;
import de.anomic.kelondro.util.ScoreCluster;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.tools.crypt;
@@ -50,8 +50,8 @@ import de.anomic.yacy.yacyURL;
public class Surftips {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
final boolean authenticated = sb.adminAuthenticated(header) >= 2;
@@ -133,7 +133,7 @@ public class Surftips {
url = row.getColString(0, null);
try{
- if(plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SURFTIPS ,new yacyURL(url, null)))
+ if(Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_SURFTIPS ,new yacyURL(url, null)))
continue;
}catch(final MalformedURLException e){continue;};
title = row.getColString(1,"UTF-8");
@@ -176,7 +176,7 @@ public class Surftips {
return (int) Math.max(0, 10 - ((System.currentTimeMillis() - created.getTime()) / 24 / 60 / 60 / 1000));
}
- private static void accumulateVotes(final plasmaSwitchboard sb, final HashMap<String, Integer> negativeHashes, final HashMap<String, Integer> positiveHashes, final int dbtype) {
+ private static void accumulateVotes(final Switchboard sb, final HashMap<String, Integer> negativeHashes, final HashMap<String, Integer> positiveHashes, final int dbtype) {
final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype));
yacyNewsRecord record;
final Iterator<yacyNewsRecord> recordIterator = sb.peers.newsPool.recordIterator(dbtype, true);
@@ -204,7 +204,7 @@ public class Surftips {
}
private static void accumulateSurftips(
- final plasmaSwitchboard sb,
+ final Switchboard sb,
final HashMap<String, Entry> surftips, final ScoreCluster<String> ranking, final Row rowdef,
final HashMap<String, Integer> negativeHashes, final HashMap<String, Integer> positiveHashes, final int dbtype) {
final int maxCount = Math.min(1000, sb.peers.newsPool.size(dbtype));
diff --git a/htroot/Threaddump_p.java b/htroot/Threaddump_p.java
index 4b82bc8b3..364f57a07 100644
--- a/htroot/Threaddump_p.java
+++ b/htroot/Threaddump_p.java
@@ -38,10 +38,10 @@ import java.util.ArrayList;
import java.util.HashMap;
import de.anomic.document.parser.html.CharacterCoding;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.FileUtils;
import de.anomic.kelondro.util.MemoryControl;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.tools.nxTools;
@@ -49,10 +49,10 @@ import de.anomic.yacy.yacyBuildProperties;
public class Threaddump_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
serverObjects prop = new serverObjects();
- plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ Switchboard sb = (Switchboard) env;
final StringBuilder buffer = new StringBuilder(1000);
diff --git a/htroot/Trails.java b/htroot/Trails.java
index 755029660..b456172bf 100644
--- a/htroot/Trails.java
+++ b/htroot/Trails.java
@@ -1,4 +1,4 @@
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.servletProperties;
@@ -6,7 +6,7 @@ import de.anomic.server.servletProperties;
//dummy class
public class Trails {
- public static servletProperties respond(final httpRequestHeader requestHeader, final serverObjects post, final serverSwitch env) {
+ public static servletProperties respond(final RequestHeader requestHeader, final serverObjects post, final serverSwitch env) {
final servletProperties prop = new servletProperties();
return prop;
}
diff --git a/htroot/User.java b/htroot/User.java
index 711a9d9de..2f3e89b44 100644
--- a/htroot/User.java
+++ b/htroot/User.java
@@ -30,22 +30,22 @@
import java.io.IOException;
import de.anomic.data.userDB;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.http.httpResponseHeader;
-import de.anomic.http.httpd;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.metadata.ResponseHeader;
+import de.anomic.http.server.HTTPDemon;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.order.Digest;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.servletProperties;
public class User{
- public static servletProperties respond(final httpRequestHeader requestHeader, final serverObjects post, final serverSwitch env) {
+ public static servletProperties respond(final RequestHeader requestHeader, final serverObjects post, final serverSwitch env) {
final servletProperties prop = new servletProperties();
- final plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
+ final Switchboard sb = Switchboard.getSwitchboard();
userDB.Entry entry=null;
//default values
@@ -53,7 +53,7 @@ public class User{
prop.put("logged-in_limit", "0");
prop.put("status", "0");
//identified via HTTPPassword
- entry=sb.userDB.proxyAuth((requestHeader.get(httpRequestHeader.AUTHORIZATION, "xxxxxx")));
+ entry=sb.userDB.proxyAuth((requestHeader.get(RequestHeader.AUTHORIZATION, "xxxxxx")));
if(entry != null){
prop.put("logged-in_identified-by", "1");
//try via cookie
@@ -62,7 +62,7 @@ public class User{
prop.put("logged-in_identified-by", "2");
//try via ip
if(entry == null){
- entry=sb.userDB.ipAuth((requestHeader.get(httpHeader.CONNECTION_PROP_CLIENTIP, "xxxxxx")));
+ entry=sb.userDB.ipAuth((requestHeader.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "xxxxxx")));
if(entry != null){
prop.put("logged-in_identified-by", "0");
}
@@ -95,7 +95,7 @@ public class User{
final String password=post.get("password");
entry=sb.userDB.passwordAuth(username, password);
- final boolean staticAdmin = sb.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").equals(
+ final boolean staticAdmin = sb.getConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, "").equals(
Digest.encodeMD5Hex(
Base64Order.standardCoder.encodeString(username + ":" + password)
)
@@ -108,7 +108,7 @@ public class User{
cookie=sb.userDB.getAdminCookie();
if(entry != null || staticAdmin){
- final httpResponseHeader outgoingHeader=new httpResponseHeader();
+ final ResponseHeader outgoingHeader=new ResponseHeader();
outgoingHeader.setCookie("login", cookie);
prop.setOutgoingHeader(outgoingHeader);
@@ -145,12 +145,12 @@ public class User{
if(post!=null && post.containsKey("logout")){
prop.put("logged-in", "0");
if(entry != null){
- entry.logout((requestHeader.get(httpHeader.CONNECTION_PROP_CLIENTIP, "xxxxxx")), userDB.getLoginToken(requestHeader.getHeaderCookies())); //todo: logout cookie
+ entry.logout((requestHeader.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "xxxxxx")), userDB.getLoginToken(requestHeader.getHeaderCookies())); //todo: logout cookie
}else{
sb.userDB.adminLogout(userDB.getLoginToken(requestHeader.getHeaderCookies()));
}
//XXX: This should not be needed anymore, because of isLoggedout
- if(! (requestHeader.get(httpRequestHeader.AUTHORIZATION, "xxxxxx")).equals("xxxxxx")){
+ if(! (requestHeader.get(RequestHeader.AUTHORIZATION, "xxxxxx")).equals("xxxxxx")){
prop.put("AUTHENTICATE","admin log-in");
}
}
diff --git a/htroot/ViewFile.java b/htroot/ViewFile.java
index 786871f9d..856d3a9bb 100644
--- a/htroot/ViewFile.java
+++ b/htroot/ViewFile.java
@@ -40,14 +40,14 @@ import de.anomic.document.ParserException;
import de.anomic.document.Document;
import de.anomic.document.parser.html.CharacterCoding;
import de.anomic.document.parser.html.ImageEntry;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.http.httpResponseHeader;
+import de.anomic.http.client.Client;
+import de.anomic.http.client.Cache;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.metadata.ResponseHeader;
import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaHTCache;
-import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.search.SnippetCache;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyURL;
@@ -65,10 +65,10 @@ public class ViewFile {
private static final String HIGHLIGHT_CSS = "searchHighlight";
private static final int MAX_HIGHLIGHTS = 6;
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
- final plasmaSwitchboard sb = (plasmaSwitchboard)env;
+ final Switchboard sb = (Switchboard)env;
final int display = (post == null) ? 0 : post.getInt("display", 0);
@@ -143,12 +143,12 @@ public class ViewFile {
// loading the resource content as byte array
InputStream resource = null;
long resourceLength = -1;
- httpResponseHeader responseHeader = null;
+ ResponseHeader responseHeader = null;
String resMime = null;
// trying to load the resource body
- resource = plasmaHTCache.getResourceContentStream(url);
- resourceLength = plasmaHTCache.getResourceContentLength(url);
- responseHeader = plasmaHTCache.loadResponseHeader(url);
+ resource = Cache.getResourceContentStream(url);
+ resourceLength = Cache.getResourceContentLength(url);
+ responseHeader = Cache.loadResponseHeader(url);
// if the resource body was not cached we try to load it from web
if (resource == null) {
@@ -163,8 +163,8 @@ public class ViewFile {
}
if (entry != null) {
- resource = plasmaHTCache.getResourceContentStream(url);
- resourceLength = plasmaHTCache.getResourceContentLength(url);
+ resource = Cache.getResourceContentStream(url);
+ resourceLength = Cache.getResourceContentLength(url);
}
if (resource == null) {
@@ -180,7 +180,7 @@ public class ViewFile {
// try to load the metadata from cache
try {
- responseHeader = plasmaHTCache.loadResponseHeader(url);
+ responseHeader = Cache.loadResponseHeader(url);
} catch (final Exception e) {
/* ignore this */
}
@@ -194,7 +194,7 @@ public class ViewFile {
return prop;
}
- responseHeader = httpClient.whead(url.toString());
+ responseHeader = Client.whead(url.toString());
if (responseHeader == null) {
prop.put("error", "4");
prop.put("error_errorText", "Unable to load resource metadata.");
diff --git a/htroot/ViewImage.java b/htroot/ViewImage.java
index 2ef39aacd..8303d559f 100644
--- a/htroot/ViewImage.java
+++ b/htroot/ViewImage.java
@@ -29,11 +29,11 @@ import java.io.InputStream;
import java.net.MalformedURLException;
import java.util.HashMap;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.search.SnippetCache;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyURL;
@@ -52,9 +52,9 @@ public class ViewImage {
}
}
- public static Image respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static Image respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard)env;
+ final Switchboard sb = (Switchboard)env;
// the url to the image can be either submitted with an url in clear text, or using a license key
// if the url is given as clear text, the user must be authorized as admin
@@ -62,7 +62,7 @@ public class ViewImage {
String urlString = post.get("url", "");
final String urlLicense = post.get("code", "");
- final boolean auth = (header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "")).equals("localhost") || sb.verifyAuthentication(header, true); // handle access rights
+ final boolean auth = (header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "")).equals("localhost") || sb.verifyAuthentication(header, true); // handle access rights
yacyURL url = null;
if ((urlString.length() > 0) && (auth)) try {
diff --git a/htroot/ViewLog_p.java b/htroot/ViewLog_p.java
index 114f7bd0e..899e3f843 100644
--- a/htroot/ViewLog_p.java
+++ b/htroot/ViewLog_p.java
@@ -33,7 +33,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.logging.GuiHandler;
@@ -41,7 +41,7 @@ import de.anomic.yacy.logging.LogalizerHandler;
public class ViewLog_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
String[] log = new String[0];
boolean reversed = false;
diff --git a/htroot/ViewProfile.java b/htroot/ViewProfile.java
index 8ad3aa512..824a6601d 100644
--- a/htroot/ViewProfile.java
+++ b/htroot/ViewProfile.java
@@ -36,9 +36,9 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.order.Base64Order;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyClient;
@@ -50,9 +50,9 @@ import de.anomic.yacy.yacySeed;
public class ViewProfile {
@SuppressWarnings("unchecked")
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final boolean authenticated = sb.adminAuthenticated(header) >= 2;
final int display = ((post == null) || (!authenticated)) ? 0 : post.getInt("display", 0);
prop.put("display", display);
diff --git a/htroot/WatchCrawler_p.java b/htroot/WatchCrawler_p.java
index 0a8f477ce..f30fdd5b5 100644
--- a/htroot/WatchCrawler_p.java
+++ b/htroot/WatchCrawler_p.java
@@ -44,10 +44,10 @@ import de.anomic.data.bookmarksDB;
import de.anomic.data.listManager;
import de.anomic.document.parser.html.ContentScraper;
import de.anomic.document.parser.html.TransformerWriter;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyNewsPool;
@@ -63,9 +63,9 @@ public class WatchCrawler_p {
// this servlet does NOT create the WatchCrawler page content!
// this servlet starts a web crawl. The interface for entering the web crawl parameters is in IndexCreate_p.html
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
// inital values for AJAX Elements (without JavaScript)
final serverObjects prop = new serverObjects();
prop.put("rejected", 0);
@@ -101,9 +101,9 @@ public class WatchCrawler_p {
// continue queue
final String queue = post.get("continue", "");
if (queue.equals("localcrawler")) {
- sb.continueCrawlJob(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
+ sb.continueCrawlJob(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
} else if (queue.equals("remotecrawler")) {
- sb.continueCrawlJob(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
+ sb.continueCrawlJob(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
}
}
@@ -111,9 +111,9 @@ public class WatchCrawler_p {
// pause queue
final String queue = post.get("pause", "");
if (queue.equals("localcrawler")) {
- sb.pauseCrawlJob(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
+ sb.pauseCrawlJob(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
} else if (queue.equals("remotecrawler")) {
- sb.pauseCrawlJob(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
+ sb.pauseCrawlJob(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
}
}
@@ -353,7 +353,7 @@ public class WatchCrawler_p {
xsstopw, xdstopw, xpstopw);
// pause local crawl here
- sb.pauseCrawlJob(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
+ sb.pauseCrawlJob(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
// loop through the contained links
final Iterator<Map.Entry<yacyURL, String>> linkiterator = hyperlinks.entrySet().iterator();
@@ -390,7 +390,7 @@ public class WatchCrawler_p {
prop.putHTML("info_error", e.getMessage());
e.printStackTrace();
}
- sb.continueCrawlJob(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
+ sb.continueCrawlJob(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
}
} else if (crawlingMode.equals(CRAWLING_MODE_SITEMAP)) {
String sitemapURLStr = null;
@@ -433,7 +433,7 @@ public class WatchCrawler_p {
}
// performance settings
- final long LCbusySleep = Integer.parseInt(env.getConfig(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL_BUSYSLEEP, "1000"));
+ final long LCbusySleep = Integer.parseInt(env.getConfig(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL_BUSYSLEEP, "1000"));
final int LCppm = (int) (60000L / Math.max(1,LCbusySleep));
prop.put("crawlingSpeedMaxChecked", (LCppm >= 30000) ? "1" : "0");
prop.put("crawlingSpeedCustChecked", ((LCppm > 10) && (LCppm < 30000)) ? "1" : "0");
@@ -453,9 +453,9 @@ public class WatchCrawler_p {
return System.currentTimeMillis() - (long) recrawlIfOlderNumber;
}
- private static void setPerformance(final plasmaSwitchboard sb, final serverObjects post) {
+ private static void setPerformance(final Switchboard sb, final serverObjects post) {
final String crawlingPerformance = post.get("crawlingPerformance", "custom");
- final long LCbusySleep = Integer.parseInt(sb.getConfig(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL_BUSYSLEEP, "1000"));
+ final long LCbusySleep = Integer.parseInt(sb.getConfig(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL_BUSYSLEEP, "1000"));
int wantedPPM = (LCbusySleep == 0) ? 30000 : (int) (60000L / LCbusySleep);
try {
wantedPPM = Integer.parseInt(post.get("customPPM", Integer.toString(wantedPPM)));
diff --git a/htroot/WatchWebStructure_p.java b/htroot/WatchWebStructure_p.java
index 48552b83c..a520a9bb7 100644
--- a/htroot/WatchWebStructure_p.java
+++ b/htroot/WatchWebStructure_p.java
@@ -2,16 +2,16 @@
import java.util.Iterator;
import de.anomic.crawler.CrawlProfile.entry;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.crawler.CrawlSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class WatchWebStructure_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
int width = 768;
diff --git a/htroot/WebStructurePicture_p.java b/htroot/WebStructurePicture_p.java
index 4860a237f..0cb427ae9 100644
--- a/htroot/WebStructurePicture_p.java
+++ b/htroot/WebStructurePicture_p.java
@@ -31,13 +31,13 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.order.Base64Order;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaWebStructure;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyURL;
+import de.anomic.ymage.WebStructureGraph;
import de.anomic.ymage.ymageGraph;
import de.anomic.ymage.ymageMatrix;
import de.anomic.ymage.ymageToolPrint;
@@ -46,8 +46,8 @@ public class WebStructurePicture_p {
private static final double maxlongd = Long.MAX_VALUE;
- public static ymageMatrix respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static ymageMatrix respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
int width = 768;
int height = 576;
@@ -112,7 +112,7 @@ public class WebStructurePicture_p {
}
- private static final int place(final ymageGraph graph, final plasmaWebStructure structure, final String centerhash, final String centerhost, int maxnodes, final long timeout, final double x, final double y, int nextlayer, final int maxlayer) {
+ private static final int place(final ymageGraph graph, final WebStructureGraph structure, final String centerhash, final String centerhost, int maxnodes, final long timeout, final double x, final double y, int nextlayer, final int maxlayer) {
// returns the number of nodes that had been placed
assert centerhost != null;
ymageGraph.coordinate center = graph.getPoint(centerhost);
@@ -125,7 +125,7 @@ public class WebStructurePicture_p {
if (nextlayer == maxlayer) return mynodes;
nextlayer++;
final double radius = 1.0 / (1 << nextlayer);
- plasmaWebStructure.structureEntry sr = structure.outgoingReferences(centerhash);
+ WebStructureGraph.structureEntry sr = structure.outgoingReferences(centerhash);
final Map<String, Integer> next = (sr == null) ? new HashMap<String, Integer>() : sr.references;
Map.Entry<String, Integer> entry;
String targethash, targethost;
diff --git a/htroot/Wiki.java b/htroot/Wiki.java
index f68ad80c3..d4ad15c31 100644
--- a/htroot/Wiki.java
+++ b/htroot/Wiki.java
@@ -36,9 +36,9 @@ import java.util.Iterator;
import de.anomic.data.diff;
import de.anomic.data.wiki.wikiBoard;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyNewsPool;
@@ -55,8 +55,8 @@ public class Wiki {
}
- public static serverObjects respond(final httpRequestHeader header, serverObjects post, final serverSwitch env) throws IOException {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, serverObjects post, final serverSwitch env) throws IOException {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
if (post == null) {
post = new serverObjects();
@@ -69,7 +69,7 @@ public class Wiki {
String access = sb.getConfig("WikiAccess", "admin");
final String pagename = get(post, "page", "start");
- final String ip = get(post, httpHeader.CONNECTION_PROP_CLIENTIP, "127.0.0.1");
+ final String ip = get(post, HeaderFramework.CONNECTION_PROP_CLIENTIP, "127.0.0.1");
String author = get(post, "author", "anonymous");
if (author.equals("anonymous")) {
author = wikiBoard.guessAuthor(ip);
diff --git a/htroot/WikiHelp.java b/htroot/WikiHelp.java
index da4205652..3c7fe8c0c 100644
--- a/htroot/WikiHelp.java
+++ b/htroot/WikiHelp.java
@@ -27,13 +27,13 @@
// javac -classpath .:../classes WikiHelp.java
// if the shell's current path is HTROOT
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class WikiHelp {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
//final plasmaSwitchboard sb = (plasmaSwitchboard) env;
final serverObjects prop = new serverObjects();
return prop;
diff --git a/htroot/YaCySearchPluginFF.java b/htroot/YaCySearchPluginFF.java
index 99f533a08..cdb6b9b82 100644
--- a/htroot/YaCySearchPluginFF.java
+++ b/htroot/YaCySearchPluginFF.java
@@ -24,9 +24,9 @@
//javac -classpath .:../Classes Status.java
//if the shell's current path is HTROOT
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -38,12 +38,12 @@ public class YaCySearchPluginFF {
* @param env the serverSwitch object holding all runtime-data
* @return the rewrite-properties for the template
*/
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
// getting the http host header
- final String hostSocket = header.get(httpHeader.CONNECTION_PROP_HOST);
+ final String hostSocket = header.get(HeaderFramework.CONNECTION_PROP_HOST);
String host = hostSocket;
int port = 80;
diff --git a/htroot/api/blacklists.java b/htroot/api/blacklists.java
index f07ab2fb5..a1b2a1b93 100644
--- a/htroot/api/blacklists.java
+++ b/htroot/api/blacklists.java
@@ -3,13 +3,13 @@ import java.io.File;
import java.util.List;
import de.anomic.data.listManager;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class blacklists {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
listManager.listsPath = new File(listManager.switchboard.getRootPath(),listManager.switchboard.getConfig("listManager.listsPath", "DATA/LISTS"));
diff --git a/htroot/api/blacklists_p.java b/htroot/api/blacklists_p.java
index 8e538fcb2..0299f0bf1 100644
--- a/htroot/api/blacklists_p.java
+++ b/htroot/api/blacklists_p.java
@@ -4,14 +4,14 @@ import java.util.List;
import de.anomic.data.AbstractBlacklist;
import de.anomic.data.listManager;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class blacklists_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
listManager.listsPath = new File(listManager.switchboard.getRootPath(),listManager.switchboard.getConfig("listManager.listsPath", "DATA/LISTS"));
diff --git a/htroot/api/bookmarks/get_bookmarks.java b/htroot/api/bookmarks/get_bookmarks.java
index 0b74a4dbf..e4aa5a058 100644
--- a/htroot/api/bookmarks/get_bookmarks.java
+++ b/htroot/api/bookmarks/get_bookmarks.java
@@ -6,16 +6,16 @@ import java.util.Iterator;
import de.anomic.data.bookmarksDB;
import de.anomic.data.userDB;
import de.anomic.document.parser.html.CharacterCoding;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class get_bookmarks {
private static final serverObjects prop = new serverObjects();
- private static plasmaSwitchboard sb = null;
+ private static Switchboard sb = null;
private static userDB.Entry user = null;
private static boolean isAdmin = false;
@@ -35,10 +35,10 @@ public class get_bookmarks {
final static int RSS = 3; // .xml (.rss)
final static int RDF = 4; // .xml
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
prop.clear();
- sb = (plasmaSwitchboard) env;
+ sb = (Switchboard) env;
user = sb.userDB.getUser(header);
isAdmin = (sb.verifyAuthentication(header, true) || user != null && user.hasRight(userDB.Entry.BOOKMARK_RIGHT));
diff --git a/htroot/api/bookmarks/get_folders.java b/htroot/api/bookmarks/get_folders.java
index 563bed624..5049daa6e 100644
--- a/htroot/api/bookmarks/get_folders.java
+++ b/htroot/api/bookmarks/get_folders.java
@@ -4,22 +4,22 @@ import java.util.Iterator;
import de.anomic.data.bookmarksDB;
import de.anomic.data.userDB;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class get_folders {
private static final serverObjects prop = new serverObjects();
- private static plasmaSwitchboard sb = null;
+ private static Switchboard sb = null;
private static userDB.Entry user = null;
private static boolean isAdmin = false;
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
prop.clear();
- sb = (plasmaSwitchboard) env;
+ sb = (Switchboard) env;
user = sb.userDB.getUser(header);
isAdmin = (sb.verifyAuthentication(header, true) || user != null && user.hasRight(userDB.Entry.BOOKMARK_RIGHT));
diff --git a/htroot/api/bookmarks/posts/add_p.java b/htroot/api/bookmarks/posts/add_p.java
index 73cbfb6db..8bdef0d57 100755
--- a/htroot/api/bookmarks/posts/add_p.java
+++ b/htroot/api/bookmarks/posts/add_p.java
@@ -5,8 +5,8 @@ import java.util.Set;
import de.anomic.data.bookmarksDB;
import de.anomic.data.listManager;
import de.anomic.data.userDB;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyNewsPool;
@@ -16,13 +16,13 @@ import de.anomic.yacy.yacyNewsRecord;
public class add_p {
private static final serverObjects prop = new serverObjects();
- private static plasmaSwitchboard sb = null;
+ private static Switchboard sb = null;
private static userDB.Entry user = null;
private static boolean isAdmin = false;
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
- sb = (plasmaSwitchboard) env;
+ sb = (Switchboard) env;
isAdmin=sb.verifyAuthentication(header, true);
user = sb.userDB.getUser(header);
diff --git a/htroot/api/bookmarks/posts/all.java b/htroot/api/bookmarks/posts/all.java
index ec552a1f4..d8ef7c4bb 100755
--- a/htroot/api/bookmarks/posts/all.java
+++ b/htroot/api/bookmarks/posts/all.java
@@ -3,17 +3,17 @@ import java.util.Date;
import java.util.Iterator;
import de.anomic.data.bookmarksDB;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.order.Digest;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class all {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
+ final Switchboard switchboard = (Switchboard) env;
final boolean isAdmin=switchboard.verifyAuthentication(header, true);
final serverObjects prop = new serverObjects();
diff --git a/htroot/api/bookmarks/posts/delete_p.java b/htroot/api/bookmarks/posts/delete_p.java
index 424659a2b..00c59a640 100755
--- a/htroot/api/bookmarks/posts/delete_p.java
+++ b/htroot/api/bookmarks/posts/delete_p.java
@@ -1,16 +1,16 @@
import java.net.MalformedURLException;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyURL;
public class delete_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
+ final Switchboard switchboard = (Switchboard) env;
final serverObjects prop = new serverObjects();
final boolean isAdmin=switchboard.verifyAuthentication(header, true);
if(post!= null){
diff --git a/htroot/api/bookmarks/posts/get.java b/htroot/api/bookmarks/posts/get.java
index b73df59bf..4f7b52363 100755
--- a/htroot/api/bookmarks/posts/get.java
+++ b/htroot/api/bookmarks/posts/get.java
@@ -6,17 +6,17 @@ import java.util.Date;
import java.util.Iterator;
import de.anomic.data.bookmarksDB;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.order.Digest;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class get {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
+ final Switchboard switchboard = (Switchboard) env;
final boolean isAdmin=switchboard.verifyAuthentication(header, true);
final serverObjects prop = new serverObjects();
String tag=null;
diff --git a/htroot/api/bookmarks/tags/addTag_p.java b/htroot/api/bookmarks/tags/addTag_p.java
index a9d10266b..3d28b1847 100644
--- a/htroot/api/bookmarks/tags/addTag_p.java
+++ b/htroot/api/bookmarks/tags/addTag_p.java
@@ -1,15 +1,15 @@
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.data.bookmarksDB.Bookmark;
public class addTag_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
+ final Switchboard switchboard = (Switchboard) env;
final serverObjects prop = new serverObjects();
boolean isAdmin = false;
isAdmin = switchboard.verifyAuthentication(header, true);
diff --git a/htroot/api/bookmarks/tags/editTag_p.java b/htroot/api/bookmarks/tags/editTag_p.java
index 75af90f42..bcd936478 100755
--- a/htroot/api/bookmarks/tags/editTag_p.java
+++ b/htroot/api/bookmarks/tags/editTag_p.java
@@ -1,13 +1,13 @@
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class editTag_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
+ final Switchboard switchboard = (Switchboard) env;
final serverObjects prop = new serverObjects();
boolean isAdmin = false;
isAdmin = switchboard.verifyAuthentication(header, true);
diff --git a/htroot/api/bookmarks/tags/getTag.java b/htroot/api/bookmarks/tags/getTag.java
index 7a2edaeed..0441212de 100755
--- a/htroot/api/bookmarks/tags/getTag.java
+++ b/htroot/api/bookmarks/tags/getTag.java
@@ -3,8 +3,8 @@ import java.util.Iterator;
import de.anomic.data.bookmarksDB;
import de.anomic.data.bookmarksDB.Tag;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -13,9 +13,9 @@ public class getTag {
final static int SORT_SIZE = 2;
final static int SHOW_ALL = -1;
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
+ final Switchboard switchboard = (Switchboard) env;
final boolean isAdmin=switchboard.verifyAuthentication(header, true);
final serverObjects prop = new serverObjects();
Iterator<Tag> it = null;
diff --git a/htroot/api/bookmarks/xbel/xbel.java b/htroot/api/bookmarks/xbel/xbel.java
index 0b46c087d..badeb9316 100755
--- a/htroot/api/bookmarks/xbel/xbel.java
+++ b/htroot/api/bookmarks/xbel/xbel.java
@@ -5,27 +5,27 @@ import java.util.Iterator;
import de.anomic.data.bookmarksDB;
import de.anomic.document.parser.html.CharacterCoding;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class xbel {
private static final serverObjects prop = new serverObjects();
- private static plasmaSwitchboard switchboard = null;
+ private static Switchboard switchboard = null;
private static boolean isAdmin = false;
private static int R = 1; // TODO: solve the recursion problem an remove global variable
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
int count = 0;;
String root = "/";
int style = 0;
prop.clear();
- switchboard = (plasmaSwitchboard) env;
+ switchboard = (Switchboard) env;
isAdmin=switchboard.verifyAuthentication(header, true);
if(post != null) {
diff --git a/htroot/api/config_p.java b/htroot/api/config_p.java
index 3bd9121fe..37e1851d4 100644
--- a/htroot/api/config_p.java
+++ b/htroot/api/config_p.java
@@ -4,14 +4,14 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class config_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
//plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
final serverObjects prop = new serverObjects();
diff --git a/htroot/api/feed.java b/htroot/api/feed.java
index 23730f934..4f0f42b9c 100755
--- a/htroot/api/feed.java
+++ b/htroot/api/feed.java
@@ -4,15 +4,15 @@ import java.util.Date;
import de.anomic.content.RSSMessage;
import de.anomic.document.parser.xml.RSSFeed;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class feed {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
// insert default values
final serverObjects prop = new serverObjects();
diff --git a/htroot/api/latency_p.java b/htroot/api/latency_p.java
index 15ecef082..cced8dcc4 100644
--- a/htroot/api/latency_p.java
+++ b/htroot/api/latency_p.java
@@ -28,14 +28,14 @@ import java.util.Map;
import de.anomic.crawler.Latency;
import de.anomic.crawler.NoticedURL;
import de.anomic.crawler.Latency.Host;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.DateFormatter;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class latency_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
//final plasmaSwitchboard sb = (plasmaSwitchboard) env;
diff --git a/htroot/api/queues_p.java b/htroot/api/queues_p.java
index dcdb9fff6..d5760a66f 100755
--- a/htroot/api/queues_p.java
+++ b/htroot/api/queues_p.java
@@ -5,9 +5,9 @@ import java.util.Locale;
import de.anomic.crawler.NoticedURL;
import de.anomic.crawler.retrieval.Request;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacySeed;
@@ -23,9 +23,9 @@ public class queues_p {
return dayFormatter.format(date);
}
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
//wikiCode wikiTransformer = new wikiCode(switchboard);
final serverObjects prop = new serverObjects();
if (post == null || !post.containsKey("html"))
@@ -41,7 +41,7 @@ public class queues_p {
// loader queue
prop.put("loaderSize", Integer.toString(sb.crawlQueues.size()));
- prop.put("loaderMax", sb.getConfigLong(plasmaSwitchboardConstants.CRAWLER_THREADS_ACTIVE_MAX, 10));
+ prop.put("loaderMax", sb.getConfigLong(SwitchboardConstants.CRAWLER_THREADS_ACTIVE_MAX, 10));
if (sb.crawlQueues.size() == 0) {
prop.put("list-loader", "0");
} else {
@@ -60,8 +60,8 @@ public class queues_p {
}
//local crawl queue
- prop.putNum("localCrawlSize", Integer.toString(sb.getThread(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL).getJobCount()));
- prop.put("localCrawlState", sb.crawlJobIsPaused(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL) ? STATE_PAUSED : STATE_RUNNING);
+ prop.putNum("localCrawlSize", Integer.toString(sb.getThread(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL).getJobCount()));
+ prop.put("localCrawlState", sb.crawlJobIsPaused(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL) ? STATE_PAUSED : STATE_RUNNING);
int stackSize = sb.crawlQueues.noticeURL.stackSize(NoticedURL.STACK_TYPE_CORE);
addNTable(sb, prop, "list-local", sb.crawlQueues.noticeURL.top(NoticedURL.STACK_TYPE_CORE, Math.min(10, stackSize)));
@@ -71,8 +71,8 @@ public class queues_p {
stackSize = sb.crawlQueues.noticeURL.stackSize(NoticedURL.STACK_TYPE_LIMIT);
//global crawl queue
- prop.putNum("remoteCrawlSize", Integer.toString(sb.getThread(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL).getJobCount()));
- prop.put("remoteCrawlState", sb.crawlJobIsPaused(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL) ? STATE_PAUSED : STATE_RUNNING);
+ prop.putNum("remoteCrawlSize", Integer.toString(sb.getThread(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL).getJobCount()));
+ prop.put("remoteCrawlState", sb.crawlJobIsPaused(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL) ? STATE_PAUSED : STATE_RUNNING);
stackSize = sb.crawlQueues.noticeURL.stackSize(NoticedURL.STACK_TYPE_LIMIT);
if (stackSize == 0) {
@@ -86,7 +86,7 @@ public class queues_p {
}
- public static final void addNTable(final plasmaSwitchboard sb, final serverObjects prop, final String tableName, final ArrayList<Request> crawlerList) {
+ public static final void addNTable(final Switchboard sb, final serverObjects prop, final String tableName, final ArrayList<Request> crawlerList) {
int showNum = 0;
Request urle;
diff --git a/htroot/api/status_p.java b/htroot/api/status_p.java
index f10561317..6bfcad6db 100644
--- a/htroot/api/status_p.java
+++ b/htroot/api/status_p.java
@@ -1,11 +1,11 @@
-import de.anomic.http.httpRequestHeader;
-import de.anomic.http.httpdByteCountInputStream;
-import de.anomic.http.httpdByteCountOutputStream;
+import de.anomic.http.io.ByteCountInputStream;
+import de.anomic.http.io.ByteCountOutputStream;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.MemoryControl;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverProcessor;
import de.anomic.server.serverSwitch;
@@ -13,15 +13,15 @@ import de.anomic.server.serverSwitch;
public class status_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
if (post == null || !post.containsKey("html"))
prop.setLocalized(false);
prop.put("rejected", "0");
sb.updateMySeed();
- final int cacheMaxSize = (int) sb.getConfigLong(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, 10000);
+ final int cacheMaxSize = (int) sb.getConfigLong(SwitchboardConstants.WORDCACHE_MAX_COUNT, 10000);
prop.putNum("ppm", sb.currentPPM());
prop.putNum("qpm", sb.peers.mySeed().getQPM());
prop.put("wordCacheSize", Integer.toString(sb.indexSegment.termIndex().getBufferSize()));
@@ -34,9 +34,9 @@ public class status_p {
prop.putNum("processors", serverProcessor.availableCPU);
// proxy traffic
- prop.put("trafficIn", httpdByteCountInputStream.getGlobalCount());
- prop.put("trafficProxy", httpdByteCountOutputStream.getAccountCount("PROXY"));
- prop.put("trafficCrawler", httpdByteCountInputStream.getAccountCount("CRAWLER"));
+ prop.put("trafficIn", ByteCountInputStream.getGlobalCount());
+ prop.put("trafficProxy", ByteCountOutputStream.getAccountCount("PROXY"));
+ prop.put("trafficCrawler", ByteCountInputStream.getAccountCount("CRAWLER"));
// return rewrite properties
return prop;
diff --git a/htroot/api/timeline.java b/htroot/api/timeline.java
index 720fae7ca..3020c9077 100644
--- a/htroot/api/timeline.java
+++ b/htroot/api/timeline.java
@@ -29,14 +29,14 @@ import java.util.Iterator;
import java.util.TreeSet;
import de.anomic.document.Word;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.text.ReferenceContainer;
import de.anomic.kelondro.text.Segment;
import de.anomic.kelondro.text.TermSearch;
import de.anomic.kelondro.text.referencePrototype.WordReference;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.search.QueryParams;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.tools.iso639;
@@ -44,9 +44,9 @@ import de.anomic.yacy.yacyCore;
public final class timeline {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
if ((post == null) || (env == null)) return prop;
diff --git a/htroot/api/trail_p.java b/htroot/api/trail_p.java
index 94678f947..db21d69ae 100644
--- a/htroot/api/trail_p.java
+++ b/htroot/api/trail_p.java
@@ -25,15 +25,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class trail_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
int c = 0;
diff --git a/htroot/api/util/getpageinfo_p.java b/htroot/api/util/getpageinfo_p.java
index b26d9198f..cd1f4df94 100755
--- a/htroot/api/util/getpageinfo_p.java
+++ b/htroot/api/util/getpageinfo_p.java
@@ -5,17 +5,17 @@ import java.util.Set;
import de.anomic.crawler.retrieval.HTTPLoader;
import de.anomic.document.parser.html.ContentScraper;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyURL;
public class getpageinfo_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
// avoid UNRESOLVED PATTERN
@@ -43,8 +43,8 @@ public class getpageinfo_p {
if (actions.indexOf("title")>=0) {
try {
final yacyURL u = new yacyURL(url, null);
- final httpRequestHeader reqHeader = new httpRequestHeader();
- reqHeader.put(httpHeader.USER_AGENT, HTTPLoader.yacyUserAgent); // do not set the crawler user agent, because this page was loaded by manual entering of the url
+ final RequestHeader reqHeader = new RequestHeader();
+ reqHeader.put(HeaderFramework.USER_AGENT, HTTPLoader.yacyUserAgent); // do not set the crawler user agent, because this page was loaded by manual entering of the url
final ContentScraper scraper = ContentScraper.parseResource(u, reqHeader);
// put the document title
diff --git a/htroot/api/util/ynetSearch.java b/htroot/api/util/ynetSearch.java
index 531beb59b..16ca422be 100755
--- a/htroot/api/util/ynetSearch.java
+++ b/htroot/api/util/ynetSearch.java
@@ -7,15 +7,15 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Scanner;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class ynetSearch {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard switchboard = (Switchboard) env;
final boolean isAdmin=switchboard.verifyAuthentication(header, true);
final serverObjects prop = new serverObjects();
diff --git a/htroot/api/version.java b/htroot/api/version.java
index bff5a59d8..c22c71e89 100644
--- a/htroot/api/version.java
+++ b/htroot/api/version.java
@@ -1,13 +1,13 @@
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyBuildProperties;
public class version {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
diff --git a/htroot/api/webstructure.java b/htroot/api/webstructure.java
index 19d64812d..b000f0d45 100644
--- a/htroot/api/webstructure.java
+++ b/htroot/api/webstructure.java
@@ -26,18 +26,18 @@ import java.net.MalformedURLException;
import java.util.Iterator;
import java.util.Map;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaWebStructure;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyURL;
+import de.anomic.ymage.WebStructureGraph;
public class webstructure {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final boolean latest = ((post == null) ? false : post.containsKey("latest"));
String about = ((post == null) ? null : post.get("about", null));
prop.put("out", 0);
@@ -53,7 +53,7 @@ public class webstructure {
}
}
if (url != null && about != null) {
- plasmaWebStructure.structureEntry sentry = sb.webStructure.outgoingReferences(about);
+ WebStructureGraph.structureEntry sentry = sb.webStructure.outgoingReferences(about);
if (sentry != null) {
reference(prop, "out", 0, sentry, sb.webStructure);
prop.put("out_domains", 1);
@@ -73,9 +73,9 @@ public class webstructure {
}
}
} else {
- final Iterator<plasmaWebStructure.structureEntry> i = sb.webStructure.structureEntryIterator(latest);
+ final Iterator<WebStructureGraph.structureEntry> i = sb.webStructure.structureEntryIterator(latest);
int c = 0;
- plasmaWebStructure.structureEntry sentry;
+ WebStructureGraph.structureEntry sentry;
while (i.hasNext()) {
sentry = i.next();
reference(prop, "out", c, sentry, sb.webStructure);
@@ -85,14 +85,14 @@ public class webstructure {
prop.put("out", 1);
if (latest) sb.webStructure.joinOldNew();
}
- prop.put("out_maxref", plasmaWebStructure.maxref);
- prop.put("maxhosts", plasmaWebStructure.maxhosts);
+ prop.put("out_maxref", WebStructureGraph.maxref);
+ prop.put("maxhosts", WebStructureGraph.maxhosts);
// return rewrite properties
return prop;
}
- public static void reference(serverObjects prop, String prefix, int c, plasmaWebStructure.structureEntry sentry, plasmaWebStructure ws) {
+ public static void reference(serverObjects prop, String prefix, int c, WebStructureGraph.structureEntry sentry, WebStructureGraph ws) {
prop.put(prefix + "_domains_" + c + "_hash", sentry.domhash);
prop.put(prefix + "_domains_" + c + "_domain", sentry.domain);
prop.put(prefix + "_domains_" + c + "_date", sentry.date);
diff --git a/htroot/api/yacydoc.java b/htroot/api/yacydoc.java
index 6d64f2f3b..667eb2cb8 100644
--- a/htroot/api/yacydoc.java
+++ b/htroot/api/yacydoc.java
@@ -27,9 +27,9 @@
import java.net.MalformedURLException;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacySeedDB;
@@ -37,9 +37,9 @@ import de.anomic.yacy.yacyURL;
public class yacydoc {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
prop.put("dc_title", "");
diff --git a/htroot/autoconfig.java b/htroot/autoconfig.java
index dc7598899..f1ae98231 100644
--- a/htroot/autoconfig.java
+++ b/htroot/autoconfig.java
@@ -24,9 +24,9 @@
//javac -classpath .:../Classes Status.java
//if the shell's current path is HTROOT
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -41,14 +41,14 @@ public class autoconfig {
* @param env the serverSwitch object holding all runtime-data
* @return the rewrite-properties for the template
*/
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
- final boolean yacyonly = env.getConfigBool(plasmaSwitchboardConstants.PROXY_YACY_ONLY, false);
+ final boolean yacyonly = env.getConfigBool(SwitchboardConstants.PROXY_YACY_ONLY, false);
// getting the http host header
- final String hostSocket = header.get(httpHeader.CONNECTION_PROP_HOST);
+ final String hostSocket = header.get(HeaderFramework.CONNECTION_PROP_HOST);
String host = hostSocket;
int port = 80;
diff --git a/htroot/compare_yacy.java b/htroot/compare_yacy.java
index d12ca75cc..7fb1cf20a 100755
--- a/htroot/compare_yacy.java
+++ b/htroot/compare_yacy.java
@@ -24,8 +24,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.servletProperties;
@@ -55,8 +55,8 @@ public class compare_yacy {
searchengines.put("Sciencenet", "http://sciencenet.fzk.de:8080/yacysearch.html?display=2&verify=true&resource=global&query=");
}
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final boolean authenticated = sb.adminAuthenticated(header) >= 2;
final int display = ((post == null) || (!authenticated)) ? 0 : post.getInt("display", 0);
final servletProperties prop = new servletProperties();
diff --git a/htroot/cytag.java b/htroot/cytag.java
index 209925992..28564dde0 100644
--- a/htroot/cytag.java
+++ b/htroot/cytag.java
@@ -31,19 +31,19 @@ import java.io.IOException;
import java.util.Date;
import de.anomic.document.parser.html.CharacterCoding;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.DateFormatter;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.ymage.ymageImageParser;
public class cytag {
- public static Image respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static Image respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard)env;
+ final Switchboard sb = (Switchboard)env;
// harvest request information
StringBuilder connect = new StringBuilder();
diff --git a/htroot/imagetest.java b/htroot/imagetest.java
index 13b68991b..0b8cc3c66 100644
--- a/htroot/imagetest.java
+++ b/htroot/imagetest.java
@@ -24,7 +24,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.ymage.ymageMatrix;
@@ -32,7 +32,7 @@ import de.anomic.ymage.ymageToolPrint;
public class imagetest {
- public static ymageMatrix respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static ymageMatrix respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
/*
BufferedImage bi = new BufferedImage(640, 400, BufferedImage.TYPE_INT_RGB);
Graphics2D g = bi.createGraphics();
diff --git a/htroot/index.java b/htroot/index.java
index b90b57756..031f32ba8 100644
--- a/htroot/index.java
+++ b/htroot/index.java
@@ -29,17 +29,17 @@
// if the shell's current path is HTROOT
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.search.QueryParams;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class index {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
// access control
@@ -58,24 +58,24 @@ public class index {
final boolean authenticated = sb.adminAuthenticated(header) >= 2;
int display = (post == null) ? 0 : post.getInt("display", 0);
if ((display == 1) && (!authenticated)) display = 0;
- final boolean browserPopUpTrigger = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_TRIGGER, "true").equals("true");
+ final boolean browserPopUpTrigger = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_TRIGGER, "true").equals("true");
if (browserPopUpTrigger) {
- final String browserPopUpPage = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "ConfigBasic.html");
+ final String browserPopUpPage = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "ConfigBasic.html");
if (browserPopUpPage.startsWith("index") || browserPopUpPage.startsWith("yacysearch")) display = 2;
}
final int searchoptions = (post == null) ? 0 : post.getInt("searchoptions", 0);
final String former = (post == null) ? "" : post.get("former", "");
final int count = Math.min(100, (post == null) ? 10 : post.getInt("count", 10));
- final int maximumRecords = Integer.parseInt((sb.getConfig(plasmaSwitchboardConstants.DEFAULT_SEARCHITEMS, "10")));
+ final int maximumRecords = Integer.parseInt((sb.getConfig(SwitchboardConstants.DEFAULT_SEARCHITEMS, "10")));
final String urlmaskfilter = (post == null) ? ".*" : post.get("urlmaskfilter", ".*");
final String prefermaskfilter = (post == null) ? "" : post.get("prefermaskfilter", "");
final String constraint = (post == null) ? "" : post.get("constraint", "");
final String cat = (post == null) ? "href" : post.get("cat", "href");
final int type = (post == null) ? 0 : post.getInt("type", 0);
- final boolean indexDistributeGranted = sb.getConfigBool(plasmaSwitchboardConstants.INDEX_DIST_ALLOW, true);
- final boolean indexReceiveGranted = sb.getConfigBool(plasmaSwitchboardConstants.INDEX_RECEIVE_ALLOW, true);
+ final boolean indexDistributeGranted = sb.getConfigBool(SwitchboardConstants.INDEX_DIST_ALLOW, true);
+ final boolean indexReceiveGranted = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, true);
//global = global && indexDistributeGranted && indexReceiveGranted;
// search domain
@@ -88,11 +88,11 @@ public class index {
if (cds.equals("app")) contentdom = QueryParams.CONTENTDOM_APP;
// we create empty entries for template strings
- String promoteSearchPageGreeting = env.getConfig(plasmaSwitchboardConstants.GREETING, "");
- if (env.getConfigBool(plasmaSwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
- prop.putHTML(plasmaSwitchboardConstants.GREETING, promoteSearchPageGreeting);
- prop.put(plasmaSwitchboardConstants.GREETING_HOMEPAGE, sb.getConfig(plasmaSwitchboardConstants.GREETING_HOMEPAGE, ""));
- prop.put(plasmaSwitchboardConstants.GREETING_LARGE_IMAGE, sb.getConfig(plasmaSwitchboardConstants.GREETING_LARGE_IMAGE, ""));
+ String promoteSearchPageGreeting = env.getConfig(SwitchboardConstants.GREETING, "");
+ if (env.getConfigBool(SwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
+ prop.putHTML(SwitchboardConstants.GREETING, promoteSearchPageGreeting);
+ prop.put(SwitchboardConstants.GREETING_HOMEPAGE, sb.getConfig(SwitchboardConstants.GREETING_HOMEPAGE, ""));
+ prop.put(SwitchboardConstants.GREETING_LARGE_IMAGE, sb.getConfig(SwitchboardConstants.GREETING_LARGE_IMAGE, ""));
prop.putHTML("former", former);
prop.put("num-results", "0");
prop.put("excluded", "0");
diff --git a/htroot/mediawiki_p.java b/htroot/mediawiki_p.java
index a234ee9cd..5433845a9 100644
--- a/htroot/mediawiki_p.java
+++ b/htroot/mediawiki_p.java
@@ -27,8 +27,8 @@
import java.io.File;
import java.io.IOException;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.tools.mediawikiIndex;
@@ -36,8 +36,8 @@ import de.anomic.tools.mediawikiIndex;
public class mediawiki_p {
//http://localhost:8080/mediawiki_p.html?dump=wikipedia.de.xml&title=Kartoffel
- public static serverObjects respond(final httpRequestHeader header, serverObjects post, final serverSwitch env) throws IOException {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, serverObjects post, final serverSwitch env) throws IOException {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
prop.put("title", "");
prop.put("page", "");
diff --git a/htroot/opensearchdescription.java b/htroot/opensearchdescription.java
index ce61ec827..c5b404a14 100644
--- a/htroot/opensearchdescription.java
+++ b/htroot/opensearchdescription.java
@@ -24,20 +24,20 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class opensearchdescription {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
// generate message content for open search description
- String promoteSearchPageGreeting = env.getConfig(plasmaSwitchboardConstants.GREETING, "");
- if (env.getConfigBool(plasmaSwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
+ String promoteSearchPageGreeting = env.getConfig(SwitchboardConstants.GREETING, "");
+ if (env.getConfigBool(SwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
String thisaddress = header.get("Host", "localhost");
if (thisaddress.indexOf(":") == -1) thisaddress += ":" + serverCore.getPortNr(env.getConfig("port", "8080"));
diff --git a/htroot/osm.java b/htroot/osm.java
index f1d6e5a3b..661f8e456 100644
--- a/htroot/osm.java
+++ b/htroot/osm.java
@@ -1,6 +1,6 @@
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.ymage.ymageMatrix;
@@ -8,7 +8,7 @@ import de.anomic.ymage.ymageOSM;
public class osm {
- public static ymageMatrix respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static ymageMatrix respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
int zoom = 10;
double lat = 47.968056d;
diff --git a/htroot/rct_p.java b/htroot/rct_p.java
index 3386bf260..64348903b 100644
--- a/htroot/rct_p.java
+++ b/htroot/rct_p.java
@@ -33,9 +33,9 @@ import java.util.Iterator;
import de.anomic.content.RSSMessage;
import de.anomic.crawler.retrieval.Request;
import de.anomic.document.parser.xml.RSSFeed;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyClient;
@@ -45,9 +45,9 @@ import de.anomic.yacy.dht.PeerSelection;
public class rct_p {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
if (post != null) {
@@ -111,7 +111,7 @@ public class rct_p {
return (url == null ? "null" : url.toNormalform(true, false));
}
- private static void listHosts(final plasmaSwitchboard sb, final serverObjects prop) {
+ private static void listHosts(final Switchboard sb, final serverObjects prop) {
// list known hosts
yacySeed seed;
int hc = 0;
diff --git a/htroot/robots.java b/htroot/robots.java
index 57abe179b..d8a80ad04 100644
--- a/htroot/robots.java
+++ b/htroot/robots.java
@@ -3,45 +3,45 @@
import java.io.File;
import java.util.ArrayList;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.http.httpdRobotsTxtConfig;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.server.RobotsTxtConfig;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.servletProperties;
public class robots {
- public static servletProperties respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static servletProperties respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final servletProperties prop = new servletProperties();
- final httpdRobotsTxtConfig rbc = ((plasmaSwitchboard)env).robotstxtConfig;
+ final RobotsTxtConfig rbc = ((Switchboard)env).robotstxtConfig;
if (rbc.isAllDisallowed()) {
- prop.put(httpdRobotsTxtConfig.ALL, 1);
+ prop.put(RobotsTxtConfig.ALL, 1);
} else {
- if (rbc.isBlogDisallowed()) prop.put(httpdRobotsTxtConfig.ALL + "_" + httpdRobotsTxtConfig.BLOG, "1");
- if (rbc.isBookmarksDisallowed()) prop.put(httpdRobotsTxtConfig.ALL + "_" + httpdRobotsTxtConfig.BOOKMARKS, "1");
- if (rbc.isFileshareDisallowed()) prop.put(httpdRobotsTxtConfig.ALL + "_" + httpdRobotsTxtConfig.FILESHARE, "1");
- if (rbc.isHomepageDisallowed()) prop.put(httpdRobotsTxtConfig.ALL + "_" + httpdRobotsTxtConfig.HOMEPAGE, "1");
- if (rbc.isNetworkDisallowed()) prop.put(httpdRobotsTxtConfig.ALL + "_" + httpdRobotsTxtConfig.NETWORK, "1");
- if (rbc.isNewsDisallowed()) prop.put(httpdRobotsTxtConfig.ALL + "_" + httpdRobotsTxtConfig.NEWS, "1");
- if (rbc.isStatusDisallowed()) prop.put(httpdRobotsTxtConfig.ALL + "_" + httpdRobotsTxtConfig.STATUS, "1");
- if (rbc.isSurftipsDisallowed()) prop.put(httpdRobotsTxtConfig.ALL + "_" + httpdRobotsTxtConfig.SURFTIPS, "1");
- if (rbc.isWikiDisallowed()) prop.put(httpdRobotsTxtConfig.ALL + "_" + httpdRobotsTxtConfig.WIKI, "1");
- if (rbc.isProfileDisallowed()) prop.put(httpdRobotsTxtConfig.ALL + "_" + httpdRobotsTxtConfig.PROFILE, "1");
+ if (rbc.isBlogDisallowed()) prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.BLOG, "1");
+ if (rbc.isBookmarksDisallowed()) prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.BOOKMARKS, "1");
+ if (rbc.isFileshareDisallowed()) prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.FILESHARE, "1");
+ if (rbc.isHomepageDisallowed()) prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.HOMEPAGE, "1");
+ if (rbc.isNetworkDisallowed()) prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.NETWORK, "1");
+ if (rbc.isNewsDisallowed()) prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.NEWS, "1");
+ if (rbc.isStatusDisallowed()) prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.STATUS, "1");
+ if (rbc.isSurftipsDisallowed()) prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.SURFTIPS, "1");
+ if (rbc.isWikiDisallowed()) prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.WIKI, "1");
+ if (rbc.isProfileDisallowed()) prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.PROFILE, "1");
if (rbc.isLockedDisallowed() || rbc.isDirsDisallowed()) {
- final ArrayList<String>[] p = getFiles(env.getConfig(plasmaSwitchboardConstants.HTROOT_PATH, plasmaSwitchboardConstants.HTROOT_PATH_DEFAULT));
+ final ArrayList<String>[] p = getFiles(env.getConfig(SwitchboardConstants.HTROOT_PATH, SwitchboardConstants.HTROOT_PATH_DEFAULT));
if (rbc.isLockedDisallowed()) {
- prop.put(httpdRobotsTxtConfig.ALL + "_" + httpdRobotsTxtConfig.LOCKED, p[0].size());
+ prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.LOCKED, p[0].size());
for (int i=0; i<p[0].size(); i++)
- prop.put(httpdRobotsTxtConfig.ALL + "_" + httpdRobotsTxtConfig.LOCKED + "_" + i + "_page", p[0].get(i));
+ prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.LOCKED + "_" + i + "_page", p[0].get(i));
}
if (rbc.isDirsDisallowed()) {
- prop.put(httpdRobotsTxtConfig.ALL + "_" + httpdRobotsTxtConfig.DIRS, p[1].size());
+ prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.DIRS, p[1].size());
for (int i=0; i<p[1].size(); i++)
- prop.put(httpdRobotsTxtConfig.ALL + "_" + httpdRobotsTxtConfig.DIRS + "_" + i + "_dir", p[1].get(i));
+ prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.DIRS + "_" + i + "_dir", p[1].get(i));
}
}
}
diff --git a/htroot/sharedBlacklist_p.java b/htroot/sharedBlacklist_p.java
index abc2c9140..14d7f9205 100644
--- a/htroot/sharedBlacklist_p.java
+++ b/htroot/sharedBlacklist_p.java
@@ -44,11 +44,11 @@ import de.anomic.data.listManager;
import de.anomic.data.list.ListAccumulator;
import de.anomic.data.list.XMLBlacklistImporter;
import de.anomic.document.parser.html.CharacterCoding;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.client.Client;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacySeed;
@@ -67,8 +67,8 @@ public class sharedBlacklist_p {
private final static String BLACKLIST_FILENAME_FILTER = "^.*\\.black$";
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
@@ -86,7 +86,7 @@ public class sharedBlacklist_p {
if (post != null) {
// initialize the list manager
- listManager.switchboard = (plasmaSwitchboard) env;
+ listManager.switchboard = (Switchboard) env;
listManager.listsPath = new File(listManager.switchboard.getRootPath(),listManager.switchboard.getConfig("listManager.listsPath", "DATA/LISTS"));
@@ -139,15 +139,15 @@ public class sharedBlacklist_p {
if (downloadURLOld != null) {
// download the blacklist
try {
- final httpRequestHeader reqHeader = new httpRequestHeader();
- reqHeader.put(httpHeader.PRAGMA,"no-cache");
- reqHeader.put(httpHeader.CACHE_CONTROL,"no-cache");
- reqHeader.put(httpHeader.USER_AGENT, HTTPLoader.yacyUserAgent);
+ final RequestHeader reqHeader = new RequestHeader();
+ reqHeader.put(HeaderFramework.PRAGMA,"no-cache");
+ reqHeader.put(HeaderFramework.CACHE_CONTROL,"no-cache");
+ reqHeader.put(HeaderFramework.USER_AGENT, HTTPLoader.yacyUserAgent);
// get List
yacyURL u = new yacyURL(downloadURLOld, null);
- otherBlacklist = FileUtils.strings(httpClient.wget(u.toString(), reqHeader, 1000), "UTF-8");
+ otherBlacklist = FileUtils.strings(Client.wget(u.toString(), reqHeader, 1000), "UTF-8");
} catch (final Exception e) {
prop.put("status", STATUS_PEER_UNKNOWN);
prop.putHTML("status_name", Hash);
@@ -164,9 +164,9 @@ public class sharedBlacklist_p {
try {
final yacyURL u = new yacyURL(downloadURL, null);
- final httpRequestHeader reqHeader = new httpRequestHeader();
- reqHeader.put(httpHeader.USER_AGENT, HTTPLoader.yacyUserAgent);
- otherBlacklist = FileUtils.strings(httpClient.wget(u.toString(), reqHeader, 10000), "UTF-8"); //get List
+ final RequestHeader reqHeader = new RequestHeader();
+ reqHeader.put(HeaderFramework.USER_AGENT, HTTPLoader.yacyUserAgent);
+ otherBlacklist = FileUtils.strings(Client.wget(u.toString(), reqHeader, 10000), "UTF-8"); //get List
} catch (final Exception e) {
prop.put("status", STATUS_URL_PROBLEM);
prop.putHTML("status_address",downloadURL);
@@ -246,13 +246,13 @@ public class sharedBlacklist_p {
pw.println(newItem);
count++;
- if (plasmaSwitchboard.urlBlacklist != null) {
+ if (Switchboard.urlBlacklist != null) {
final String supportedBlacklistTypesStr = AbstractBlacklist.BLACKLIST_TYPES_STRING;
final String[] supportedBlacklistTypes = supportedBlacklistTypesStr.split(",");
for (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) {
if (listManager.listSetContains(supportedBlacklistTypes[blTypes] + ".BlackLists",selectedBlacklistName)) {
- plasmaSwitchboard.urlBlacklist.add(supportedBlacklistTypes[blTypes],newItem.substring(0, pos), newItem.substring(pos + 1));
+ Switchboard.urlBlacklist.add(supportedBlacklistTypes[blTypes],newItem.substring(0, pos), newItem.substring(pos + 1));
}
}
}
diff --git a/htroot/ssitestservlet.java b/htroot/ssitestservlet.java
index 7009944e3..affb883d4 100644
--- a/htroot/ssitestservlet.java
+++ b/htroot/ssitestservlet.java
@@ -25,13 +25,13 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class ssitestservlet {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
//plasmaSwitchboard sb = (plasmaSwitchboard) env;
final serverObjects prop = new serverObjects();
diff --git a/htroot/test.java b/htroot/test.java
index c547c5a24..357f257ce 100644
--- a/htroot/test.java
+++ b/htroot/test.java
@@ -1,4 +1,4 @@
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -6,7 +6,7 @@ public class test {
// http://localhost:8080/test.xml?count=10
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
final int count = Math.min(1000, (post == null) ? 0 : post.getInt("count", 0));
diff --git a/htroot/www/welcome.java b/htroot/www/welcome.java
index adfd8b628..9c39f813f 100644
--- a/htroot/www/welcome.java
+++ b/htroot/www/welcome.java
@@ -32,9 +32,9 @@ import java.io.File;
import java.net.InetAddress;
import java.net.UnknownHostException;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverCore;
import de.anomic.server.serverDomains;
import de.anomic.server.serverObjects;
@@ -43,8 +43,8 @@ import de.anomic.yacy.yacySeed;
public class welcome {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
@@ -62,7 +62,7 @@ public class welcome {
prop.put("hostip", "Unknown Host Exception");
}
prop.put("port", serverCore.getPortNr(env.getConfig("port","8080")));
- prop.put("clientip", header.get(httpHeader.CONNECTION_PROP_CLIENTIP, ""));
+ prop.put("clientip", header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, ""));
final String peertype = (sb.peers.mySeed() == null) ? yacySeed.PEERTYPE_JUNIOR : sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN);
final boolean senior = (peertype.equals(yacySeed.PEERTYPE_SENIOR)) || (peertype.equals(yacySeed.PEERTYPE_PRINCIPAL));
diff --git a/htroot/yacy/crawlReceipt.java b/htroot/yacy/crawlReceipt.java
index 456cc19ee..8a995a51f 100644
--- a/htroot/yacy/crawlReceipt.java
+++ b/htroot/yacy/crawlReceipt.java
@@ -30,9 +30,9 @@
import java.io.IOException;
import de.anomic.crawler.ZURL;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.tools.crypt;
@@ -47,9 +47,9 @@ public final class crawlReceipt {
* this is used to respond on a remote crawling request
*/
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
if ((post == null) || (env == null)) return prop;
if (!yacyNetwork.authentifyRequest(post, env)) return prop;
diff --git a/htroot/yacy/hello.java b/htroot/yacy/hello.java
index 50eb5e074..66ff78509 100644
--- a/htroot/yacy/hello.java
+++ b/htroot/yacy/hello.java
@@ -32,9 +32,9 @@ import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.Map;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverCore;
import de.anomic.server.serverDomains;
import de.anomic.server.serverObjects;
@@ -51,8 +51,8 @@ public final class hello {
// example:
// http://localhost:8080/yacy/hello.html?count=1&seed=p|{Hash=sCJ6Tq8T0N9x,IPType=&empty;,Port=8080,IP=,Uptime=8,rI=190,Version=0.10004882,PeerType=junior,UTC=+0200,RCount=0,sI=0,LastSeen=20080605103333,Name=intratest,CCount=5.0,SCount=40,news=,USpeed=0,CRTCnt=0,CRWCnt=0,BDate=20080605081349,rU=190,LCount=187,dct=1212668923654,ICount=2,sU=0,ISpeed=0,RSpeed=0.0,NCount=0,Flags=oooo}
// http://localhost:8080/yacy/hello.html?count=10&seed=z|H4sIAAAAAAAAADWQW2vDMAyF_81eJork3GyGX-YxGigly2WFvZTQijbQJsHx1pWx_z7nMj1J4ug7B_2s6-GsP5q3G-G6vBz2e0iz8t6zfuBr7-5PUNanQfulhqyzTkuUCFXvmitrBJtq4ed3tkPTtRpXhIiRDAmq0uhHFIiQMduJ-NXYU9NCbrrP1vnjIdUqgk09uIK51V6rMBRIilAo2NajwzfhGcx8QUKsEIp5iCJo-eaTVUXPfPQ4k5dm4pp8NzaESsLzS-14QVNIMlA-ka2m1JuZJJWIBRwPo0GIIiYp4zCSkC5GQSLiJIah0p6X_rvlS-MTbWdhkCSBIni9jA_rfP3-Ae1Oye9dAQAA
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) throws InterruptedException {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) throws InterruptedException {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
long start = System.currentTimeMillis();
prop.put("message", "none");
@@ -73,7 +73,7 @@ public final class hello {
int count = 0;
try {count = (countStr == null) ? 0 : Integer.parseInt(countStr);} catch (final NumberFormatException e) {count = 0;}
// final Date remoteTime = yacyCore.parseUniversalDate(post.get(MYTIME)); // read remote time
- final String clientip = header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "<unknown>"); // read an artificial header addendum
+ final String clientip = header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "<unknown>"); // read an artificial header addendum
final InetAddress ias = serverDomains.dnsResolve(clientip);
if (ias == null) {
prop.put("message", "cannot resolve your IP from your reported location " + clientip);
@@ -97,7 +97,7 @@ public final class hello {
// if ((properTest != null) && (! properTest.substring(0,1).equals("IP"))) { return null; }
// we easily know the caller's IP:
- final String userAgent = header.get(httpHeader.USER_AGENT, "<unknown>");
+ final String userAgent = header.get(HeaderFramework.USER_AGENT, "<unknown>");
final String reportedip = remoteSeed.getIP();
final String reportedPeerType = remoteSeed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR);
final float clientversion = remoteSeed.getVersion();
diff --git a/htroot/yacy/list.java b/htroot/yacy/list.java
index 1653b4e1e..35fec3772 100644
--- a/htroot/yacy/list.java
+++ b/htroot/yacy/list.java
@@ -29,10 +29,10 @@
import java.io.File;
import de.anomic.data.listManager;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -42,9 +42,9 @@ import de.anomic.yacy.yacySeed;
public final class list {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
if (post == null || env == null) throw new NullPointerException("post: " + post + ", sb: " + env);
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final String blackListName = post.get("listname", "");
@@ -54,14 +54,14 @@ public final class list {
if (!yacyNetwork.authentifyRequest(post, env)) return prop;
final String col = post.get("col", "");
- final File listsPath = env.getConfigPath(plasmaSwitchboardConstants.LISTS_PATH, plasmaSwitchboardConstants.LISTS_PATH_DEFAULT);
+ final File listsPath = env.getConfigPath(SwitchboardConstants.LISTS_PATH, SwitchboardConstants.LISTS_PATH_DEFAULT);
String otherPeerName = null;
if (post.containsKey("iam")) {
final yacySeed bla = sb.peers.get(post.get("iam", ""));
if (bla != null) otherPeerName = bla.getName();
}
- if (otherPeerName == null) otherPeerName = header.get(httpHeader.CONNECTION_PROP_CLIENTIP);
+ if (otherPeerName == null) otherPeerName = header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP);
if ((sb.isRobinsonMode()) && (!sb.isInMyCluster(otherPeerName))) {
// if we are a robinson cluster, answer only if this client is known by our network definition
diff --git a/htroot/yacy/message.java b/htroot/yacy/message.java
index fc2a34f1f..93783ac62 100644
--- a/htroot/yacy/message.java
+++ b/htroot/yacy/message.java
@@ -35,10 +35,10 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import de.anomic.data.messageBoard;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.tools.crypt;
@@ -54,11 +54,11 @@ public final class message {
return SimpleFormatter.format(date);
}
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
if (post == null || env == null) { return null; }
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
if ((post == null) || (env == null)) return prop;
if (!yacyNetwork.authentifyRequest(post, env)) return prop;
@@ -82,7 +82,7 @@ public final class message {
if ((sb.isRobinsonMode()) &&
(!((sb.isPublicRobinson()) ||
- (sb.isInMyCluster(header.get(httpHeader.CONNECTION_PROP_CLIENTIP)))))) {
+ (sb.isInMyCluster(header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP)))))) {
// if we are a robinson cluster, answer only if this client is known by our network definition
prop.put("response", "-1"); // request rejected
return prop;
@@ -163,7 +163,7 @@ public final class message {
#[message]#
*/
- private static void messageForwardingViaEmail(final plasmaSwitchboard sb, final messageBoard.entry msgEntry) {
+ private static void messageForwardingViaEmail(final Switchboard sb, final messageBoard.entry msgEntry) {
try {
if (!Boolean.valueOf(sb.getConfig("msgForwardingEnabled","false")).booleanValue()) return;
diff --git a/htroot/yacy/profile.java b/htroot/yacy/profile.java
index 2582a7b20..0b4b21caa 100644
--- a/htroot/yacy/profile.java
+++ b/htroot/yacy/profile.java
@@ -35,25 +35,25 @@ import java.io.IOException;
import java.util.Iterator;
import java.util.Properties;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyNetwork;
public final class profile {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
if ((post == null) || (env == null)) return prop;
if (!yacyNetwork.authentifyRequest(post, env)) return prop;
if ((sb.isRobinsonMode()) &&
(!sb.isPublicRobinson()) &&
- (!sb.isInMyCluster(header.get(httpHeader.CONNECTION_PROP_CLIENTIP)))) {
+ (!sb.isInMyCluster(header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP)))) {
// if we are a robinson cluster, answer only if this client is known by our network definition
prop.put("list", "0");
return prop;
diff --git a/htroot/yacy/query.java b/htroot/yacy/query.java
index 279e4a4c5..baf48b55d 100644
--- a/htroot/yacy/query.java
+++ b/htroot/yacy/query.java
@@ -29,10 +29,10 @@
import java.io.IOException;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyNetwork;
@@ -42,11 +42,11 @@ public final class query {
// example:
// http://localhost:8080/yacy/query.html?youare=sCJ6Tq8T0N9x&object=lurlcount
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch ss) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch ss) {
if (post == null || ss == null) { return null; }
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) ss;
+ final Switchboard sb = (Switchboard) ss;
final serverObjects prop = new serverObjects();
if ((post == null) || (ss == null) || !yacyNetwork.authentifyRequest(post, ss)) {
prop.put("response", "-1"); // request rejected
@@ -55,7 +55,7 @@ public final class query {
if ((sb.isRobinsonMode()) &&
(!sb.isPublicRobinson()) &&
- (!sb.isInMyCluster(header.get(httpHeader.CONNECTION_PROP_CLIENTIP)))) {
+ (!sb.isInMyCluster(header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP)))) {
// if we are a robinson cluster, answer only if we are public robinson peers,
// or we are a private cluster and the requester is in our cluster.
// if we don't answer, the remote peer will recognize us as junior peer,
diff --git a/htroot/yacy/search.java b/htroot/yacy/search.java
index 1dc8e0623..36734c0dc 100644
--- a/htroot/yacy/search.java
+++ b/htroot/yacy/search.java
@@ -36,19 +36,18 @@ import java.util.TreeSet;
import de.anomic.content.RSSMessage;
import de.anomic.document.parser.xml.RSSFeed;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.order.Bitfield;
import de.anomic.kelondro.text.ReferenceContainer;
import de.anomic.kelondro.text.referencePrototype.WordReference;
import de.anomic.kelondro.util.SortStack;
import de.anomic.net.natLib;
-import de.anomic.plasma.plasmaProfiling;
-import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.search.QueryParams;
import de.anomic.search.RankingProfile;
import de.anomic.search.QueryEvent;
+import de.anomic.search.Switchboard;
import de.anomic.search.QueryEvent.ResultEntry;
import de.anomic.search.RankingProcess.NavigatorEntry;
import de.anomic.server.serverCore;
@@ -61,18 +60,19 @@ import de.anomic.yacy.yacyCore;
import de.anomic.yacy.yacyNetwork;
import de.anomic.yacy.yacySeed;
import de.anomic.yacy.yacyURL;
+import de.anomic.ymage.ProfilingGraph;
public final class search {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
sb.remoteSearchLastAccess = System.currentTimeMillis();
final serverObjects prop = new serverObjects();
if ((post == null) || (env == null)) return prop;
if (!yacyNetwork.authentifyRequest(post, env)) return prop;
- final String client = header.get(httpHeader.CONNECTION_PROP_CLIENTIP);
+ final String client = header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP);
//System.out.println("yacy: search received request = " + post.toString());
@@ -127,7 +127,7 @@ public final class search {
if ((sb.isRobinsonMode()) &&
(!((sb.isPublicRobinson()) ||
- (sb.isInMyCluster(header.get(httpHeader.CONNECTION_PROP_CLIENTIP)))))) {
+ (sb.isInMyCluster(header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP)))))) {
// if we are a robinson cluster, answer only if this client is known by our network definition
prop.put("links", "");
prop.put("linkcount", "0");
@@ -217,7 +217,7 @@ public final class search {
//final Map<byte[], ReferenceContainer<WordReference>>[] containers = sb.indexSegment.index().searchTerm(theQuery.queryHashes, theQuery.excludeHashes, plasmaSearchQuery.hashes2StringSet(urls));
final HashMap<byte[], ReferenceContainer<WordReference>> incc = sb.indexSegment.termIndex().searchConjunction(theQuery.queryHashes, QueryParams.hashes2StringSet(urls));
- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), QueryEvent.COLLECTION, incc.size(), System.currentTimeMillis() - timer), false);
+ serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), QueryEvent.COLLECTION, incc.size(), System.currentTimeMillis() - timer), false);
if (incc != null) {
final Iterator<Map.Entry<byte[], ReferenceContainer<WordReference>>> ci = incc.entrySet().iterator();
Map.Entry<byte[], ReferenceContainer<WordReference>> entry;
@@ -333,7 +333,7 @@ public final class search {
refstr.append(",").append(e.name);
}
prop.put("references", (refstr.length() > 0) ? refstr.substring(1) : refstr.toString());
- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), "reference collection", ws.size(), System.currentTimeMillis() - timer), false);
+ serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), "reference collection", ws.size(), System.currentTimeMillis() - timer), false);
}
prop.put("indexabstract", indexabstract.toString());
@@ -360,7 +360,7 @@ public final class search {
}
prop.put("links", links.toString());
prop.put("linkcount", accu.size());
- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), "result list preparation", accu.size(), System.currentTimeMillis() - timer), false);
+ serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), "result list preparation", accu.size(), System.currentTimeMillis() - timer), false);
}
// add information about forward peers
diff --git a/htroot/yacy/transfer.java b/htroot/yacy/transfer.java
index 18395a816..e8b45d796 100644
--- a/htroot/yacy/transfer.java
+++ b/htroot/yacy/transfer.java
@@ -27,13 +27,13 @@
import java.io.File;
import java.io.IOException;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.order.Digest;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaRankingDistribution;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
+import de.anomic.search.blockrank.CRDistribution;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyNetwork;
@@ -41,8 +41,8 @@ import de.anomic.yacy.yacySeed;
public final class transfer {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
if ((post == null) || (env == null)) return prop;
if (!yacyNetwork.authentifyRequest(post, env)) return prop;
@@ -72,8 +72,8 @@ public final class transfer {
// reject unknown peers: this does not appear fair, but anonymous senders are dangerous
// reject paths that contain '..' because they are dangerous
if (sb.getLog().isFine()) {
- if (otherseed == null) sb.getLog().logFine("RankingTransmission: rejected unknown peer '" + otherpeer + "', current IP " + header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "unknown"));
- if (filename.indexOf("..") >= 0) sb.getLog().logFine("RankingTransmission: rejected wrong path '" + filename + "' from peer " + (otherseed == null ? "null" : otherseed.getName() + "/" + otherseed.getPublicAddress()) + ", current IP " + header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "unknown"));
+ if (otherseed == null) sb.getLog().logFine("RankingTransmission: rejected unknown peer '" + otherpeer + "', current IP " + header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "unknown"));
+ if (filename.indexOf("..") >= 0) sb.getLog().logFine("RankingTransmission: rejected wrong path '" + filename + "' from peer " + (otherseed == null ? "null" : otherseed.getName() + "/" + otherseed.getPublicAddress()) + ", current IP " + header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "unknown"));
}
return prop;
}
@@ -115,7 +115,7 @@ public final class transfer {
if (sb.getLog().isFine()) sb.getLog().logFine("RankingTransmission: denied " + otherpeerName + " to send CR file " + filename + ": wrong access code");
} else {
sb.rankingPermissions.remove(accesscode); // not needed any more
- final File path = new File(sb.rankingPath, plasmaRankingDistribution.CR_OTHER);
+ final File path = new File(sb.rankingPath, CRDistribution.CR_OTHER);
path.mkdirs();
final File file = new File(path, filename);
try {
diff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.java
index 656b6856a..2d9b8e988 100644
--- a/htroot/yacy/transferRWI.java
+++ b/htroot/yacy/transferRWI.java
@@ -35,11 +35,11 @@ import java.util.List;
import de.anomic.content.RSSMessage;
import de.anomic.data.Blacklist;
import de.anomic.document.parser.xml.RSSFeed;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.text.referencePrototype.WordReferenceRow;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -51,10 +51,10 @@ import de.anomic.yacy.logging.Log;
public final class transferRWI {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) throws InterruptedException {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) throws InterruptedException {
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
final String contentType = header.getContentType();
if ((post == null) || (env == null)) {
@@ -83,7 +83,7 @@ public final class transferRWI {
byte[] indexes = post.get("indexes", "").getBytes(); // the indexes, as list of word entries
boolean granted = sb.getConfig("allowReceiveIndex", "false").equals("true");
final boolean blockBlacklist = sb.getConfig("indexReceiveBlockBlacklist", "false").equals("true");
- final long cachelimit = sb.getConfigLong(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, 100000);
+ final long cachelimit = sb.getConfigLong(SwitchboardConstants.WORDCACHE_MAX_COUNT, 100000);
final yacySeed otherPeer = sb.peers.get(iam);
final String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion()));
@@ -166,7 +166,7 @@ public final class transferRWI {
urlHash = iEntry.metadataHash();
// block blacklisted entries
- if ((blockBlacklist) && (plasmaSwitchboard.urlBlacklist.hashInBlacklistedCache(Blacklist.BLACKLIST_DHT, urlHash))) {
+ if ((blockBlacklist) && (Switchboard.urlBlacklist.hashInBlacklistedCache(Blacklist.BLACKLIST_DHT, urlHash))) {
if (yacyCore.log.isFine()) yacyCore.log.logFine("transferRWI: blocked blacklisted URLHash '" + urlHash + "' from peer " + otherPeerName);
blocked++;
continue;
@@ -222,7 +222,7 @@ public final class transferRWI {
}
result = "ok";
- pause = (int) (sb.indexSegment.termIndex().getBufferSize() * 20000 / sb.getConfigLong(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, 100000)); // estimation of necessary pause time
+ pause = (int) (sb.indexSegment.termIndex().getBufferSize() * 20000 / sb.getConfigLong(SwitchboardConstants.WORDCACHE_MAX_COUNT, 100000)); // estimation of necessary pause time
}
prop.put("unknownURL", unknownURLs.toString());
diff --git a/htroot/yacy/transferURL.java b/htroot/yacy/transferURL.java
index f7fe532c8..1cf6f6654 100644
--- a/htroot/yacy/transferURL.java
+++ b/htroot/yacy/transferURL.java
@@ -32,10 +32,10 @@ import java.text.ParseException;
import de.anomic.content.RSSMessage;
import de.anomic.data.Blacklist;
import de.anomic.document.parser.xml.RSSFeed;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -46,13 +46,13 @@ import de.anomic.yacy.yacySeed;
public final class transferURL {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) throws InterruptedException {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) throws InterruptedException {
final long start = System.currentTimeMillis();
long freshdate = 0;
try {freshdate = DateFormatter.parseShortDay("20061101").getTime();} catch (final ParseException e1) {}
// return variable that accumulates replacements
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
if ((post == null) || (env == null)) return prop;
if (!yacyNetwork.authentifyRequest(post, env)) return prop;
@@ -120,7 +120,7 @@ public final class transferURL {
}
// check if the entry is blacklisted
- if ((blockBlacklist) && (plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_DHT, metadata.url()))) {
+ if ((blockBlacklist) && (Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_DHT, metadata.url()))) {
if (yacyCore.log.isFine()) yacyCore.log.logFine("transferURL: blocked blacklisted URL '" + metadata.url().toNormalform(false, true) + "' from peer " + otherPeerName);
lEntry = null;
blocked++;
diff --git a/htroot/yacy/urls.java b/htroot/yacy/urls.java
index e2a8fac90..c8ff72347 100644
--- a/htroot/yacy/urls.java
+++ b/htroot/yacy/urls.java
@@ -29,10 +29,10 @@ import java.util.Date;
import de.anomic.crawler.NoticedURL;
import de.anomic.crawler.retrieval.Request;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyNetwork;
@@ -40,8 +40,8 @@ import de.anomic.yacy.yacyURL;
public class urls {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
// insert default values
final serverObjects prop = new serverObjects();
diff --git a/htroot/yacyinteractive.java b/htroot/yacyinteractive.java
index 91fa5556c..1013b7cb2 100644
--- a/htroot/yacyinteractive.java
+++ b/htroot/yacyinteractive.java
@@ -24,9 +24,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -34,22 +34,22 @@ import de.anomic.server.serverSwitch;
public class yacyinteractive {
- public static serverObjects respond(final httpRequestHeader header, serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
final boolean authenticated = sb.adminAuthenticated(header) >= 2;
int display = (post == null) ? 0 : post.getInt("display", 0);
if ((display == 1) && (!authenticated)) display = 0;
- final boolean browserPopUpTrigger = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_TRIGGER, "true").equals("true");
+ final boolean browserPopUpTrigger = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_TRIGGER, "true").equals("true");
if (browserPopUpTrigger) {
- final String browserPopUpPage = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "ConfigBasic.html");
+ final String browserPopUpPage = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "ConfigBasic.html");
if (browserPopUpPage.startsWith("yacyinteractive")) display = 2;
}
- String promoteSearchPageGreeting = env.getConfig(plasmaSwitchboardConstants.GREETING, "");
- if (env.getConfigBool(plasmaSwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
+ String promoteSearchPageGreeting = env.getConfig(SwitchboardConstants.GREETING, "");
+ if (env.getConfigBool(SwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
prop.put("promoteSearchPageGreeting", promoteSearchPageGreeting);
- prop.put("promoteSearchPageGreeting.homepage", sb.getConfig(plasmaSwitchboardConstants.GREETING_HOMEPAGE, ""));
- prop.put("promoteSearchPageGreeting.smallImage", sb.getConfig(plasmaSwitchboardConstants.GREETING_SMALL_IMAGE, ""));
+ prop.put("promoteSearchPageGreeting.homepage", sb.getConfig(SwitchboardConstants.GREETING_HOMEPAGE, ""));
+ prop.put("promoteSearchPageGreeting.smallImage", sb.getConfig(SwitchboardConstants.GREETING_SMALL_IMAGE, ""));
prop.put("display", display);
String query = (post == null) ? "" : post.get("query", "");
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index 7afc41248..1c90c4a91 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -37,19 +37,18 @@ import de.anomic.document.Condenser;
import de.anomic.document.Word;
import de.anomic.document.Document;
import de.anomic.document.parser.xml.RSSFeed;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.order.Bitfield;
import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;
import de.anomic.kelondro.util.MemoryControl;
import de.anomic.kelondro.util.SetTools;
-import de.anomic.plasma.plasmaProfiling;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
import de.anomic.search.QueryParams;
import de.anomic.search.RankingProfile;
import de.anomic.search.QueryEvent;
import de.anomic.search.SnippetCache;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverCore;
import de.anomic.server.serverDomains;
import de.anomic.server.serverObjects;
@@ -62,11 +61,12 @@ import de.anomic.yacy.yacyNewsPool;
import de.anomic.yacy.yacyNewsRecord;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.logging.Log;
+import de.anomic.ymage.ProfilingGraph;
public class yacysearch {
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
sb.localSearchLastAccess = System.currentTimeMillis();
final boolean searchAllowed = sb.getConfigBool("publicSearchpage", true) || sb.verifyAuthentication(header, false);
@@ -74,14 +74,14 @@ public class yacysearch {
final boolean authenticated = sb.adminAuthenticated(header) >= 2;
int display = (post == null) ? 0 : post.getInt("display", 0);
if ((display == 1) && (!authenticated)) display = 0;
- final boolean browserPopUpTrigger = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_TRIGGER, "true").equals("true");
+ final boolean browserPopUpTrigger = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_TRIGGER, "true").equals("true");
if (browserPopUpTrigger) {
- final String browserPopUpPage = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "ConfigBasic.html");
+ final String browserPopUpPage = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "ConfigBasic.html");
if (browserPopUpPage.startsWith("index") || browserPopUpPage.startsWith("yacysearch")) display = 2;
}
- String promoteSearchPageGreeting = env.getConfig(plasmaSwitchboardConstants.GREETING, "");
- if (env.getConfigBool(plasmaSwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
- final String client = header.get(httpHeader.CONNECTION_PROP_CLIENTIP); // the search client who initiated the search
+ String promoteSearchPageGreeting = env.getConfig(SwitchboardConstants.GREETING, "");
+ if (env.getConfigBool(SwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
+ final String client = header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP); // the search client who initiated the search
// get query
String originalquerystring = (post == null) ? "" : post.get("query", post.get("search", "")).trim(); // SRU compliance
@@ -91,8 +91,8 @@ public class yacysearch {
//final boolean rss = (post == null) ? false : post.get("rss", "false").equals("true");
prop.put("promoteSearchPageGreeting", promoteSearchPageGreeting);
- prop.put("promoteSearchPageGreeting.homepage", sb.getConfig(plasmaSwitchboardConstants.GREETING_HOMEPAGE, ""));
- prop.put("promoteSearchPageGreeting.smallImage", sb.getConfig(plasmaSwitchboardConstants.GREETING_SMALL_IMAGE, ""));
+ prop.put("promoteSearchPageGreeting.homepage", sb.getConfig(SwitchboardConstants.GREETING_HOMEPAGE, ""));
+ prop.put("promoteSearchPageGreeting.smallImage", sb.getConfig(SwitchboardConstants.GREETING_SMALL_IMAGE, ""));
if ((post == null) || (env == null) || (!searchAllowed)) {
// we create empty entries for template strings
prop.put("searchagain", "0");
@@ -167,7 +167,7 @@ public class yacysearch {
}
// SEARCH
- final boolean indexReceiveGranted = sb.getConfigBool(plasmaSwitchboardConstants.INDEX_RECEIVE_ALLOW, true);
+ final boolean indexReceiveGranted = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, true);
global = global && indexReceiveGranted; // if the user does not want indexes from remote peers, it cannot be a global search
//final boolean offline = yacyCore.seedDB.mySeed().isVirgin();
@@ -337,7 +337,7 @@ public class yacysearch {
if (language.startsWith("lang_")) language = language.substring(5);
if (!iso639.exists(language)) {
// find out language of the user by reading of the user-agent string
- String agent = header.get(httpHeader.ACCEPT_LANGUAGE);
+ String agent = header.get(HeaderFramework.ACCEPT_LANGUAGE);
if (agent == null) agent = System.getProperty("user.language");
language = (agent == null) ? "en" : iso639.userAgentLanguageDetection(agent);
if (language == null) language = "en";
@@ -352,9 +352,9 @@ public class yacysearch {
int maxDistance = (querystring.indexOf('"') >= 0) ? maxDistance = query.length - 1 : Integer.MAX_VALUE;
// filter out stopwords
- final TreeSet<String> filtered = SetTools.joinConstructive(query[0], plasmaSwitchboard.stopwords);
+ final TreeSet<String> filtered = SetTools.joinConstructive(query[0], Switchboard.stopwords);
if (filtered.size() > 0) {
- SetTools.excludeDestructive(query[0], plasmaSwitchboard.stopwords);
+ SetTools.excludeDestructive(query[0], Switchboard.stopwords);
}
// if a minus-button was hit, remove a special reference first
@@ -406,7 +406,7 @@ public class yacysearch {
// prepare search properties
//final boolean yacyonline = ((sb.webIndex.seedDB != null) && (sb.webIndex.seedDB.mySeed() != null) && (sb.webIndex.seedDB.mySeed().getPublicAddress() != null));
- final boolean globalsearch = (global) /* && (yacyonline)*/ && (sb.getConfigBool(plasmaSwitchboardConstants.INDEX_RECEIVE_ALLOW, false));
+ final boolean globalsearch = (global) /* && (yacyonline)*/ && (sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false));
// do the search
final TreeSet<byte[]> queryHashes = Word.words2hashes(query[0]);
@@ -436,13 +436,13 @@ public class yacysearch {
yacyURL.TLD_any_zone_filter,
client,
authenticated);
- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), QueryEvent.INITIALIZATION, 0, 0), false);
+ serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), QueryEvent.INITIALIZATION, 0, 0), false);
// tell all threads to do nothing for a specific time
sb.intermissionAllThreads(10000);
// filter out words that appear in bluelist
- theQuery.filterOut(plasmaSwitchboard.blueList);
+ theQuery.filterOut(Switchboard.blueList);
// log
Log.logInfo("LOCAL_SEARCH", "INIT WORD SEARCH: " + theQuery.queryString + ":" + QueryParams.hashSet2hashString(theQuery.queryHashes) + " - " + theQuery.neededResults() + " links to be computed, " + theQuery.displayResults() + " lines to be displayed");
diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java
index 558c79649..7d0e16f9a 100644
--- a/htroot/yacysearchitem.java
+++ b/htroot/yacysearchitem.java
@@ -30,14 +30,13 @@ import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.TreeSet;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaProfiling;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.search.QueryParams;
import de.anomic.search.QueryEvent;
import de.anomic.search.RankingProcess;
import de.anomic.search.SnippetCache;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverProfiling;
import de.anomic.server.serverSwitch;
@@ -47,6 +46,7 @@ import de.anomic.tools.Formatter;
import de.anomic.yacy.yacyNewsPool;
import de.anomic.yacy.yacySeed;
import de.anomic.yacy.yacyURL;
+import de.anomic.ymage.ProfilingGraph;
public class yacysearchitem {
@@ -55,14 +55,14 @@ public class yacysearchitem {
private static final int namelength = 60;
private static final int urllength = 120;
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
- final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
+ final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
final String eventID = post.get("eventID", "");
final boolean authenticated = sb.adminAuthenticated(header) >= 2;
final int item = post.getInt("item", -1);
- final boolean auth = (header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "")).equals("localhost") || sb.verifyAuthentication(header, true);
+ final boolean auth = (header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "")).equals("localhost") || sb.verifyAuthentication(header, true);
final int display = (post == null) ? 0 : post.getInt("display", 0);
// default settings for blank item
@@ -123,8 +123,8 @@ public class yacysearchitem {
prop.put("content_urlhash", result.hash());
prop.put("content_urlhexhash", yacySeed.b64Hash2hexHash(result.hash()));
prop.putHTML("content_urlname", nxTools.shortenURLString(result.urlname(), urllength));
- prop.put("content_date", plasmaSwitchboard.dateString(result.modified()));
- prop.put("content_date822", plasmaSwitchboard.dateString822(result.modified()));
+ prop.put("content_date", Switchboard.dateString(result.modified()));
+ prop.put("content_date822", Switchboard.dateString822(result.modified()));
prop.put("content_ybr", RankingProcess.ybr(result.hash()));
prop.putHTML("content_size", Integer.toString(result.filesize())); // we don't use putNUM here because that number shall be usable as sorting key. To print the size, use 'sizename'
prop.putHTML("content_sizename", sizename(result.filesize()));
@@ -147,7 +147,7 @@ public class yacysearchitem {
prop.put("content_description", desc);
prop.putXML("content_description-xml", desc);
prop.putJSON("content_description-json", desc);
- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), QueryEvent.FINALIZATION + "-" + item, 0, 0), false);
+ serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), QueryEvent.FINALIZATION + "-" + item, 0, 0), false);
return prop;
}
diff --git a/htroot/yacysearchtrailer.java b/htroot/yacysearchtrailer.java
index fe4c51cbb..0c8e93619 100644
--- a/htroot/yacysearchtrailer.java
+++ b/htroot/yacysearchtrailer.java
@@ -27,21 +27,21 @@
import java.util.ArrayList;
import java.util.Iterator;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.plasma.plasmaProfiling;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.search.QueryParams;
import de.anomic.search.QueryEvent;
import de.anomic.search.RankingProcess.NavigatorEntry;
import de.anomic.server.serverObjects;
import de.anomic.server.serverProfiling;
import de.anomic.server.serverSwitch;
+import de.anomic.ymage.ProfilingGraph;
public class yacysearchtrailer {
private static final int MAX_TOPWORDS = 10;
- public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) {
+ public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
final String eventID = post.get("eventID", "");
@@ -127,7 +127,7 @@ public class yacysearchtrailer {
prop.put("nav-topics_element", i);
prop.put("nav-topics", "1");
- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(theQuery.id(true), QueryEvent.FINALIZATION + "-" + "bottomline", 0, 0), false);
+ serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), QueryEvent.FINALIZATION + "-" + "bottomline", 0, 0), false);
return prop;
}
diff --git a/source/de/anomic/crawler/CrawlQueues.java b/source/de/anomic/crawler/CrawlQueues.java
index 5ac32e993..43d7e40d7 100644
--- a/source/de/anomic/crawler/CrawlQueues.java
+++ b/source/de/anomic/crawler/CrawlQueues.java
@@ -41,12 +41,12 @@ import de.anomic.crawler.retrieval.Request;
import de.anomic.crawler.retrieval.LoaderDispatcher;
import de.anomic.crawler.retrieval.Response;
import de.anomic.document.parser.xml.RSSFeed;
-import de.anomic.http.httpClient;
+import de.anomic.http.client.Client;
import de.anomic.kelondro.table.SplitTable;
import de.anomic.kelondro.util.DateFormatter;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverProcessorJob;
import de.anomic.yacy.yacyClient;
import de.anomic.yacy.yacySeed;
@@ -56,7 +56,7 @@ import de.anomic.yacy.logging.Log;
public class CrawlQueues {
- protected plasmaSwitchboard sb;
+ protected Switchboard sb;
protected Log log;
protected Map<Integer, crawlWorker> workers; // mapping from url hash to Worker thread object
protected LoaderDispatcher loader;
@@ -65,7 +65,7 @@ public class CrawlQueues {
public NoticedURL noticeURL;
public ZURL errorURL, delegatedURL;
- public CrawlQueues(final plasmaSwitchboard sb, final File plasmaPath) {
+ public CrawlQueues(final Switchboard sb, final File plasmaPath) {
this.sb = sb;
this.log = new Log("CRAWLER");
this.workers = new ConcurrentHashMap<Integer, crawlWorker>();
@@ -186,8 +186,8 @@ public class CrawlQueues {
public boolean coreCrawlJob() {
final boolean robinsonPrivateCase = ((sb.isRobinsonMode()) &&
- (!sb.getConfig(plasmaSwitchboardConstants.CLUSTER_MODE, "").equals(plasmaSwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER)) &&
- (!sb.getConfig(plasmaSwitchboardConstants.CLUSTER_MODE, "").equals(plasmaSwitchboardConstants.CLUSTER_MODE_PRIVATE_CLUSTER)));
+ (!sb.getConfig(SwitchboardConstants.CLUSTER_MODE, "").equals(SwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER)) &&
+ (!sb.getConfig(SwitchboardConstants.CLUSTER_MODE, "").equals(SwitchboardConstants.CLUSTER_MODE_PRIVATE_CLUSTER)));
if (((robinsonPrivateCase) || (coreCrawlJobSize() <= 20)) && (limitCrawlJobSize() > 0)) {
// move some tasks to the core crawl job so we have something to do
@@ -196,13 +196,13 @@ public class CrawlQueues {
noticeURL.shift(NoticedURL.STACK_TYPE_LIMIT, NoticedURL.STACK_TYPE_CORE, sb.crawler.profilesActiveCrawls);
}
log.logInfo("shifted " + toshift + " jobs from global crawl to local crawl (coreCrawlJobSize()=" + coreCrawlJobSize() +
- ", limitCrawlJobSize()=" + limitCrawlJobSize() + ", cluster.mode=" + sb.getConfig(plasmaSwitchboardConstants.CLUSTER_MODE, "") +
+ ", limitCrawlJobSize()=" + limitCrawlJobSize() + ", cluster.mode=" + sb.getConfig(SwitchboardConstants.CLUSTER_MODE, "") +
", robinsonMode=" + ((sb.isRobinsonMode()) ? "on" : "off"));
}
if(!crawlIsPossible(NoticedURL.STACK_TYPE_CORE, "Core")) return false;
- if(isPaused(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL)) return false;
+ if(isPaused(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL)) return false;
// do a local crawl
Request urlEntry = null;
@@ -279,10 +279,10 @@ public class CrawlQueues {
private boolean isPaused(String crawljob) {
final Object[] status = sb.crawlJobsStatus.get(crawljob);
boolean pauseEnded = false;
- synchronized(status[plasmaSwitchboardConstants.CRAWLJOB_SYNC]) {
- if (((Boolean)status[plasmaSwitchboardConstants.CRAWLJOB_STATUS]).booleanValue()) {
+ synchronized(status[SwitchboardConstants.CRAWLJOB_SYNC]) {
+ if (((Boolean)status[SwitchboardConstants.CRAWLJOB_STATUS]).booleanValue()) {
try {
- status[plasmaSwitchboardConstants.CRAWLJOB_SYNC].wait();
+ status[SwitchboardConstants.CRAWLJOB_SYNC].wait();
}
catch (final InterruptedException e) { pauseEnded = true;}
}
@@ -303,7 +303,7 @@ public class CrawlQueues {
//log.logDebug("GlobalCrawl: queue is empty");
return false;
}
- value = (int) sb.getConfigLong(plasmaSwitchboardConstants.CRAWLER_THREADS_ACTIVE_MAX, 10);
+ value = (int) sb.getConfigLong(SwitchboardConstants.CRAWLER_THREADS_ACTIVE_MAX, 10);
if (this.size() >= value) {
// try a cleanup
this.cleanup();
@@ -311,7 +311,7 @@ public class CrawlQueues {
// check again
if (this.size() >= value) {
if (this.log.isFine()) {
- log.logFine(type + "Crawl: too many processes in loader queue, dismissed (" + "cacheLoader=" + this.size() + "), httpClients = " + httpClient.connectionCount());
+ log.logFine(type + "Crawl: too many processes in loader queue, dismissed (" + "cacheLoader=" + this.size() + "), httpClients = " + Client.connectionCount());
}
return false;
}
@@ -339,13 +339,13 @@ public class CrawlQueues {
return false;
}
- if (this.size() >= sb.getConfigLong(plasmaSwitchboardConstants.CRAWLER_THREADS_ACTIVE_MAX, 10)) {
+ if (this.size() >= sb.getConfigLong(SwitchboardConstants.CRAWLER_THREADS_ACTIVE_MAX, 10)) {
// try a cleanup
cleanup();
}
// check again
- if (this.size() >= sb.getConfigLong(plasmaSwitchboardConstants.CRAWLER_THREADS_ACTIVE_MAX, 10)) {
- if (this.log.isFine()) log.logFine("remoteCrawlLoaderJob: too many processes in loader queue, dismissed (" + "cacheLoader=" + this.size() + "), httpClients = " + httpClient.connectionCount());
+ if (this.size() >= sb.getConfigLong(SwitchboardConstants.CRAWLER_THREADS_ACTIVE_MAX, 10)) {
+ if (this.log.isFine()) log.logFine("remoteCrawlLoaderJob: too many processes in loader queue, dismissed (" + "cacheLoader=" + this.size() + "), httpClients = " + Client.connectionCount());
return false;
}
@@ -474,7 +474,7 @@ public class CrawlQueues {
// or there is no global crawl on the stack
if (!crawlIsPossible(NoticedURL.STACK_TYPE_REMOTE, "Global")) return false;
- if (isPaused(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL)) return false;
+ if (isPaused(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL)) return false;
// we don't want to crawl a global URL globally, since WE are the global part. (from this point of view)
final String stats = "REMOTETRIGGEREDCRAWL[" + noticeURL.stackSize(NoticedURL.STACK_TYPE_CORE) + ", " + noticeURL.stackSize(NoticedURL.STACK_TYPE_LIMIT) + ", " + noticeURL.stackSize(NoticedURL.STACK_TYPE_OVERHANG) + ", "
@@ -590,7 +590,7 @@ public class CrawlQueues {
eentry.store();
errorURL.push(eentry);
e.printStackTrace();
- httpClient.initConnectionManager();
+ Client.initConnectionManager();
this.entry.setStatus("worker-exception", serverProcessorJob.STATUS_FINISHED);
} finally {
crawlWorker w = workers.remove(code);
diff --git a/source/de/anomic/crawler/CrawlStacker.java b/source/de/anomic/crawler/CrawlStacker.java
index 2bd736fa7..89fb638f4 100644
--- a/source/de/anomic/crawler/CrawlStacker.java
+++ b/source/de/anomic/crawler/CrawlStacker.java
@@ -35,7 +35,7 @@ import de.anomic.crawler.retrieval.Request;
import de.anomic.data.Blacklist;
import de.anomic.kelondro.text.Segment;
import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverDomains;
import de.anomic.server.serverProcessor;
import de.anomic.yacy.yacySeedDB;
@@ -191,7 +191,7 @@ public final class CrawlStacker {
}
// check blacklist
- if (plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_CRAWLER, entry.url())) {
+ if (Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_CRAWLER, entry.url())) {
if (this.log.isFine()) this.log.logFine("URL '" + entry.url().toString() + "' is in blacklist. " +
"Stack processing time: " + (System.currentTimeMillis() - startTime) + "ms");
return "url in blacklist";
diff --git a/source/de/anomic/plasma/plasmaDbImporter.java b/source/de/anomic/crawler/ExternalIndexImporter.java
similarity index 95%
rename from source/de/anomic/plasma/plasmaDbImporter.java
rename to source/de/anomic/crawler/ExternalIndexImporter.java
index 0b61db8a6..15078fd7d 100644
--- a/source/de/anomic/plasma/plasmaDbImporter.java
+++ b/source/de/anomic/crawler/ExternalIndexImporter.java
@@ -1,11 +1,9 @@
-package de.anomic.plasma;
+package de.anomic.crawler;
import java.util.HashSet;
import java.util.Iterator;
import java.util.TreeSet;
-import de.anomic.crawler.AbstractImporter;
-import de.anomic.crawler.Importer;
import de.anomic.kelondro.text.Reference;
import de.anomic.kelondro.text.ReferenceContainer;
import de.anomic.kelondro.text.Segment;
@@ -13,7 +11,7 @@ import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;
import de.anomic.kelondro.text.referencePrototype.WordReference;
import de.anomic.kelondro.util.DateFormatter;
-public class plasmaDbImporter extends AbstractImporter implements Importer {
+public class ExternalIndexImporter extends AbstractImporter implements Importer {
/**
* the source word index (the DB to import)
@@ -33,7 +31,7 @@ public class plasmaDbImporter extends AbstractImporter implements Importer {
private long urlCounter = 0, wordCounter = 0, entryCounter = 0, notBoundEntryCounter = 0;
- public plasmaDbImporter(final Segment homeWI, final Segment importWI) {
+ public ExternalIndexImporter(final Segment homeWI, final Segment importWI) {
super("PLASMADB");
this.homeWordIndex = homeWI;
this.importWordIndex = importWI;
diff --git a/source/de/anomic/crawler/Latency.java b/source/de/anomic/crawler/Latency.java
index 9f168a5d4..798a22eb7 100644
--- a/source/de/anomic/crawler/Latency.java
+++ b/source/de/anomic/crawler/Latency.java
@@ -27,7 +27,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.yacy.yacyURL;
public class Latency {
@@ -171,7 +171,7 @@ public class Latency {
if (!local && host != null) waiting += host.flux(waiting);
// find the delay as given by robots.txt on target site
- long robotsDelay = (local) ? 0 : plasmaSwitchboard.getSwitchboard().robots.crawlDelayMillis(url);
+ long robotsDelay = (local) ? 0 : Switchboard.getSwitchboard().robots.crawlDelayMillis(url);
waiting = Math.max(waiting, robotsDelay);
// use the access latency as rule how fast we can access the server
diff --git a/source/de/anomic/crawler/ResourceObserver.java b/source/de/anomic/crawler/ResourceObserver.java
index 37965372a..8e66848f1 100644
--- a/source/de/anomic/crawler/ResourceObserver.java
+++ b/source/de/anomic/crawler/ResourceObserver.java
@@ -28,8 +28,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.tools.diskUsage;
import de.anomic.yacy.logging.Log;
@@ -48,7 +48,7 @@ public final class ResourceObserver {
private static final int HIGH = 2;
public static final Log log = new Log("RESOURCE OBSERVER");
- private final plasmaSwitchboard sb;
+ private final Switchboard sb;
private int checkDiskUsageCount;
private int checkMemoryUsageCount;
@@ -60,7 +60,7 @@ public final class ResourceObserver {
* and pauses crawls if necessary
* @param sb the plasmaSwitchboard
*/
- public ResourceObserver(final plasmaSwitchboard sb) {
+ public ResourceObserver(final Switchboard sb) {
this.sb = sb;
log.logInfo("initializing the resource observer");
@@ -68,11 +68,11 @@ public final class ResourceObserver {
// FIXME whats about the secondary path???
// = (getConfig(plasmaSwitchboard.INDEX_SECONDARY_PATH, "");
final String[] pathes = {
- plasmaSwitchboardConstants.HTDOCS_PATH,
- plasmaSwitchboardConstants.INDEX_PRIMARY_PATH,
- plasmaSwitchboardConstants.LISTS_PATH,
- plasmaSwitchboardConstants.RANKING_PATH,
- plasmaSwitchboardConstants.WORK_PATH};
+ SwitchboardConstants.HTDOCS_PATH,
+ SwitchboardConstants.INDEX_PRIMARY_PATH,
+ SwitchboardConstants.LISTS_PATH,
+ SwitchboardConstants.RANKING_PATH,
+ SwitchboardConstants.WORK_PATH};
String path;
for (final String element : pathes) {
try {
@@ -93,7 +93,7 @@ public final class ResourceObserver {
}
public static void initThread() {
- plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
+ Switchboard sb = Switchboard.getSwitchboard();
// initializing the resourceObserver
sb.observer = new ResourceObserver(sb);
// run the oberver here a first time
@@ -120,17 +120,17 @@ public final class ResourceObserver {
}
if (tmpDisksFree < HIGH || tmpMemoryFree < HIGH) {
- if (!sb.crawlJobIsPaused(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL)) {
+ if (!sb.crawlJobIsPaused(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL)) {
log.logInfo("pausing local crawls");
- sb.pauseCrawlJob(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
+ sb.pauseCrawlJob(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
}
- if (!sb.crawlJobIsPaused(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL)) {
+ if (!sb.crawlJobIsPaused(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL)) {
log.logInfo("pausing remote triggered crawls");
- sb.pauseCrawlJob(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
+ sb.pauseCrawlJob(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
}
- if (tmpDisksFree == LOW && sb.getConfigBool(plasmaSwitchboardConstants.INDEX_RECEIVE_ALLOW, false)) {
+ if (tmpDisksFree == LOW && sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false)) {
log.logInfo("disabling index receive");
- sb.setConfig(plasmaSwitchboardConstants.INDEX_RECEIVE_ALLOW, false);
+ sb.setConfig(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false);
sb.peers.mySeed().setFlagAcceptRemoteIndex(false);
}
}
diff --git a/source/de/anomic/crawler/RobotsTxt.java b/source/de/anomic/crawler/RobotsTxt.java
index 0a8690ce3..ed07c6bd4 100644
--- a/source/de/anomic/crawler/RobotsTxt.java
+++ b/source/de/anomic/crawler/RobotsTxt.java
@@ -41,10 +41,10 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import de.anomic.crawler.retrieval.HTTPLoader;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpResponse;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.client.Client;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.metadata.ResponseContainer;
import de.anomic.kelondro.blob.Heap;
import de.anomic.kelondro.blob.MapView;
import de.anomic.kelondro.order.NaturalOrder;
@@ -517,26 +517,26 @@ public class RobotsTxt {
downloadStart = System.currentTimeMillis();
// if we previously have downloaded this robots.txt then we can set the if-modified-since header
- httpRequestHeader reqHeaders = new httpRequestHeader();
+ RequestHeader reqHeaders = new RequestHeader();
// add yacybot user agent
- reqHeaders.put(httpHeader.USER_AGENT, HTTPLoader.crawlerUserAgent);
+ reqHeaders.put(HeaderFramework.USER_AGENT, HTTPLoader.crawlerUserAgent);
// adding referer
- reqHeaders.put(httpRequestHeader.REFERER, (yacyURL.newURL(robotsURL,"/")).toNormalform(true, true));
+ reqHeaders.put(RequestHeader.REFERER, (yacyURL.newURL(robotsURL,"/")).toNormalform(true, true));
if (entry != null) {
oldEtag = entry.getETag();
- reqHeaders = new httpRequestHeader();
+ reqHeaders = new RequestHeader();
final Date modDate = entry.getModDate();
- if (modDate != null) reqHeaders.put(httpRequestHeader.IF_MODIFIED_SINCE, DateFormatter.formatRFC1123(entry.getModDate()));
+ if (modDate != null) reqHeaders.put(RequestHeader.IF_MODIFIED_SINCE, DateFormatter.formatRFC1123(entry.getModDate()));
}
// setup http-client
//TODO: adding Traffic statistic for robots download?
- final httpClient client = new httpClient(10000, reqHeaders);
- httpResponse res = null;
+ final Client client = new Client(10000, reqHeaders);
+ ResponseContainer res = null;
try {
// sending the get request
res = client.GET(robotsURL.toString());
@@ -552,7 +552,7 @@ public class RobotsTxt {
} else {
// getting some metadata
- eTag = res.getResponseHeader().containsKey(httpHeader.ETAG)?(res.getResponseHeader().get(httpHeader.ETAG)).trim():null;
+ eTag = res.getResponseHeader().containsKey(HeaderFramework.ETAG)?(res.getResponseHeader().get(HeaderFramework.ETAG)).trim():null;
lastMod = res.getResponseHeader().lastModified();
// if the robots.txt file was not changed we break here
@@ -577,7 +577,7 @@ public class RobotsTxt {
return null;
} else if (res.getStatusLine().startsWith("3")) {
// getting redirection URL
- String redirectionUrlString = res.getResponseHeader().get(httpHeader.LOCATION);
+ String redirectionUrlString = res.getResponseHeader().get(HeaderFramework.LOCATION);
if (redirectionUrlString==null) {
if (log.isFinest()) log.logFinest("robots.txt could not be downloaded from URL '" + robotsURL + "' because of missing redirecton header. [" + res.getStatusLine() + "].");
robotsTxt = null;
diff --git a/source/de/anomic/crawler/SitemapImporter.java b/source/de/anomic/crawler/SitemapImporter.java
index 5dd352122..e75f59a2e 100644
--- a/source/de/anomic/crawler/SitemapImporter.java
+++ b/source/de/anomic/crawler/SitemapImporter.java
@@ -26,7 +26,7 @@
package de.anomic.crawler;
import de.anomic.data.SitemapParser;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.yacy.yacyURL;
public class SitemapImporter extends AbstractImporter implements Importer {
@@ -35,7 +35,7 @@ public class SitemapImporter extends AbstractImporter implements Importer {
private yacyURL sitemapURL = null;
private final ImporterManager superviser;
- public SitemapImporter(final plasmaSwitchboard sb, final ImporterManager importManager, final yacyURL sitemapURL, final CrawlProfile.entry profileEntry) throws ImporterException {
+ public SitemapImporter(final Switchboard sb, final ImporterManager importManager, final yacyURL sitemapURL, final CrawlProfile.entry profileEntry) throws ImporterException {
super("sitemap");
this.superviser = importManager;
try {
diff --git a/source/de/anomic/crawler/retrieval/FTPLoader.java b/source/de/anomic/crawler/retrieval/FTPLoader.java
index afe681313..18dfc4322 100644
--- a/source/de/anomic/crawler/retrieval/FTPLoader.java
+++ b/source/de/anomic/crawler/retrieval/FTPLoader.java
@@ -34,23 +34,23 @@ import java.util.Date;
import de.anomic.crawler.Latency;
import de.anomic.document.Parser;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.http.httpResponseHeader;
+import de.anomic.http.client.Cache;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.metadata.ResponseHeader;
import de.anomic.kelondro.util.DateFormatter;
import de.anomic.net.ftpc;
-import de.anomic.plasma.plasmaHTCache;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.logging.Log;
public class FTPLoader {
- private final plasmaSwitchboard sb;
+ private final Switchboard sb;
private final Log log;
private final int maxFileSize;
- public FTPLoader(final plasmaSwitchboard sb, final Log log) {
+ public FTPLoader(final Switchboard sb, final Log log) {
this.sb = sb;
this.log = log;
maxFileSize = (int) sb.getConfigLong("crawler.ftp.maxFileSize", -1l);
@@ -58,18 +58,18 @@ public class FTPLoader {
protected Response createCacheEntry(final Request request, final String mimeType, final Date fileDate) {
if (request == null) return null;
- httpRequestHeader requestHeader = new httpRequestHeader();
- if (request.referrerhash() != null) requestHeader.put(httpRequestHeader.REFERER, sb.getURL(request.referrerhash()).toNormalform(true, false));
- httpResponseHeader responseHeader = new httpResponseHeader();
- responseHeader.put(httpHeader.LAST_MODIFIED, DateFormatter.formatRFC1123(fileDate));
- responseHeader.put(httpHeader.CONTENT_TYPE, mimeType);
+ RequestHeader requestHeader = new RequestHeader();
+ if (request.referrerhash() != null) requestHeader.put(RequestHeader.REFERER, sb.getURL(request.referrerhash()).toNormalform(true, false));
+ ResponseHeader responseHeader = new ResponseHeader();
+ responseHeader.put(HeaderFramework.LAST_MODIFIED, DateFormatter.formatRFC1123(fileDate));
+ responseHeader.put(HeaderFramework.CONTENT_TYPE, mimeType);
Response metadata = new Response(
request,
requestHeader,
responseHeader,
"OK",
sb.crawler.profilesActiveCrawls.getEntry(request.profileHandle()));
- plasmaHTCache.storeMetadata(responseHeader, metadata);
+ Cache.storeMetadata(responseHeader, metadata);
return metadata;
}
diff --git a/source/de/anomic/crawler/retrieval/HTTPLoader.java b/source/de/anomic/crawler/retrieval/HTTPLoader.java
index 9f4f8d6d2..3c05e35ca 100644
--- a/source/de/anomic/crawler/retrieval/HTTPLoader.java
+++ b/source/de/anomic/crawler/retrieval/HTTPLoader.java
@@ -31,13 +31,13 @@ import java.util.Date;
import de.anomic.crawler.Latency;
import de.anomic.data.Blacklist;
import de.anomic.document.Parser;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpResponse;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.http.httpResponseHeader;
-import de.anomic.plasma.plasmaHTCache;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.client.Client;
+import de.anomic.http.client.Cache;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.metadata.ResponseContainer;
+import de.anomic.http.metadata.ResponseHeader;
+import de.anomic.search.Switchboard;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.logging.Log;
@@ -48,8 +48,8 @@ public final class HTTPLoader {
private static final String DEFAULT_CHARSET = "ISO-8859-1,utf-8;q=0.7,*;q=0.7";
private static final long DEFAULT_MAXFILESIZE = 1024 * 1024 * 10;
public static final int DEFAULT_CRAWLING_RETRY_COUNT = 5;
- public static final String crawlerUserAgent = "yacybot (" + httpClient.getSystemOST() +") http://yacy.net/bot.html";
- public static final String yacyUserAgent = "yacy (" + httpClient.getSystemOST() +") yacy.net";
+ public static final String crawlerUserAgent = "yacybot (" + Client.getSystemOST() +") http://yacy.net/bot.html";
+ public static final String yacyUserAgent = "yacy (" + Client.getSystemOST() +") yacy.net";
/**
* The socket timeout that should be used
@@ -64,10 +64,10 @@ public final class HTTPLoader {
//private String acceptEncoding;
//private String acceptLanguage;
//private String acceptCharset;
- private final plasmaSwitchboard sb;
+ private final Switchboard sb;
private final Log log;
- public HTTPLoader(final plasmaSwitchboard sb, final Log theLog) {
+ public HTTPLoader(final Switchboard sb, final Log theLog) {
this.sb = sb;
this.log = theLog;
@@ -83,7 +83,7 @@ public final class HTTPLoader {
* @param responseStatus Status-Code SPACE Reason-Phrase
* @return
*/
- protected Response createCacheEntry(final Request request, final Date requestDate, final httpRequestHeader requestHeader, final httpResponseHeader responseHeader, final String responseStatus) {
+ protected Response createCacheEntry(final Request request, final Date requestDate, final RequestHeader requestHeader, final ResponseHeader responseHeader, final String responseStatus) {
Response metadata = new Response(
request,
requestHeader,
@@ -91,7 +91,7 @@ public final class HTTPLoader {
responseStatus,
sb.crawler.profilesActiveCrawls.getEntry(request.profileHandle())
);
- plasmaHTCache.storeMetadata(responseHeader, metadata);
+ Cache.storeMetadata(responseHeader, metadata);
return metadata;
}
@@ -125,7 +125,7 @@ public final class HTTPLoader {
// check if url is in blacklist
final String hostlow = host.toLowerCase();
- if (plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_CRAWLER, hostlow, path)) {
+ if (Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_CRAWLER, hostlow, path)) {
sb.crawlQueues.errorURL.newEntry(entry, sb.peers.mySeed().hash, new Date(), 1, "url in blacklist").store();
throw new IOException("CRAWLER Rejecting URL '" + entry.url().toString() + "'. URL is in blacklist.");
}
@@ -135,19 +135,19 @@ public final class HTTPLoader {
final long maxFileSize = sb.getConfigLong("crawler.http.maxFileSize", DEFAULT_MAXFILESIZE);
//try {
// create a request header
- final httpRequestHeader requestHeader = new httpRequestHeader();
- requestHeader.put(httpHeader.USER_AGENT, crawlerUserAgent);
+ final RequestHeader requestHeader = new RequestHeader();
+ requestHeader.put(HeaderFramework.USER_AGENT, crawlerUserAgent);
yacyURL refererURL = null;
if (entry.referrerhash() != null) refererURL = sb.getURL(entry.referrerhash());
- if (refererURL != null) requestHeader.put(httpRequestHeader.REFERER, refererURL.toNormalform(true, true));
- requestHeader.put(httpHeader.ACCEPT_LANGUAGE, sb.getConfig("crawler.http.acceptLanguage", DEFAULT_LANGUAGE));
- requestHeader.put(httpHeader.ACCEPT_CHARSET, sb.getConfig("crawler.http.acceptCharset", DEFAULT_CHARSET));
- requestHeader.put(httpHeader.ACCEPT_ENCODING, sb.getConfig("crawler.http.acceptEncoding", DEFAULT_ENCODING));
+ if (refererURL != null) requestHeader.put(RequestHeader.REFERER, refererURL.toNormalform(true, true));
+ requestHeader.put(HeaderFramework.ACCEPT_LANGUAGE, sb.getConfig("crawler.http.acceptLanguage", DEFAULT_LANGUAGE));
+ requestHeader.put(HeaderFramework.ACCEPT_CHARSET, sb.getConfig("crawler.http.acceptCharset", DEFAULT_CHARSET));
+ requestHeader.put(HeaderFramework.ACCEPT_ENCODING, sb.getConfig("crawler.http.acceptEncoding", DEFAULT_ENCODING));
// HTTP-Client
- final httpClient client = new httpClient(socketTimeout, requestHeader);
+ final Client client = new Client(socketTimeout, requestHeader);
- httpResponse res = null;
+ ResponseContainer res = null;
try {
// send request
res = client.GET(entry.url().toString(), maxFileSize);
@@ -205,9 +205,9 @@ public final class HTTPLoader {
htCache = null;
}*/
} else if (res.getStatusLine().startsWith("30")) {
- if (res.getResponseHeader().containsKey(httpHeader.LOCATION)) {
+ if (res.getResponseHeader().containsKey(HeaderFramework.LOCATION)) {
// getting redirection URL
- String redirectionUrlString = res.getResponseHeader().get(httpHeader.LOCATION);
+ String redirectionUrlString = res.getResponseHeader().get(HeaderFramework.LOCATION);
redirectionUrlString = redirectionUrlString.trim();
if (redirectionUrlString.length() == 0) {
diff --git a/source/de/anomic/crawler/retrieval/LoaderDispatcher.java b/source/de/anomic/crawler/retrieval/LoaderDispatcher.java
index 338e9005b..7290a19a6 100644
--- a/source/de/anomic/crawler/retrieval/LoaderDispatcher.java
+++ b/source/de/anomic/crawler/retrieval/LoaderDispatcher.java
@@ -33,7 +33,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverCore;
import de.anomic.server.serverProcessorJob;
import de.anomic.yacy.logging.Log;
@@ -43,13 +43,13 @@ public final class LoaderDispatcher {
private static final long minDelay = 250; // milliseconds; 4 accesses per second
private static final ConcurrentHashMap<String, Long> accessTime = new ConcurrentHashMap<String, Long>(); // to protect targets from DDoS
- private final plasmaSwitchboard sb;
+ private final Switchboard sb;
private final Log log;
private final HashSet<String> supportedProtocols;
private final HTTPLoader httpLoader;
private final FTPLoader ftpLoader;
- public LoaderDispatcher(final plasmaSwitchboard sb, final Log log) {
+ public LoaderDispatcher(final Switchboard sb, final Log log) {
this.sb = sb;
this.log = log;
this.supportedProtocols = new HashSet<String>(Arrays.asList(new String[]{"http","https","ftp"}));
diff --git a/source/de/anomic/crawler/retrieval/Response.java b/source/de/anomic/crawler/retrieval/Response.java
index 6e3580cb2..d1fd02994 100755
--- a/source/de/anomic/crawler/retrieval/Response.java
+++ b/source/de/anomic/crawler/retrieval/Response.java
@@ -30,12 +30,12 @@ import java.util.Date;
import de.anomic.crawler.CrawlProfile;
import de.anomic.document.Parser;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.http.httpResponseHeader;
+import de.anomic.http.client.Cache;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.metadata.ResponseHeader;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaHTCache;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.yacy.yacyURL;
public class Response {
@@ -55,8 +55,8 @@ public class Response {
// the class objects
private final Request request;
- private final httpRequestHeader requestHeader;
- private final httpResponseHeader responseHeader;
+ private final RequestHeader requestHeader;
+ private final ResponseHeader responseHeader;
private final String responseStatus;
private final CrawlProfile.entry profile;
private byte[] content;
@@ -142,8 +142,8 @@ public class Response {
public Response(
Request request,
- final httpRequestHeader requestHeader,
- final httpResponseHeader responseHeader,
+ final RequestHeader requestHeader,
+ final ResponseHeader responseHeader,
final String responseStatus,
final CrawlProfile.entry profile) {
this.request = request;
@@ -277,16 +277,16 @@ public class Response {
// -authorization cases in request
// authorization makes pages very individual, and therefore we cannot use the
// content in the cache
- if (requestHeader.containsKey(httpRequestHeader.AUTHORIZATION)) { return "personalized"; }
+ if (requestHeader.containsKey(RequestHeader.AUTHORIZATION)) { return "personalized"; }
// -ranges in request and response
// we do not cache partial content
- if (requestHeader.containsKey(httpHeader.RANGE)) { return "partial"; }
+ if (requestHeader.containsKey(HeaderFramework.RANGE)) { return "partial"; }
}
if (responseHeader != null) {
// -ranges in request and response
// we do not cache partial content
- if (responseHeader.containsKey(httpHeader.CONTENT_RANGE)) { return "partial"; }
+ if (responseHeader.containsKey(HeaderFramework.CONTENT_RANGE)) { return "partial"; }
// -if-modified-since in request
// we do not care about if-modified-since, because this case only occurres if the
@@ -304,7 +304,7 @@ public class Response {
// -pragma in response
// if we have a pragma non-cache, we don't cache. usually if this is wanted from
// the server, it makes sense
- String cacheControl = responseHeader.get(httpHeader.PRAGMA);
+ String cacheControl = responseHeader.get(HeaderFramework.PRAGMA);
if (cacheControl != null && cacheControl.trim().toUpperCase().equals("NO-CACHE")) { return "controlled_no_cache"; }
// -expires in response
@@ -313,7 +313,7 @@ public class Response {
// -cache-control in response
// the cache-control has many value options.
- cacheControl = responseHeader.get(httpHeader.CACHE_CONTROL);
+ cacheControl = responseHeader.get(HeaderFramework.CACHE_CONTROL);
if (cacheControl != null) {
cacheControl = cacheControl.trim().toUpperCase();
if (cacheControl.startsWith("MAX-AGE=")) {
@@ -357,17 +357,17 @@ public class Response {
String cacheControl;
if (requestHeader != null) {
// -authorization cases in request
- if (requestHeader.containsKey(httpRequestHeader.AUTHORIZATION)) { return false; }
+ if (requestHeader.containsKey(RequestHeader.AUTHORIZATION)) { return false; }
// -ranges in request
// we do not cache partial content
- if (requestHeader.containsKey(httpHeader.RANGE)) { return false; }
+ if (requestHeader.containsKey(HeaderFramework.RANGE)) { return false; }
// if the client requests a un-cached copy of the resource ...
- cacheControl = requestHeader.get(httpHeader.PRAGMA);
+ cacheControl = requestHeader.get(HeaderFramework.PRAGMA);
if (cacheControl != null && cacheControl.trim().toUpperCase().equals("NO-CACHE")) { return false; }
- cacheControl = requestHeader.get(httpHeader.CACHE_CONTROL);
+ cacheControl = requestHeader.get(HeaderFramework.CACHE_CONTROL);
if (cacheControl != null) {
cacheControl = cacheControl.trim().toUpperCase();
if (cacheControl.startsWith("NO-CACHE") || cacheControl.startsWith("MAX-AGE=0")) { return false; }
@@ -376,10 +376,10 @@ public class Response {
// -if-modified-since in request
// The entity has to be transferred only if it has
// been modified since the date given by the If-Modified-Since header.
- if (requestHeader.containsKey(httpRequestHeader.IF_MODIFIED_SINCE)) {
+ if (requestHeader.containsKey(RequestHeader.IF_MODIFIED_SINCE)) {
// checking this makes only sense if the cached response contains
// a Last-Modified field. If the field does not exist, we go the safe way
- if (!responseHeader.containsKey(httpHeader.LAST_MODIFIED)) { return false; }
+ if (!responseHeader.containsKey(HeaderFramework.LAST_MODIFIED)) { return false; }
// parse date
Date d1, d2;
d2 = responseHeader.lastModified(); if (d2 == null) { d2 = new Date(DateFormatter.correctedUTCTime()); }
@@ -389,15 +389,15 @@ public class Response {
}
final String mimeType = getMimeType();
- if (!plasmaHTCache.isPicture(mimeType)) {
+ if (!Cache.isPicture(mimeType)) {
// -cookies in request
// unfortunately, we should reload in case of a cookie
// but we think that pictures can still be considered as fresh
// -set-cookie in cached response
// this is a similar case as for COOKIE.
- if (requestHeader.containsKey(httpRequestHeader.COOKIE) ||
- responseHeader.containsKey(httpHeader.SET_COOKIE) ||
- responseHeader.containsKey(httpHeader.SET_COOKIE2)) {
+ if (requestHeader.containsKey(RequestHeader.COOKIE) ||
+ responseHeader.containsKey(HeaderFramework.SET_COOKIE) ||
+ responseHeader.containsKey(HeaderFramework.SET_COOKIE2)) {
return false; // too strong
}
}
@@ -408,7 +408,7 @@ public class Response {
// logically, we would not need to care about no-cache pragmas in cached response headers,
// because they cannot exist since they are not written to the cache.
// So this IF should always fail..
- cacheControl = responseHeader.get(httpHeader.PRAGMA);
+ cacheControl = responseHeader.get(HeaderFramework.PRAGMA);
if (cacheControl != null && cacheControl.trim().toUpperCase().equals("NO-CACHE")) { return false; }
// see for documentation also:
@@ -427,7 +427,7 @@ public class Response {
if (expires.before(new Date(DateFormatter.correctedUTCTime()))) { return false; }
}
final Date lastModified = responseHeader.lastModified();
- cacheControl = responseHeader.get(httpHeader.CACHE_CONTROL);
+ cacheControl = responseHeader.get(HeaderFramework.CACHE_CONTROL);
if (cacheControl == null && lastModified == null && expires == null) { return false; }
// -lastModified in cached response
@@ -513,7 +513,7 @@ public class Response {
// we checked that in shallStoreCache
// a picture cannot be indexed
- if (plasmaHTCache.noIndexingURL(url())) {
+ if (Cache.noIndexingURL(url())) {
return "Media_Content_(forbidden)";
}
@@ -532,7 +532,7 @@ public class Response {
// a picture cannot be indexed
final String mimeType = responseHeader.mime();
- if (plasmaHTCache.isPicture(mimeType)) {
+ if (Cache.isPicture(mimeType)) {
return "Media_Content_(Picture)";
}
String parserError = Parser.supportsMime(mimeType);
@@ -543,7 +543,7 @@ public class Response {
// -if-modified-since in request
// if the page is fresh at the very moment we can index it
final Date ifModifiedSince = this.requestHeader.ifModifiedSince();
- if ((ifModifiedSince != null) && (responseHeader.containsKey(httpHeader.LAST_MODIFIED))) {
+ if ((ifModifiedSince != null) && (responseHeader.containsKey(HeaderFramework.LAST_MODIFIED))) {
// parse date
Date d = responseHeader.lastModified();
if (d == null) {
@@ -557,8 +557,8 @@ public class Response {
}
// -pragma in cached response
- if (responseHeader.containsKey(httpHeader.PRAGMA) &&
- (responseHeader.get(httpHeader.PRAGMA)).toUpperCase().equals("NO-CACHE")) {
+ if (responseHeader.containsKey(HeaderFramework.PRAGMA) &&
+ (responseHeader.get(HeaderFramework.PRAGMA)).toUpperCase().equals("NO-CACHE")) {
return "Denied_(pragma_no_cache)";
}
@@ -582,7 +582,7 @@ public class Response {
// -cache-control in cached response
// the cache-control has many value options.
- String cacheControl = responseHeader.get(httpHeader.CACHE_CONTROL);
+ String cacheControl = responseHeader.get(HeaderFramework.CACHE_CONTROL);
if (cacheControl != null) {
cacheControl = cacheControl.trim().toUpperCase();
/* we have the following cases for cache-control:
@@ -652,11 +652,11 @@ public class Response {
// a picture cannot be indexed
if (responseHeader != null) {
final String mimeType = responseHeader.mime();
- if (plasmaHTCache.isPicture(mimeType)) { return "Media_Content_(Picture)"; }
+ if (Cache.isPicture(mimeType)) { return "Media_Content_(Picture)"; }
String parserError = Parser.supportsMime(mimeType);
if (parserError != null) { return "Media_Content, parser error: " + parserError; }
}
- if (plasmaHTCache.noIndexingURL(url())) { return "Media_Content_(forbidden)"; }
+ if (Cache.noIndexingURL(url())) { return "Media_Content_(forbidden)"; }
// -if-modified-since in request
// if the page is fresh at the very moment we can index it
@@ -712,7 +712,7 @@ public class Response {
public yacyURL referrerURL() {
if (requestHeader == null) return null;
try {
- return new yacyURL(requestHeader.get(httpRequestHeader.REFERER, ""), null);
+ return new yacyURL(requestHeader.get(RequestHeader.REFERER, ""), null);
} catch (final Exception e) {
return null;
}
@@ -720,7 +720,7 @@ public class Response {
public String referrerHash() {
if (requestHeader == null) return null;
- String u = requestHeader.get(httpRequestHeader.REFERER, "");
+ String u = requestHeader.get(RequestHeader.REFERER, "");
if (u == null || u.length() == 0) return null;
try {
return new yacyURL(u, null).hash();
@@ -738,14 +738,14 @@ public class Response {
}
public boolean requestWithCookie() {
- return (requestHeader == null) ? false : requestHeader.containsKey(httpRequestHeader.COOKIE);
+ return (requestHeader == null) ? false : requestHeader.containsKey(RequestHeader.COOKIE);
}
public boolean requestProhibitsIndexing() {
return (requestHeader == null)
? false
- : requestHeader.containsKey(httpHeader.X_YACY_INDEX_CONTROL) &&
- (requestHeader.get(httpHeader.X_YACY_INDEX_CONTROL)).toUpperCase().equals("NO-INDEX");
+ : requestHeader.containsKey(HeaderFramework.X_YACY_INDEX_CONTROL) &&
+ (requestHeader.get(HeaderFramework.X_YACY_INDEX_CONTROL)).toUpperCase().equals("NO-INDEX");
}
public int processCase(String mySeedHash) {
@@ -756,17 +756,17 @@ public class Response {
// 4) proxy-load (initiator is "------------")
// 5) local prefetch/crawling (initiator is own seedHash)
// 6) local fetching for global crawling (other known or unknwon initiator)
- int processCase = plasmaSwitchboardConstants.PROCESSCASE_0_UNKNOWN;
+ int processCase = SwitchboardConstants.PROCESSCASE_0_UNKNOWN;
// FIXME the equals seems to be incorrect: String.equals(boolean)
if ((initiator() == null) || initiator().length() == 0 || initiator().equals("------------")) {
// proxy-load
- processCase = plasmaSwitchboardConstants.PROCESSCASE_4_PROXY_LOAD;
+ processCase = SwitchboardConstants.PROCESSCASE_4_PROXY_LOAD;
} else if (initiator().equals(mySeedHash)) {
// normal crawling
- processCase = plasmaSwitchboardConstants.PROCESSCASE_5_LOCAL_CRAWLING;
+ processCase = SwitchboardConstants.PROCESSCASE_5_LOCAL_CRAWLING;
} else {
// this was done for remote peer (a global crawl)
- processCase = plasmaSwitchboardConstants.PROCESSCASE_6_GLOBAL_CRAWLING;
+ processCase = SwitchboardConstants.PROCESSCASE_6_GLOBAL_CRAWLING;
}
return processCase;
}
diff --git a/source/de/anomic/data/SitemapParser.java b/source/de/anomic/data/SitemapParser.java
index 75e74ded0..2b2065365 100644
--- a/source/de/anomic/data/SitemapParser.java
+++ b/source/de/anomic/data/SitemapParser.java
@@ -41,14 +41,14 @@ import org.xml.sax.helpers.DefaultHandler;
import de.anomic.crawler.CrawlProfile;
import de.anomic.crawler.retrieval.HTTPLoader;
import de.anomic.crawler.retrieval.Request;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpResponse;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.http.httpdByteCountInputStream;
+import de.anomic.http.client.Client;
+import de.anomic.http.io.ByteCountInputStream;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.metadata.ResponseContainer;
import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.logging.Log;
@@ -131,9 +131,9 @@ public class SitemapParser extends DefaultHandler {
* last modification date of the {@link #nextURL}
*/
private Date lastMod = null;
- private final plasmaSwitchboard sb;
+ private final Switchboard sb;
- public SitemapParser(final plasmaSwitchboard sb, final yacyURL sitemap, final CrawlProfile.entry theCrawlingProfile) {
+ public SitemapParser(final Switchboard sb, final yacyURL sitemap, final CrawlProfile.entry theCrawlingProfile) {
assert sitemap != null;
this.sb = sb;
this.siteMapURL = sitemap;
@@ -152,10 +152,10 @@ public class SitemapParser extends DefaultHandler {
*/
public void parse() {
// download document
- final httpRequestHeader requestHeader = new httpRequestHeader();
- requestHeader.put(httpHeader.USER_AGENT, HTTPLoader.crawlerUserAgent);
- final httpClient client = new httpClient(5000, requestHeader);
- httpResponse res = null;
+ final RequestHeader requestHeader = new RequestHeader();
+ requestHeader.put(HeaderFramework.USER_AGENT, HTTPLoader.crawlerUserAgent);
+ final Client client = new Client(5000, requestHeader);
+ ResponseContainer res = null;
try {
res = client.GET(siteMapURL.toString());
if (res.getStatusCode() != 200) {
@@ -176,7 +176,7 @@ public class SitemapParser extends DefaultHandler {
contentStream = new GZIPInputStream(contentStream);
}
- final httpdByteCountInputStream counterStream = new httpdByteCountInputStream(contentStream, null);
+ final ByteCountInputStream counterStream = new ByteCountInputStream(contentStream, null);
// parse it
logger.logInfo("Start parsing sitemap file " + this.siteMapURL + "\n\tMimeType: " + contentMimeType +
"\n\tLength: " + this.contentLength);
diff --git a/source/de/anomic/data/bookmarksDB.java b/source/de/anomic/data/bookmarksDB.java
index 59e99eef6..ae705e2c8 100644
--- a/source/de/anomic/data/bookmarksDB.java
+++ b/source/de/anomic/data/bookmarksDB.java
@@ -73,7 +73,7 @@ import de.anomic.kelondro.order.NaturalOrder;
import de.anomic.kelondro.util.DateFormatter;
import de.anomic.kelondro.util.kelondroException;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverBusyThread;
import de.anomic.server.serverInstantBusyThread;
import de.anomic.yacy.yacyNewsPool;
@@ -130,7 +130,7 @@ public class bookmarksDB {
if (!datesExisted) rebuildDates();
// autoReCrawl
- plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
+ Switchboard sb = Switchboard.getSwitchboard();
this.autoReCrawl = new serverInstantBusyThread(this, "autoReCrawl", null, null);
long sleepTime = Long.parseLong(sb.getConfig("autoReCrawl_idlesleep" , SLEEP_TIME));
sb.deployThread("autoReCrawl", "autoReCrawl Scheduler", "simple scheduler for automatic re-crawls of bookmarked urls", null, autoReCrawl, 120000,
@@ -157,7 +157,7 @@ public class bookmarksDB {
public boolean autoReCrawl() {
// read crontab
- File f = new File (plasmaSwitchboard.getSwitchboard().getRootPath(),"DATA/SETTINGS/autoReCrawl.conf");
+ File f = new File (Switchboard.getSwitchboard().getRootPath(),"DATA/SETTINGS/autoReCrawl.conf");
String s;
try {
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(f)));
@@ -179,8 +179,8 @@ public class bookmarksDB {
} catch( FileNotFoundException ex ) {
try {
Log.logInfo("BOOKMARKS", "autoReCrawl - creating new autoReCrawl.conf");
- File inputFile = new File(plasmaSwitchboard.getSwitchboard().getRootPath(),"defaults/autoReCrawl.conf");
- File outputFile = new File(plasmaSwitchboard.getSwitchboard().getRootPath(),"DATA/SETTINGS/autoReCrawl.conf");
+ File inputFile = new File(Switchboard.getSwitchboard().getRootPath(),"defaults/autoReCrawl.conf");
+ File outputFile = new File(Switchboard.getSwitchboard().getRootPath(),"DATA/SETTINGS/autoReCrawl.conf");
FileReader i = new FileReader(inputFile);
FileWriter o = new FileWriter(outputFile);
int c;
@@ -208,7 +208,7 @@ public class bookmarksDB {
int crawlingDomFilterDepth, int crawlingDomMaxPages, boolean crawlingQ, boolean indexText, boolean indexMedia,
boolean crawlOrder, boolean xsstopw, boolean storeHTCache) {
- plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
+ Switchboard sb = Switchboard.getSwitchboard();
Iterator<String> bit=getBookmarksIterator(folder, true);
Log.logInfo("BOOKMARKS", "autoReCrawl - processing: "+folder);
diff --git a/source/de/anomic/data/listManager.java b/source/de/anomic/data/listManager.java
index d6d0776d9..395eca137 100644
--- a/source/de/anomic/data/listManager.java
+++ b/source/de/anomic/data/listManager.java
@@ -43,13 +43,13 @@ import java.util.Set;
import java.util.Vector;
import de.anomic.data.Blacklist.blacklistFile;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverCore;
// The Naming of the functions is a bit strange...
public class listManager {
- public static plasmaSwitchboard switchboard = null;
+ public static Switchboard switchboard = null;
public static File listsPath = null;
/**
@@ -403,8 +403,8 @@ public class listManager {
blacklistFiles.add(blFile);
}
- plasmaSwitchboard.urlBlacklist.clear();
- plasmaSwitchboard.urlBlacklist.loadList(
+ Switchboard.urlBlacklist.clear();
+ Switchboard.urlBlacklist.loadList(
blacklistFiles.toArray(new blacklistFile[blacklistFiles.size()]),
"/");
diff --git a/source/de/anomic/data/userDB.java b/source/de/anomic/data/userDB.java
index 504847a38..b31bbac1e 100644
--- a/source/de/anomic/data/userDB.java
+++ b/source/de/anomic/data/userDB.java
@@ -35,7 +35,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Random;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.blob.Heap;
import de.anomic.kelondro.blob.MapView;
import de.anomic.kelondro.order.Base64Order;
@@ -144,8 +144,8 @@ public final class userDB {
}
return null;
}
- public Entry getUser(final httpRequestHeader header){
- return getUser(header.get(httpRequestHeader.AUTHORIZATION), header.getHeaderCookies());
+ public Entry getUser(final RequestHeader header){
+ return getUser(header.get(RequestHeader.AUTHORIZATION), header.getHeaderCookies());
}
public Entry getUser(final String auth, final String cookies){
Entry entry=null;
diff --git a/source/de/anomic/data/wiki/knwikiParser.java b/source/de/anomic/data/wiki/knwikiParser.java
index 893669dca..db67786fd 100644
--- a/source/de/anomic/data/wiki/knwikiParser.java
+++ b/source/de/anomic/data/wiki/knwikiParser.java
@@ -38,15 +38,15 @@ import de.anomic.data.wiki.tokens.ListToken;
import de.anomic.data.wiki.tokens.SimpleToken;
import de.anomic.data.wiki.tokens.TableToken;
import de.anomic.data.wiki.tokens.Token;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
public class knwikiParser implements wikiParser {
public Token[] tokens;
private String[] BEs;
- private final plasmaSwitchboard sb;
+ private final Switchboard sb;
- private knwikiParser(final plasmaSwitchboard sb) {
+ private knwikiParser(final Switchboard sb) {
this.sb = sb;
}
diff --git a/source/de/anomic/data/wiki/tokens/LinkToken.java b/source/de/anomic/data/wiki/tokens/LinkToken.java
index 7060a77e5..525ea7d44 100644
--- a/source/de/anomic/data/wiki/tokens/LinkToken.java
+++ b/source/de/anomic/data/wiki/tokens/LinkToken.java
@@ -37,7 +37,7 @@ import de.anomic.data.bookmarksDB;
import de.anomic.data.bookmarksDB.Bookmark;
import de.anomic.data.bookmarksDB.Tag;
import de.anomic.data.wiki.wikiParserException;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
public class LinkToken extends AbstractToken {
@@ -78,10 +78,10 @@ public class LinkToken extends AbstractToken {
private final String localhost;
private final String wikiPath;
- private final plasmaSwitchboard sb;
+ private final Switchboard sb;
private int patternNr = 0;
- public LinkToken(final String localhost, final String wikiPath, final plasmaSwitchboard sb) {
+ public LinkToken(final String localhost, final String wikiPath, final Switchboard sb) {
this.localhost = localhost;
this.wikiPath = wikiPath;
this.sb = sb;
diff --git a/source/de/anomic/document/Document.java b/source/de/anomic/document/Document.java
index d6a3d144c..0f17668a7 100644
--- a/source/de/anomic/document/Document.java
+++ b/source/de/anomic/document/Document.java
@@ -47,9 +47,9 @@ import de.anomic.document.parser.html.ContentScraper;
import de.anomic.document.parser.html.ImageEntry;
import de.anomic.kelondro.util.DateFormatter;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaWebStructure;
import de.anomic.server.serverCachedFileOutputStream;
import de.anomic.yacy.yacyURL;
+import de.anomic.ymage.WebStructureGraph;
public class Document {
@@ -545,7 +545,7 @@ dc_rights
this.favicon = faviconURL;
}
- public void notifyWebStructure(final plasmaWebStructure webStructure, final Condenser condenser, final Date docDate) {
+ public void notifyWebStructure(final WebStructureGraph webStructure, final Condenser condenser, final Date docDate) {
final Integer[] ioLinks = webStructure.generateCitationReference(this, condenser, docDate); // [outlinksSame, outlinksOther]
this.inboundLinks = ioLinks[0].intValue();
this.outboundLinks = ioLinks[1].intValue();
diff --git a/source/de/anomic/document/parser/html/ContentScraper.java b/source/de/anomic/document/parser/html/ContentScraper.java
index 0e5bc3866..2a50f2213 100644
--- a/source/de/anomic/document/parser/html/ContentScraper.java
+++ b/source/de/anomic/document/parser/html/ContentScraper.java
@@ -46,9 +46,9 @@ import javax.swing.event.EventListenerList;
import de.anomic.crawler.retrieval.HTTPLoader;
import de.anomic.document.parser.htmlParser;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.client.Client;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.FileUtils;
import de.anomic.server.serverCharBuffer;
import de.anomic.yacy.yacyURL;
@@ -513,13 +513,13 @@ public class ContentScraper extends AbstractScraper implements Scraper {
public static ContentScraper parseResource(final yacyURL location) throws IOException {
// load page
- final httpRequestHeader reqHeader = new httpRequestHeader();
- reqHeader.put(httpHeader.USER_AGENT, HTTPLoader.crawlerUserAgent);
+ final RequestHeader reqHeader = new RequestHeader();
+ reqHeader.put(HeaderFramework.USER_AGENT, HTTPLoader.crawlerUserAgent);
return parseResource(location, reqHeader);
}
- public static ContentScraper parseResource(final yacyURL location, final httpRequestHeader reqHeader) throws IOException {
- final Reader pageReader = httpClient.wgetReader(location.toString(), reqHeader, 10000);
+ public static ContentScraper parseResource(final yacyURL location, final RequestHeader reqHeader) throws IOException {
+ final Reader pageReader = Client.wgetReader(location.toString(), reqHeader, 10000);
if (pageReader == null) throw new IOException("no response from url " + location.toString());
// scrape content
diff --git a/source/de/anomic/document/parser/html/ContentTransformer.java b/source/de/anomic/document/parser/html/ContentTransformer.java
index 50622d972..475bffc8c 100644
--- a/source/de/anomic/document/parser/html/ContentTransformer.java
+++ b/source/de/anomic/document/parser/html/ContentTransformer.java
@@ -34,7 +34,7 @@ import java.util.Locale;
import java.util.Properties;
import java.util.TreeSet;
-import de.anomic.http.httpTemplate;
+import de.anomic.http.server.TemplateEngine;
import de.anomic.kelondro.util.ByteBuffer;
import de.anomic.server.serverCharBuffer;
@@ -117,13 +117,13 @@ public class ContentTransformer extends AbstractTransformer implements Transform
final ArrayList<String> result = new ArrayList<String>();
final ByteBuffer sbb = new ByteBuffer(text);
- final ByteBuffer[] sbbs = httpTemplate.splitQuotations(sbb);
+ final ByteBuffer[] sbbs = TemplateEngine.splitQuotations(sbb);
for (int i = 0; i < sbbs.length; i++) {
// TODO: avoid empty if statements
if (sbbs[i].isWhitespace(true)) {
//sbb.append(sbbs[i]);
- } else if ((sbbs[i].byteAt(0) == httpTemplate.hash) ||
- (sbbs[i].startsWith(httpTemplate.dpdpa))) {
+ } else if ((sbbs[i].byteAt(0) == TemplateEngine.hash) ||
+ (sbbs[i].startsWith(TemplateEngine.dpdpa))) {
// this is a template or a part of a template
//sbb.append(sbbs[i]);
} else {
diff --git a/source/de/anomic/document/parser/odtParser.java b/source/de/anomic/document/parser/odtParser.java
index 24b656d76..6a3569233 100644
--- a/source/de/anomic/document/parser/odtParser.java
+++ b/source/de/anomic/document/parser/odtParser.java
@@ -47,11 +47,12 @@ import de.anomic.document.AbstractParser;
import de.anomic.document.Idiom;
import de.anomic.document.ParserException;
import de.anomic.document.Document;
+
import de.anomic.document.parser.xml.ODContentHandler;
import de.anomic.document.parser.xml.ODMetaHandler;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.client.Client;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.FileUtils;
import de.anomic.server.serverCharBuffer;
import de.anomic.yacy.yacyURL;
@@ -274,9 +275,9 @@ public class odtParser extends AbstractParser implements Idiom {
final odtParser testParser = new odtParser();
// downloading the document content
- final httpRequestHeader reqHeader = new httpRequestHeader();
- reqHeader.put(httpHeader.USER_AGENT, HTTPLoader.crawlerUserAgent);
- final byte[] content = httpClient.wget(contentUrl.toString(), reqHeader, 10000);
+ final RequestHeader reqHeader = new RequestHeader();
+ reqHeader.put(HeaderFramework.USER_AGENT, HTTPLoader.crawlerUserAgent);
+ final byte[] content = Client.wget(contentUrl.toString(), reqHeader, 10000);
final ByteArrayInputStream input = new ByteArrayInputStream(content);
// parsing the document
diff --git a/source/de/anomic/document/parser/vcfParser.java b/source/de/anomic/document/parser/vcfParser.java
index 6be8e9c53..5f43d7b60 100644
--- a/source/de/anomic/document/parser/vcfParser.java
+++ b/source/de/anomic/document/parser/vcfParser.java
@@ -43,9 +43,9 @@ import de.anomic.document.AbstractParser;
import de.anomic.document.Idiom;
import de.anomic.document.ParserException;
import de.anomic.document.Document;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.client.Client;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.yacy.yacyURL;
@@ -283,9 +283,9 @@ public class vcfParser extends AbstractParser implements Idiom {
final yacyURL contentUrl = new yacyURL(args[0], null);
final vcfParser testParser = new vcfParser();
- final httpRequestHeader reqHeader = new httpRequestHeader();
- reqHeader.put(httpHeader.USER_AGENT, HTTPLoader.crawlerUserAgent);
- final byte[] content = httpClient.wget(contentUrl.toString(), reqHeader, 10000);
+ final RequestHeader reqHeader = new RequestHeader();
+ reqHeader.put(HeaderFramework.USER_AGENT, HTTPLoader.crawlerUserAgent);
+ final byte[] content = Client.wget(contentUrl.toString(), reqHeader, 10000);
final ByteArrayInputStream input = new ByteArrayInputStream(content);
testParser.parse(contentUrl, "text/x-vcard", "UTF-8",input);
} catch (final Exception e) {
diff --git a/source/de/anomic/http/AcceptEverythingSSLProtcolSocketFactory.java b/source/de/anomic/http/client/AcceptEverythingSSLProtcolSocketFactory.java
similarity index 99%
rename from source/de/anomic/http/AcceptEverythingSSLProtcolSocketFactory.java
rename to source/de/anomic/http/client/AcceptEverythingSSLProtcolSocketFactory.java
index d4e3017ff..ffac9583f 100644
--- a/source/de/anomic/http/AcceptEverythingSSLProtcolSocketFactory.java
+++ b/source/de/anomic/http/client/AcceptEverythingSSLProtcolSocketFactory.java
@@ -1,4 +1,4 @@
-package de.anomic.http;
+package de.anomic.http.client;
import java.io.IOException;
import java.net.InetAddress;
diff --git a/source/de/anomic/http/AcceptEverythingTrustManager.java b/source/de/anomic/http/client/AcceptEverythingTrustManager.java
similarity index 97%
rename from source/de/anomic/http/AcceptEverythingTrustManager.java
rename to source/de/anomic/http/client/AcceptEverythingTrustManager.java
index 6fd24d0cb..c750ddeb6 100644
--- a/source/de/anomic/http/AcceptEverythingTrustManager.java
+++ b/source/de/anomic/http/client/AcceptEverythingTrustManager.java
@@ -1,4 +1,4 @@
-package de.anomic.http;
+package de.anomic.http.client;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
diff --git a/source/de/anomic/plasma/plasmaHTCache.java b/source/de/anomic/http/client/Cache.java
similarity index 69%
rename from source/de/anomic/plasma/plasmaHTCache.java
rename to source/de/anomic/http/client/Cache.java
index 343f7cbdb..1b260b1a8 100644
--- a/source/de/anomic/plasma/plasmaHTCache.java
+++ b/source/de/anomic/http/client/Cache.java
@@ -1,4 +1,4 @@
-// plasmaHTCache.java
+// httpCache.java
// -----------------------
// part of YaCy
// (C) by Michael Peter Christen; [email protected]
@@ -32,7 +32,7 @@
the class shall also be used to do a cache-cleaning and index creation
*/
-package de.anomic.plasma;
+package de.anomic.http.client;
import java.io.ByteArrayInputStream;
import java.io.File;
@@ -43,89 +43,41 @@ import java.util.Map;
import de.anomic.crawler.retrieval.Response;
import de.anomic.document.Classification;
-import de.anomic.http.httpResponseHeader;
+import de.anomic.http.metadata.ResponseHeader;
import de.anomic.kelondro.blob.ArrayStack;
import de.anomic.kelondro.blob.Compressor;
import de.anomic.kelondro.blob.Heap;
import de.anomic.kelondro.blob.MapView;
import de.anomic.kelondro.order.Base64Order;
-import de.anomic.kelondro.util.FileUtils;
import de.anomic.yacy.yacySeedDB;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.logging.Log;
-public final class plasmaHTCache {
+public final class Cache {
- public static final String RESPONSE_HEADER_DB_NAME = "responseHeader.heap";
- public static final String FILE_DB_NAME = "file.array";
-
- public static final long oneday = 1000L * 60L * 60L * 24L; // milliseconds of a day
+ private static final String RESPONSE_HEADER_DB_NAME = "responseHeader.heap";
+ private static final String FILE_DB_NAME = "file.array";
private static MapView responseHeaderDB = null;
private static Compressor fileDB = null;
private static ArrayStack fileDBunbuffered = null;
- public static long maxCacheSize = 0l;
- public static File cachePath = null;
- public static String prefix;
- public static final Log log = new Log("HTCACHE");
-
-
- // URL attributes
- public static final int UA_LOCAL = 0; // URL was crawled locally
- public static final int UA_TILDE = 1; // tilde appears in URL
- public static final int UA_REDIRECT = 2; // The URL is a redirection
-
- // local flag attributes
- public static final char LT_LOCAL = 'L';
- public static final char LT_GLOBAL = 'G';
-
+ private static long maxCacheSize = 0l;
+ private static File cachePath = null;
+ private static String prefix;
+ private static final Log log = new Log("HTCACHE");
public static void init(final File htCachePath, String peerSalt, final long CacheSizeMax) {
cachePath = htCachePath;
maxCacheSize = CacheSizeMax;
prefix = peerSalt;
-
- // reset old HTCache ?
- String[] list = cachePath.list();
- if (list != null) {
- File object;
- for (int i = list.length - 1; i >= 0; i--) {
- object = new File(cachePath, list[i]);
-
- if (object.getName().equals("http") ||
- object.getName().equals("yacy") ||
- object.getName().equals("https") ||
- object.getName().equals("ftp")) {
- FileUtils.deletedelete(cachePath);
- }
- }
- }
// set/make cache path
if (!htCachePath.exists()) {
htCachePath.mkdirs();
}
- if (!htCachePath.isDirectory()) {
- // if the cache does not exists or is a file and not a directory, panic
- log.logSevere("the cache path " + htCachePath.toString() + " is not a directory or does not exists and cannot be created");
- System.exit(0);
- }
-
- // open the response header database
- openDB();
- }
- static void resetDB() {
- log.logFine("reset responseHeader DB with "+ responseHeaderDB.size() +" entries");
- if (responseHeaderDB != null) responseHeaderDB.close();
- final File dbfile = new File(cachePath, RESPONSE_HEADER_DB_NAME);
- if (dbfile.exists()) FileUtils.deletedelete(dbfile);
- openDB();
- }
-
- private static void openDB() {
// open the response header database
final File dbfile = new File(cachePath, RESPONSE_HEADER_DB_NAME);
Heap blob = null;
@@ -144,14 +96,6 @@ public final class plasmaHTCache {
}
}
- public static int responseHeaderDBSize() {
- return responseHeaderDB.size();
- }
-
- public static long fileDBSize() {
- return fileDB.length();
- }
-
/**
* This method changes the HTCache size.<br>
* @param the new cache size in bytes
@@ -160,15 +104,6 @@ public final class plasmaHTCache {
maxCacheSize = newCacheSize;
fileDBunbuffered.setMaxSize(maxCacheSize);
}
-
- /**
- * This method returns the free HTCache size.<br>
- * @return the cache size in bytes
- */
- public static long getFreeSize() {
- long l = fileDB.length();
- return (l >= maxCacheSize) ? 0 : maxCacheSize - l;
- }
public static void close() {
responseHeaderDB.close();
@@ -201,9 +136,8 @@ public final class plasmaHTCache {
// Store to Cache
-
public static void storeMetadata(
- final httpResponseHeader responseHeader,
+ final ResponseHeader responseHeader,
Response metadata
) {
if (responseHeader != null) try {
@@ -216,7 +150,6 @@ public final class plasmaHTCache {
} catch (final Exception e) {
log.logWarning("could not write ResourceInfo: "
+ e.getClass() + ": " + e.getMessage());
- resetDB();
}
}
@@ -238,7 +171,7 @@ public final class plasmaHTCache {
* @throws <b>UnsupportedProtocolException</b> if the protocol is not supported and therefore the
* info object couldn't be created
*/
- public static httpResponseHeader loadResponseHeader(final yacyURL url) {
+ public static ResponseHeader loadResponseHeader(final yacyURL url) {
// loading data from database
Map<String, String> hdb;
@@ -249,7 +182,7 @@ public final class plasmaHTCache {
}
if (hdb == null) return null;
- return new httpResponseHeader(null, hdb);
+ return new ResponseHeader(null, hdb);
}
/**
diff --git a/source/de/anomic/http/httpClient.java b/source/de/anomic/http/client/Client.java
similarity index 87%
rename from source/de/anomic/http/httpClient.java
rename to source/de/anomic/http/client/Client.java
index 84450a807..2a3ded4bb 100644
--- a/source/de/anomic/http/httpClient.java
+++ b/source/de/anomic/http/client/Client.java
@@ -24,7 +24,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.client;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -62,6 +62,10 @@ import org.apache.commons.httpclient.protocol.Protocol;
import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
import de.anomic.crawler.Latency;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.metadata.ResponseContainer;
+import de.anomic.http.metadata.ResponseHeader;
+import de.anomic.http.metadata.HeaderFramework;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.logging.Log;
@@ -72,7 +76,7 @@ import de.anomic.yacy.logging.Log;
* @author danielr
*
*/
-public class httpClient {
+public class Client {
/**
* "the HttpClient instance and connection manager should be shared among all threads for maximum efficiency."
@@ -161,7 +165,7 @@ public class httpClient {
private static long lastCleanup = 0;
private Header[] headers = new Header[0];
- private httpRemoteProxyConfig proxyConfig = null;
+ private RemoteProxyConfig proxyConfig = null;
private boolean useGlobalProxyConfig = true;
private boolean followRedirects = true;
//private boolean ignoreCookies = true;
@@ -171,7 +175,7 @@ public class httpClient {
*
* @param timeout in milliseconds
*/
- public httpClient(final int timeout) {
+ public Client(final int timeout) {
this(timeout, null);
}
@@ -181,7 +185,7 @@ public class httpClient {
* @param timeout in milliseconds
* @param header header options to send
*/
- public httpClient(final int timeout, final httpRequestHeader header) {
+ public Client(final int timeout, final RequestHeader header) {
super();
setTimeout(timeout);
setHeader(header);
@@ -196,7 +200,7 @@ public class httpClient {
* @param header header options to send
* @param proxyConfig
*/
- public httpClient(final int timeout, final httpRequestHeader header, final httpRemoteProxyConfig proxyConfig) {
+ public Client(final int timeout, final RequestHeader header, final RemoteProxyConfig proxyConfig) {
super();
setTimeout(timeout);
setHeader(header);
@@ -207,7 +211,7 @@ public class httpClient {
* (non-Javadoc)
* @see de.anomic.http.HttpClient#setProxy(de.anomic.http.httpRemoteProxyConfig)
*/
- public void setProxy(final httpRemoteProxyConfig proxyConfig) {
+ public void setProxy(final RemoteProxyConfig proxyConfig) {
this.useGlobalProxyConfig = false;
this.proxyConfig = proxyConfig;
}
@@ -216,7 +220,7 @@ public class httpClient {
* (non-Javadoc)
* @see de.anomic.http.HttpClient#setHeader(de.anomic.http.httpHeader)
*/
- public void setHeader(final httpRequestHeader header) {
+ public void setHeader(final RequestHeader header) {
headers = convertHeaders(header);
}
@@ -255,7 +259,7 @@ public class httpClient {
* @return InputStream of content (body)
* @throws IOException
*/
- public httpResponse GET(final String uri) throws IOException {
+ public ResponseContainer GET(final String uri) throws IOException {
return GET(uri, Long.MAX_VALUE);
}
@@ -267,8 +271,8 @@ public class httpClient {
* @return InputStream of content (body)
* @throws IOException
*/
- public httpResponse GET(final String uri, long maxfilesize) throws IOException {
- final HttpMethod get = new httpClientGetMethod(uri, maxfilesize);
+ public ResponseContainer GET(final String uri, long maxfilesize) throws IOException {
+ final HttpMethod get = new ClientGetMethod(uri, maxfilesize);
get.setFollowRedirects(followRedirects);
get.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
return execute(get);
@@ -281,7 +285,7 @@ public class httpClient {
* @return Instance of response with the content.
* @throws IOException
*/
- public httpResponse HEAD(final String uri) throws IOException {
+ public ResponseContainer HEAD(final String uri) throws IOException {
assert uri != null : "precondition violated: uri != null";
final HttpMethod head = new HeadMethod(uri);
head.setFollowRedirects(followRedirects);
@@ -299,7 +303,7 @@ public class httpClient {
* @return Instance of response with the content.
* @throws IOException
*/
- public httpResponse POST(final String uri, final InputStream ins) throws IOException {
+ public ResponseContainer POST(final String uri, final InputStream ins) throws IOException {
assert uri != null : "precondition violated: uri != null";
assert ins != null : "precondition violated: ins != null";
final PostMethod post = new PostMethod(uri);
@@ -319,7 +323,7 @@ public class httpClient {
* @return Instance of response with the content.
* @throws IOException
*/
- public httpResponse POST(final String uri, final List<Part> multiparts, final boolean gzipBody)
+ public ResponseContainer POST(final String uri, final List<Part> multiparts, final boolean gzipBody)
throws IOException {
assert uri != null : "precondition violated: uri != null";
final PostMethod post = new PostMethod(uri);
@@ -335,7 +339,7 @@ public class httpClient {
if (gzipBody) {
data = zipRequest(data);
- post.setRequestHeader(httpHeader.CONTENT_ENCODING, httpHeader.CONTENT_ENCODING_GZIP);
+ post.setRequestHeader(HeaderFramework.CONTENT_ENCODING, HeaderFramework.CONTENT_ENCODING_GZIP);
post.setContentChunked(true);
}
post.setRequestEntity(data);
@@ -369,7 +373,7 @@ public class httpClient {
* (non-Javadoc)
* @see de.anomic.http.HttpClient#CONNECT(java.lang.String, int, de.anomic.http.httpHeader)
*/
- public httpResponse CONNECT(final String host, final int port) throws IOException {
+ public ResponseContainer CONNECT(final String host, final int port) throws IOException {
final HostConfiguration hostConfig = new HostConfiguration();
hostConfig.setHost(host, port);
final HttpMethod connect = new ConnectMethod(hostConfig);
@@ -384,7 +388,7 @@ public class httpClient {
* @param requestHeader
* @param method
*/
- public void addHeader(final httpRequestHeader requestHeader, final HttpMethod method) {
+ public void addHeader(final RequestHeader requestHeader, final HttpMethod method) {
assert method != null : "precondition violated: method != null";
if (requestHeader != null) {
addHeaders(convertHeaders(requestHeader), method);
@@ -414,7 +418,7 @@ public class httpClient {
* @param requestHeader
* @return
*/
- private static Header[] convertHeaders(final httpRequestHeader requestHeader) {
+ private static Header[] convertHeaders(final RequestHeader requestHeader) {
final Header[] headers;
if (requestHeader == null) {
headers = new Header[0];
@@ -436,15 +440,15 @@ public class httpClient {
* @return
* @throws IOException
*/
- private httpResponse execute(final HttpMethod method) throws IOException {
+ private ResponseContainer execute(final HttpMethod method) throws IOException {
assert method != null : "precondition violated: method != null";
setHeader(method);
- final httpRemoteProxyConfig hostProxyConfig = setProxy(method);
+ final RemoteProxyConfig hostProxyConfig = setProxy(method);
final HostConfiguration hostConfig = getProxyHostConfig(hostProxyConfig);
// statistics
- HttpConnectionInfo.addConnection(generateConInfo(method));
+ ConnectionInfo.addConnection(generateConInfo(method));
// execute (send request)
if (Log.isFine("HTTPC")) Log.logFine("HTTPC", "executing " + method.hashCode() + " " + method.getName() + " " + method.getURI());
@@ -460,26 +464,26 @@ public class httpClient {
// cleanUp statistics
yacyURL url = new yacyURL(method.getURI().toString(), null);
if (url.hash() != null) Latency.slowdown(url.hash().substring(6), url.getHost());
- HttpConnectionInfo.removeConnection(generateConInfo(method));
+ ConnectionInfo.removeConnection(generateConInfo(method));
throw e;
} catch (final IOException e) {
// cleanUp statistics
yacyURL url = new yacyURL(method.getURI().toString(), null);
if (url.hash() != null) Latency.slowdown(url.hash().substring(6), url.getHost());
- HttpConnectionInfo.removeConnection(generateConInfo(method));
+ ConnectionInfo.removeConnection(generateConInfo(method));
throw e;
} catch (final IllegalStateException e) {
// cleanUp statistics
yacyURL url = new yacyURL(method.getURI().toString(), null);
if (url.hash() != null) Latency.slowdown(url.hash().substring(6), url.getHost());
- HttpConnectionInfo.removeConnection(generateConInfo(method));
+ ConnectionInfo.removeConnection(generateConInfo(method));
throw new IOException(e.getMessage());
}
if (Log.isFinest("HTTPC")) Log.logFinest("HTTPC", "<-" + method.hashCode() + " response headers " +
Arrays.toString(method.getResponseHeaders()));
// return response
- return new httpResponse(method);
+ return new ResponseContainer(method);
}
/**
@@ -487,7 +491,7 @@ public class httpClient {
* @return
* @throws URIException
*/
- private httpRemoteProxyConfig setProxy(final HttpMethod method) throws URIException {
+ private RemoteProxyConfig setProxy(final HttpMethod method) throws URIException {
String host = null;
// set proxy
try {
@@ -496,7 +500,7 @@ public class httpClient {
Log.logWarning("HTTPC", "could not extract host of uri: "+ e.getMessage());
throw e;
}
- final httpRemoteProxyConfig hostProxyConfig = getProxyConfig(host);
+ final RemoteProxyConfig hostProxyConfig = getProxyConfig(host);
if(hostProxyConfig != null) {
final String scheme = method.getURI().getScheme();
if(scheme != null && scheme.toLowerCase().startsWith("https") && !hostProxyConfig.useProxy4SSL()) {
@@ -522,7 +526,7 @@ public class httpClient {
* @param method
* @return
*/
- private HttpConnectionInfo generateConInfo(final HttpMethod method) {
+ private ConnectionInfo generateConInfo(final HttpMethod method) {
int port = 80;
String host = null;
String protocol = null;
@@ -534,7 +538,7 @@ public class httpClient {
// should not happen, because method is already executed
}
final String query = method.getQueryString() != null ? "?" + method.getQueryString() : "";
- return new HttpConnectionInfo(protocol, port == -1 || port == 80 ? host : host + ":" + port, method.getName() +
+ return new ConnectionInfo(protocol, port == -1 || port == 80 ? host : host + ":" + port, method.getName() +
" " + method.getPath() + query, method.hashCode(), System.currentTimeMillis());
}
@@ -544,7 +548,7 @@ public class httpClient {
* @param method
* @param hostProxyConfig
*/
- private void addProxyAuth(final HttpMethod method, final httpRemoteProxyConfig hostProxyConfig) {
+ private void addProxyAuth(final HttpMethod method, final RemoteProxyConfig hostProxyConfig) {
if (hostProxyConfig != null && hostProxyConfig.useProxy()) {
final String remoteProxyUser = hostProxyConfig.getProxyUser();
if (remoteProxyUser != null && remoteProxyUser.length() > 0) {
@@ -554,7 +558,7 @@ public class httpClient {
final String remoteProxyPwd = hostProxyConfig.getProxyPwd();
final String credentials = Base64Order.standardCoder.encodeString(
remoteProxyUser.replace(":", "") + ":" + remoteProxyPwd);
- method.setRequestHeader(httpRequestHeader.PROXY_AUTHORIZATION, "Basic " + credentials);
+ method.setRequestHeader(RequestHeader.PROXY_AUTHORIZATION, "Basic " + credentials);
}
}
}
@@ -564,8 +568,8 @@ public class httpClient {
* @param hostname
* @return null if no proxy should be used
*/
- private httpRemoteProxyConfig getProxyConfig(final String hostname) {
- final httpRemoteProxyConfig hostProxyConfig;
+ private RemoteProxyConfig getProxyConfig(final String hostname) {
+ final RemoteProxyConfig hostProxyConfig;
if (!useGlobalProxyConfig) {
// client specific
if(proxyConfig == null) {
@@ -575,7 +579,7 @@ public class httpClient {
}
} else {
// default settings
- hostProxyConfig = httpRemoteProxyConfig.getProxyConfigForHost(hostname);
+ hostProxyConfig = RemoteProxyConfig.getProxyConfigForHost(hostname);
}
return hostProxyConfig;
}
@@ -584,7 +588,7 @@ public class httpClient {
* @param hostProxyConfig
* @return current host-config with additional proxy set or null if no proxy should be used
*/
- private HostConfiguration getProxyHostConfig(final httpRemoteProxyConfig hostProxyConfig) {
+ private HostConfiguration getProxyHostConfig(final RemoteProxyConfig hostProxyConfig) {
final HostConfiguration hostConfig;
// generate http-configuration
if (hostProxyConfig != null && hostProxyConfig.useProxy()) {
@@ -621,7 +625,7 @@ public class httpClient {
* @param args
*/
public static void main(final String[] args) {
- httpResponse resp = null;
+ ResponseContainer resp = null;
String url = args[0];
if (!url.toUpperCase().startsWith("HTTP://")) {
url = "http://" + url;
@@ -635,7 +639,7 @@ public class httpClient {
files.add(new FilePart("anotherfile.raw", new ByteArrayPartSource("anotherfile.raw",
"this is not a binary file ;)".getBytes())));
System.out.println("POST " + files.size() + " elements to " + url);
- final httpClient client = new httpClient(1000);
+ final Client client = new Client(1000);
resp = client.POST(url, files, false);
System.out.println("----- Header: -----");
System.out.println(resp.getResponseHeader().toString());
@@ -686,7 +690,7 @@ public class httpClient {
lastCleanup = now;
conManager.closeIdleConnections(closeConnectionsAfterMillis);
conManager.deleteClosedConnections();
- HttpConnectionInfo.cleanUp();
+ ConnectionInfo.cleanUp();
}
}
@@ -740,18 +744,18 @@ public class httpClient {
* @return
*/
public static byte[] wget(final String uri) {
- return wget(uri, new httpRequestHeader(), 10000, null);
+ return wget(uri, new RequestHeader(), 10000, null);
}
- public static byte[] wget(final String uri, final httpRequestHeader header, final int timeout) {
+ public static byte[] wget(final String uri, final RequestHeader header, final int timeout) {
return wget(uri, header, timeout, null);
}
- public static byte[] wget(final String uri, final httpRequestHeader header, final int timeout, final String vhost) {
+ public static byte[] wget(final String uri, final RequestHeader header, final int timeout, final String vhost) {
assert uri != null : "precondition violated: uri != null";
addHostHeader(header, vhost);
- final httpClient client = new httpClient(timeout, header);
+ final Client client = new Client(timeout, header);
// do the request
- httpResponse response = null;
+ ResponseContainer response = null;
try {
response = client.GET(uri);
return response.getData();
@@ -766,18 +770,18 @@ public class httpClient {
return null;
}
public static Reader wgetReader(final String uri) {
- return wgetReader(uri, new httpRequestHeader(), 10000, null);
+ return wgetReader(uri, new RequestHeader(), 10000, null);
}
- public static Reader wgetReader(final String uri, final httpRequestHeader header, final int timeout) {
+ public static Reader wgetReader(final String uri, final RequestHeader header, final int timeout) {
return wgetReader(uri, header, timeout, null);
}
- public static Reader wgetReader(final String uri, final httpRequestHeader header, final int timeout, final String vhost) {
+ public static Reader wgetReader(final String uri, final RequestHeader header, final int timeout, final String vhost) {
assert uri != null : "precondition violated: uri != null";
addHostHeader(header, vhost);
- final httpClient client = new httpClient(timeout, header);
+ final Client client = new Client(timeout, header);
// do the request
- httpResponse response = null;
+ ResponseContainer response = null;
try {
response = client.GET(uri);
Charset charset = response.getResponseHeader().getCharSet();
@@ -795,13 +799,13 @@ public class httpClient {
* @param vhost
* @return
*/
- private static void addHostHeader(httpRequestHeader header, final String vhost) {
+ private static void addHostHeader(RequestHeader header, final String vhost) {
if (vhost != null) {
if (header != null) {
- header = new httpRequestHeader();
+ header = new RequestHeader();
}
// set host-header
- header.add(httpHeader.HOST, vhost);
+ header.add(HeaderFramework.HOST, vhost);
}
}
@@ -811,7 +815,7 @@ public class httpClient {
* @param uri
* @return
*/
- public static httpResponseHeader whead(final String uri) {
+ public static ResponseHeader whead(final String uri) {
return whead(uri, null);
}
@@ -822,9 +826,9 @@ public class httpClient {
* @param header request header
* @return null on error
*/
- public static httpResponseHeader whead(final String uri, final httpRequestHeader header) {
- final httpClient client = new httpClient(10000, header);
- httpResponse response = null;
+ public static ResponseHeader whead(final String uri, final RequestHeader header) {
+ final Client client = new Client(10000, header);
+ ResponseContainer response = null;
try {
response = client.HEAD(uri);
return response.getResponseHeader();
diff --git a/source/de/anomic/http/httpClientGetMethod.java b/source/de/anomic/http/client/ClientGetMethod.java
similarity index 91%
rename from source/de/anomic/http/httpClientGetMethod.java
rename to source/de/anomic/http/client/ClientGetMethod.java
index 55f821a3c..8d4810026 100644
--- a/source/de/anomic/http/httpClientGetMethod.java
+++ b/source/de/anomic/http/client/ClientGetMethod.java
@@ -24,7 +24,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.client;
import java.io.IOException;
@@ -39,11 +39,11 @@ import org.apache.commons.httpclient.methods.GetMethod;
* @author lotus
*
*/
-public class httpClientGetMethod extends GetMethod {
+public class ClientGetMethod extends GetMethod {
private long maxfilesize = Long.MAX_VALUE;
- public httpClientGetMethod(String uri, long maxfilesize) {
+ public ClientGetMethod(String uri, long maxfilesize) {
super(uri);
if (maxfilesize > 0) this.maxfilesize = maxfilesize;
}
diff --git a/source/de/anomic/http/HttpConnectionInfo.java b/source/de/anomic/http/client/ConnectionInfo.java
similarity index 87%
rename from source/de/anomic/http/HttpConnectionInfo.java
rename to source/de/anomic/http/client/ConnectionInfo.java
index 6352ea8c6..d2e9f19a1 100644
--- a/source/de/anomic/http/HttpConnectionInfo.java
+++ b/source/de/anomic/http/client/ConnectionInfo.java
@@ -24,7 +24,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.client;
import java.util.Collections;
import java.util.HashSet;
@@ -38,12 +38,12 @@ import de.anomic.yacy.logging.Log;
* @author daniel
* @since 07.04.2008
*/
-public class HttpConnectionInfo {
+public class ConnectionInfo {
/**
* a list of all current connections
*/
- private final static Set<HttpConnectionInfo> allConnections = Collections
- .synchronizedSet(new HashSet<HttpConnectionInfo>());
+ private final static Set<ConnectionInfo> allConnections = Collections
+ .synchronizedSet(new HashSet<ConnectionInfo>());
// this is only for statistics, so it can be bigger to see lost connectionInfos
private final static int staleAfterMillis = 30 * 60000; // 30 minutes
@@ -62,7 +62,7 @@ public class HttpConnectionInfo {
* @param id
* @param initTime
*/
- public HttpConnectionInfo(final String protocol, final String targetHost, final String command, final int id,
+ public ConnectionInfo(final String protocol, final String targetHost, final String command, final int id,
final long initTime) {
this.protocol = protocol;
this.targetHost = targetHost;
@@ -120,7 +120,7 @@ public class HttpConnectionInfo {
*
* @return the allConnections
*/
- public static Set<HttpConnectionInfo> getAllConnections() {
+ public static Set<ConnectionInfo> getAllConnections() {
return allConnections;
}
@@ -129,7 +129,7 @@ public class HttpConnectionInfo {
*
* @param conInfo
*/
- public static void addConnection(final HttpConnectionInfo conInfo) {
+ public static void addConnection(final ConnectionInfo conInfo) {
allConnections.add(conInfo);
}
@@ -138,7 +138,7 @@ public class HttpConnectionInfo {
*
* @param conInfo
*/
- public static void removeConnection(final HttpConnectionInfo conInfo) {
+ public static void removeConnection(final ConnectionInfo conInfo) {
allConnections.remove(conInfo);
}
@@ -148,7 +148,7 @@ public class HttpConnectionInfo {
* @param id
*/
public static void removeConnection(final int id) {
- removeConnection(new HttpConnectionInfo(null, null, null, id, 0));
+ removeConnection(new ConnectionInfo(null, null, null, id, 0));
}
/**
@@ -158,7 +158,7 @@ public class HttpConnectionInfo {
try {
synchronized (allConnections) {
final int sizeBefore = allConnections.size();
- for(final HttpConnectionInfo con: allConnections) {
+ for(final ConnectionInfo con: allConnections) {
if(con.getLifetime() > staleAfterMillis) {
allConnections.remove(con);
}
@@ -219,7 +219,7 @@ public class HttpConnectionInfo {
if (getClass() != obj.getClass()) {
return false;
}
- final HttpConnectionInfo other = (HttpConnectionInfo) obj;
+ final ConnectionInfo other = (ConnectionInfo) obj;
if (id != other.id) {
return false;
}
diff --git a/source/de/anomic/http/DefaultCharsetFilePart.java b/source/de/anomic/http/client/DefaultCharsetFilePart.java
similarity index 98%
rename from source/de/anomic/http/DefaultCharsetFilePart.java
rename to source/de/anomic/http/client/DefaultCharsetFilePart.java
index 3c329e19f..9fa26dd92 100644
--- a/source/de/anomic/http/DefaultCharsetFilePart.java
+++ b/source/de/anomic/http/client/DefaultCharsetFilePart.java
@@ -24,7 +24,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.client;
import java.nio.charset.Charset;
diff --git a/source/de/anomic/http/DefaultCharsetStringPart.java b/source/de/anomic/http/client/DefaultCharsetStringPart.java
similarity index 98%
rename from source/de/anomic/http/DefaultCharsetStringPart.java
rename to source/de/anomic/http/client/DefaultCharsetStringPart.java
index e7b205394..49e3866c7 100644
--- a/source/de/anomic/http/DefaultCharsetStringPart.java
+++ b/source/de/anomic/http/client/DefaultCharsetStringPart.java
@@ -24,7 +24,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.client;
import java.nio.charset.Charset;
diff --git a/source/de/anomic/http/EasySSLProtocolSocketFactory.java b/source/de/anomic/http/client/EasySSLProtocolSocketFactory.java
similarity index 99%
rename from source/de/anomic/http/EasySSLProtocolSocketFactory.java
rename to source/de/anomic/http/client/EasySSLProtocolSocketFactory.java
index 7dda88ffa..3f6a9940c 100644
--- a/source/de/anomic/http/EasySSLProtocolSocketFactory.java
+++ b/source/de/anomic/http/client/EasySSLProtocolSocketFactory.java
@@ -32,7 +32,7 @@
* ========================
* 2008-04-07 danielr: changed package from org.apache.commons.httpclient.contrib.ssl
*/
-package de.anomic.http;
+package de.anomic.http.client;
import java.io.IOException;
import java.net.InetAddress;
@@ -52,6 +52,7 @@ import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
/**
* <p>
* EasySSLProtocolSocketFactory can be used to creats SSL {@link Socket}s
diff --git a/source/de/anomic/http/EasyX509TrustManager.java b/source/de/anomic/http/client/EasyX509TrustManager.java
similarity index 99%
rename from source/de/anomic/http/EasyX509TrustManager.java
rename to source/de/anomic/http/client/EasyX509TrustManager.java
index 0812aedb1..e3b60efbe 100644
--- a/source/de/anomic/http/EasyX509TrustManager.java
+++ b/source/de/anomic/http/client/EasyX509TrustManager.java
@@ -28,7 +28,7 @@
* ========================
* 2008-04-07 danielr: changed package from org.apache.commons.httpclient.contrib.ssl
*/
-package de.anomic.http;
+package de.anomic.http.client;
import java.security.KeyStore;
import java.security.KeyStoreException;
diff --git a/source/de/anomic/http/MultiOutputStream.java b/source/de/anomic/http/client/MultiOutputStream.java
similarity index 91%
rename from source/de/anomic/http/MultiOutputStream.java
rename to source/de/anomic/http/client/MultiOutputStream.java
index 893b4eb89..3b9ca89ba 100644
--- a/source/de/anomic/http/MultiOutputStream.java
+++ b/source/de/anomic/http/client/MultiOutputStream.java
@@ -2,7 +2,7 @@
* MultiOutputStream.java
* @since 26.08.2008
*/
-package de.anomic.http;
+package de.anomic.http.client;
import java.io.IOException;
import java.io.OutputStream;
@@ -13,7 +13,7 @@ import java.io.OutputStream;
* @author daniel
*
*/
-class MultiOutputStream extends OutputStream {
+public class MultiOutputStream extends OutputStream {
private final OutputStream[] streams;
diff --git a/source/de/anomic/http/httpRemoteProxyConfig.java b/source/de/anomic/http/client/RemoteProxyConfig.java
similarity index 87%
rename from source/de/anomic/http/httpRemoteProxyConfig.java
rename to source/de/anomic/http/client/RemoteProxyConfig.java
index 60ea54b98..7a8a6ec29 100644
--- a/source/de/anomic/http/httpRemoteProxyConfig.java
+++ b/source/de/anomic/http/client/RemoteProxyConfig.java
@@ -28,15 +28,15 @@
//javac -classpath .:../Classes Settings_p.java
//if the shell's current path is HTROOT
-package de.anomic.http;
+package de.anomic.http.client;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
-public final class httpRemoteProxyConfig {
+public final class RemoteProxyConfig {
/*
* Remote Proxy configuration
@@ -58,19 +58,19 @@ public final class httpRemoteProxyConfig {
/**
* *The* remote Proxy configuration
*/
- private static httpRemoteProxyConfig remoteProxyConfig = null;
+ private static RemoteProxyConfig remoteProxyConfig = null;
/**
* @param remoteProxyConfig the remoteProxyConfig to set
*/
- public static synchronized void setRemoteProxyConfig(final httpRemoteProxyConfig remoteProxyConfig) {
- httpRemoteProxyConfig.remoteProxyConfig = remoteProxyConfig;
+ public static synchronized void setRemoteProxyConfig(final RemoteProxyConfig remoteProxyConfig) {
+ RemoteProxyConfig.remoteProxyConfig = remoteProxyConfig;
}
/**
* @return the remoteProxyConfig
*/
- public static synchronized httpRemoteProxyConfig getRemoteProxyConfig() {
+ public static synchronized RemoteProxyConfig getRemoteProxyConfig() {
return remoteProxyConfig;
}
@@ -81,11 +81,11 @@ public final class httpRemoteProxyConfig {
* @param proxyHostPort
* @return
*/
- public static httpRemoteProxyConfig createRemoteProxyConfig(
+ public static RemoteProxyConfig createRemoteProxyConfig(
final String proxyHostName,
final int proxyHostPort
) {
- final httpRemoteProxyConfig newConfig = new httpRemoteProxyConfig();
+ final RemoteProxyConfig newConfig = new RemoteProxyConfig();
newConfig.remoteProxyUse = true;
newConfig.remoteProxyUse4SSL = true;
@@ -105,7 +105,7 @@ public final class httpRemoteProxyConfig {
* @param sb
* @return
*/
- public static void init(final plasmaSwitchboard sb) {
+ public static void init(final Switchboard sb) {
// reading the proxy host name
final String proxyHostName = sb.getConfig("remoteProxyHost", "").trim();
// reading the proxy host port
@@ -116,7 +116,7 @@ public final class httpRemoteProxyConfig {
proxyHostPort = 3128;
}
// create new config
- final httpRemoteProxyConfig newConfig = createRemoteProxyConfig(proxyHostName, proxyHostPort);
+ final RemoteProxyConfig newConfig = createRemoteProxyConfig(proxyHostName, proxyHostPort);
// determining if remote proxy usage is enabled
newConfig.remoteProxyUse = newConfig.remoteProxyUse && sb.getConfigBool("remoteProxyUse", false);
@@ -285,8 +285,8 @@ public final class httpRemoteProxyConfig {
* @param server
* @return proxy which should be used or null if no proxy should be used
*/
- public static httpRemoteProxyConfig getProxyConfigForHost(final String server) {
- final httpRemoteProxyConfig proxyConfig = getRemoteProxyConfig();
+ public static RemoteProxyConfig getProxyConfigForHost(final String server) {
+ final RemoteProxyConfig proxyConfig = getRemoteProxyConfig();
if(proxyConfig == null || !proxyConfig.useForHost(server)) {
return null;
}
@@ -299,7 +299,7 @@ public final class httpRemoteProxyConfig {
* @param address full address with host and optionally port or path <host>:<port>/<path>
* @return null if no proxy should be used
*/
- public static httpRemoteProxyConfig getProxyConfigForURI(final String address) {
+ public static RemoteProxyConfig getProxyConfigForURI(final String address) {
// host goes to port
int p = address.indexOf(":");
if (p < 0) {
diff --git a/source/de/anomic/http/httpdBoundedSizeOutputStream.java b/source/de/anomic/http/io/BoundedSizeOutputStream.java
similarity index 78%
rename from source/de/anomic/http/httpdBoundedSizeOutputStream.java
rename to source/de/anomic/http/io/BoundedSizeOutputStream.java
index fa0d849c0..52655cbb6 100644
--- a/source/de/anomic/http/httpdBoundedSizeOutputStream.java
+++ b/source/de/anomic/http/io/BoundedSizeOutputStream.java
@@ -22,20 +22,21 @@
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.io;
import java.io.IOException;
import java.io.OutputStream;
-public class httpdBoundedSizeOutputStream extends httpdByteCountOutputStream {
+
+public class BoundedSizeOutputStream extends ByteCountOutputStream {
protected final long maxSize;
- public httpdBoundedSizeOutputStream(final OutputStream outputStream, final long sizeLimit) {
+ public BoundedSizeOutputStream(final OutputStream outputStream, final long sizeLimit) {
this(outputStream,0,sizeLimit);
}
- public httpdBoundedSizeOutputStream(final OutputStream outputStream, final long initByteCount, final long sizeLimit) {
+ public BoundedSizeOutputStream(final OutputStream outputStream, final long initByteCount, final long sizeLimit) {
super(outputStream,initByteCount,null);
this.maxSize = sizeLimit;
}
@@ -47,7 +48,7 @@ public class httpdBoundedSizeOutputStream extends httpdByteCountOutputStream {
if (rest > 0) this.write(b, 0, (int)rest);
// throw an exception
- throw new httpdLimitExceededException("Limit exceeded",this.maxSize);
+ throw new LimitExceededException("Limit exceeded",this.maxSize);
}
super.write(b);
}
@@ -59,7 +60,7 @@ public class httpdBoundedSizeOutputStream extends httpdByteCountOutputStream {
if (rest > 0) this.write(b, 0, (int)rest);
// throw an exception
- throw new httpdLimitExceededException("Limit exceeded",this.maxSize);
+ throw new LimitExceededException("Limit exceeded",this.maxSize);
}
super.write(b, off, len);
}
@@ -67,7 +68,7 @@ public class httpdBoundedSizeOutputStream extends httpdByteCountOutputStream {
public synchronized void write(final int b) throws IOException {
if (this.byteCount + 1 > this.maxSize) {
// throw an exception
- throw new httpdLimitExceededException("Limit exceeded",this.maxSize);
+ throw new LimitExceededException("Limit exceeded",this.maxSize);
}
super.write(b);
}
diff --git a/source/de/anomic/http/httpdByteCountInputStream.java b/source/de/anomic/http/io/ByteCountInputStream.java
similarity index 89%
rename from source/de/anomic/http/httpdByteCountInputStream.java
rename to source/de/anomic/http/io/ByteCountInputStream.java
index db73e226b..8504c7ce2 100644
--- a/source/de/anomic/http/httpdByteCountInputStream.java
+++ b/source/de/anomic/http/io/ByteCountInputStream.java
@@ -24,14 +24,14 @@
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.io;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
-public class httpdByteCountInputStream extends FilterInputStream {
+public class ByteCountInputStream extends FilterInputStream {
private static final Object syncObject = new Object();
private static final HashMap<String, Long> byteCountInfo = new HashMap<String, Long>(2);
@@ -41,7 +41,7 @@ public class httpdByteCountInputStream extends FilterInputStream {
protected long byteCount;
private String byteCountAccountName = null;
- protected httpdByteCountInputStream(final InputStream inputStream) {
+ protected ByteCountInputStream(final InputStream inputStream) {
this(inputStream,null);
}
@@ -49,7 +49,7 @@ public class httpdByteCountInputStream extends FilterInputStream {
* Constructor of this class
* @param inputStream the {@link InputStream} to read from
*/
- public httpdByteCountInputStream(final InputStream inputStream, final String accountName) {
+ public ByteCountInputStream(final InputStream inputStream, final String accountName) {
this(inputStream,0,accountName);
}
@@ -58,7 +58,7 @@ public class httpdByteCountInputStream extends FilterInputStream {
* @param inputStream the {@link InputStream} to read from
* @param initByteCount to initialize the bytecount with a given value
*/
- public httpdByteCountInputStream(final InputStream inputStream, final int initByteCount, final String accountName) {
+ public ByteCountInputStream(final InputStream inputStream, final int initByteCount, final String accountName) {
super(inputStream);
this.byteCount = initByteCount;
this.byteCountAccountName = accountName;
diff --git a/source/de/anomic/http/httpdByteCountOutputStream.java b/source/de/anomic/http/io/ByteCountOutputStream.java
similarity index 88%
rename from source/de/anomic/http/httpdByteCountOutputStream.java
rename to source/de/anomic/http/io/ByteCountOutputStream.java
index ce47e16de..b9fe7c0ec 100644
--- a/source/de/anomic/http/httpdByteCountOutputStream.java
+++ b/source/de/anomic/http/io/ByteCountOutputStream.java
@@ -22,14 +22,14 @@
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.io;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
-public class httpdByteCountOutputStream extends BufferedOutputStream {
+public class ByteCountOutputStream extends BufferedOutputStream {
private static final Object syncObject = new Object();
private static long globalByteCount = 0;
@@ -43,11 +43,11 @@ public class httpdByteCountOutputStream extends BufferedOutputStream {
* Constructor of this class
* @param outputStream the {@link OutputStream} to write to
*/
- public httpdByteCountOutputStream(final OutputStream outputStream) {
+ public ByteCountOutputStream(final OutputStream outputStream) {
this(outputStream,null);
}
- public httpdByteCountOutputStream(final OutputStream outputStream, final String accountName) {
+ public ByteCountOutputStream(final OutputStream outputStream, final String accountName) {
this(outputStream,0,accountName);
}
@@ -56,7 +56,7 @@ public class httpdByteCountOutputStream extends BufferedOutputStream {
* @param outputStream the {@link OutputStream} to write to
* @param initByteCount to initialize the bytecount with a given value
*/
- public httpdByteCountOutputStream(final OutputStream outputStream, final long initByteCount, final String accountName) {
+ public ByteCountOutputStream(final OutputStream outputStream, final long initByteCount, final String accountName) {
super(outputStream);
this.byteCount = initByteCount;
this.byteCountAccountName = accountName;
diff --git a/source/de/anomic/http/httpChunkedInputStream.java b/source/de/anomic/http/io/ChunkedInputStream.java
similarity index 93%
rename from source/de/anomic/http/httpChunkedInputStream.java
rename to source/de/anomic/http/io/ChunkedInputStream.java
index e83ba1f25..3aefdebc4 100644
--- a/source/de/anomic/http/httpChunkedInputStream.java
+++ b/source/de/anomic/http/io/ChunkedInputStream.java
@@ -22,7 +22,7 @@
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.io;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
@@ -30,13 +30,14 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.ByteBuffer;
/**
* Some parts of this class code was copied from <a href="http://www.devdaily.com/java/jwarehouse/commons-httpclient-2.0/src/java/org/apache/commons/httpclient/ChunkedInputStream.shtml">Apache httpclient Project.</a>
* @author theli
*/
-public final class httpChunkedInputStream extends InputStream {
+public final class ChunkedInputStream extends InputStream {
private static final int READ_CHUNK_STATE_NORMAL = 0;
private static final int READ_CHUNK_STATE_CR_READ = 1;
@@ -49,14 +50,14 @@ public final class httpChunkedInputStream extends InputStream {
private final InputStream inputStream;
private int currPos;
private int currChunkSize;
- private httpRequestHeader httpTrailer;
+ private RequestHeader httpTrailer;
private boolean beginningOfStream = true;
private boolean isEOF = false;
private boolean isClosed = false;
- public httpChunkedInputStream(final InputStream in) {
+ public ChunkedInputStream(final InputStream in) {
if (in == null)throw new IllegalArgumentException("InputStream must not be null");
@@ -138,7 +139,7 @@ public final class httpChunkedInputStream extends InputStream {
final ByteArrayInputStream bin = new ByteArrayInputStream(bout.getBytes());
reader = new BufferedReader(new InputStreamReader(bin));
- this.httpTrailer = new httpRequestHeader();
+ this.httpTrailer = new RequestHeader();
this.httpTrailer.readHttpHeader(reader);
} finally {
if (reader != null) try {reader.close();}catch(final Exception e){}
diff --git a/source/de/anomic/http/httpChunkedOutputStream.java b/source/de/anomic/http/io/ChunkedOutputStream.java
similarity index 93%
rename from source/de/anomic/http/httpChunkedOutputStream.java
rename to source/de/anomic/http/io/ChunkedOutputStream.java
index c458ad3f2..2de0c19f1 100644
--- a/source/de/anomic/http/httpChunkedOutputStream.java
+++ b/source/de/anomic/http/io/ChunkedOutputStream.java
@@ -22,7 +22,7 @@
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.io;
import java.io.FilterOutputStream;
import java.io.IOException;
@@ -33,10 +33,10 @@ import de.anomic.kelondro.util.ByteBuffer;
import de.anomic.kelondro.util.FileUtils;
import de.anomic.server.serverCore;
-public final class httpChunkedOutputStream extends FilterOutputStream {
+public final class ChunkedOutputStream extends FilterOutputStream {
private boolean finished = false;
- public httpChunkedOutputStream(final OutputStream out) {
+ public ChunkedOutputStream(final OutputStream out) {
super(out);
}
diff --git a/source/de/anomic/http/httpdLimitExceededException.java b/source/de/anomic/http/io/LimitExceededException.java
similarity index 86%
rename from source/de/anomic/http/httpdLimitExceededException.java
rename to source/de/anomic/http/io/LimitExceededException.java
index a51317c11..0d9de1687 100644
--- a/source/de/anomic/http/httpdLimitExceededException.java
+++ b/source/de/anomic/http/io/LimitExceededException.java
@@ -22,16 +22,16 @@
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.io;
import java.io.IOException;
-public class httpdLimitExceededException extends IOException {
+public class LimitExceededException extends IOException {
private static final long serialVersionUID = 1L;
private final long limit;
- public httpdLimitExceededException(final String errorMsg, final long limit) {
+ public LimitExceededException(final String errorMsg, final long limit) {
super(errorMsg);
this.limit = limit;
}
diff --git a/source/de/anomic/http/httpHeader.java b/source/de/anomic/http/metadata/HeaderFramework.java
similarity index 91%
rename from source/de/anomic/http/httpHeader.java
rename to source/de/anomic/http/metadata/HeaderFramework.java
index aa3a9cbf7..5e037717b 100644
--- a/source/de/anomic/http/httpHeader.java
+++ b/source/de/anomic/http/metadata/HeaderFramework.java
@@ -1,4 +1,4 @@
-// httpHeader.java
+// HeaderFramework.java
// -----------------------
// (C) by Michael Peter Christen; [email protected]
// first published on http://www.anomic.de
@@ -33,7 +33,7 @@
instance of this class.
*/
-package de.anomic.http;
+package de.anomic.http.metadata;
import java.io.BufferedReader;
import java.io.File;
@@ -50,11 +50,12 @@ import java.util.Properties;
import java.util.TreeMap;
import java.util.Vector;
+import de.anomic.http.server.HTTPDemon;
import de.anomic.kelondro.util.DateFormatter;
import de.anomic.yacy.yacyURL;
-public class httpHeader extends TreeMap<String, String> implements Map<String, String> {
+public class HeaderFramework extends TreeMap<String, String> implements Map<String, String> {
private static final long serialVersionUID = 18L;
@@ -219,11 +220,11 @@ public class httpHeader extends TreeMap<String, String> implements Map<String, S
insensitiveCollator.setDecomposition(Collator.NO_DECOMPOSITION);
}
- public httpHeader() {
+ public HeaderFramework() {
this(null);
}
- public httpHeader(final HashMap<String, String> reverseMappingCache) {
+ public HeaderFramework(final HashMap<String, String> reverseMappingCache) {
// this creates a new TreeMap with a case insensitive mapping
// to provide a put-method that translates given keys into their
// 'proper' appearance, a translation cache is needed.
@@ -233,7 +234,7 @@ public class httpHeader extends TreeMap<String, String> implements Map<String, S
this.reverseMappingCache = reverseMappingCache;
}
- public httpHeader(final HashMap<String, String> reverseMappingCache, final Map<String, String> othermap) {
+ public HeaderFramework(final HashMap<String, String> reverseMappingCache, final Map<String, String> othermap) {
// creates a case insensitive map from another map
super((Collator) insensitiveCollator.clone());
this.reverseMappingCache = reverseMappingCache;
@@ -426,10 +427,10 @@ public class httpHeader extends TreeMap<String, String> implements Map<String, S
// setting the status text if it was not already set
if ((httpStatusText == null)||(httpStatusText.length()==0)) {
- if (httpVersion.equals("HTTP/1.0") && httpHeader.http1_0.containsKey(Integer.toString(httpStatusCode)))
- httpStatusText = httpHeader.http1_0.get(Integer.toString(httpStatusCode));
- else if (httpVersion.equals("HTTP/1.1") && httpHeader.http1_1.containsKey(Integer.toString(httpStatusCode)))
- httpStatusText = httpHeader.http1_1.get(Integer.toString(httpStatusCode));
+ if (httpVersion.equals("HTTP/1.0") && HeaderFramework.http1_0.containsKey(Integer.toString(httpStatusCode)))
+ httpStatusText = HeaderFramework.http1_0.get(Integer.toString(httpStatusCode));
+ else if (httpVersion.equals("HTTP/1.1") && HeaderFramework.http1_1.containsKey(Integer.toString(httpStatusCode)))
+ httpStatusText = HeaderFramework.http1_1.get(Integer.toString(httpStatusCode));
else httpStatusText = "Unknown";
}
@@ -459,9 +460,9 @@ public class httpHeader extends TreeMap<String, String> implements Map<String, S
}
public static yacyURL getRequestURL(final Properties conProp) throws MalformedURLException {
- String host = conProp.getProperty(httpHeader.CONNECTION_PROP_HOST);
- final String path = conProp.getProperty(httpHeader.CONNECTION_PROP_PATH); // always starts with leading '/'
- final String args = conProp.getProperty(httpHeader.CONNECTION_PROP_ARGS); // may be null if no args were given
+ String host = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HOST);
+ final String path = conProp.getProperty(HeaderFramework.CONNECTION_PROP_PATH); // always starts with leading '/'
+ final String args = conProp.getProperty(HeaderFramework.CONNECTION_PROP_ARGS); // may be null if no args were given
//String ip = conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP); // the ip from the connecting peer
int port, pos;
@@ -476,7 +477,7 @@ public class httpHeader extends TreeMap<String, String> implements Map<String, S
return url;
}
- public static void handleTransparentProxySupport(final httpRequestHeader header, final Properties prop, final String virtualHost, final boolean isTransparentProxy) {
+ public static void handleTransparentProxySupport(final RequestHeader header, final Properties prop, final String virtualHost, final boolean isTransparentProxy) {
// transparent proxy support is only available for http 1.0 and above connections
if (prop.getProperty(CONNECTION_PROP_HTTP_VER, "HTTP/0.9").equals("HTTP/0.9")) return;
@@ -488,15 +489,15 @@ public class httpHeader extends TreeMap<String, String> implements Map<String, S
if (!prop.getProperty(CONNECTION_PROP_HOST).equals(virtualHost)) return;
// TODO: we could have problems with connections from extern here ...
- final String dstHostSocket = header.get(httpHeader.HOST);
- prop.setProperty(CONNECTION_PROP_HOST,(httpd.isThisHostName(dstHostSocket)?virtualHost:dstHostSocket));
+ final String dstHostSocket = header.get(HeaderFramework.HOST);
+ prop.setProperty(CONNECTION_PROP_HOST,(HTTPDemon.isThisHostName(dstHostSocket)?virtualHost:dstHostSocket));
}
/**
* Reading http headers from a reader class and building up a httpHeader object
* @param reader the {@link BufferedReader} that is used to read the http header lines
- * @return a {@link httpHeader}-Object containing all parsed headers
+ * @return a {@link HeaderFramework}-Object containing all parsed headers
* @throws IOException
*/
public void readHttpHeader(final BufferedReader reader) throws IOException {
@@ -530,7 +531,7 @@ public class httpHeader extends TreeMap<String, String> implements Map<String, S
/**
* Implementation of Map.Entry. Structure that hold two values - exactly what we need!
*/
- static class Entry implements Map.Entry<String, String> {
+ public static class Entry implements Map.Entry<String, String> {
private final String k;
private String v;
Entry(final String k, final String v) {
diff --git a/source/de/anomic/http/httpRequestHeader.java b/source/de/anomic/http/metadata/RequestHeader.java
similarity index 91%
rename from source/de/anomic/http/httpRequestHeader.java
rename to source/de/anomic/http/metadata/RequestHeader.java
index f2fca6576..65fab4b36 100755
--- a/source/de/anomic/http/httpRequestHeader.java
+++ b/source/de/anomic/http/metadata/RequestHeader.java
@@ -1,4 +1,4 @@
-// httpRequestHeader.java
+// RequestHeader.java
// -----------------------
// (C) 2008 by Michael Peter Christen; [email protected]
// first published on http://yacy.net
@@ -21,7 +21,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.metadata;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -31,10 +31,11 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
+import de.anomic.http.server.HTTPDemon;
import de.anomic.kelondro.util.DateFormatter;
import de.anomic.server.serverCore;
-public class httpRequestHeader extends httpHeader {
+public class RequestHeader extends HeaderFramework {
// request header properties
@@ -61,15 +62,15 @@ public class httpRequestHeader extends httpHeader {
private static final long serialVersionUID = 0L;
- public httpRequestHeader() {
+ public RequestHeader() {
super();
}
- public httpRequestHeader(final HashMap<String, String> reverseMappingCache) {
+ public RequestHeader(final HashMap<String, String> reverseMappingCache) {
super(reverseMappingCache);
}
- public httpRequestHeader(final HashMap<String, String> reverseMappingCache, final Map<String, String> othermap) {
+ public RequestHeader(final HashMap<String, String> reverseMappingCache, final Map<String, String> othermap) {
super(reverseMappingCache, othermap);
}
@@ -191,7 +192,7 @@ public class httpRequestHeader extends httpHeader {
// THIS IS THE "GOOD" CASE
// a perfect formulated url
final String dstHostSocket = args.substring(0, sep);
- prop.setProperty(CONNECTION_PROP_HOST, (httpd.isThisHostName(dstHostSocket)?virtualHost:dstHostSocket));
+ prop.setProperty(CONNECTION_PROP_HOST, (HTTPDemon.isThisHostName(dstHostSocket)?virtualHost:dstHostSocket));
path = args.substring(sep); // yes, including beginning "/"
}
} else {
@@ -230,10 +231,10 @@ public class httpRequestHeader extends httpHeader {
return prop;
}
- public static httpRequestHeader readHeader(final Properties prop, final serverCore.Session theSession) throws IOException {
+ public static RequestHeader readHeader(final Properties prop, final serverCore.Session theSession) throws IOException {
// reading all headers
- final httpRequestHeader header = new httpRequestHeader(httpd.reverseMappingCache);
+ final RequestHeader header = new RequestHeader(HTTPDemon.reverseMappingCache);
int p;
String line;
while ((line = theSession.readLineAsString()) != null) {
@@ -248,15 +249,16 @@ public class httpRequestHeader extends httpHeader {
/*
* doing some header validation here ...
*/
- final String httpVersion = prop.getProperty(httpHeader.CONNECTION_PROP_HTTP_VER, "HTTP/0.9");
- if (httpVersion.equals("HTTP/1.1") && !header.containsKey(httpHeader.HOST)) {
+ final String httpVersion = prop.getProperty(HeaderFramework.CONNECTION_PROP_HTTP_VER, "HTTP/0.9");
+ if (httpVersion.equals("HTTP/1.1") && !header.containsKey(HeaderFramework.HOST)) {
// the HTTP/1.1 specification requires that an HTTP/1.1 server must reject any
// HTTP/1.1 message that does not contain a Host header.
- httpd.sendRespondError(prop,theSession.out,0,400,null,null,null);
+ HTTPDemon.sendRespondError(prop,theSession.out,0,400,null,null,null);
throw new IOException("400 Bad request");
}
return header;
- }
+ }
+
}
diff --git a/source/de/anomic/http/httpResponse.java b/source/de/anomic/http/metadata/ResponseContainer.java
similarity index 89%
rename from source/de/anomic/http/httpResponse.java
rename to source/de/anomic/http/metadata/ResponseContainer.java
index 2cc594fde..0b578c9b5 100644
--- a/source/de/anomic/http/httpResponse.java
+++ b/source/de/anomic/http/metadata/ResponseContainer.java
@@ -1,4 +1,4 @@
-// JakartaCommonsHttpResponse.java
+// ResponseContainer.java
// (C) 2008 by Daniel Raap; [email protected]
// first published 2.4.2008 on http://yacy.net
//
@@ -24,7 +24,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.metadata;
import java.io.IOException;
import java.io.InputStream;
@@ -33,6 +33,8 @@ import java.util.zip.GZIPInputStream;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpMethod;
+import de.anomic.http.client.ConnectionInfo;
+import de.anomic.http.io.ByteCountInputStream;
import de.anomic.kelondro.util.FileUtils;
/**
@@ -41,7 +43,7 @@ import de.anomic.kelondro.util.FileUtils;
* @author daniel
* @since 21.03.2008
*/
-public class httpResponse {
+public class ResponseContainer {
private final HttpMethod method;
private String incomingAccountingName = null;
@@ -56,7 +58,7 @@ public class httpResponse {
* @param method
* @throws IOException
*/
- public httpResponse(final HttpMethod method) {
+ public ResponseContainer(final HttpMethod method) {
super();
this.method = method;
@@ -67,8 +69,8 @@ public class httpResponse {
*
* @see de.anomic.http.HttpResponse#getResponseHeader()
*/
- public httpResponseHeader getResponseHeader() {
- final httpResponseHeader responseHeader = new httpResponseHeader();
+ public ResponseHeader getResponseHeader() {
+ final ResponseHeader responseHeader = new ResponseHeader();
for (final Header header : getHeaders()) {
responseHeader.add(header.getName(), header.getValue());
}
@@ -120,7 +122,7 @@ public class httpResponse {
inStream = new GZIPInputStream(inStream);
}
// count bytes for overall http-statistics
- return new httpdByteCountInputStream(inStream, incomingAccountingName);
+ return new ByteCountInputStream(inStream, incomingAccountingName);
}
/**
@@ -140,7 +142,7 @@ public class httpResponse {
public void closeStream() {
method.releaseConnection();
// statistics
- HttpConnectionInfo.removeConnection(method.hashCode());
+ ConnectionInfo.removeConnection(method.hashCode());
}
/*
diff --git a/source/de/anomic/http/httpResponseHeader.java b/source/de/anomic/http/metadata/ResponseHeader.java
similarity index 92%
rename from source/de/anomic/http/httpResponseHeader.java
rename to source/de/anomic/http/metadata/ResponseHeader.java
index 21415629f..fdeef39b1 100755
--- a/source/de/anomic/http/httpResponseHeader.java
+++ b/source/de/anomic/http/metadata/ResponseHeader.java
@@ -21,7 +21,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.metadata;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
@@ -32,26 +32,26 @@ import java.util.Map;
import de.anomic.yacy.logging.Log;
-public class httpResponseHeader extends httpHeader {
+public class ResponseHeader extends HeaderFramework {
// response header properties
private static final long serialVersionUID = 0L;
- public httpResponseHeader() {
+ public ResponseHeader() {
super();
}
- public httpResponseHeader(final HashMap<String, String> reverseMappingCache) {
+ public ResponseHeader(final HashMap<String, String> reverseMappingCache) {
super(reverseMappingCache);
}
- public httpResponseHeader(final HashMap<String, String> reverseMappingCache, final Map<String, String> othermap) {
+ public ResponseHeader(final HashMap<String, String> reverseMappingCache, final Map<String, String> othermap) {
super(reverseMappingCache, othermap);
}
public Date date() {
- Date d = headerDate(httpHeader.DATE);
+ Date d = headerDate(HeaderFramework.DATE);
if (d == null) return new Date(); else return d;
}
diff --git a/source/de/anomic/http/httpdAlternativeDomainNames.java b/source/de/anomic/http/server/AlternativeDomainNames.java
similarity index 96%
rename from source/de/anomic/http/httpdAlternativeDomainNames.java
rename to source/de/anomic/http/server/AlternativeDomainNames.java
index 9324511ad..aabf80903 100644
--- a/source/de/anomic/http/httpdAlternativeDomainNames.java
+++ b/source/de/anomic/http/server/AlternativeDomainNames.java
@@ -22,9 +22,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.server;
-public interface httpdAlternativeDomainNames {
+public interface AlternativeDomainNames {
/**
* for a given domain name, return a new address
diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/server/HTTPDFileHandler.java
similarity index 80%
rename from source/de/anomic/http/httpdFileHandler.java
rename to source/de/anomic/http/server/HTTPDFileHandler.java
index 8f326df1e..1a0b5158f 100644
--- a/source/de/anomic/http/httpdFileHandler.java
+++ b/source/de/anomic/http/server/HTTPDFileHandler.java
@@ -1,1201 +1,1205 @@
-// httpdFileHandler.java
-// -----------------------
-// (C) by Michael Peter Christen; [email protected]
-// first published on http://www.anomic.de
-// Frankfurt, Germany, 2004, 2005
-// last major change: 01.01.2009
-//
-// CGI additions by Marc Nause
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program 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 General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-/*
- Class documentation:
- this class provides a file servlet and CGI interface
- for the httpd server.
- Whenever this server is addressed to load a local file,
- this class searches for the file in the local path as
- configured in the setting property 'rootPath'
- The servlet loads the file and returns it to the client.
- Every file can also act as an template for the built-in
- CGI interface. There is no specific path for CGI functions.
- CGI functionality is triggered, if for the file to-be-served
- 'template.html' also a file 'template.class' exists. Then,
- the class file is called with the GET/POST properties that
- are attached to the http call.
- Possible variable hand-over are:
- - form method GET
- - form method POST, enctype text/plain
- - form method POST, enctype multipart/form-data
- The class that creates the CGI respond must have at least one
- static method of the form
- public static java.util.Hashtable respond(java.util.HashMap, serverSwitch)
- In the HashMap, the GET/POST variables are handed over.
- The return value is a Property object that contains replacement
- key/value pairs for the patterns in the template file.
- The templates must have the form
- either '#['<name>']#' for single attributes, or
- '#{'<enumname>'}#' and '#{/'<enumname>'}#' for enumerations of
- values '#['<value>']#'.
- A single value in repetitions/enumerations in the template has
- the property key '_'<enumname><count>'_'<value>
- Please see also the example files 'test.html' and 'test.java'
- */
-
-package de.anomic.http;
-
-import java.awt.Image;
-import java.awt.image.BufferedImage;
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.lang.ref.SoftReference;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.InetAddress;
-import java.net.URLDecoder;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.zip.GZIPOutputStream;
-
-import de.anomic.document.Classification;
-import de.anomic.document.parser.htmlParser;
-import de.anomic.document.parser.html.ContentScraper;
-import de.anomic.document.parser.html.ScraperInputStream;
-import de.anomic.kelondro.util.ByteBuffer;
-import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.kelondro.util.FileUtils;
-import de.anomic.kelondro.util.MemoryControl;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
-import de.anomic.server.serverClassLoader;
-import de.anomic.server.serverCore;
-import de.anomic.server.serverObjects;
-import de.anomic.server.serverSwitch;
-import de.anomic.server.servletProperties;
-import de.anomic.yacy.yacyBuildProperties;
-import de.anomic.yacy.yacyURL;
-import de.anomic.yacy.logging.Log;
-import de.anomic.ymage.ymageMatrix;
-
-public final class httpdFileHandler {
-
- private static final boolean safeServletsMode = false; // if true then all servlets are called synchronized
-
- private static final Properties mimeTable = new Properties();
- // create a class loader
- private static final serverClassLoader provider = new serverClassLoader(/*this.getClass().getClassLoader()*/);
- private static serverSwitch switchboard = null;
- private static plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
-
- private static File htRootPath = null;
- private static File htDocsPath = null;
- private static File htTemplatePath = null;
- private static String[] defaultFiles = null;
- private static File htDefaultPath = null;
- private static File htLocalePath = null;
-
- protected static final class TemplateCacheEntry {
- Date lastModified;
- byte[] content;
- }
- private static final ConcurrentHashMap<File, SoftReference<TemplateCacheEntry>> templateCache;
- private static final ConcurrentHashMap<File, SoftReference<Method>> templateMethodCache;
-
- public static final boolean useTemplateCache;
-
- //private Properties connectionProperties = null;
- // creating a logger
- private static final Log theLogger = new Log("FILEHANDLER");
-
- static {
- final serverSwitch theSwitchboard = plasmaSwitchboard.getSwitchboard();
- useTemplateCache = theSwitchboard.getConfig("enableTemplateCache","true").equalsIgnoreCase("true");
- templateCache = (useTemplateCache)? new ConcurrentHashMap<File, SoftReference<TemplateCacheEntry>>() : new ConcurrentHashMap<File, SoftReference<TemplateCacheEntry>>(0);
- templateMethodCache = (useTemplateCache) ? new ConcurrentHashMap<File, SoftReference<Method>>() : new ConcurrentHashMap<File, SoftReference<Method>>(0);
-
- if (httpdFileHandler.switchboard == null) {
- httpdFileHandler.switchboard = theSwitchboard;
-
- if (mimeTable.size() == 0) {
- // load the mime table
- final String mimeTablePath = theSwitchboard.getConfig("mimeConfig","");
- BufferedInputStream mimeTableInputStream = null;
- try {
- Log.logConfig("HTTPDFiles", "Loading mime mapping file " + mimeTablePath);
- mimeTableInputStream = new BufferedInputStream(new FileInputStream(new File(theSwitchboard.getRootPath(), mimeTablePath)));
- mimeTable.load(mimeTableInputStream);
- } catch (final Exception e) {
- Log.logSevere("HTTPDFiles", "ERROR: path to configuration file or configuration invalid\n" + e);
- System.exit(1);
- } finally {
- if (mimeTableInputStream != null) try { mimeTableInputStream.close(); } catch (final Exception e1) {}
- }
- }
-
- // create default files array
- initDefaultPath();
-
- // create a htRootPath: system pages
- if (htRootPath == null) {
- htRootPath = new File(theSwitchboard.getRootPath(), theSwitchboard.getConfig(plasmaSwitchboardConstants.HTROOT_PATH, plasmaSwitchboardConstants.HTROOT_PATH_DEFAULT));
- if (!(htRootPath.exists())) htRootPath.mkdir();
- }
-
- // create a htDocsPath: user defined pages
- if (htDocsPath == null) {
- htDocsPath = theSwitchboard.getConfigPath(plasmaSwitchboardConstants.HTDOCS_PATH, plasmaSwitchboardConstants.HTDOCS_PATH_DEFAULT);
- if (!(htDocsPath.exists())) htDocsPath.mkdirs();
- }
-
- // create a repository path
- final File repository = new File(htDocsPath, "repository");
- if (!repository.exists()) repository.mkdirs();
-
- // create a htTemplatePath
- if (htTemplatePath == null) {
- htTemplatePath = theSwitchboard.getConfigPath("htTemplatePath","htroot/env/templates");
- if (!(htTemplatePath.exists())) htTemplatePath.mkdir();
- }
- //This is now handles by #%env/templates/foo%#
- //if (templates.size() == 0) templates.putAll(httpTemplate.loadTemplates(htTemplatePath));
-
- // create htLocaleDefault, htLocalePath
- if (htDefaultPath == null) htDefaultPath = theSwitchboard.getConfigPath("htDefaultPath", "htroot");
- if (htLocalePath == null) htLocalePath = theSwitchboard.getConfigPath("locale.translated_html", "DATA/LOCALE/htroot");
- }
-
- }
-
- public static final void initDefaultPath() {
- // create default files array
- defaultFiles = switchboard.getConfig("defaultFiles","index.html").split(",");
- if (defaultFiles.length == 0) defaultFiles = new String[] {"index.html"};
- }
-
- /** Returns a path to the localized or default file according to the locale.language (from he switchboard)
- * @param path relative from htroot */
- public static File getLocalizedFile(final String path){
- return getLocalizedFile(path, switchboard.getConfig("locale.language","default"));
- }
-
- /** Returns a path to the localized or default file according to the parameter localeSelection
- * @param path relative from htroot
- * @param localeSelection language of localized file; locale.language from switchboard is used if localeSelection.equals("") */
- public static File getLocalizedFile(final String path, final String localeSelection){
- //if (htDefaultPath == null) htDefaultPath = switchboard.getConfigPath("htDefaultPath", "htroot");
- //if (htLocalePath == null) htLocalePath = switchboard.getConfigPath("locale.translated_html", "DATA/LOCALE/htroot");
- //if (htDocsPath == null) htDocsPath = switchboard.getConfigPath(plasmaSwitchboardConstants.HTDOCS_PATH, plasmaSwitchboardConstants.HTDOCS_PATH_DEFAULT);
-
- if (path.startsWith("/repository/"))
- return new File(switchboard.getConfig("repositoryPath", "DATA/HTDOCS/repository"), path.substring(11));
- if (!(localeSelection.equals("default"))) {
- final File localePath = new File(htLocalePath, localeSelection + '/' + path);
- if (localePath.exists()) return localePath; // avoid "NoSuchFile" troubles if the "localeSelection" is misspelled
- }
-
- File docsPath = new File(htDocsPath, path);
- if (docsPath.exists()) return docsPath;
- return new File(htDefaultPath, path);
- }
-
- private static final httpResponseHeader getDefaultHeaders(final String path) {
- final httpResponseHeader headers = new httpResponseHeader();
- String ext;
- int pos;
- if ((pos = path.lastIndexOf('.')) < 0) {
- ext = "";
- } else {
- ext = path.substring(pos + 1).toLowerCase();
- }
- headers.put(httpHeader.SERVER, "AnomicHTTPD (www.anomic.de)");
- headers.put(httpHeader.DATE, DateFormatter.formatRFC1123(new Date()));
- if(!(Classification.isMediaExtension(ext))){
- headers.put(httpHeader.PRAGMA, "no-cache");
- }
- return headers;
- }
-
- public static void doGet(final Properties conProp, final httpRequestHeader requestHeader, final OutputStream response) {
- doResponse(conProp, requestHeader, response, null);
- }
-
- public static void doHead(final Properties conProp, final httpRequestHeader requestHeader, final OutputStream response) {
- doResponse(conProp, requestHeader, response, null);
- }
-
- public static void doPost(final Properties conProp, final httpRequestHeader requestHeader, final OutputStream response, final InputStream body) {
- doResponse(conProp, requestHeader, response, body);
- }
-
- public static void doResponse(final Properties conProp, final httpRequestHeader requestHeader, final OutputStream out, final InputStream body) {
-
- String path = null;
- try {
- // getting some connection properties
- final String method = conProp.getProperty(httpHeader.CONNECTION_PROP_METHOD);
- path = conProp.getProperty(httpHeader.CONNECTION_PROP_PATH);
- String argsString = conProp.getProperty(httpHeader.CONNECTION_PROP_ARGS); // is null if no args were given
- final String httpVersion = conProp.getProperty(httpHeader.CONNECTION_PROP_HTTP_VER);
- final String clientIP = conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP, "unknown-host");
-
- // check hack attacks in path
- if (path.indexOf("..") >= 0) {
- httpd.sendRespondError(conProp,out,4,403,null,"Access not allowed",null);
- return;
- }
-
- // url decoding of path
- try {
- path = URLDecoder.decode(path, "UTF-8");
- } catch (final UnsupportedEncodingException e) {
- // This should never occur
- assert(false) : "UnsupportedEncodingException: " + e.getMessage();
- }
-
- // check against hack attacks in path
- if (path.indexOf("..") >= 0) {
- httpd.sendRespondError(conProp,out,4,403,null,"Access not allowed",null);
- return;
- }
-
- // check permission/granted access
- String authorization = requestHeader.get(httpRequestHeader.AUTHORIZATION);
- if (authorization != null && authorization.length() == 0) authorization = null;
- final String adminAccountBase64MD5 = switchboard.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "");
-
- // a bad patch to map the /xml/ path to /api/
- if (path.startsWith("/xml/")) {
- path = "/api/" + path.substring(5);
- }
-
- final boolean adminAccountForLocalhost = sb.getConfigBool("adminAccountForLocalhost", false);
- final String refererHost = requestHeader.refererHost();
- final boolean accessFromLocalhost = serverCore.isLocalhost(clientIP) && (refererHost.length() == 0 || serverCore.isLocalhost(refererHost));
- final boolean grantedForLocalhost = adminAccountForLocalhost && accessFromLocalhost;
- final boolean protectedPage = path.indexOf("_p.") > 0;
- final boolean accountEmpty = adminAccountBase64MD5.length() == 0;
-
- if (!grantedForLocalhost && protectedPage && !accountEmpty) {
- // authentication required
- if (authorization == null) {
- // no authorization given in response. Ask for that
- final httpResponseHeader responseHeader = getDefaultHeaders(path);
- responseHeader.put(httpRequestHeader.WWW_AUTHENTICATE,"Basic realm=\"admin log-in\"");
- //httpd.sendRespondHeader(conProp,out,httpVersion,401,headers);
- final servletProperties tp=new servletProperties();
- tp.put("returnto", path);
- //TODO: separate error page Wrong Login / No Login
- httpd.sendRespondError(conProp, out, 5, 401, "Wrong Authentication", "", new File("proxymsg/authfail.inc"), tp, null, responseHeader);
- return;
- } else if (
- (httpd.staticAdminAuthenticated(authorization.trim().substring(6), switchboard) == 4) ||
- (sb.userDB.hasAdminRight(authorization, requestHeader.getHeaderCookies()))) {
- //Authentication successful. remove brute-force flag
- serverCore.bfHost.remove(conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP));
- } else {
- // a wrong authentication was given or the userDB user does not have admin access. Ask again
- Log.logInfo("HTTPD", "Wrong log-in for account 'admin' in http file handler for path '" + path + "' from host '" + clientIP + "'");
- final Integer attempts = serverCore.bfHost.get(clientIP);
- if (attempts == null)
- serverCore.bfHost.put(clientIP, Integer.valueOf(1));
- else
- serverCore.bfHost.put(clientIP, Integer.valueOf(attempts.intValue() + 1));
-
- final httpResponseHeader headers = getDefaultHeaders(path);
- headers.put(httpRequestHeader.WWW_AUTHENTICATE,"Basic realm=\"admin log-in\"");
- httpd.sendRespondHeader(conProp,out,httpVersion,401,headers);
- return;
- }
- }
-
- // parse arguments
- serverObjects args = new serverObjects();
- int argc = 0;
- if (argsString == null) {
- // no args here, maybe a POST with multipart extension
- int length = requestHeader.getContentLength();
- //System.out.println("HEADER: " + requestHeader.toString()); // DEBUG
-
- /* don't parse body in case of a POST CGI call since it has to be
- * handed over to the CGI script unaltered and parsed by the script
- */
- if (method.equals(httpHeader.METHOD_POST) &&
- !(switchboard.getConfigBool("cgi.allow", false) &&
- httpdFileHandler.matchesSuffix(path, switchboard.getConfig("cgi.suffixes", null)))
- ) {
-
- // if its a POST, it can be either multipart or as args in the body
- if ((requestHeader.containsKey(httpHeader.CONTENT_TYPE)) &&
- (requestHeader.get(httpHeader.CONTENT_TYPE).toLowerCase().startsWith("multipart"))) {
- // parse multipart
- final HashMap<String, byte[]> files = httpd.parseMultipart(requestHeader, args, body);
- // integrate these files into the args
- if (files != null) {
- final Iterator<Map.Entry<String, byte[]>> fit = files.entrySet().iterator();
- Map.Entry<String, byte[]> entry;
- while (fit.hasNext()) {
- entry = fit.next();
- args.put(entry.getKey() + "$file", entry.getValue());
- }
- }
- argc = Integer.parseInt(requestHeader.get("ARGC"));
- } else {
- // parse args in body
- argc = httpd.parseArgs(args, body, length);
- }
- } else {
- // no args
- argsString = null;
- args = null;
- argc = 0;
- }
- } else {
- // simple args in URL (stuff after the "?")
- argc = httpd.parseArgs(args, argsString);
- }
-
- // check for cross site scripting - attacks in request arguments
- if (args != null && argc > 0) {
- // check all values for occurrences of script values
- final Iterator<String> e = args.values().iterator(); // enumeration of values
- String val;
- while (e.hasNext()) {
- val = e.next();
- if ((val != null) && (val.indexOf("<script") >= 0) && !path.equals("/WatchCrawler_p.html")) {
- // deny request
- httpd.sendRespondError(conProp,out,4,403,null,"bad post values",null);
- return;
- }
- }
- }
-
- // we are finished with parsing
- // the result of value hand-over is in args and argc
- if (path.length() == 0) {
- httpd.sendRespondError(conProp,out,4,400,null,"Bad Request",null);
- out.flush();
- return;
- }
- File targetClass=null;
-
- // locate the file
- if (!path.startsWith("/") && !path.startsWith("\\")) path = "/" + path; // attach leading slash
-
- // a different language can be desired (by i.e. ConfigBasic.html) than the one stored in the locale.language
- String localeSelection = switchboard.getConfig("locale.language","default");
- if (args != null && (args.containsKey("language"))) {
- // TODO 9.11.06 Bost: a class with information about available languages is needed.
- // the indexOf(".") is just a workaround because there from ConfigLanguage.html commes "de.lng" and
- // from ConfigBasic.html comes just "de" in the "language" parameter
- localeSelection = args.get("language", localeSelection);
- if (localeSelection.indexOf(".") != -1)
- localeSelection = localeSelection.substring(0, localeSelection.indexOf("."));
- }
-
- File targetFile = getLocalizedFile(path, localeSelection);
- final String targetExt = conProp.getProperty("EXT","");
- targetClass = rewriteClassFile(new File(htDefaultPath, path));
- if (path.endsWith("/") || path.endsWith("\\")) {
- String testpath;
- // attach default file name
- for (int i = 0; i < defaultFiles.length; i++) {
- testpath = path + defaultFiles[i];
- targetFile = getOverlayedFile(testpath);
- targetClass = getOverlayedClass(testpath);
- if (targetFile.exists()) {
- path = testpath;
- break;
- }
- }
- targetFile = getLocalizedFile(path, localeSelection);
-
- //no defaultfile, send a dirlisting
- if (targetFile == null || !targetFile.exists() || (targetFile.exists() && targetFile.isDirectory())) {
- final StringBuilder aBuffer = new StringBuilder();
- aBuffer.append("<html>\n<head>\n</head>\n<body>\n<h1>Index of " + path + "</h1>\n <ul>\n");
- String[] list = targetFile.list();
- if (list == null) list = new String[0]; // should not occur!
- File f;
- String size;
- long sz;
- String headline, author, description;
- int images, links;
- ContentScraper scraper;
- for (int i = 0; i < list.length; i++) {
- f = new File(targetFile, list[i]);
- if (f.isDirectory()) {
- aBuffer.append(" <li><a href=\"" + path + list[i] + "/\">" + list[i] + "/</a><br></li>\n");
- } else {
- if (list[i].endsWith("html") || (list[i].endsWith("htm"))) {
- scraper = ContentScraper.parseResource(f);
- headline = scraper.getTitle();
- author = scraper.getAuthor();
- description = scraper.getDescription();
- images = scraper.getImages().size();
- links = scraper.getAnchors().size();
- } else {
- headline = null;
- author = null;
- description = null;
- images = 0;
- links = 0;
- }
- sz = f.length();
- if (sz < 1024) {
- size = sz + " bytes";
- } else if (sz < 1024 * 1024) {
- size = (sz / 1024) + " KB";
- } else {
- size = (sz / 1024 / 1024) + " MB";
- }
- aBuffer.append(" <li>");
- if ((headline != null) && (headline.length() > 0)) aBuffer.append("<a href=\"" + list[i] + "\"><b>" + headline + "</b></a><br>");
- aBuffer.append("<a href=\"" + path + list[i] + "\">" + list[i] + "</a><br>");
- if ((author != null) && (author.length() > 0)) aBuffer.append("Author: " + author + "<br>");
- if ((description != null) && (description.length() > 0)) aBuffer.append("Description: " + description + "<br>");
- aBuffer.append(DateFormatter.formatShortDay(new Date(f.lastModified())) + ", " + size + ((images > 0) ? ", " + images + " images" : "") + ((links > 0) ? ", " + links + " links" : "") + "<br></li>\n");
- }
- }
- aBuffer.append(" </ul>\n</body>\n</html>\n");
-
- // write the list to the client
- httpd.sendRespondHeader(conProp, out, httpVersion, 200, null, "text/html; charset=UTF-8", aBuffer.length(), new Date(targetFile.lastModified()), null, new httpResponseHeader(), null, null, true);
- if (!method.equals(httpHeader.METHOD_HEAD)) {
- out.write(aBuffer.toString().getBytes("UTF-8"));
- }
- return;
- }
- } else {
- //XXX: you cannot share a .png/.gif file with a name like a class in htroot.
- if ( !(targetFile.exists()) &&
- !((path.endsWith("png")||path.endsWith("gif") ||
- matchesSuffix(path, switchboard.getConfig("cgi.suffixes", null)) ||
- path.endsWith(".stream")) &&
- targetClass!=null ) ){
- targetFile = new File(htDocsPath, path);
- targetClass = rewriteClassFile(new File(htDocsPath, path));
- }
- }
-
- //File targetClass = rewriteClassFile(targetFile);
- //We need tp here
- servletProperties templatePatterns = null;
- Date targetDate;
- boolean nocache = false;
-
- if ((targetClass != null) && (path.endsWith("png"))) {
- // call an image-servlet to produce an on-the-fly - generated image
- Object img = null;
- try {
- requestHeader.put(httpHeader.CONNECTION_PROP_CLIENTIP, conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP));
- requestHeader.put(httpHeader.CONNECTION_PROP_PATH, path);
- // in case that there are no args given, args = null or empty hashmap
- img = invokeServlet(targetClass, requestHeader, args);
- } catch (final InvocationTargetException e) {
- theLogger.logSevere("INTERNAL ERROR: " + e.toString() + ":" +
- e.getMessage() +
- " target exception at " + targetClass + ": " +
- e.getTargetException().toString() + ":" +
- e.getTargetException().getMessage() +
- "; java.awt.graphicsenv='" + System.getProperty("java.awt.graphicsenv","") + "'");
- e.printStackTrace();
- e.getTargetException().printStackTrace();
- targetClass = null;
- }
- if (img == null) {
- // error with image generation; send file-not-found
- httpd.sendRespondError(conProp, out, 3, 404, "File not Found", null, null);
- } else {
- if (img instanceof ymageMatrix) {
- final ymageMatrix yp = (ymageMatrix) img;
- // send an image to client
- targetDate = new Date(System.currentTimeMillis());
- nocache = true;
- final String mimeType = mimeTable.getProperty(targetExt, "text/html");
- final ByteBuffer result = ymageMatrix.exportImage(yp.getImage(), targetExt);
-
- // write the array to the client
- httpd.sendRespondHeader(conProp, out, httpVersion, 200, null, mimeType, result.length(), targetDate, null, null, null, null, nocache);
- if (!method.equals(httpHeader.METHOD_HEAD)) {
- result.writeTo(out);
- }
- }
- if (img instanceof Image) {
- final Image i = (Image) img;
- // send an image to client
- targetDate = new Date(System.currentTimeMillis());
- nocache = true;
- final String mimeType = mimeTable.getProperty(targetExt, "text/html");
-
- // generate an byte array from the generated image
- int width = i.getWidth(null); if (width < 0) width = 96; // bad hack
- int height = i.getHeight(null); if (height < 0) height = 96; // bad hack
- final BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
- bi.createGraphics().drawImage(i, 0, 0, width, height, null);
- final ByteBuffer result = ymageMatrix.exportImage(bi, targetExt);
-
- // write the array to the client
- httpd.sendRespondHeader(conProp, out, httpVersion, 200, null, mimeType, result.length(), targetDate, null, null, null, null, nocache);
- if (!method.equals(httpHeader.METHOD_HEAD)) {
- result.writeTo(out);
- }
- }
- }
- } else if (((switchboard.getConfigBool("cgi.allow", false)) && // check if CGI execution is allowed in config
- (httpdFileHandler.matchesSuffix(path, switchboard.getConfig("cgi.suffixes", null))) && // "right" file extension?
- (path.substring(0, path.indexOf(targetFile.getName())).contains("/CGI-BIN/") ||
- path.substring(0, path.indexOf(targetFile.getName())).contains("/cgi-bin/")) && // file in right directory?
- targetFile.exists())
- ) {
-
- String mimeType = "text/html";
- int statusCode = 200;
-
- ProcessBuilder pb;
-
- pb = new ProcessBuilder(targetFile.getAbsolutePath());
-
- String fileSeparator = System.getProperty("file.separator", "/");
-
- // set environment variables
- Map<String, String> env = pb.environment();
- env.put("SERVER_SOFTWARE", getDefaultHeaders(path).get(httpHeader.SERVER));
- env.put("SERVER_NAME", switchboard.getConfig("peerName", "<nameless>"));
- env.put("GATEWAY_INTERFACE", "CGI/1.1");
- if (httpVersion != null) {
- env.put("SERVER_PROTOCOL", httpVersion);
- }
- env.put("SERVER_PORT", switchboard.getConfig("port", "8080"));
- env.put("REQUEST_METHOD", method);
-// env.put("PATH_INFO", ""); // TODO: implement
-// env.put("PATH_TRANSLATED", ""); // TODO: implement
- env.put("SCRIPT_NAME", path);
- if (argsString != null) {
- env.put("QUERY_STRING", argsString);
- }
- env.put("REMOTE_HOST", InetAddress.getByName(clientIP).getHostName());
- env.put("REMOTE_ADDR", clientIP);
-// env.put("AUTH_TYPE", ""); // TODO: implement
-// env.put("REMOTE_USER", ""); // TODO: implement
-// env.put("REMOTE_IDENT", ""); // I don't think we need this
- env.put("DOCUMENT_ROOT", switchboard.getRootPath().getAbsolutePath() + fileSeparator + switchboard.getConfig("htDocsPath", "DATA/HTDOCS"));
- if (requestHeader.getContentType() != null) {
- env.put("CONTENT_TYPE", requestHeader.getContentType());
- }
- if (method.equalsIgnoreCase(httpHeader.METHOD_POST) && body != null) {
- env.put("CONTENT_LENGTH", requestHeader.getContentLength() + "");
- }
-
- // add values from request header to environment (see: http://hoohoo.ncsa.uiuc.edu/cgi/env.html#headers)
- for (Map.Entry<String, String> requestHeaderEntry : requestHeader.entrySet()) {
- env.put("HTTP_" + requestHeaderEntry.getKey().toUpperCase().replace("-", "_"), requestHeaderEntry.getValue());
- }
-
- int exitValue = 0;
- String cgiBody = null;
-
- try {
- // start execution of script
- Process p = pb.start();
-
- OutputStream os = new BufferedOutputStream(p.getOutputStream());
-
- if (method.equalsIgnoreCase(httpHeader.METHOD_POST) && body != null) {
- byte[] buffer = new byte[1024];
- int len = requestHeader.getContentLength();
- while (len > 0) {
- body.read(buffer);
- len = len - buffer.length;
- os.write(buffer);
- }
- }
-
- os.close();
-
- try {
- p.waitFor();
- } catch (InterruptedException ex) {
-
- }
-
- exitValue = p.exitValue();
-
- InputStream is = new BufferedInputStream(p.getInputStream());
-
- StringBuilder StringBuilder = new StringBuilder(1024);
-
- while (is.available() > 0) {
- StringBuilder.append((char) is.read());
- }
-
- String cgiReturn = StringBuilder.toString();
- int indexOfDelimiter = cgiReturn.indexOf("\n\n");
- String[] cgiHeader = new String[0];
- if (indexOfDelimiter > -1) {
- cgiHeader = cgiReturn.substring(0, indexOfDelimiter).split("\n");
- }
- cgiBody = cgiReturn.substring(indexOfDelimiter + 1);
-
- String key;
- String value;
- for (int i = 0; i < cgiHeader.length; i++) {
- indexOfDelimiter = cgiHeader[i].indexOf(":");
- key = cgiHeader[i].substring(0, indexOfDelimiter).trim();
- value = cgiHeader[i].substring(indexOfDelimiter + 1).trim();
- conProp.setProperty(key, value);
- if (key.equals("Cache-Control") && value.equals("no-cache")) {
- nocache = true;
- } else if (key.equals("Content-type")) {
- mimeType = value;
- } else if (key.equals("Status")) {
- if (key.length() > 2) {
- try {
- statusCode = Integer.parseInt(value.substring(0, 3));
- } catch (NumberFormatException ex) {
- /* tough luck, we will just have to use 200 as default value */
- }
- }
- }
- }
- } catch (IOException ex) {
- exitValue = -1;
- }
-
- /* did the script return an exit value != 0 and still there is supposed to be
- * everything right with the HTTP status? -> change status to 500 since 200 would
- * be a lie
- */
- if (exitValue != 0 && statusCode == 200) {
- statusCode = 500;
- }
-
- targetDate = new Date(System.currentTimeMillis());
-
- if (exitValue == 0 || (cgiBody != null && !cgiBody.equals(""))) {
- httpd.sendRespondHeader(conProp, out, httpVersion, statusCode, null, mimeType, cgiBody.length(), targetDate, null, null, null, null, nocache);
- out.write(cgiBody.getBytes());
- } else {
- httpd.sendRespondError(conProp, out, exitValue, statusCode, null, httpHeader.http1_1.get(statusCode + ""), null);
- }
-
-
- } else if ((targetClass != null) && (path.endsWith(".stream"))) {
- // call rewrite-class
- requestHeader.put(httpHeader.CONNECTION_PROP_CLIENTIP, conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP));
- requestHeader.put(httpHeader.CONNECTION_PROP_PATH, path);
- //requestHeader.put(httpHeader.CONNECTION_PROP_INPUTSTREAM, body);
- //requestHeader.put(httpHeader.CONNECTION_PROP_OUTPUTSTREAM, out);
-
- httpd.sendRespondHeader(conProp, out, httpVersion, 200, null);
-
- // in case that there are no args given, args = null or empty hashmap
- /* servletProperties tp = (servlerObjects) */ invokeServlet(targetClass, requestHeader, args);
- forceConnectionClose(conProp);
- return;
- } else if (targetFile.exists() && targetFile.isFile() && targetFile.canRead()) {
- // we have found a file that can be written to the client
- // if this file uses templates, then we use the template
- // re-write - method to create an result
- String mimeType = mimeTable.getProperty(targetExt,"text/html");
- final boolean zipContent = requestHeader.acceptGzip() && httpd.shallTransportZipped("." + conProp.getProperty("EXT",""));
- if (path.endsWith("html") ||
- path.endsWith("htm") ||
- path.endsWith("xml") ||
- path.endsWith("json") ||
- path.endsWith("rdf") ||
- path.endsWith("rss") ||
- path.endsWith("csv") ||
- path.endsWith("pac") ||
- path.endsWith("src") ||
- path.endsWith("vcf") ||
- path.endsWith("/") ||
- path.equals("/robots.txt")) {
-
- /*targetFile = getLocalizedFile(path);
- if (!(targetFile.exists())) {
- // try to find that file in the htDocsPath
- File trialFile = new File(htDocsPath, path);
- if (trialFile.exists()) targetFile = trialFile;
- }*/
-
-
- // call rewrite-class
-
- if (targetClass != null) {
- // CGI-class: call the class to create a property for rewriting
- try {
- requestHeader.put(httpHeader.CONNECTION_PROP_CLIENTIP, conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP));
- requestHeader.put(httpHeader.CONNECTION_PROP_PATH, path);
- // in case that there are no args given, args = null or empty hashmap
- final Object tmp = invokeServlet(targetClass, requestHeader, args);
- if (tmp == null) {
- // if no args given, then tp will be an empty Hashtable object (not null)
- templatePatterns = new servletProperties();
- } else if (tmp instanceof servletProperties) {
- templatePatterns = (servletProperties) tmp;
- } else {
- templatePatterns = new servletProperties((serverObjects) tmp);
- }
- // check if the servlets requests authentification
- if (templatePatterns.containsKey(servletProperties.ACTION_AUTHENTICATE)) {
- // handle brute-force protection
- if (authorization != null) {
- Log.logInfo("HTTPD", "dynamic log-in for account 'admin' in http file handler for path '" + path + "' from host '" + clientIP + "'");
- final Integer attempts = serverCore.bfHost.get(clientIP);
- if (attempts == null)
- serverCore.bfHost.put(clientIP, Integer.valueOf(1));
- else
- serverCore.bfHost.put(clientIP, Integer.valueOf(attempts.intValue() + 1));
- }
- // send authentication request to browser
- final httpResponseHeader headers = getDefaultHeaders(path);
- headers.put(httpRequestHeader.WWW_AUTHENTICATE,"Basic realm=\"" + templatePatterns.get(servletProperties.ACTION_AUTHENTICATE, "") + "\"");
- httpd.sendRespondHeader(conProp,out,httpVersion,401,headers);
- return;
- } else if (templatePatterns.containsKey(servletProperties.ACTION_LOCATION)) {
- String location = templatePatterns.get(servletProperties.ACTION_LOCATION, "");
- if (location.length() == 0) location = path;
-
- final httpResponseHeader headers = getDefaultHeaders(path);
- headers.setCookieVector(templatePatterns.getOutgoingHeader().getCookieVector()); //put the cookies into the new header TODO: can we put all headerlines, without trouble?
- headers.put(httpHeader.LOCATION,location);
- httpd.sendRespondHeader(conProp,out,httpVersion,302,headers);
- return;
- }
- // add the application version, the uptime and the client name to every rewrite table
- templatePatterns.put(servletProperties.PEER_STAT_VERSION, yacyBuildProperties.getVersion());
- templatePatterns.put(servletProperties.PEER_STAT_UPTIME, ((System.currentTimeMillis() - serverCore.startupTime) / 1000) / 60); // uptime in minutes
- templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTNAME, switchboard.getConfig("peerName", "anomic"));
- templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTID, ((plasmaSwitchboard) switchboard).peers.myID());
- templatePatterns.put(servletProperties.PEER_STAT_MYTIME, DateFormatter.formatShortSecond());
- //System.out.println("respond props: " + ((tp == null) ? "null" : tp.toString())); // debug
- } catch (final InvocationTargetException e) {
- if (e.getCause() instanceof InterruptedException) {
- throw new InterruptedException(e.getCause().getMessage());
- }
-
- theLogger.logSevere("INTERNAL ERROR: " + e.toString() + ":" +
- e.getMessage() +
- " target exception at " + targetClass + ": " +
- e.getTargetException().toString() + ":" +
- e.getTargetException().getMessage(),e);
- targetClass = null;
- throw e;
- }
- nocache = true;
- }
-
- targetDate = new Date(targetFile.lastModified());
-
- // rewrite the file
- InputStream fis = null;
-
- // read the file/template
- TemplateCacheEntry templateCacheEntry = null;
- long fileSize = targetFile.length();
- if (useTemplateCache && fileSize <= 512 * 1024) {
- // read from cache
- SoftReference<TemplateCacheEntry> ref = templateCache.get(targetFile);
- if (ref != null) {
- templateCacheEntry = ref.get();
- if (templateCacheEntry == null) templateCache.remove(targetFile);
- }
-
- Date targetFileDate = new Date(targetFile.lastModified());
- if (templateCacheEntry == null || targetFileDate.after(templateCacheEntry.lastModified)) {
- // loading the content of the template file into
- // a byte array
- templateCacheEntry = new TemplateCacheEntry();
- templateCacheEntry.lastModified = targetFileDate;
- templateCacheEntry.content = FileUtils.read(targetFile);
-
- // storing the content into the cache
- ref = new SoftReference<TemplateCacheEntry>(templateCacheEntry);
- templateCache.put(targetFile, ref);
- if (theLogger.isFinest()) theLogger.logFinest("Cache MISS for file " + targetFile);
- } else {
- if (theLogger.isFinest()) theLogger.logFinest("Cache HIT for file " + targetFile);
- }
-
- // creating an inputstream needed by the template
- // rewrite function
- fis = new ByteArrayInputStream(templateCacheEntry.content);
- templateCacheEntry = null;
- } else if (fileSize <= Math.min(4 * 1024 * 1204, MemoryControl.available() / 100)) {
- // read file completely into ram, avoid that too many files are open at the same time
- fis = new ByteArrayInputStream(FileUtils.read(targetFile));
- } else {
- fis = new BufferedInputStream(new FileInputStream(targetFile));
- }
-
- if (mimeType.startsWith("text")) {
- // every text-file distributed by yacy is UTF-8
- if(!path.startsWith("/repository")) {
- mimeType = mimeType + "; charset=UTF-8";
- } else {
- // detect charset of html-files
- if((path.endsWith("html") || path.endsWith("htm"))) {
- // save position
- fis.mark(1000);
- // scrape document to look up charset
- final ScraperInputStream htmlFilter = new ScraperInputStream(fis,"UTF-8",new yacyURL("http://localhost", null),null,false);
- final String charset = htmlParser.patchCharsetEncoding(htmlFilter.detectCharset());
- if(charset != null)
- mimeType = mimeType + "; charset="+charset;
- // reset position
- fis.reset();
- }
- }
- }
-
- // write the array to the client
- // we can do that either in standard mode (whole thing completely) or in chunked mode
- // since yacy clients do not understand chunked mode (yet), we use this only for communication with the administrator
- final boolean yacyClient = requestHeader.userAgent().startsWith("yacy");
- final boolean chunked = !method.equals(httpHeader.METHOD_HEAD) && !yacyClient && httpVersion.equals(httpHeader.HTTP_VERSION_1_1);
- if (chunked) {
- // send page in chunks and parse SSIs
- final ByteBuffer o = new ByteBuffer();
- // apply templates
- httpTemplate.writeTemplate(fis, o, templatePatterns, "-UNRESOLVED_PATTERN-".getBytes("UTF-8"));
- fis.close();
- httpd.sendRespondHeader(conProp, out, httpVersion, 200, null, mimeType, -1, targetDate, null, (templatePatterns == null) ? new httpResponseHeader() : templatePatterns.getOutgoingHeader(), null, "chunked", nocache);
- // send the content in chunked parts, see RFC 2616 section 3.6.1
- final httpChunkedOutputStream chos = new httpChunkedOutputStream(out);
- httpSSI.writeSSI(o, chos, authorization, clientIP);
- //chos.write(result);
- chos.finish();
- } else {
- // send page as whole thing, SSIs are not possible
- final String contentEncoding = (zipContent) ? "gzip" : null;
- // apply templates
- final ByteBuffer o1 = new ByteBuffer();
- httpTemplate.writeTemplate(fis, o1, templatePatterns, "-UNRESOLVED_PATTERN-".getBytes("UTF-8"));
- fis.close();
- final ByteBuffer o = new ByteBuffer();
-
- if (zipContent) {
- GZIPOutputStream zippedOut = new GZIPOutputStream(o);
- httpSSI.writeSSI(o1, zippedOut, authorization, clientIP);
- //httpTemplate.writeTemplate(fis, zippedOut, tp, "-UNRESOLVED_PATTERN-".getBytes("UTF-8"));
- zippedOut.finish();
- zippedOut.flush();
- zippedOut.close();
- zippedOut = null;
- } else {
- httpSSI.writeSSI(o1, o, authorization, clientIP);
- //httpTemplate.writeTemplate(fis, o, tp, "-UNRESOLVED_PATTERN-".getBytes("UTF-8"));
- }
- if (method.equals(httpHeader.METHOD_HEAD)) {
- httpd.sendRespondHeader(conProp, out,
- httpVersion, 200, null, mimeType, o.length(),
- targetDate, null, (templatePatterns == null) ? new httpResponseHeader() : templatePatterns.getOutgoingHeader(),
- contentEncoding, null, nocache);
- } else {
- final byte[] result = o.getBytes(); // this interrupts streaming (bad idea!)
- httpd.sendRespondHeader(conProp, out,
- httpVersion, 200, null, mimeType, result.length,
- targetDate, null, (templatePatterns == null) ? new httpResponseHeader() : templatePatterns.getOutgoingHeader(),
- contentEncoding, null, nocache);
- FileUtils.copy(result, out);
- }
- }
- } else { // no html
-
- int statusCode = 200;
- int rangeStartOffset = 0;
- httpResponseHeader header = new httpResponseHeader();
-
- // adding the accept ranges header
- header.put(httpHeader.ACCEPT_RANGES, "bytes");
-
- // reading the files md5 hash if availabe and use it as ETAG of the resource
- String targetMD5 = null;
- final File targetMd5File = new File(targetFile + ".md5");
- try {
- if (targetMd5File.exists()) {
- //String description = null;
- targetMD5 = new String(FileUtils.read(targetMd5File));
- int pos = targetMD5.indexOf('\n');
- if (pos >= 0) {
- //description = targetMD5.substring(pos + 1);
- targetMD5 = targetMD5.substring(0, pos);
- }
-
- // using the checksum as ETAG header
- header.put(httpHeader.ETAG, targetMD5);
- }
- } catch (final IOException e) {
- e.printStackTrace();
- }
-
- if (requestHeader.containsKey(httpHeader.RANGE)) {
- final Object ifRange = requestHeader.ifRange();
- if ((ifRange == null)||
- (ifRange instanceof Date && targetFile.lastModified() == ((Date)ifRange).getTime()) ||
- (ifRange instanceof String && ifRange.equals(targetMD5))) {
- final String rangeHeaderVal = requestHeader.get(httpHeader.RANGE).trim();
- if (rangeHeaderVal.startsWith("bytes=")) {
- final String rangesVal = rangeHeaderVal.substring("bytes=".length());
- final String[] ranges = rangesVal.split(",");
- if ((ranges.length == 1)&&(ranges[0].endsWith("-"))) {
- rangeStartOffset = Integer.valueOf(ranges[0].substring(0,ranges[0].length()-1)).intValue();
- statusCode = 206;
- if (header == null) header = new httpResponseHeader();
- header.put(httpHeader.CONTENT_RANGE, "bytes " + rangeStartOffset + "-" + (targetFile.length()-1) + "/" + targetFile.length());
- }
- }
- }
- }
-
- // write the file to the client
- targetDate = new Date(targetFile.lastModified());
- final long contentLength = (zipContent)?-1:targetFile.length()-rangeStartOffset;
- final String contentEncoding = (zipContent) ? "gzip" : null;
- final String transferEncoding = (httpVersion.equals(httpHeader.HTTP_VERSION_1_1) && zipContent) ? "chunked" : null;
- if (!httpVersion.equals(httpHeader.HTTP_VERSION_1_1) && zipContent) forceConnectionClose(conProp);
-
- httpd.sendRespondHeader(conProp, out, httpVersion, statusCode, null, mimeType, contentLength, targetDate, null, header, contentEncoding, transferEncoding, nocache);
-
- if (!method.equals(httpHeader.METHOD_HEAD)) {
- httpChunkedOutputStream chunkedOut = null;
- GZIPOutputStream zipped = null;
- OutputStream newOut = out;
-
- if (transferEncoding != null) {
- chunkedOut = new httpChunkedOutputStream(newOut);
- newOut = chunkedOut;
- }
- if (contentEncoding != null) {
- zipped = new GZIPOutputStream(newOut);
- newOut = zipped;
- }
-
- FileUtils.copyRange(targetFile, newOut, rangeStartOffset);
-
- if (zipped != null) {
- zipped.flush();
- zipped.finish();
- }
- if (chunkedOut != null) {
- chunkedOut.finish();
- }
-
- // flush all
- try {newOut.flush();}catch (final Exception e) {}
-
- // wait a little time until everything closes so that clients can read from the streams/sockets
- if ((contentLength >= 0) && (requestHeader.get(httpRequestHeader.CONNECTION, "close")).indexOf("keep-alive") == -1) {
- // in case that the client knows the size in advance (contentLength present) the waiting will have no effect on the interface performance
- // but if the client waits on a connection interruption this will slow down.
- try {Thread.sleep(2000);} catch (final InterruptedException e) {} // FIXME: is this necessary?
- }
- }
-
- // check mime type again using the result array: these are 'magics'
-// if (serverByteBuffer.equals(result, 1, "PNG".getBytes())) mimeType = mimeTable.getProperty("png","text/html");
-// else if (serverByteBuffer.equals(result, 0, "GIF89".getBytes())) mimeType = mimeTable.getProperty("gif","text/html");
-// else if (serverByteBuffer.equals(result, 6, "JFIF".getBytes())) mimeType = mimeTable.getProperty("jpg","text/html");
- //System.out.print("MAGIC:"); for (int i = 0; i < 10; i++) System.out.print(Integer.toHexString((int) result[i]) + ","); System.out.println();
- }
- } else {
- httpd.sendRespondError(conProp,out,3,404,"File not Found",null,null);
- return;
- }
- } catch (final Exception e) {
- try {
- // doing some errorhandling ...
- //e.printStackTrace();
- int httpStatusCode = 400;
- final String httpStatusText = null;
- final StringBuilder errorMessage = new StringBuilder(2000);
- Exception errorExc = null;
-
- final String errorMsg = e.getMessage();
- if (
- (e instanceof InterruptedException) ||
- ((errorMsg != null) && (errorMsg.startsWith("Socket closed")) && (Thread.currentThread().isInterrupted()))
- ) {
- errorMessage.append("Interruption detected while processing query.");
- httpStatusCode = 503;
- } else {
- if ((errorMsg != null) &&
- (
- errorMsg.contains("Broken pipe") ||
- errorMsg.contains("Connection reset") ||
- errorMsg.contains("Software caused connection abort")
- )) {
- // client closed the connection, so we just end silently
- errorMessage.append("Client unexpectedly closed connection while processing query.");
- } else if ((errorMsg != null) && (errorMsg.startsWith("Connection timed out"))) {
- errorMessage.append("Connection timed out.");
- } else {
- errorMessage.append("Unexpected error while processing query.");
- httpStatusCode = 500;
- errorExc = e;
- }
- }
-
- errorMessage.append("\nSession: ").append(Thread.currentThread().getName())
- .append("\nQuery: ").append(path)
- .append("\nClient: ").append(conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP,"unknown"))
- .append("\nReason: ").append(e.toString());
-
- if (!conProp.containsKey(httpHeader.CONNECTION_PROP_PROXY_RESPOND_HEADER)) {
- // sending back an error message to the client
- // if we have not already send an http header
- httpd.sendRespondError(conProp,out, 4, httpStatusCode, httpStatusText, new String(errorMessage),errorExc);
- } else {
- // otherwise we close the connection
- forceConnectionClose(conProp);
- }
-
- // if it is an unexpected error we log it
- if (httpStatusCode == 500) {
- theLogger.logWarning(new String(errorMessage),e);
- }
-
- } catch (final Exception ee) {
- forceConnectionClose(conProp);
- }
-
- } finally {
- try {out.flush();}catch (final Exception e) {}
- }
- }
-
- public static final File getOverlayedClass(final String path) {
- File targetClass;
- targetClass = rewriteClassFile(new File(htDefaultPath, path)); //works for default and localized files
- if (targetClass == null || !targetClass.exists()) {
- //works for htdocs
- targetClass=rewriteClassFile(new File(htDocsPath, path));
- }
- return targetClass;
- }
-
- public static final File getOverlayedFile(final String path) {
- File targetFile;
- targetFile = getLocalizedFile(path);
- if (!targetFile.exists()) {
- targetFile = new File(htDocsPath, path);
- }
- return targetFile;
- }
-
- private static final void forceConnectionClose(final Properties conprop) {
- if (conprop != null) {
- conprop.setProperty(httpHeader.CONNECTION_PROP_PERSISTENT,"close");
- }
- }
-
- private static final File rewriteClassFile(final File template) {
- try {
- String f = template.getCanonicalPath();
- final int p = f.lastIndexOf(".");
- if (p < 0) return null;
- f = f.substring(0, p) + ".class";
- //System.out.println("constructed class path " + f);
- final File cf = new File(f);
- if (cf.exists()) return cf;
- return null;
- } catch (final IOException e) {
- return null;
- }
- }
-
- private static final Method rewriteMethod(final File classFile) {
- Method m = null;
- // now make a class out of the stream
- try {
- if (useTemplateCache) {
- final SoftReference<Method> ref = templateMethodCache.get(classFile);
- if (ref != null) {
- m = ref.get();
- if (m == null) {
- templateMethodCache.remove(classFile);
- } else {
- return m;
- }
- }
- }
-
- final Class<?> c = provider.loadClass(classFile);
- final Class<?>[] params = new Class[] {
- httpRequestHeader.class,
- serverObjects.class,
- serverSwitch.class };
- m = c.getMethod("respond", params);
-
- if (useTemplateCache) {
- // storing the method into the cache
- final SoftReference<Method> ref = new SoftReference<Method>(m);
- templateMethodCache.put(classFile, ref);
- }
-
- } catch (final ClassNotFoundException e) {
- System.out.println("INTERNAL ERROR: class " + classFile + " is missing:" + e.getMessage());
- } catch (final NoSuchMethodException e) {
- System.out.println("INTERNAL ERROR: method respond not found in class " + classFile + ": " + e.getMessage());
- }
- //System.out.println("found method: " + m.toString());
- return m;
- }
-
- public static final Object invokeServlet(final File targetClass, final httpRequestHeader request, final serverObjects args) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
- Object result;
- if (safeServletsMode) synchronized (switchboard) {
- result = rewriteMethod(targetClass).invoke(null, new Object[] {request, args, switchboard});
- } else {
- result = rewriteMethod(targetClass).invoke(null, new Object[] {request, args, switchboard});
- }
- return result;
- }
-
- /**
- * Tells if a filename ends with a suffix from a given list.
- * @param filename the filename
- * @param suffixList the list of suffixes which is a string of suffixes separated by commas
- * @return true if the filename ends with a suffix from the list, else false
- */
- private static boolean matchesSuffix(String name, String suffixList) {
- boolean ret = false;
-
- if (suffixList != null && name != null) {
- String[] suffixes = suffixList.split(",");
- find:
- for (int i = 0; i < suffixes.length; i++) {
- if (name.endsWith("." + suffixes[i].trim())) {
- ret = true;
- break find;
- }
- }
- }
-
- return ret;
- }
-
-}
+// httpdFileHandler.java
+// -----------------------
+// (C) by Michael Peter Christen; [email protected]
+// first published on http://www.anomic.de
+// Frankfurt, Germany, 2004, 2005
+// last major change: 01.01.2009
+//
+// CGI additions by Marc Nause
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+/*
+ Class documentation:
+ this class provides a file servlet and CGI interface
+ for the httpd server.
+ Whenever this server is addressed to load a local file,
+ this class searches for the file in the local path as
+ configured in the setting property 'rootPath'
+ The servlet loads the file and returns it to the client.
+ Every file can also act as an template for the built-in
+ CGI interface. There is no specific path for CGI functions.
+ CGI functionality is triggered, if for the file to-be-served
+ 'template.html' also a file 'template.class' exists. Then,
+ the class file is called with the GET/POST properties that
+ are attached to the http call.
+ Possible variable hand-over are:
+ - form method GET
+ - form method POST, enctype text/plain
+ - form method POST, enctype multipart/form-data
+ The class that creates the CGI respond must have at least one
+ static method of the form
+ public static java.util.Hashtable respond(java.util.HashMap, serverSwitch)
+ In the HashMap, the GET/POST variables are handed over.
+ The return value is a Property object that contains replacement
+ key/value pairs for the patterns in the template file.
+ The templates must have the form
+ either '#['<name>']#' for single attributes, or
+ '#{'<enumname>'}#' and '#{/'<enumname>'}#' for enumerations of
+ values '#['<value>']#'.
+ A single value in repetitions/enumerations in the template has
+ the property key '_'<enumname><count>'_'<value>
+ Please see also the example files 'test.html' and 'test.java'
+ */
+
+package de.anomic.http.server;
+
+import java.awt.Image;
+import java.awt.image.BufferedImage;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.lang.ref.SoftReference;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.InetAddress;
+import java.net.URLDecoder;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.zip.GZIPOutputStream;
+
+import de.anomic.document.Classification;
+import de.anomic.document.parser.htmlParser;
+import de.anomic.document.parser.html.ContentScraper;
+import de.anomic.document.parser.html.ScraperInputStream;
+import de.anomic.http.io.ChunkedOutputStream;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.metadata.ResponseHeader;
+import de.anomic.kelondro.util.ByteBuffer;
+import de.anomic.kelondro.util.DateFormatter;
+import de.anomic.kelondro.util.FileUtils;
+import de.anomic.kelondro.util.MemoryControl;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
+import de.anomic.server.serverClassLoader;
+import de.anomic.server.serverCore;
+import de.anomic.server.serverObjects;
+import de.anomic.server.serverSwitch;
+import de.anomic.server.servletProperties;
+import de.anomic.yacy.yacyBuildProperties;
+import de.anomic.yacy.yacyURL;
+import de.anomic.yacy.logging.Log;
+import de.anomic.ymage.ymageMatrix;
+
+public final class HTTPDFileHandler {
+
+ private static final boolean safeServletsMode = false; // if true then all servlets are called synchronized
+
+ private static final Properties mimeTable = new Properties();
+ // create a class loader
+ private static final serverClassLoader provider = new serverClassLoader(/*this.getClass().getClassLoader()*/);
+ private static serverSwitch switchboard = null;
+ private static Switchboard sb = Switchboard.getSwitchboard();
+
+ private static File htRootPath = null;
+ private static File htDocsPath = null;
+ private static File htTemplatePath = null;
+ private static String[] defaultFiles = null;
+ private static File htDefaultPath = null;
+ private static File htLocalePath = null;
+
+ protected static final class TemplateCacheEntry {
+ Date lastModified;
+ byte[] content;
+ }
+ private static final ConcurrentHashMap<File, SoftReference<TemplateCacheEntry>> templateCache;
+ private static final ConcurrentHashMap<File, SoftReference<Method>> templateMethodCache;
+
+ public static final boolean useTemplateCache;
+
+ //private Properties connectionProperties = null;
+ // creating a logger
+ private static final Log theLogger = new Log("FILEHANDLER");
+
+ static {
+ final serverSwitch theSwitchboard = Switchboard.getSwitchboard();
+ useTemplateCache = theSwitchboard.getConfig("enableTemplateCache","true").equalsIgnoreCase("true");
+ templateCache = (useTemplateCache)? new ConcurrentHashMap<File, SoftReference<TemplateCacheEntry>>() : new ConcurrentHashMap<File, SoftReference<TemplateCacheEntry>>(0);
+ templateMethodCache = (useTemplateCache) ? new ConcurrentHashMap<File, SoftReference<Method>>() : new ConcurrentHashMap<File, SoftReference<Method>>(0);
+
+ if (switchboard == null) {
+ switchboard = theSwitchboard;
+
+ if (mimeTable.size() == 0) {
+ // load the mime table
+ final String mimeTablePath = theSwitchboard.getConfig("mimeConfig","");
+ BufferedInputStream mimeTableInputStream = null;
+ try {
+ Log.logConfig("HTTPDFiles", "Loading mime mapping file " + mimeTablePath);
+ mimeTableInputStream = new BufferedInputStream(new FileInputStream(new File(theSwitchboard.getRootPath(), mimeTablePath)));
+ mimeTable.load(mimeTableInputStream);
+ } catch (final Exception e) {
+ Log.logSevere("HTTPDFiles", "ERROR: path to configuration file or configuration invalid\n" + e);
+ System.exit(1);
+ } finally {
+ if (mimeTableInputStream != null) try { mimeTableInputStream.close(); } catch (final Exception e1) {}
+ }
+ }
+
+ // create default files array
+ initDefaultPath();
+
+ // create a htRootPath: system pages
+ if (htRootPath == null) {
+ htRootPath = new File(theSwitchboard.getRootPath(), theSwitchboard.getConfig(SwitchboardConstants.HTROOT_PATH, SwitchboardConstants.HTROOT_PATH_DEFAULT));
+ if (!(htRootPath.exists())) htRootPath.mkdir();
+ }
+
+ // create a htDocsPath: user defined pages
+ if (htDocsPath == null) {
+ htDocsPath = theSwitchboard.getConfigPath(SwitchboardConstants.HTDOCS_PATH, SwitchboardConstants.HTDOCS_PATH_DEFAULT);
+ if (!(htDocsPath.exists())) htDocsPath.mkdirs();
+ }
+
+ // create a repository path
+ final File repository = new File(htDocsPath, "repository");
+ if (!repository.exists()) repository.mkdirs();
+
+ // create a htTemplatePath
+ if (htTemplatePath == null) {
+ htTemplatePath = theSwitchboard.getConfigPath("htTemplatePath","htroot/env/templates");
+ if (!(htTemplatePath.exists())) htTemplatePath.mkdir();
+ }
+ //This is now handles by #%env/templates/foo%#
+ //if (templates.size() == 0) templates.putAll(httpTemplate.loadTemplates(htTemplatePath));
+
+ // create htLocaleDefault, htLocalePath
+ if (htDefaultPath == null) htDefaultPath = theSwitchboard.getConfigPath("htDefaultPath", "htroot");
+ if (htLocalePath == null) htLocalePath = theSwitchboard.getConfigPath("locale.translated_html", "DATA/LOCALE/htroot");
+ }
+
+ }
+
+ public static final void initDefaultPath() {
+ // create default files array
+ defaultFiles = switchboard.getConfig("defaultFiles","index.html").split(",");
+ if (defaultFiles.length == 0) defaultFiles = new String[] {"index.html"};
+ }
+
+ /** Returns a path to the localized or default file according to the locale.language (from he switchboard)
+ * @param path relative from htroot */
+ public static File getLocalizedFile(final String path){
+ return getLocalizedFile(path, switchboard.getConfig("locale.language","default"));
+ }
+
+ /** Returns a path to the localized or default file according to the parameter localeSelection
+ * @param path relative from htroot
+ * @param localeSelection language of localized file; locale.language from switchboard is used if localeSelection.equals("") */
+ public static File getLocalizedFile(final String path, final String localeSelection){
+ //if (htDefaultPath == null) htDefaultPath = switchboard.getConfigPath("htDefaultPath", "htroot");
+ //if (htLocalePath == null) htLocalePath = switchboard.getConfigPath("locale.translated_html", "DATA/LOCALE/htroot");
+ //if (htDocsPath == null) htDocsPath = switchboard.getConfigPath(plasmaSwitchboardConstants.HTDOCS_PATH, plasmaSwitchboardConstants.HTDOCS_PATH_DEFAULT);
+
+ if (path.startsWith("/repository/"))
+ return new File(switchboard.getConfig("repositoryPath", "DATA/HTDOCS/repository"), path.substring(11));
+ if (!(localeSelection.equals("default"))) {
+ final File localePath = new File(htLocalePath, localeSelection + '/' + path);
+ if (localePath.exists()) return localePath; // avoid "NoSuchFile" troubles if the "localeSelection" is misspelled
+ }
+
+ File docsPath = new File(htDocsPath, path);
+ if (docsPath.exists()) return docsPath;
+ return new File(htDefaultPath, path);
+ }
+
+ private static final ResponseHeader getDefaultHeaders(final String path) {
+ final ResponseHeader headers = new ResponseHeader();
+ String ext;
+ int pos;
+ if ((pos = path.lastIndexOf('.')) < 0) {
+ ext = "";
+ } else {
+ ext = path.substring(pos + 1).toLowerCase();
+ }
+ headers.put(HeaderFramework.SERVER, "AnomicHTTPD (www.anomic.de)");
+ headers.put(HeaderFramework.DATE, DateFormatter.formatRFC1123(new Date()));
+ if(!(Classification.isMediaExtension(ext))){
+ headers.put(HeaderFramework.PRAGMA, "no-cache");
+ }
+ return headers;
+ }
+
+ public static void doGet(final Properties conProp, final RequestHeader requestHeader, final OutputStream response) {
+ doResponse(conProp, requestHeader, response, null);
+ }
+
+ public static void doHead(final Properties conProp, final RequestHeader requestHeader, final OutputStream response) {
+ doResponse(conProp, requestHeader, response, null);
+ }
+
+ public static void doPost(final Properties conProp, final RequestHeader requestHeader, final OutputStream response, final InputStream body) {
+ doResponse(conProp, requestHeader, response, body);
+ }
+
+ public static void doResponse(final Properties conProp, final RequestHeader requestHeader, final OutputStream out, final InputStream body) {
+
+ String path = null;
+ try {
+ // getting some connection properties
+ final String method = conProp.getProperty(HeaderFramework.CONNECTION_PROP_METHOD);
+ path = conProp.getProperty(HeaderFramework.CONNECTION_PROP_PATH);
+ String argsString = conProp.getProperty(HeaderFramework.CONNECTION_PROP_ARGS); // is null if no args were given
+ final String httpVersion = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HTTP_VER);
+ final String clientIP = conProp.getProperty(HeaderFramework.CONNECTION_PROP_CLIENTIP, "unknown-host");
+
+ // check hack attacks in path
+ if (path.indexOf("..") >= 0) {
+ HTTPDemon.sendRespondError(conProp,out,4,403,null,"Access not allowed",null);
+ return;
+ }
+
+ // url decoding of path
+ try {
+ path = URLDecoder.decode(path, "UTF-8");
+ } catch (final UnsupportedEncodingException e) {
+ // This should never occur
+ assert(false) : "UnsupportedEncodingException: " + e.getMessage();
+ }
+
+ // check against hack attacks in path
+ if (path.indexOf("..") >= 0) {
+ HTTPDemon.sendRespondError(conProp,out,4,403,null,"Access not allowed",null);
+ return;
+ }
+
+ // check permission/granted access
+ String authorization = requestHeader.get(RequestHeader.AUTHORIZATION);
+ if (authorization != null && authorization.length() == 0) authorization = null;
+ final String adminAccountBase64MD5 = switchboard.getConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, "");
+
+ // a bad patch to map the /xml/ path to /api/
+ if (path.startsWith("/xml/")) {
+ path = "/api/" + path.substring(5);
+ }
+
+ final boolean adminAccountForLocalhost = sb.getConfigBool("adminAccountForLocalhost", false);
+ final String refererHost = requestHeader.refererHost();
+ final boolean accessFromLocalhost = serverCore.isLocalhost(clientIP) && (refererHost.length() == 0 || serverCore.isLocalhost(refererHost));
+ final boolean grantedForLocalhost = adminAccountForLocalhost && accessFromLocalhost;
+ final boolean protectedPage = path.indexOf("_p.") > 0;
+ final boolean accountEmpty = adminAccountBase64MD5.length() == 0;
+
+ if (!grantedForLocalhost && protectedPage && !accountEmpty) {
+ // authentication required
+ if (authorization == null) {
+ // no authorization given in response. Ask for that
+ final ResponseHeader responseHeader = getDefaultHeaders(path);
+ responseHeader.put(RequestHeader.WWW_AUTHENTICATE,"Basic realm=\"admin log-in\"");
+ //httpd.sendRespondHeader(conProp,out,httpVersion,401,headers);
+ final servletProperties tp=new servletProperties();
+ tp.put("returnto", path);
+ //TODO: separate error page Wrong Login / No Login
+ HTTPDemon.sendRespondError(conProp, out, 5, 401, "Wrong Authentication", "", new File("proxymsg/authfail.inc"), tp, null, responseHeader);
+ return;
+ } else if (
+ (HTTPDemon.staticAdminAuthenticated(authorization.trim().substring(6), switchboard) == 4) ||
+ (sb.userDB.hasAdminRight(authorization, requestHeader.getHeaderCookies()))) {
+ //Authentication successful. remove brute-force flag
+ serverCore.bfHost.remove(conProp.getProperty(HeaderFramework.CONNECTION_PROP_CLIENTIP));
+ } else {
+ // a wrong authentication was given or the userDB user does not have admin access. Ask again
+ Log.logInfo("HTTPD", "Wrong log-in for account 'admin' in http file handler for path '" + path + "' from host '" + clientIP + "'");
+ final Integer attempts = serverCore.bfHost.get(clientIP);
+ if (attempts == null)
+ serverCore.bfHost.put(clientIP, Integer.valueOf(1));
+ else
+ serverCore.bfHost.put(clientIP, Integer.valueOf(attempts.intValue() + 1));
+
+ final ResponseHeader headers = getDefaultHeaders(path);
+ headers.put(RequestHeader.WWW_AUTHENTICATE,"Basic realm=\"admin log-in\"");
+ HTTPDemon.sendRespondHeader(conProp,out,httpVersion,401,headers);
+ return;
+ }
+ }
+
+ // parse arguments
+ serverObjects args = new serverObjects();
+ int argc = 0;
+ if (argsString == null) {
+ // no args here, maybe a POST with multipart extension
+ int length = requestHeader.getContentLength();
+ //System.out.println("HEADER: " + requestHeader.toString()); // DEBUG
+
+ /* don't parse body in case of a POST CGI call since it has to be
+ * handed over to the CGI script unaltered and parsed by the script
+ */
+ if (method.equals(HeaderFramework.METHOD_POST) &&
+ !(switchboard.getConfigBool("cgi.allow", false) &&
+ matchesSuffix(path, switchboard.getConfig("cgi.suffixes", null)))
+ ) {
+
+ // if its a POST, it can be either multipart or as args in the body
+ if ((requestHeader.containsKey(HeaderFramework.CONTENT_TYPE)) &&
+ (requestHeader.get(HeaderFramework.CONTENT_TYPE).toLowerCase().startsWith("multipart"))) {
+ // parse multipart
+ final HashMap<String, byte[]> files = HTTPDemon.parseMultipart(requestHeader, args, body);
+ // integrate these files into the args
+ if (files != null) {
+ final Iterator<Map.Entry<String, byte[]>> fit = files.entrySet().iterator();
+ Map.Entry<String, byte[]> entry;
+ while (fit.hasNext()) {
+ entry = fit.next();
+ args.put(entry.getKey() + "$file", entry.getValue());
+ }
+ }
+ argc = Integer.parseInt(requestHeader.get("ARGC"));
+ } else {
+ // parse args in body
+ argc = HTTPDemon.parseArgs(args, body, length);
+ }
+ } else {
+ // no args
+ argsString = null;
+ args = null;
+ argc = 0;
+ }
+ } else {
+ // simple args in URL (stuff after the "?")
+ argc = HTTPDemon.parseArgs(args, argsString);
+ }
+
+ // check for cross site scripting - attacks in request arguments
+ if (args != null && argc > 0) {
+ // check all values for occurrences of script values
+ final Iterator<String> e = args.values().iterator(); // enumeration of values
+ String val;
+ while (e.hasNext()) {
+ val = e.next();
+ if ((val != null) && (val.indexOf("<script") >= 0) && !path.equals("/WatchCrawler_p.html")) {
+ // deny request
+ HTTPDemon.sendRespondError(conProp,out,4,403,null,"bad post values",null);
+ return;
+ }
+ }
+ }
+
+ // we are finished with parsing
+ // the result of value hand-over is in args and argc
+ if (path.length() == 0) {
+ HTTPDemon.sendRespondError(conProp,out,4,400,null,"Bad Request",null);
+ out.flush();
+ return;
+ }
+ File targetClass=null;
+
+ // locate the file
+ if (!path.startsWith("/") && !path.startsWith("\\")) path = "/" + path; // attach leading slash
+
+ // a different language can be desired (by i.e. ConfigBasic.html) than the one stored in the locale.language
+ String localeSelection = switchboard.getConfig("locale.language","default");
+ if (args != null && (args.containsKey("language"))) {
+ // TODO 9.11.06 Bost: a class with information about available languages is needed.
+ // the indexOf(".") is just a workaround because there from ConfigLanguage.html commes "de.lng" and
+ // from ConfigBasic.html comes just "de" in the "language" parameter
+ localeSelection = args.get("language", localeSelection);
+ if (localeSelection.indexOf(".") != -1)
+ localeSelection = localeSelection.substring(0, localeSelection.indexOf("."));
+ }
+
+ File targetFile = getLocalizedFile(path, localeSelection);
+ final String targetExt = conProp.getProperty("EXT","");
+ targetClass = rewriteClassFile(new File(htDefaultPath, path));
+ if (path.endsWith("/") || path.endsWith("\\")) {
+ String testpath;
+ // attach default file name
+ for (int i = 0; i < defaultFiles.length; i++) {
+ testpath = path + defaultFiles[i];
+ targetFile = getOverlayedFile(testpath);
+ targetClass = getOverlayedClass(testpath);
+ if (targetFile.exists()) {
+ path = testpath;
+ break;
+ }
+ }
+ targetFile = getLocalizedFile(path, localeSelection);
+
+ //no defaultfile, send a dirlisting
+ if (targetFile == null || !targetFile.exists() || (targetFile.exists() && targetFile.isDirectory())) {
+ final StringBuilder aBuffer = new StringBuilder();
+ aBuffer.append("<html>\n<head>\n</head>\n<body>\n<h1>Index of " + path + "</h1>\n <ul>\n");
+ String[] list = targetFile.list();
+ if (list == null) list = new String[0]; // should not occur!
+ File f;
+ String size;
+ long sz;
+ String headline, author, description;
+ int images, links;
+ ContentScraper scraper;
+ for (int i = 0; i < list.length; i++) {
+ f = new File(targetFile, list[i]);
+ if (f.isDirectory()) {
+ aBuffer.append(" <li><a href=\"" + path + list[i] + "/\">" + list[i] + "/</a><br></li>\n");
+ } else {
+ if (list[i].endsWith("html") || (list[i].endsWith("htm"))) {
+ scraper = ContentScraper.parseResource(f);
+ headline = scraper.getTitle();
+ author = scraper.getAuthor();
+ description = scraper.getDescription();
+ images = scraper.getImages().size();
+ links = scraper.getAnchors().size();
+ } else {
+ headline = null;
+ author = null;
+ description = null;
+ images = 0;
+ links = 0;
+ }
+ sz = f.length();
+ if (sz < 1024) {
+ size = sz + " bytes";
+ } else if (sz < 1024 * 1024) {
+ size = (sz / 1024) + " KB";
+ } else {
+ size = (sz / 1024 / 1024) + " MB";
+ }
+ aBuffer.append(" <li>");
+ if ((headline != null) && (headline.length() > 0)) aBuffer.append("<a href=\"" + list[i] + "\"><b>" + headline + "</b></a><br>");
+ aBuffer.append("<a href=\"" + path + list[i] + "\">" + list[i] + "</a><br>");
+ if ((author != null) && (author.length() > 0)) aBuffer.append("Author: " + author + "<br>");
+ if ((description != null) && (description.length() > 0)) aBuffer.append("Description: " + description + "<br>");
+ aBuffer.append(DateFormatter.formatShortDay(new Date(f.lastModified())) + ", " + size + ((images > 0) ? ", " + images + " images" : "") + ((links > 0) ? ", " + links + " links" : "") + "<br></li>\n");
+ }
+ }
+ aBuffer.append(" </ul>\n</body>\n</html>\n");
+
+ // write the list to the client
+ HTTPDemon.sendRespondHeader(conProp, out, httpVersion, 200, null, "text/html; charset=UTF-8", aBuffer.length(), new Date(targetFile.lastModified()), null, new ResponseHeader(), null, null, true);
+ if (!method.equals(HeaderFramework.METHOD_HEAD)) {
+ out.write(aBuffer.toString().getBytes("UTF-8"));
+ }
+ return;
+ }
+ } else {
+ //XXX: you cannot share a .png/.gif file with a name like a class in htroot.
+ if ( !(targetFile.exists()) &&
+ !((path.endsWith("png")||path.endsWith("gif") ||
+ matchesSuffix(path, switchboard.getConfig("cgi.suffixes", null)) ||
+ path.endsWith(".stream")) &&
+ targetClass!=null ) ){
+ targetFile = new File(htDocsPath, path);
+ targetClass = rewriteClassFile(new File(htDocsPath, path));
+ }
+ }
+
+ //File targetClass = rewriteClassFile(targetFile);
+ //We need tp here
+ servletProperties templatePatterns = null;
+ Date targetDate;
+ boolean nocache = false;
+
+ if ((targetClass != null) && (path.endsWith("png"))) {
+ // call an image-servlet to produce an on-the-fly - generated image
+ Object img = null;
+ try {
+ requestHeader.put(HeaderFramework.CONNECTION_PROP_CLIENTIP, conProp.getProperty(HeaderFramework.CONNECTION_PROP_CLIENTIP));
+ requestHeader.put(HeaderFramework.CONNECTION_PROP_PATH, path);
+ // in case that there are no args given, args = null or empty hashmap
+ img = invokeServlet(targetClass, requestHeader, args);
+ } catch (final InvocationTargetException e) {
+ theLogger.logSevere("INTERNAL ERROR: " + e.toString() + ":" +
+ e.getMessage() +
+ " target exception at " + targetClass + ": " +
+ e.getTargetException().toString() + ":" +
+ e.getTargetException().getMessage() +
+ "; java.awt.graphicsenv='" + System.getProperty("java.awt.graphicsenv","") + "'");
+ e.printStackTrace();
+ e.getTargetException().printStackTrace();
+ targetClass = null;
+ }
+ if (img == null) {
+ // error with image generation; send file-not-found
+ HTTPDemon.sendRespondError(conProp, out, 3, 404, "File not Found", null, null);
+ } else {
+ if (img instanceof ymageMatrix) {
+ final ymageMatrix yp = (ymageMatrix) img;
+ // send an image to client
+ targetDate = new Date(System.currentTimeMillis());
+ nocache = true;
+ final String mimeType = mimeTable.getProperty(targetExt, "text/html");
+ final ByteBuffer result = ymageMatrix.exportImage(yp.getImage(), targetExt);
+
+ // write the array to the client
+ HTTPDemon.sendRespondHeader(conProp, out, httpVersion, 200, null, mimeType, result.length(), targetDate, null, null, null, null, nocache);
+ if (!method.equals(HeaderFramework.METHOD_HEAD)) {
+ result.writeTo(out);
+ }
+ }
+ if (img instanceof Image) {
+ final Image i = (Image) img;
+ // send an image to client
+ targetDate = new Date(System.currentTimeMillis());
+ nocache = true;
+ final String mimeType = mimeTable.getProperty(targetExt, "text/html");
+
+ // generate an byte array from the generated image
+ int width = i.getWidth(null); if (width < 0) width = 96; // bad hack
+ int height = i.getHeight(null); if (height < 0) height = 96; // bad hack
+ final BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+ bi.createGraphics().drawImage(i, 0, 0, width, height, null);
+ final ByteBuffer result = ymageMatrix.exportImage(bi, targetExt);
+
+ // write the array to the client
+ HTTPDemon.sendRespondHeader(conProp, out, httpVersion, 200, null, mimeType, result.length(), targetDate, null, null, null, null, nocache);
+ if (!method.equals(HeaderFramework.METHOD_HEAD)) {
+ result.writeTo(out);
+ }
+ }
+ }
+ } else if (((switchboard.getConfigBool("cgi.allow", false)) && // check if CGI execution is allowed in config
+ (matchesSuffix(path, switchboard.getConfig("cgi.suffixes", null))) && // "right" file extension?
+ (path.substring(0, path.indexOf(targetFile.getName())).contains("/CGI-BIN/") ||
+ path.substring(0, path.indexOf(targetFile.getName())).contains("/cgi-bin/")) && // file in right directory?
+ targetFile.exists())
+ ) {
+
+ String mimeType = "text/html";
+ int statusCode = 200;
+
+ ProcessBuilder pb;
+
+ pb = new ProcessBuilder(targetFile.getAbsolutePath());
+
+ String fileSeparator = System.getProperty("file.separator", "/");
+
+ // set environment variables
+ Map<String, String> env = pb.environment();
+ env.put("SERVER_SOFTWARE", getDefaultHeaders(path).get(HeaderFramework.SERVER));
+ env.put("SERVER_NAME", switchboard.getConfig("peerName", "<nameless>"));
+ env.put("GATEWAY_INTERFACE", "CGI/1.1");
+ if (httpVersion != null) {
+ env.put("SERVER_PROTOCOL", httpVersion);
+ }
+ env.put("SERVER_PORT", switchboard.getConfig("port", "8080"));
+ env.put("REQUEST_METHOD", method);
+// env.put("PATH_INFO", ""); // TODO: implement
+// env.put("PATH_TRANSLATED", ""); // TODO: implement
+ env.put("SCRIPT_NAME", path);
+ if (argsString != null) {
+ env.put("QUERY_STRING", argsString);
+ }
+ env.put("REMOTE_HOST", InetAddress.getByName(clientIP).getHostName());
+ env.put("REMOTE_ADDR", clientIP);
+// env.put("AUTH_TYPE", ""); // TODO: implement
+// env.put("REMOTE_USER", ""); // TODO: implement
+// env.put("REMOTE_IDENT", ""); // I don't think we need this
+ env.put("DOCUMENT_ROOT", switchboard.getRootPath().getAbsolutePath() + fileSeparator + switchboard.getConfig("htDocsPath", "DATA/HTDOCS"));
+ if (requestHeader.getContentType() != null) {
+ env.put("CONTENT_TYPE", requestHeader.getContentType());
+ }
+ if (method.equalsIgnoreCase(HeaderFramework.METHOD_POST) && body != null) {
+ env.put("CONTENT_LENGTH", requestHeader.getContentLength() + "");
+ }
+
+ // add values from request header to environment (see: http://hoohoo.ncsa.uiuc.edu/cgi/env.html#headers)
+ for (Map.Entry<String, String> requestHeaderEntry : requestHeader.entrySet()) {
+ env.put("HTTP_" + requestHeaderEntry.getKey().toUpperCase().replace("-", "_"), requestHeaderEntry.getValue());
+ }
+
+ int exitValue = 0;
+ String cgiBody = null;
+
+ try {
+ // start execution of script
+ Process p = pb.start();
+
+ OutputStream os = new BufferedOutputStream(p.getOutputStream());
+
+ if (method.equalsIgnoreCase(HeaderFramework.METHOD_POST) && body != null) {
+ byte[] buffer = new byte[1024];
+ int len = requestHeader.getContentLength();
+ while (len > 0) {
+ body.read(buffer);
+ len = len - buffer.length;
+ os.write(buffer);
+ }
+ }
+
+ os.close();
+
+ try {
+ p.waitFor();
+ } catch (InterruptedException ex) {
+
+ }
+
+ exitValue = p.exitValue();
+
+ InputStream is = new BufferedInputStream(p.getInputStream());
+
+ StringBuilder StringBuilder = new StringBuilder(1024);
+
+ while (is.available() > 0) {
+ StringBuilder.append((char) is.read());
+ }
+
+ String cgiReturn = StringBuilder.toString();
+ int indexOfDelimiter = cgiReturn.indexOf("\n\n");
+ String[] cgiHeader = new String[0];
+ if (indexOfDelimiter > -1) {
+ cgiHeader = cgiReturn.substring(0, indexOfDelimiter).split("\n");
+ }
+ cgiBody = cgiReturn.substring(indexOfDelimiter + 1);
+
+ String key;
+ String value;
+ for (int i = 0; i < cgiHeader.length; i++) {
+ indexOfDelimiter = cgiHeader[i].indexOf(":");
+ key = cgiHeader[i].substring(0, indexOfDelimiter).trim();
+ value = cgiHeader[i].substring(indexOfDelimiter + 1).trim();
+ conProp.setProperty(key, value);
+ if (key.equals("Cache-Control") && value.equals("no-cache")) {
+ nocache = true;
+ } else if (key.equals("Content-type")) {
+ mimeType = value;
+ } else if (key.equals("Status")) {
+ if (key.length() > 2) {
+ try {
+ statusCode = Integer.parseInt(value.substring(0, 3));
+ } catch (NumberFormatException ex) {
+ /* tough luck, we will just have to use 200 as default value */
+ }
+ }
+ }
+ }
+ } catch (IOException ex) {
+ exitValue = -1;
+ }
+
+ /* did the script return an exit value != 0 and still there is supposed to be
+ * everything right with the HTTP status? -> change status to 500 since 200 would
+ * be a lie
+ */
+ if (exitValue != 0 && statusCode == 200) {
+ statusCode = 500;
+ }
+
+ targetDate = new Date(System.currentTimeMillis());
+
+ if (exitValue == 0 || (cgiBody != null && !cgiBody.equals(""))) {
+ HTTPDemon.sendRespondHeader(conProp, out, httpVersion, statusCode, null, mimeType, cgiBody.length(), targetDate, null, null, null, null, nocache);
+ out.write(cgiBody.getBytes());
+ } else {
+ HTTPDemon.sendRespondError(conProp, out, exitValue, statusCode, null, HeaderFramework.http1_1.get(statusCode + ""), null);
+ }
+
+
+ } else if ((targetClass != null) && (path.endsWith(".stream"))) {
+ // call rewrite-class
+ requestHeader.put(HeaderFramework.CONNECTION_PROP_CLIENTIP, conProp.getProperty(HeaderFramework.CONNECTION_PROP_CLIENTIP));
+ requestHeader.put(HeaderFramework.CONNECTION_PROP_PATH, path);
+ //requestHeader.put(httpHeader.CONNECTION_PROP_INPUTSTREAM, body);
+ //requestHeader.put(httpHeader.CONNECTION_PROP_OUTPUTSTREAM, out);
+
+ HTTPDemon.sendRespondHeader(conProp, out, httpVersion, 200, null);
+
+ // in case that there are no args given, args = null or empty hashmap
+ /* servletProperties tp = (servlerObjects) */ invokeServlet(targetClass, requestHeader, args);
+ forceConnectionClose(conProp);
+ return;
+ } else if (targetFile.exists() && targetFile.isFile() && targetFile.canRead()) {
+ // we have found a file that can be written to the client
+ // if this file uses templates, then we use the template
+ // re-write - method to create an result
+ String mimeType = mimeTable.getProperty(targetExt,"text/html");
+ final boolean zipContent = requestHeader.acceptGzip() && HTTPDemon.shallTransportZipped("." + conProp.getProperty("EXT",""));
+ if (path.endsWith("html") ||
+ path.endsWith("htm") ||
+ path.endsWith("xml") ||
+ path.endsWith("json") ||
+ path.endsWith("rdf") ||
+ path.endsWith("rss") ||
+ path.endsWith("csv") ||
+ path.endsWith("pac") ||
+ path.endsWith("src") ||
+ path.endsWith("vcf") ||
+ path.endsWith("/") ||
+ path.equals("/robots.txt")) {
+
+ /*targetFile = getLocalizedFile(path);
+ if (!(targetFile.exists())) {
+ // try to find that file in the htDocsPath
+ File trialFile = new File(htDocsPath, path);
+ if (trialFile.exists()) targetFile = trialFile;
+ }*/
+
+
+ // call rewrite-class
+
+ if (targetClass != null) {
+ // CGI-class: call the class to create a property for rewriting
+ try {
+ requestHeader.put(HeaderFramework.CONNECTION_PROP_CLIENTIP, conProp.getProperty(HeaderFramework.CONNECTION_PROP_CLIENTIP));
+ requestHeader.put(HeaderFramework.CONNECTION_PROP_PATH, path);
+ // in case that there are no args given, args = null or empty hashmap
+ final Object tmp = invokeServlet(targetClass, requestHeader, args);
+ if (tmp == null) {
+ // if no args given, then tp will be an empty Hashtable object (not null)
+ templatePatterns = new servletProperties();
+ } else if (tmp instanceof servletProperties) {
+ templatePatterns = (servletProperties) tmp;
+ } else {
+ templatePatterns = new servletProperties((serverObjects) tmp);
+ }
+ // check if the servlets requests authentification
+ if (templatePatterns.containsKey(servletProperties.ACTION_AUTHENTICATE)) {
+ // handle brute-force protection
+ if (authorization != null) {
+ Log.logInfo("HTTPD", "dynamic log-in for account 'admin' in http file handler for path '" + path + "' from host '" + clientIP + "'");
+ final Integer attempts = serverCore.bfHost.get(clientIP);
+ if (attempts == null)
+ serverCore.bfHost.put(clientIP, Integer.valueOf(1));
+ else
+ serverCore.bfHost.put(clientIP, Integer.valueOf(attempts.intValue() + 1));
+ }
+ // send authentication request to browser
+ final ResponseHeader headers = getDefaultHeaders(path);
+ headers.put(RequestHeader.WWW_AUTHENTICATE,"Basic realm=\"" + templatePatterns.get(servletProperties.ACTION_AUTHENTICATE, "") + "\"");
+ HTTPDemon.sendRespondHeader(conProp,out,httpVersion,401,headers);
+ return;
+ } else if (templatePatterns.containsKey(servletProperties.ACTION_LOCATION)) {
+ String location = templatePatterns.get(servletProperties.ACTION_LOCATION, "");
+ if (location.length() == 0) location = path;
+
+ final ResponseHeader headers = getDefaultHeaders(path);
+ headers.setCookieVector(templatePatterns.getOutgoingHeader().getCookieVector()); //put the cookies into the new header TODO: can we put all headerlines, without trouble?
+ headers.put(HeaderFramework.LOCATION,location);
+ HTTPDemon.sendRespondHeader(conProp,out,httpVersion,302,headers);
+ return;
+ }
+ // add the application version, the uptime and the client name to every rewrite table
+ templatePatterns.put(servletProperties.PEER_STAT_VERSION, yacyBuildProperties.getVersion());
+ templatePatterns.put(servletProperties.PEER_STAT_UPTIME, ((System.currentTimeMillis() - serverCore.startupTime) / 1000) / 60); // uptime in minutes
+ templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTNAME, switchboard.getConfig("peerName", "anomic"));
+ templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTID, ((Switchboard) switchboard).peers.myID());
+ templatePatterns.put(servletProperties.PEER_STAT_MYTIME, DateFormatter.formatShortSecond());
+ //System.out.println("respond props: " + ((tp == null) ? "null" : tp.toString())); // debug
+ } catch (final InvocationTargetException e) {
+ if (e.getCause() instanceof InterruptedException) {
+ throw new InterruptedException(e.getCause().getMessage());
+ }
+
+ theLogger.logSevere("INTERNAL ERROR: " + e.toString() + ":" +
+ e.getMessage() +
+ " target exception at " + targetClass + ": " +
+ e.getTargetException().toString() + ":" +
+ e.getTargetException().getMessage(),e);
+ targetClass = null;
+ throw e;
+ }
+ nocache = true;
+ }
+
+ targetDate = new Date(targetFile.lastModified());
+
+ // rewrite the file
+ InputStream fis = null;
+
+ // read the file/template
+ TemplateCacheEntry templateCacheEntry = null;
+ long fileSize = targetFile.length();
+ if (useTemplateCache && fileSize <= 512 * 1024) {
+ // read from cache
+ SoftReference<TemplateCacheEntry> ref = templateCache.get(targetFile);
+ if (ref != null) {
+ templateCacheEntry = ref.get();
+ if (templateCacheEntry == null) templateCache.remove(targetFile);
+ }
+
+ Date targetFileDate = new Date(targetFile.lastModified());
+ if (templateCacheEntry == null || targetFileDate.after(templateCacheEntry.lastModified)) {
+ // loading the content of the template file into
+ // a byte array
+ templateCacheEntry = new TemplateCacheEntry();
+ templateCacheEntry.lastModified = targetFileDate;
+ templateCacheEntry.content = FileUtils.read(targetFile);
+
+ // storing the content into the cache
+ ref = new SoftReference<TemplateCacheEntry>(templateCacheEntry);
+ templateCache.put(targetFile, ref);
+ if (theLogger.isFinest()) theLogger.logFinest("Cache MISS for file " + targetFile);
+ } else {
+ if (theLogger.isFinest()) theLogger.logFinest("Cache HIT for file " + targetFile);
+ }
+
+ // creating an inputstream needed by the template
+ // rewrite function
+ fis = new ByteArrayInputStream(templateCacheEntry.content);
+ templateCacheEntry = null;
+ } else if (fileSize <= Math.min(4 * 1024 * 1204, MemoryControl.available() / 100)) {
+ // read file completely into ram, avoid that too many files are open at the same time
+ fis = new ByteArrayInputStream(FileUtils.read(targetFile));
+ } else {
+ fis = new BufferedInputStream(new FileInputStream(targetFile));
+ }
+
+ if (mimeType.startsWith("text")) {
+ // every text-file distributed by yacy is UTF-8
+ if(!path.startsWith("/repository")) {
+ mimeType = mimeType + "; charset=UTF-8";
+ } else {
+ // detect charset of html-files
+ if((path.endsWith("html") || path.endsWith("htm"))) {
+ // save position
+ fis.mark(1000);
+ // scrape document to look up charset
+ final ScraperInputStream htmlFilter = new ScraperInputStream(fis,"UTF-8",new yacyURL("http://localhost", null),null,false);
+ final String charset = htmlParser.patchCharsetEncoding(htmlFilter.detectCharset());
+ if(charset != null)
+ mimeType = mimeType + "; charset="+charset;
+ // reset position
+ fis.reset();
+ }
+ }
+ }
+
+ // write the array to the client
+ // we can do that either in standard mode (whole thing completely) or in chunked mode
+ // since yacy clients do not understand chunked mode (yet), we use this only for communication with the administrator
+ final boolean yacyClient = requestHeader.userAgent().startsWith("yacy");
+ final boolean chunked = !method.equals(HeaderFramework.METHOD_HEAD) && !yacyClient && httpVersion.equals(HeaderFramework.HTTP_VERSION_1_1);
+ if (chunked) {
+ // send page in chunks and parse SSIs
+ final ByteBuffer o = new ByteBuffer();
+ // apply templates
+ TemplateEngine.writeTemplate(fis, o, templatePatterns, "-UNRESOLVED_PATTERN-".getBytes("UTF-8"));
+ fis.close();
+ HTTPDemon.sendRespondHeader(conProp, out, httpVersion, 200, null, mimeType, -1, targetDate, null, (templatePatterns == null) ? new ResponseHeader() : templatePatterns.getOutgoingHeader(), null, "chunked", nocache);
+ // send the content in chunked parts, see RFC 2616 section 3.6.1
+ final ChunkedOutputStream chos = new ChunkedOutputStream(out);
+ ServerSideIncludes.writeSSI(o, chos, authorization, clientIP);
+ //chos.write(result);
+ chos.finish();
+ } else {
+ // send page as whole thing, SSIs are not possible
+ final String contentEncoding = (zipContent) ? "gzip" : null;
+ // apply templates
+ final ByteBuffer o1 = new ByteBuffer();
+ TemplateEngine.writeTemplate(fis, o1, templatePatterns, "-UNRESOLVED_PATTERN-".getBytes("UTF-8"));
+ fis.close();
+ final ByteBuffer o = new ByteBuffer();
+
+ if (zipContent) {
+ GZIPOutputStream zippedOut = new GZIPOutputStream(o);
+ ServerSideIncludes.writeSSI(o1, zippedOut, authorization, clientIP);
+ //httpTemplate.writeTemplate(fis, zippedOut, tp, "-UNRESOLVED_PATTERN-".getBytes("UTF-8"));
+ zippedOut.finish();
+ zippedOut.flush();
+ zippedOut.close();
+ zippedOut = null;
+ } else {
+ ServerSideIncludes.writeSSI(o1, o, authorization, clientIP);
+ //httpTemplate.writeTemplate(fis, o, tp, "-UNRESOLVED_PATTERN-".getBytes("UTF-8"));
+ }
+ if (method.equals(HeaderFramework.METHOD_HEAD)) {
+ HTTPDemon.sendRespondHeader(conProp, out,
+ httpVersion, 200, null, mimeType, o.length(),
+ targetDate, null, (templatePatterns == null) ? new ResponseHeader() : templatePatterns.getOutgoingHeader(),
+ contentEncoding, null, nocache);
+ } else {
+ final byte[] result = o.getBytes(); // this interrupts streaming (bad idea!)
+ HTTPDemon.sendRespondHeader(conProp, out,
+ httpVersion, 200, null, mimeType, result.length,
+ targetDate, null, (templatePatterns == null) ? new ResponseHeader() : templatePatterns.getOutgoingHeader(),
+ contentEncoding, null, nocache);
+ FileUtils.copy(result, out);
+ }
+ }
+ } else { // no html
+
+ int statusCode = 200;
+ int rangeStartOffset = 0;
+ ResponseHeader header = new ResponseHeader();
+
+ // adding the accept ranges header
+ header.put(HeaderFramework.ACCEPT_RANGES, "bytes");
+
+ // reading the files md5 hash if availabe and use it as ETAG of the resource
+ String targetMD5 = null;
+ final File targetMd5File = new File(targetFile + ".md5");
+ try {
+ if (targetMd5File.exists()) {
+ //String description = null;
+ targetMD5 = new String(FileUtils.read(targetMd5File));
+ int pos = targetMD5.indexOf('\n');
+ if (pos >= 0) {
+ //description = targetMD5.substring(pos + 1);
+ targetMD5 = targetMD5.substring(0, pos);
+ }
+
+ // using the checksum as ETAG header
+ header.put(HeaderFramework.ETAG, targetMD5);
+ }
+ } catch (final IOException e) {
+ e.printStackTrace();
+ }
+
+ if (requestHeader.containsKey(HeaderFramework.RANGE)) {
+ final Object ifRange = requestHeader.ifRange();
+ if ((ifRange == null)||
+ (ifRange instanceof Date && targetFile.lastModified() == ((Date)ifRange).getTime()) ||
+ (ifRange instanceof String && ifRange.equals(targetMD5))) {
+ final String rangeHeaderVal = requestHeader.get(HeaderFramework.RANGE).trim();
+ if (rangeHeaderVal.startsWith("bytes=")) {
+ final String rangesVal = rangeHeaderVal.substring("bytes=".length());
+ final String[] ranges = rangesVal.split(",");
+ if ((ranges.length == 1)&&(ranges[0].endsWith("-"))) {
+ rangeStartOffset = Integer.valueOf(ranges[0].substring(0,ranges[0].length()-1)).intValue();
+ statusCode = 206;
+ if (header == null) header = new ResponseHeader();
+ header.put(HeaderFramework.CONTENT_RANGE, "bytes " + rangeStartOffset + "-" + (targetFile.length()-1) + "/" + targetFile.length());
+ }
+ }
+ }
+ }
+
+ // write the file to the client
+ targetDate = new Date(targetFile.lastModified());
+ final long contentLength = (zipContent)?-1:targetFile.length()-rangeStartOffset;
+ final String contentEncoding = (zipContent) ? "gzip" : null;
+ final String transferEncoding = (httpVersion.equals(HeaderFramework.HTTP_VERSION_1_1) && zipContent) ? "chunked" : null;
+ if (!httpVersion.equals(HeaderFramework.HTTP_VERSION_1_1) && zipContent) forceConnectionClose(conProp);
+
+ HTTPDemon.sendRespondHeader(conProp, out, httpVersion, statusCode, null, mimeType, contentLength, targetDate, null, header, contentEncoding, transferEncoding, nocache);
+
+ if (!method.equals(HeaderFramework.METHOD_HEAD)) {
+ ChunkedOutputStream chunkedOut = null;
+ GZIPOutputStream zipped = null;
+ OutputStream newOut = out;
+
+ if (transferEncoding != null) {
+ chunkedOut = new ChunkedOutputStream(newOut);
+ newOut = chunkedOut;
+ }
+ if (contentEncoding != null) {
+ zipped = new GZIPOutputStream(newOut);
+ newOut = zipped;
+ }
+
+ FileUtils.copyRange(targetFile, newOut, rangeStartOffset);
+
+ if (zipped != null) {
+ zipped.flush();
+ zipped.finish();
+ }
+ if (chunkedOut != null) {
+ chunkedOut.finish();
+ }
+
+ // flush all
+ try {newOut.flush();}catch (final Exception e) {}
+
+ // wait a little time until everything closes so that clients can read from the streams/sockets
+ if ((contentLength >= 0) && (requestHeader.get(RequestHeader.CONNECTION, "close")).indexOf("keep-alive") == -1) {
+ // in case that the client knows the size in advance (contentLength present) the waiting will have no effect on the interface performance
+ // but if the client waits on a connection interruption this will slow down.
+ try {Thread.sleep(2000);} catch (final InterruptedException e) {} // FIXME: is this necessary?
+ }
+ }
+
+ // check mime type again using the result array: these are 'magics'
+// if (serverByteBuffer.equals(result, 1, "PNG".getBytes())) mimeType = mimeTable.getProperty("png","text/html");
+// else if (serverByteBuffer.equals(result, 0, "GIF89".getBytes())) mimeType = mimeTable.getProperty("gif","text/html");
+// else if (serverByteBuffer.equals(result, 6, "JFIF".getBytes())) mimeType = mimeTable.getProperty("jpg","text/html");
+ //System.out.print("MAGIC:"); for (int i = 0; i < 10; i++) System.out.print(Integer.toHexString((int) result[i]) + ","); System.out.println();
+ }
+ } else {
+ HTTPDemon.sendRespondError(conProp,out,3,404,"File not Found",null,null);
+ return;
+ }
+ } catch (final Exception e) {
+ try {
+ // doing some errorhandling ...
+ //e.printStackTrace();
+ int httpStatusCode = 400;
+ final String httpStatusText = null;
+ final StringBuilder errorMessage = new StringBuilder(2000);
+ Exception errorExc = null;
+
+ final String errorMsg = e.getMessage();
+ if (
+ (e instanceof InterruptedException) ||
+ ((errorMsg != null) && (errorMsg.startsWith("Socket closed")) && (Thread.currentThread().isInterrupted()))
+ ) {
+ errorMessage.append("Interruption detected while processing query.");
+ httpStatusCode = 503;
+ } else {
+ if ((errorMsg != null) &&
+ (
+ errorMsg.contains("Broken pipe") ||
+ errorMsg.contains("Connection reset") ||
+ errorMsg.contains("Software caused connection abort")
+ )) {
+ // client closed the connection, so we just end silently
+ errorMessage.append("Client unexpectedly closed connection while processing query.");
+ } else if ((errorMsg != null) && (errorMsg.startsWith("Connection timed out"))) {
+ errorMessage.append("Connection timed out.");
+ } else {
+ errorMessage.append("Unexpected error while processing query.");
+ httpStatusCode = 500;
+ errorExc = e;
+ }
+ }
+
+ errorMessage.append("\nSession: ").append(Thread.currentThread().getName())
+ .append("\nQuery: ").append(path)
+ .append("\nClient: ").append(conProp.getProperty(HeaderFramework.CONNECTION_PROP_CLIENTIP,"unknown"))
+ .append("\nReason: ").append(e.toString());
+
+ if (!conProp.containsKey(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_HEADER)) {
+ // sending back an error message to the client
+ // if we have not already send an http header
+ HTTPDemon.sendRespondError(conProp,out, 4, httpStatusCode, httpStatusText, new String(errorMessage),errorExc);
+ } else {
+ // otherwise we close the connection
+ forceConnectionClose(conProp);
+ }
+
+ // if it is an unexpected error we log it
+ if (httpStatusCode == 500) {
+ theLogger.logWarning(new String(errorMessage),e);
+ }
+
+ } catch (final Exception ee) {
+ forceConnectionClose(conProp);
+ }
+
+ } finally {
+ try {out.flush();}catch (final Exception e) {}
+ }
+ }
+
+ public static final File getOverlayedClass(final String path) {
+ File targetClass;
+ targetClass = rewriteClassFile(new File(htDefaultPath, path)); //works for default and localized files
+ if (targetClass == null || !targetClass.exists()) {
+ //works for htdocs
+ targetClass=rewriteClassFile(new File(htDocsPath, path));
+ }
+ return targetClass;
+ }
+
+ public static final File getOverlayedFile(final String path) {
+ File targetFile;
+ targetFile = getLocalizedFile(path);
+ if (!targetFile.exists()) {
+ targetFile = new File(htDocsPath, path);
+ }
+ return targetFile;
+ }
+
+ private static final void forceConnectionClose(final Properties conprop) {
+ if (conprop != null) {
+ conprop.setProperty(HeaderFramework.CONNECTION_PROP_PERSISTENT,"close");
+ }
+ }
+
+ private static final File rewriteClassFile(final File template) {
+ try {
+ String f = template.getCanonicalPath();
+ final int p = f.lastIndexOf(".");
+ if (p < 0) return null;
+ f = f.substring(0, p) + ".class";
+ //System.out.println("constructed class path " + f);
+ final File cf = new File(f);
+ if (cf.exists()) return cf;
+ return null;
+ } catch (final IOException e) {
+ return null;
+ }
+ }
+
+ private static final Method rewriteMethod(final File classFile) {
+ Method m = null;
+ // now make a class out of the stream
+ try {
+ if (useTemplateCache) {
+ final SoftReference<Method> ref = templateMethodCache.get(classFile);
+ if (ref != null) {
+ m = ref.get();
+ if (m == null) {
+ templateMethodCache.remove(classFile);
+ } else {
+ return m;
+ }
+ }
+ }
+
+ final Class<?> c = provider.loadClass(classFile);
+ final Class<?>[] params = new Class[] {
+ RequestHeader.class,
+ serverObjects.class,
+ serverSwitch.class };
+ m = c.getMethod("respond", params);
+
+ if (useTemplateCache) {
+ // storing the method into the cache
+ final SoftReference<Method> ref = new SoftReference<Method>(m);
+ templateMethodCache.put(classFile, ref);
+ }
+
+ } catch (final ClassNotFoundException e) {
+ System.out.println("INTERNAL ERROR: class " + classFile + " is missing:" + e.getMessage());
+ } catch (final NoSuchMethodException e) {
+ System.out.println("INTERNAL ERROR: method respond not found in class " + classFile + ": " + e.getMessage());
+ }
+ //System.out.println("found method: " + m.toString());
+ return m;
+ }
+
+ public static final Object invokeServlet(final File targetClass, final RequestHeader request, final serverObjects args) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
+ Object result;
+ if (safeServletsMode) synchronized (switchboard) {
+ result = rewriteMethod(targetClass).invoke(null, new Object[] {request, args, switchboard});
+ } else {
+ result = rewriteMethod(targetClass).invoke(null, new Object[] {request, args, switchboard});
+ }
+ return result;
+ }
+
+ /**
+ * Tells if a filename ends with a suffix from a given list.
+ * @param filename the filename
+ * @param suffixList the list of suffixes which is a string of suffixes separated by commas
+ * @return true if the filename ends with a suffix from the list, else false
+ */
+ private static boolean matchesSuffix(String name, String suffixList) {
+ boolean ret = false;
+
+ if (suffixList != null && name != null) {
+ String[] suffixes = suffixList.split(",");
+ find:
+ for (int i = 0; i < suffixes.length; i++) {
+ if (name.endsWith("." + suffixes[i].trim())) {
+ ret = true;
+ break find;
+ }
+ }
+ }
+
+ return ret;
+ }
+
+}
diff --git a/source/de/anomic/http/httpdProxyHandler.java b/source/de/anomic/http/server/HTTPDProxyHandler.java
similarity index 77%
rename from source/de/anomic/http/httpdProxyHandler.java
rename to source/de/anomic/http/server/HTTPDProxyHandler.java
index 027e0c054..7be242499 100644
--- a/source/de/anomic/http/httpdProxyHandler.java
+++ b/source/de/anomic/http/server/HTTPDProxyHandler.java
@@ -40,7 +40,7 @@
*/
-package de.anomic.http;
+package de.anomic.http.server;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
@@ -78,22 +78,31 @@ import de.anomic.data.Blacklist;
import de.anomic.document.Parser;
import de.anomic.document.parser.html.ContentTransformer;
import de.anomic.document.parser.html.Transformer;
+import de.anomic.http.client.MultiOutputStream;
+import de.anomic.http.client.Client;
+import de.anomic.http.client.RemoteProxyConfig;
+import de.anomic.http.client.Cache;
+import de.anomic.http.io.ChunkedOutputStream;
+import de.anomic.http.io.ByteCountOutputStream;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.metadata.ResponseContainer;
+import de.anomic.http.metadata.ResponseHeader;
import de.anomic.kelondro.util.DateFormatter;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaHTCache;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverCore;
import de.anomic.server.serverDomains;
import de.anomic.server.serverObjects;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.logging.Log;
-public final class httpdProxyHandler {
+public final class HTTPDProxyHandler {
// static variables
// can only be instantiated upon first instantiation of this class object
- private static plasmaSwitchboard sb = null;
+ private static Switchboard sb = null;
private static final HashSet<String> yellowList;
private static int timeout = 30000;
private static boolean yacyTrigger = true;
@@ -121,7 +130,7 @@ public final class httpdProxyHandler {
// getting the logging manager
final LogManager manager = LogManager.getLogManager();
- final String className = httpdProxyHandler.class.getName();
+ final String className = HTTPDProxyHandler.class.getName();
// determining if proxy access logging is enabled
final String enabled = manager.getProperty("de.anomic.http.httpdProxyHandler.logging.enabled");
@@ -160,7 +169,7 @@ public final class httpdProxyHandler {
theLogger.logSevere("Unable to configure proxy access logging.",e);
}
- sb = plasmaSwitchboard.getSwitchboard();
+ sb = Switchboard.getSwitchboard();
if (sb != null) {
isTransparentProxy = Boolean.valueOf(sb.getConfig("isTransparentProxy","false")).booleanValue();
@@ -177,7 +186,7 @@ public final class httpdProxyHandler {
// load a transformer
transformer = new ContentTransformer();
- transformer.init(new File(sb.getRootPath(), sb.getConfig(plasmaSwitchboardConstants.LIST_BLUE, "")).toString());
+ transformer.init(new File(sb.getRootPath(), sb.getConfig(SwitchboardConstants.LIST_BLUE, "")).toString());
// load the yellow-list
final String f = sb.getConfig("proxyYellowList", null);
@@ -220,7 +229,7 @@ public final class httpdProxyHandler {
*/
private static final StringBuilder userAgentStr = new StringBuilder();
- public static void handleOutgoingCookies(final httpRequestHeader requestHeader, final String targethost, final String clienthost) {
+ public static void handleOutgoingCookies(final RequestHeader requestHeader, final String targethost, final String clienthost) {
/*
The syntax for the header is:
@@ -234,8 +243,8 @@ public final class httpdProxyHandler {
domain = "$Domain" "=" value
*/
if (sb.getConfigBool("proxy.monitorCookies", false)) {
- if (requestHeader.containsKey(httpRequestHeader.COOKIE)) {
- final Object[] entry = new Object[]{new Date(), clienthost, requestHeader.getMultiple(httpRequestHeader.COOKIE)};
+ if (requestHeader.containsKey(RequestHeader.COOKIE)) {
+ final Object[] entry = new Object[]{new Date(), clienthost, requestHeader.getMultiple(RequestHeader.COOKIE)};
synchronized(sb.outgoingCookies) {
sb.outgoingCookies.put(targethost, entry);
}
@@ -243,7 +252,7 @@ public final class httpdProxyHandler {
}
}
- public static void handleIncomingCookies(final httpResponseHeader respondHeader, final String serverhost, final String targetclient) {
+ public static void handleIncomingCookies(final ResponseHeader respondHeader, final String serverhost, final String targetclient) {
/*
The syntax for the Set-Cookie response header is
@@ -260,8 +269,8 @@ public final class httpdProxyHandler {
| "Version" "=" 1*DIGIT
*/
if (sb.getConfigBool("proxy.monitorCookies", false)) {
- if (respondHeader.containsKey(httpHeader.SET_COOKIE)) {
- final Object[] entry = new Object[]{new Date(), targetclient, respondHeader.getMultiple(httpHeader.SET_COOKIE)};
+ if (respondHeader.containsKey(HeaderFramework.SET_COOKIE)) {
+ final Object[] entry = new Object[]{new Date(), targetclient, respondHeader.getMultiple(HeaderFramework.SET_COOKIE)};
synchronized(sb.incomingCookies) {
sb.incomingCookies.put(serverhost, entry);
}
@@ -273,31 +282,31 @@ public final class httpdProxyHandler {
* @param conProp a collection of properties about the connection, like URL
* @param requestHeader The header lines of the connection from the request
* @param respond the OutputStream to the client
- * @see de.anomic.http.httpdHandler#doGet(java.util.Properties, de.anomic.http.httpHeader, java.io.OutputStream)
+ * @see de.anomic.http.httpdHandler#doGet(java.util.Properties, de.anomic.http.metadata.HeaderFramework, java.io.OutputStream)
*/
- public static void doGet(final Properties conProp, final httpRequestHeader requestHeader, final OutputStream respond) {
- httpdByteCountOutputStream countedRespond = null;
+ public static void doGet(final Properties conProp, final RequestHeader requestHeader, final OutputStream respond) {
+ ByteCountOutputStream countedRespond = null;
try {
final int reqID = requestHeader.hashCode();
// remembering the starting time of the request
final Date requestDate = new Date(); // remember the time...
- conProp.put(httpHeader.CONNECTION_PROP_REQUEST_START, Long.valueOf(requestDate.getTime()));
+ conProp.put(HeaderFramework.CONNECTION_PROP_REQUEST_START, Long.valueOf(requestDate.getTime()));
if (yacyTrigger) de.anomic.yacy.yacyCore.triggerOnlineAction();
sb.proxyLastAccess = System.currentTimeMillis();
// using an ByteCount OutputStream to count the send bytes (needed for the logfile)
- countedRespond = new httpdByteCountOutputStream(respond,conProp.getProperty(httpHeader.CONNECTION_PROP_REQUESTLINE).length() + 2,"PROXY");
+ countedRespond = new ByteCountOutputStream(respond,conProp.getProperty(HeaderFramework.CONNECTION_PROP_REQUESTLINE).length() + 2,"PROXY");
- String host = conProp.getProperty(httpHeader.CONNECTION_PROP_HOST);
- String path = conProp.getProperty(httpHeader.CONNECTION_PROP_PATH); // always starts with leading '/'
- final String args = conProp.getProperty(httpHeader.CONNECTION_PROP_ARGS); // may be null if no args were given
- final String ip = conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP); // the ip from the connecting peer
+ String host = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HOST);
+ String path = conProp.getProperty(HeaderFramework.CONNECTION_PROP_PATH); // always starts with leading '/'
+ final String args = conProp.getProperty(HeaderFramework.CONNECTION_PROP_ARGS); // may be null if no args were given
+ final String ip = conProp.getProperty(HeaderFramework.CONNECTION_PROP_CLIENTIP); // the ip from the connecting peer
int pos=0;
int port=0;
yacyURL url = null;
try {
- url = httpHeader.getRequestURL(conProp);
+ url = HeaderFramework.getRequestURL(conProp);
if (theLogger.isFine()) theLogger.logFine(reqID +" GET "+ url);
if (theLogger.isFinest()) theLogger.logFinest(reqID +" header: "+ requestHeader);
@@ -314,16 +323,16 @@ public final class httpdProxyHandler {
} catch(final MalformedURLException e){}//just keep the old one
}
if (theLogger.isFinest()) theLogger.logFinest(reqID +" using redirector to "+ url);
- conProp.setProperty(httpHeader.CONNECTION_PROP_HOST, url.getHost()+":"+url.getPort());
- conProp.setProperty(httpHeader.CONNECTION_PROP_PATH, url.getPath());
- requestHeader.put(httpHeader.HOST, url.getHost()+":"+url.getPort());
- requestHeader.put(httpHeader.CONNECTION_PROP_PATH, url.getPath());
+ conProp.setProperty(HeaderFramework.CONNECTION_PROP_HOST, url.getHost()+":"+url.getPort());
+ conProp.setProperty(HeaderFramework.CONNECTION_PROP_PATH, url.getPath());
+ requestHeader.put(HeaderFramework.HOST, url.getHost()+":"+url.getPort());
+ requestHeader.put(HeaderFramework.CONNECTION_PROP_PATH, url.getPath());
}
} catch (final MalformedURLException e) {
final String errorMsg = "ERROR: internal error with url generation: host=" +
host + ", port=" + port + ", path=" + path + ", args=" + args;
theLogger.logSevere(errorMsg);
- httpd.sendRespondError(conProp,countedRespond,4,501,null,errorMsg,e);
+ HTTPDemon.sendRespondError(conProp,countedRespond,4,501,null,errorMsg,e);
return;
}
@@ -339,9 +348,9 @@ public final class httpdProxyHandler {
// respond a 404 for all AGIS ("all you get is shit") servers
final String hostlow = host.toLowerCase();
if (args != null) { path = path + "?" + args; }
- if (plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_PROXY, hostlow, path)) {
+ if (Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_PROXY, hostlow, path)) {
theLogger.logInfo("AGIS blocking of host '" + hostlow + "'");
- httpd.sendRespondError(conProp,countedRespond,4,403,null,
+ HTTPDemon.sendRespondError(conProp,countedRespond,4,403,null,
"URL '" + hostlow + "' blocked by yacy proxy (blacklisted)",null);
return;
}
@@ -349,7 +358,7 @@ public final class httpdProxyHandler {
// handle outgoing cookies
handleOutgoingCookies(requestHeader, host, ip);
prepareRequestHeader(conProp, requestHeader, hostlow);
- httpResponseHeader cachedResponseHeader = plasmaHTCache.loadResponseHeader(url);
+ ResponseHeader cachedResponseHeader = Cache.loadResponseHeader(url);
// why are files unzipped upon arrival? why not zip all files in cache?
// This follows from the following premises
@@ -395,9 +404,9 @@ public final class httpdProxyHandler {
"200 OK",
sb.crawler.defaultProxyProfile
);
- plasmaHTCache.storeMetadata(cachedResponseHeader, cacheEntry); // TODO: check if this storeMetadata is necessary
+ Cache.storeMetadata(cachedResponseHeader, cacheEntry); // TODO: check if this storeMetadata is necessary
- byte[] cacheContent = plasmaHTCache.getResourceContent(url);
+ byte[] cacheContent = Cache.getResourceContent(url);
if (cacheContent != null && cacheEntry.shallUseCacheForProxy()) {
if (theLogger.isFinest()) theLogger.logFinest(reqID + " fulfill request from cache");
fulfillRequestFromCache(conProp, url, requestHeader, cachedResponseHeader, cacheContent, countedRespond);
@@ -413,9 +422,9 @@ public final class httpdProxyHandler {
final String exTxt = e.getMessage();
if ((exTxt!=null)&&(exTxt.startsWith("Socket closed"))) {
forceConnectionClose(conProp);
- } else if (!conProp.containsKey(httpHeader.CONNECTION_PROP_PROXY_RESPOND_HEADER)) {
+ } else if (!conProp.containsKey(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_HEADER)) {
final String errorMsg = "Unexpected Error. " + e.getClass().getName() + ": " + e.getMessage();
- httpd.sendRespondError(conProp,countedRespond,4,501,null,errorMsg,e);
+ HTTPDemon.sendRespondError(conProp,countedRespond,4,501,null,errorMsg,e);
theLogger.logSevere(errorMsg);
} else {
forceConnectionClose(conProp);
@@ -427,25 +436,25 @@ public final class httpdProxyHandler {
try { if(countedRespond != null) countedRespond.flush(); else if(respond != null) respond.flush(); } catch (final Exception e) {}
if (countedRespond != null) countedRespond.finish();
- conProp.put(httpHeader.CONNECTION_PROP_REQUEST_END, Long.valueOf(System.currentTimeMillis()));
- conProp.put(httpHeader.CONNECTION_PROP_PROXY_RESPOND_SIZE,(countedRespond != null) ? Long.valueOf(countedRespond.getCount()) : -1L);
+ conProp.put(HeaderFramework.CONNECTION_PROP_REQUEST_END, Long.valueOf(System.currentTimeMillis()));
+ conProp.put(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_SIZE,(countedRespond != null) ? Long.valueOf(countedRespond.getCount()) : -1L);
logProxyAccess(conProp);
}
}
- private static void fulfillRequestFromWeb(final Properties conProp, final yacyURL url, final httpRequestHeader requestHeader, final httpResponseHeader cachedResponseHeader, final OutputStream respond) {
+ private static void fulfillRequestFromWeb(final Properties conProp, final yacyURL url, final RequestHeader requestHeader, final ResponseHeader cachedResponseHeader, final OutputStream respond) {
final GZIPOutputStream gzippedOut = null;
- httpResponse res = null;
+ ResponseContainer res = null;
try {
final int reqID = requestHeader.hashCode();
- String host = conProp.getProperty(httpHeader.CONNECTION_PROP_HOST);
- final String path = conProp.getProperty(httpHeader.CONNECTION_PROP_PATH); // always starts with leading '/'
- final String args = conProp.getProperty(httpHeader.CONNECTION_PROP_ARGS); // may be null if no args were given
- final String ip = conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP); // the ip from the connecting peer
- final String httpVer = conProp.getProperty(httpHeader.CONNECTION_PROP_HTTP_VER); // the ip from the connecting peer
+ String host = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HOST);
+ final String path = conProp.getProperty(HeaderFramework.CONNECTION_PROP_PATH); // always starts with leading '/'
+ final String args = conProp.getProperty(HeaderFramework.CONNECTION_PROP_ARGS); // may be null if no args were given
+ final String ip = conProp.getProperty(HeaderFramework.CONNECTION_PROP_CLIENTIP); // the ip from the connecting peer
+ final String httpVer = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HTTP_VER); // the ip from the connecting peer
int port, pos;
if ((pos = host.indexOf(":")) < 0) {
@@ -472,29 +481,29 @@ public final class httpdProxyHandler {
final String connectHost = hostPart(host, port, yAddress);
final String getUrl = "http://"+ connectHost + remotePath;
- final httpClient client = setupHttpClient(requestHeader, connectHost);
+ final Client client = setupHttpClient(requestHeader, connectHost);
// send request
try {
res = client.GET(getUrl);
if (theLogger.isFinest()) theLogger.logFinest(reqID +" response status: "+ res.getStatusLine());
- conProp.put(httpHeader.CONNECTION_PROP_CLIENT_REQUEST_HEADER, requestHeader);
+ conProp.put(HeaderFramework.CONNECTION_PROP_CLIENT_REQUEST_HEADER, requestHeader);
- final httpResponseHeader responseHeader = res.getResponseHeader();
+ final ResponseHeader responseHeader = res.getResponseHeader();
// determine if it's an internal error of the httpc
if (responseHeader.size() == 0) {
throw new Exception(res.getStatusLine());
}
- final httpChunkedOutputStream chunkedOut = setTransferEncoding(conProp, responseHeader, res.getStatusCode(), respond);
+ final ChunkedOutputStream chunkedOut = setTransferEncoding(conProp, responseHeader, res.getStatusCode(), respond);
// the cache does either not exist or is (supposed to be) stale
long sizeBeforeDelete = -1;
if (cachedResponseHeader != null) {
// delete the cache
- sizeBeforeDelete = plasmaHTCache.getResourceContentLength(url);
- plasmaHTCache.deleteFromCache(url);
- conProp.setProperty(httpHeader.CONNECTION_PROP_PROXY_RESPOND_CODE, "TCP_REFRESH_MISS");
+ sizeBeforeDelete = Cache.getResourceContentLength(url);
+ Cache.deleteFromCache(url);
+ conProp.setProperty(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_CODE, "TCP_REFRESH_MISS");
}
// reserver cache entry
@@ -516,7 +525,7 @@ public final class httpdProxyHandler {
res.getStatusLine(),
sb.crawler.defaultProxyProfile
);
- plasmaHTCache.storeMetadata(responseHeader, cacheEntry);
+ Cache.storeMetadata(responseHeader, cacheEntry);
// handle incoming cookies
handleIncomingCookies(responseHeader, host, ip);
@@ -525,11 +534,11 @@ public final class httpdProxyHandler {
// sending the respond header back to the client
if (chunkedOut != null) {
- responseHeader.put(httpHeader.TRANSFER_ENCODING, "chunked");
+ responseHeader.put(HeaderFramework.TRANSFER_ENCODING, "chunked");
}
if (theLogger.isFinest()) theLogger.logFinest(reqID +" sending response header: "+ responseHeader);
- httpd.sendRespondHeader(
+ HTTPDemon.sendRespondHeader(
conProp,
respond,
httpVer,
@@ -576,19 +585,19 @@ public final class httpdProxyHandler {
//cacheEntry.status = plasmaHTCache.CACHE_FILL; // it's an insert
cacheEntry.setContent(cacheArray);
sb.htEntryStoreProcess(cacheEntry);
- conProp.setProperty(httpHeader.CONNECTION_PROP_PROXY_RESPOND_CODE,"TCP_MISS");
+ conProp.setProperty(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_CODE,"TCP_MISS");
} else if (cacheArray != null && sizeBeforeDelete == cacheArray.length) {
// before we came here we deleted a cache entry
cacheArray = null;
//cacheEntry.status = plasmaHTCache.CACHE_STALE_RELOAD_BAD;
//cacheManager.push(cacheEntry); // unnecessary update
- conProp.setProperty(httpHeader.CONNECTION_PROP_PROXY_RESPOND_CODE,"TCP_REF_FAIL_HIT");
+ conProp.setProperty(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_CODE,"TCP_REF_FAIL_HIT");
} else {
// before we came here we deleted a cache entry
//cacheEntry.status = plasmaHTCache.CACHE_STALE_RELOAD_GOOD;
cacheEntry.setContent(cacheArray);
sb.htEntryStoreProcess(cacheEntry);
- conProp.setProperty(httpHeader.CONNECTION_PROP_PROXY_RESPOND_CODE,"TCP_REFRESH_MISS");
+ conProp.setProperty(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_CODE,"TCP_REFRESH_MISS");
}
} else {
// no caching
@@ -599,7 +608,7 @@ public final class httpdProxyHandler {
FileUtils.copy(res.getDataAsStream(), outStream);
- conProp.setProperty(httpHeader.CONNECTION_PROP_PROXY_RESPOND_CODE,"TCP_MISS");
+ conProp.setProperty(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_CODE,"TCP_MISS");
}
if (gzippedOut != null) {
@@ -649,15 +658,15 @@ public final class httpdProxyHandler {
private static void fulfillRequestFromCache(
final Properties conProp,
final yacyURL url,
- final httpRequestHeader requestHeader,
- final httpResponseHeader cachedResponseHeader,
+ final RequestHeader requestHeader,
+ final ResponseHeader cachedResponseHeader,
final byte[] cacheEntry,
final OutputStream respond
) throws IOException {
- final String httpVer = conProp.getProperty(httpHeader.CONNECTION_PROP_HTTP_VER);
+ final String httpVer = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HTTP_VER);
- final httpChunkedOutputStream chunkedOut = null;
+ final ChunkedOutputStream chunkedOut = null;
final GZIPOutputStream gzippedOut = null;
// we respond on the request by using the cache, the cache is fresh
@@ -665,7 +674,7 @@ public final class httpdProxyHandler {
prepareResponseHeader(cachedResponseHeader, httpVer);
// replace date field in old header by actual date, this is according to RFC
- cachedResponseHeader.put(httpHeader.DATE, DateFormatter.formatRFC1123(new Date()));
+ cachedResponseHeader.put(HeaderFramework.DATE, DateFormatter.formatRFC1123(new Date()));
// if (((String)requestHeader.get(httpHeader.ACCEPT_ENCODING,"")).indexOf("gzip") != -1) {
// chunked = new httpChunkedOutputStream(respond);
@@ -679,28 +688,28 @@ public final class httpdProxyHandler {
// }
// check if we can send a 304 instead the complete content
- if (requestHeader.containsKey(httpRequestHeader.IF_MODIFIED_SINCE)) {
+ if (requestHeader.containsKey(RequestHeader.IF_MODIFIED_SINCE)) {
// conditional request: freshness of cache for that condition was already
// checked within shallUseCache(). Now send only a 304 response
theLogger.logInfo("CACHE HIT/304 " + url.toString());
- conProp.setProperty(httpHeader.CONNECTION_PROP_PROXY_RESPOND_CODE,"TCP_REFRESH_HIT");
+ conProp.setProperty(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_CODE,"TCP_REFRESH_HIT");
// setting the content length header to 0
- cachedResponseHeader.put(httpHeader.CONTENT_LENGTH, Integer.toString(0));
+ cachedResponseHeader.put(HeaderFramework.CONTENT_LENGTH, Integer.toString(0));
// send cached header with replaced date and added length
- httpd.sendRespondHeader(conProp,respond,httpVer,304,cachedResponseHeader);
+ HTTPDemon.sendRespondHeader(conProp,respond,httpVer,304,cachedResponseHeader);
//respondHeader(respond, "304 OK", cachedResponseHeader); // respond with 'not modified'
} else {
// unconditional request: send content of cache
theLogger.logInfo("CACHE HIT/203 " + url.toString());
- conProp.setProperty(httpHeader.CONNECTION_PROP_PROXY_RESPOND_CODE,"TCP_HIT");
+ conProp.setProperty(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_CODE,"TCP_HIT");
// setting the content header to the proper length
- cachedResponseHeader.put(httpHeader.CONTENT_LENGTH, Long.toString(cacheEntry.length));
+ cachedResponseHeader.put(HeaderFramework.CONTENT_LENGTH, Long.toString(cacheEntry.length));
// send cached header with replaced date and added length
- httpd.sendRespondHeader(conProp,respond,httpVer,203,cachedResponseHeader);
+ HTTPDemon.sendRespondHeader(conProp,respond,httpVer,203,cachedResponseHeader);
//respondHeader(respond, "203 OK", cachedResponseHeader); // respond with 'non-authoritative'
final OutputStream outStream = (gzippedOut != null) ? gzippedOut : ((chunkedOut != null)? chunkedOut : respond);
@@ -716,11 +725,11 @@ public final class httpdProxyHandler {
} catch (final Exception e) {
// this happens if the client stops loading the file
// we do nothing here
- if (conProp.containsKey(httpHeader.CONNECTION_PROP_PROXY_RESPOND_HEADER)) {
+ if (conProp.containsKey(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_HEADER)) {
theLogger.logWarning("Error while trying to send cached message body.");
- conProp.setProperty(httpHeader.CONNECTION_PROP_PERSISTENT,"close");
+ conProp.setProperty(HeaderFramework.CONNECTION_PROP_PERSISTENT,"close");
} else {
- httpd.sendRespondError(conProp,respond,4,503,"socket error: " + e.getMessage(),"socket error: " + e.getMessage(), e);
+ HTTPDemon.sendRespondError(conProp,respond,4,503,"socket error: " + e.getMessage(),"socket error: " + e.getMessage(), e);
}
} finally {
try { respond.flush(); } catch (final Exception e) {}
@@ -728,25 +737,25 @@ public final class httpdProxyHandler {
return;
}
- public static void doHead(final Properties conProp, final httpRequestHeader requestHeader, OutputStream respond) {
+ public static void doHead(final Properties conProp, final RequestHeader requestHeader, OutputStream respond) {
- httpResponse res = null;
+ ResponseContainer res = null;
yacyURL url = null;
try {
final int reqID = requestHeader.hashCode();
// remembering the starting time of the request
final Date requestDate = new Date(); // remember the time...
- conProp.put(httpHeader.CONNECTION_PROP_REQUEST_START, Long.valueOf(requestDate.getTime()));
+ conProp.put(HeaderFramework.CONNECTION_PROP_REQUEST_START, Long.valueOf(requestDate.getTime()));
if (yacyTrigger) de.anomic.yacy.yacyCore.triggerOnlineAction();
sb.proxyLastAccess = System.currentTimeMillis();
// using an ByteCount OutputStream to count the send bytes
- respond = new httpdByteCountOutputStream(respond,conProp.getProperty(httpHeader.CONNECTION_PROP_REQUESTLINE).length() + 2,"PROXY");
+ respond = new ByteCountOutputStream(respond,conProp.getProperty(HeaderFramework.CONNECTION_PROP_REQUESTLINE).length() + 2,"PROXY");
- String host = conProp.getProperty(httpHeader.CONNECTION_PROP_HOST);
- final String path = conProp.getProperty(httpHeader.CONNECTION_PROP_PATH);
- final String args = conProp.getProperty(httpHeader.CONNECTION_PROP_ARGS);
- final String httpVer = conProp.getProperty(httpHeader.CONNECTION_PROP_HTTP_VER);
+ String host = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HOST);
+ final String path = conProp.getProperty(HeaderFramework.CONNECTION_PROP_PATH);
+ final String args = conProp.getProperty(HeaderFramework.CONNECTION_PROP_ARGS);
+ final String httpVer = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HTTP_VER);
int port, pos;
if ((pos = host.indexOf(":")) < 0) {
@@ -762,7 +771,7 @@ public final class httpdProxyHandler {
final String errorMsg = "ERROR: internal error with url generation: host=" +
host + ", port=" + port + ", path=" + path + ", args=" + args;
theLogger.logSevere(errorMsg);
- httpd.sendRespondError(conProp,respond,4,501,null,errorMsg,e);
+ HTTPDemon.sendRespondError(conProp,respond,4,501,null,errorMsg,e);
return;
}
if (theLogger.isFine()) theLogger.logFine(reqID +" HEAD "+ url);
@@ -774,8 +783,8 @@ public final class httpdProxyHandler {
// re-calc the url path
String remotePath = (args == null) ? path : (path + "?" + args);
- if (plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_PROXY, hostlow, remotePath)) {
- httpd.sendRespondError(conProp,respond,4,403,null,
+ if (Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_PROXY, hostlow, remotePath)) {
+ HTTPDemon.sendRespondError(conProp,respond,4,403,null,
"URL '" + hostlow + "' blocked by yacy proxy (blacklisted)",null);
theLogger.logInfo("AGIS blocking of host '" + hostlow + "'");
return;
@@ -799,7 +808,7 @@ public final class httpdProxyHandler {
final String getUrl = "http://"+ connectHost + remotePath;
if (theLogger.isFinest()) theLogger.logFinest(reqID +" using url: "+ getUrl);
- final httpClient client = setupHttpClient(requestHeader, connectHost);
+ final Client client = setupHttpClient(requestHeader, connectHost);
// send request
try {
@@ -807,7 +816,7 @@ public final class httpdProxyHandler {
if (theLogger.isFinest()) theLogger.logFinest(reqID +" response status: "+ res.getStatusLine());
// determine if it's an internal error of the httpc
- final httpResponseHeader responseHeader = res.getResponseHeader();
+ final ResponseHeader responseHeader = res.getResponseHeader();
if (responseHeader.size() == 0) {
throw new Exception(res.getStatusLine());
}
@@ -816,7 +825,7 @@ public final class httpdProxyHandler {
// sending the server respond back to the client
if (theLogger.isFinest()) theLogger.logFinest(reqID +" sending response header: "+ responseHeader);
- httpd.sendRespondHeader(conProp,respond,httpVer,res.getStatusCode(),res.getStatusLine().substring(4),responseHeader);
+ HTTPDemon.sendRespondHeader(conProp,respond,httpVer,res.getStatusCode(),res.getStatusLine().substring(4),responseHeader);
respond.flush();
} finally {
if(res != null) {
@@ -829,27 +838,27 @@ public final class httpdProxyHandler {
}
}
- public static void doPost(final Properties conProp, final httpRequestHeader requestHeader, final OutputStream respond, InputStream body) throws IOException {
+ public static void doPost(final Properties conProp, final RequestHeader requestHeader, final OutputStream respond, InputStream body) throws IOException {
assert conProp != null : "precondition violated: conProp != null";
assert requestHeader != null : "precondition violated: requestHeader != null";
assert body != null : "precondition violated: body != null";
yacyURL url = null;
- httpdByteCountOutputStream countedRespond = null;
+ ByteCountOutputStream countedRespond = null;
try {
final int reqID = requestHeader.hashCode();
// remembering the starting time of the request
final Date requestDate = new Date(); // remember the time...
- conProp.put(httpHeader.CONNECTION_PROP_REQUEST_START, Long.valueOf(requestDate.getTime()));
+ conProp.put(HeaderFramework.CONNECTION_PROP_REQUEST_START, Long.valueOf(requestDate.getTime()));
if (yacyTrigger) de.anomic.yacy.yacyCore.triggerOnlineAction();
sb.proxyLastAccess = System.currentTimeMillis();
// using an ByteCount OutputStream to count the send bytes
- countedRespond = new httpdByteCountOutputStream(respond,conProp.getProperty(httpHeader.CONNECTION_PROP_REQUESTLINE).length() + 2,"PROXY");
+ countedRespond = new ByteCountOutputStream(respond,conProp.getProperty(HeaderFramework.CONNECTION_PROP_REQUESTLINE).length() + 2,"PROXY");
- String host = conProp.getProperty(httpHeader.CONNECTION_PROP_HOST);
- final String path = conProp.getProperty(httpHeader.CONNECTION_PROP_PATH);
- final String args = conProp.getProperty(httpHeader.CONNECTION_PROP_ARGS); // may be null if no args were given
- final String httpVer = conProp.getProperty(httpHeader.CONNECTION_PROP_HTTP_VER);
+ String host = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HOST);
+ final String path = conProp.getProperty(HeaderFramework.CONNECTION_PROP_PATH);
+ final String args = conProp.getProperty(HeaderFramework.CONNECTION_PROP_ARGS); // may be null if no args were given
+ final String httpVer = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HTTP_VER);
int port, pos;
if ((pos = host.indexOf(":")) < 0) {
@@ -865,7 +874,7 @@ public final class httpdProxyHandler {
final String errorMsg = "ERROR: internal error with url generation: host=" +
host + ", port=" + port + ", path=" + path + ", args=" + args;
theLogger.logSevere(errorMsg);
- httpd.sendRespondError(conProp,countedRespond,4,501,null,errorMsg,e);
+ HTTPDemon.sendRespondError(conProp,countedRespond,4,501,null,errorMsg,e);
return;
}
if (theLogger.isFine()) theLogger.logFine(reqID +" POST "+ url);
@@ -890,7 +899,7 @@ public final class httpdProxyHandler {
final String getUrl = "http://"+ connectHost + remotePath;
if (theLogger.isFinest()) theLogger.logFinest(reqID +" using url: "+ getUrl);
- final httpClient client = setupHttpClient(requestHeader, connectHost);
+ final Client client = setupHttpClient(requestHeader, connectHost);
// check input
if(body == null) {
@@ -916,30 +925,30 @@ public final class httpdProxyHandler {
}
body = new ByteArrayInputStream(bodyData);
}
- httpResponse res = null;
+ ResponseContainer res = null;
try {
// sending the request
res = client.POST(getUrl, body);
if (theLogger.isFinest()) theLogger.logFinest(reqID +" response status: "+ res.getStatusLine());
- final httpResponseHeader responseHeader = res.getResponseHeader();
+ final ResponseHeader responseHeader = res.getResponseHeader();
// determine if it's an internal error of the httpc
if (responseHeader.size() == 0) {
throw new Exception(res.getStatusLine());
}
- final httpChunkedOutputStream chunked = setTransferEncoding(conProp, responseHeader, res.getStatusCode(), countedRespond);
+ final ChunkedOutputStream chunked = setTransferEncoding(conProp, responseHeader, res.getStatusCode(), countedRespond);
prepareResponseHeader(responseHeader, res.getHttpVer());
// sending the respond header back to the client
if (chunked != null) {
- responseHeader.put(httpHeader.TRANSFER_ENCODING, "chunked");
+ responseHeader.put(HeaderFramework.TRANSFER_ENCODING, "chunked");
}
// sending response headers
if (theLogger.isFinest()) theLogger.logFinest(reqID +" sending response header: "+ responseHeader);
- httpd.sendRespondHeader(conProp,
+ HTTPDemon.sendRespondHeader(conProp,
countedRespond,
httpVer,
res.getStatusCode(),
@@ -985,8 +994,8 @@ public final class httpdProxyHandler {
respond.flush();
}
- conProp.put(httpHeader.CONNECTION_PROP_REQUEST_END, Long.valueOf(System.currentTimeMillis()));
- conProp.put(httpHeader.CONNECTION_PROP_PROXY_RESPOND_SIZE,(countedRespond != null) ? Long.valueOf(countedRespond.getCount()) : -1L);
+ conProp.put(HeaderFramework.CONNECTION_PROP_REQUEST_END, Long.valueOf(System.currentTimeMillis()));
+ conProp.put(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_SIZE,(countedRespond != null) ? Long.valueOf(countedRespond.getCount()) : -1L);
logProxyAccess(conProp);
}
}
@@ -998,7 +1007,7 @@ public final class httpdProxyHandler {
* @return
*/
private static String resolveYacyDomains(final String host) {
- return (httpd.getAlternativeResolver() == null) ? null : httpd.getAlternativeResolver().resolve(host);
+ return (HTTPDemon.getAlternativeResolver() == null) ? null : HTTPDemon.getAlternativeResolver().resolve(host);
}
/**
@@ -1017,18 +1026,18 @@ public final class httpdProxyHandler {
* @param requestHeader
* @param hostlow
*/
- private static void prepareRequestHeader(final Properties conProp, final httpRequestHeader requestHeader, final String hostlow) {
+ private static void prepareRequestHeader(final Properties conProp, final RequestHeader requestHeader, final String hostlow) {
// set another userAgent, if not yellow-listed
if ((yellowList != null) && (!(yellowList.contains(domain(hostlow))))) {
// change the User-Agent
- requestHeader.put(httpHeader.USER_AGENT, generateUserAgent(requestHeader));
+ requestHeader.put(HeaderFramework.USER_AGENT, generateUserAgent(requestHeader));
}
// only gzip-encoding is supported, remove other encodings (e. g. deflate)
- if ((requestHeader.get(httpHeader.ACCEPT_ENCODING,"")).indexOf("gzip") != -1) {
- requestHeader.put(httpHeader.ACCEPT_ENCODING, "gzip");
+ if ((requestHeader.get(HeaderFramework.ACCEPT_ENCODING,"")).indexOf("gzip") != -1) {
+ requestHeader.put(HeaderFramework.ACCEPT_ENCODING, "gzip");
} else {
- requestHeader.put(httpHeader.ACCEPT_ENCODING, "");
+ requestHeader.put(HeaderFramework.ACCEPT_ENCODING, "");
}
addXForwardedForHeader(conProp, requestHeader);
@@ -1056,12 +1065,12 @@ public final class httpdProxyHandler {
* @param connectHost may be 'host:port' or 'host:port/path'
* @return
*/
- private static httpClient setupHttpClient(final httpRequestHeader requestHeader, final String connectHost) {
+ private static Client setupHttpClient(final RequestHeader requestHeader, final String connectHost) {
// setup HTTP-client
- final httpClient client = new httpClient(timeout, requestHeader);
+ final Client client = new Client(timeout, requestHeader);
client.setFollowRedirects(false);
// cookies are handled by the user's browser
- client.setProxy(httpRemoteProxyConfig.getProxyConfigForURI(connectHost));
+ client.setProxy(RemoteProxyConfig.getProxyConfigForURI(connectHost));
return client;
}
@@ -1085,25 +1094,25 @@ public final class httpdProxyHandler {
* @param respond
* @return
*/
- private static httpChunkedOutputStream setTransferEncoding(
- final Properties conProp, final httpResponseHeader responseHeader,
+ private static ChunkedOutputStream setTransferEncoding(
+ final Properties conProp, final ResponseHeader responseHeader,
final int statusCode, final OutputStream respond) {
- final String httpVer = conProp.getProperty(httpHeader.CONNECTION_PROP_HTTP_VER);
- httpChunkedOutputStream chunkedOut = null;
+ final String httpVer = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HTTP_VER);
+ ChunkedOutputStream chunkedOut = null;
// gzipped response is ungzipped an therefor the length is unknown
if (responseHeader.gzip() || responseHeader.getContentLength() < 0) {
// according to http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
// a 204,304 message must not contain a message body.
// Therefore we need to set the content-length to 0.
if (statusCode == 204 || statusCode == 304) {
- responseHeader.put(httpHeader.CONTENT_LENGTH, "0");
+ responseHeader.put(HeaderFramework.CONTENT_LENGTH, "0");
} else {
- if (httpVer.equals(httpHeader.HTTP_VERSION_0_9) || httpVer.equals(httpHeader.HTTP_VERSION_1_0)) {
+ if (httpVer.equals(HeaderFramework.HTTP_VERSION_0_9) || httpVer.equals(HeaderFramework.HTTP_VERSION_1_0)) {
forceConnectionClose(conProp);
} else {
- chunkedOut = new httpChunkedOutputStream(respond);
+ chunkedOut = new ChunkedOutputStream(respond);
}
- responseHeader.remove(httpHeader.CONTENT_LENGTH);
+ responseHeader.remove(HeaderFramework.CONTENT_LENGTH);
}
}
return chunkedOut;
@@ -1113,7 +1122,7 @@ public final class httpdProxyHandler {
* @param res
* @param responseHeader
*/
- private static void prepareResponseHeader(final httpResponseHeader responseHeader, final String httpVer) {
+ private static void prepareResponseHeader(final ResponseHeader responseHeader, final String httpVer) {
modifyProxyHeaders(responseHeader, httpVer);
correctContentEncoding(responseHeader);
@@ -1122,11 +1131,11 @@ public final class httpdProxyHandler {
/**
* @param responseHeader
*/
- private static void correctContentEncoding(final httpResponseHeader responseHeader) {
+ private static void correctContentEncoding(final ResponseHeader responseHeader) {
// TODO gzip again? set "correct" encoding?
if(responseHeader.gzip()) {
- responseHeader.remove(httpHeader.CONTENT_ENCODING);
- responseHeader.remove(httpHeader.CONTENT_LENGTH); // remove gziped length
+ responseHeader.remove(HeaderFramework.CONTENT_ENCODING);
+ responseHeader.remove(HeaderFramework.CONTENT_LENGTH); // remove gziped length
}
}
@@ -1136,10 +1145,10 @@ public final class httpdProxyHandler {
* @param conProp
* @param requestHeader
*/
- private static void addXForwardedForHeader(final Properties conProp, final httpRequestHeader requestHeader) {
+ private static void addXForwardedForHeader(final Properties conProp, final RequestHeader requestHeader) {
// setting the X-Forwarded-For Header
if (sb.getConfigBool("proxy.sendXForwardedForHeader", true)) {
- requestHeader.put(httpHeader.X_FORWARDED_FOR, conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP));
+ requestHeader.put(HeaderFramework.X_FORWARDED_FOR, conProp.getProperty(HeaderFramework.CONNECTION_PROP_CLIENTIP));
}
}
@@ -1149,44 +1158,44 @@ public final class httpdProxyHandler {
* @param requestHeader
* @param httpVer
*/
- private static void modifyProxyHeaders(final httpHeader requestHeader, final String httpVer) {
+ private static void modifyProxyHeaders(final HeaderFramework requestHeader, final String httpVer) {
removeHopByHopHeaders(requestHeader);
setViaHeader(requestHeader, httpVer);
}
- private static void removeHopByHopHeaders(final httpHeader headers) {
+ private static void removeHopByHopHeaders(final HeaderFramework headers) {
/*
- Trailers
*/
- headers.remove(httpRequestHeader.CONNECTION);
- headers.remove(httpRequestHeader.KEEP_ALIVE);
- headers.remove(httpRequestHeader.UPGRADE);
- headers.remove(httpRequestHeader.TE);
- headers.remove(httpRequestHeader.PROXY_CONNECTION);
- headers.remove(httpRequestHeader.PROXY_AUTHENTICATE);
- headers.remove(httpRequestHeader.PROXY_AUTHORIZATION);
+ headers.remove(RequestHeader.CONNECTION);
+ headers.remove(RequestHeader.KEEP_ALIVE);
+ headers.remove(RequestHeader.UPGRADE);
+ headers.remove(RequestHeader.TE);
+ headers.remove(RequestHeader.PROXY_CONNECTION);
+ headers.remove(RequestHeader.PROXY_AUTHENTICATE);
+ headers.remove(RequestHeader.PROXY_AUTHORIZATION);
// special headers inserted by squid
- headers.remove(httpRequestHeader.X_CACHE);
- headers.remove(httpRequestHeader.X_CACHE_LOOKUP);
+ headers.remove(RequestHeader.X_CACHE);
+ headers.remove(RequestHeader.X_CACHE_LOOKUP);
// remove transfer encoding header
- headers.remove(httpHeader.TRANSFER_ENCODING);
+ headers.remove(HeaderFramework.TRANSFER_ENCODING);
//removing yacy status headers
- headers.remove(httpHeader.X_YACY_KEEP_ALIVE_REQUEST_COUNT);
- headers.remove(httpHeader.X_YACY_ORIGINAL_REQUEST_LINE);
+ headers.remove(HeaderFramework.X_YACY_KEEP_ALIVE_REQUEST_COUNT);
+ headers.remove(HeaderFramework.X_YACY_ORIGINAL_REQUEST_LINE);
}
- private static void setViaHeader(final httpHeader header, final String httpVer) {
+ private static void setViaHeader(final HeaderFramework header, final String httpVer) {
if (!sb.getConfigBool("proxy.sendViaHeader", true)) return;
- final String myAddress = (httpd.getAlternativeResolver() == null) ? null : httpd.getAlternativeResolver().myAlternativeAddress();
+ final String myAddress = (HTTPDemon.getAlternativeResolver() == null) ? null : HTTPDemon.getAlternativeResolver().myAlternativeAddress();
if (myAddress != null) {
// getting header set by other proxies in the chain
final StringBuilder viaValue = new StringBuilder();
- if (header.containsKey(httpHeader.VIA)) viaValue.append(header.get(httpHeader.VIA));
+ if (header.containsKey(HeaderFramework.VIA)) viaValue.append(header.get(HeaderFramework.VIA));
if (viaValue.length() > 0) viaValue.append(", ");
// appending info about this peer
@@ -1196,18 +1205,18 @@ public final class httpdProxyHandler {
.append("(YaCy ").append(sb.getConfig("vString", "0.0")).append(")");
// storing header back
- header.put(httpHeader.VIA, new String(viaValue));
+ header.put(HeaderFramework.VIA, new String(viaValue));
}
}
- public static void doConnect(final Properties conProp, final httpRequestHeader requestHeader, final InputStream clientIn, final OutputStream clientOut) throws IOException {
+ public static void doConnect(final Properties conProp, final RequestHeader requestHeader, final InputStream clientIn, final OutputStream clientOut) throws IOException {
sb.proxyLastAccess = System.currentTimeMillis();
- String host = conProp.getProperty(httpHeader.CONNECTION_PROP_HOST);
- final String httpVersion = conProp.getProperty(httpHeader.CONNECTION_PROP_HTTP_VER);
- String path = conProp.getProperty(httpHeader.CONNECTION_PROP_PATH);
- final String args = conProp.getProperty(httpHeader.CONNECTION_PROP_ARGS);
+ String host = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HOST);
+ final String httpVersion = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HTTP_VER);
+ String path = conProp.getProperty(HeaderFramework.CONNECTION_PROP_PATH);
+ final String args = conProp.getProperty(HeaderFramework.CONNECTION_PROP_ARGS);
if (args != null) { path = path + "?" + args; }
int port, pos;
@@ -1222,8 +1231,8 @@ public final class httpdProxyHandler {
// blacklist idea inspired by [AS]:
// respond a 404 for all AGIS ("all you get is shit") servers
final String hostlow = host.toLowerCase();
- if (plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_PROXY, hostlow, path)) {
- httpd.sendRespondError(conProp,clientOut,4,403,null,
+ if (Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_PROXY, hostlow, path)) {
+ HTTPDemon.sendRespondError(conProp,clientOut,4,403,null,
"URL '" + hostlow + "' blocked by yacy proxy (blacklisted)",null);
theLogger.logInfo("AGIS blocking of host '" + hostlow + "'");
forceConnectionClose(conProp);
@@ -1231,16 +1240,16 @@ public final class httpdProxyHandler {
}
// possibly branch into PROXY-PROXY connection
- final httpRemoteProxyConfig proxyConfig = httpRemoteProxyConfig.getRemoteProxyConfig();
+ final RemoteProxyConfig proxyConfig = RemoteProxyConfig.getRemoteProxyConfig();
if (
(proxyConfig != null) &&
(proxyConfig.useProxy()) &&
(proxyConfig.useProxy4SSL())
) {
- final httpClient remoteProxy = new httpClient(timeout, requestHeader, proxyConfig);
+ final Client remoteProxy = new Client(timeout, requestHeader, proxyConfig);
remoteProxy.setFollowRedirects(false); // should not be needed, but safe is safe
- httpResponse response = null;
+ ResponseContainer response = null;
try {
response = remoteProxy.CONNECT(host, port);
// outputs a logline to the serverlog with the current status
@@ -1254,7 +1263,7 @@ public final class httpdProxyHandler {
// go on (see below)
} else {
// pass error response back to client
- httpd.sendRespondHeader(conProp,clientOut,httpVersion,response.getStatusCode(),response.getStatusLine().substring(4),response.getResponseHeader());
+ HTTPDemon.sendRespondHeader(conProp,clientOut,httpVersion,response.getStatusCode(),response.getStatusLine().substring(4),response.getResponseHeader());
//respondHeader(clientOut, response.status, response.responseHeader);
forceConnectionClose(conProp);
return;
@@ -1422,21 +1431,21 @@ public final class httpdProxyHandler {
}
// sending back an error message to the client
- if (!conProp.containsKey(httpHeader.CONNECTION_PROP_PROXY_RESPOND_HEADER)) {
+ if (!conProp.containsKey(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_HEADER)) {
if (detailedErrorMsg) {
- httpd.sendRespondError(conProp,respond, httpStatusCode, httpStatusText, new File(detailedErrorMsgFile), detailedErrorMsgMap, errorExc);
+ HTTPDemon.sendRespondError(conProp,respond, httpStatusCode, httpStatusText, new File(detailedErrorMsgFile), detailedErrorMsgMap, errorExc);
} else {
- httpd.sendRespondError(conProp,respond,4,httpStatusCode,httpStatusText,errorMessage,errorExc);
+ HTTPDemon.sendRespondError(conProp,respond,4,httpStatusCode,httpStatusText,errorMessage,errorExc);
}
} else {
if (unknownError) {
theLogger.logSevere("Unknown Error while processing request '" +
- conProp.getProperty(httpHeader.CONNECTION_PROP_REQUESTLINE,"unknown") + "':" +
+ conProp.getProperty(HeaderFramework.CONNECTION_PROP_REQUESTLINE,"unknown") + "':" +
"\n" + Thread.currentThread().getName() +
"\n" + errorMessage,e);
} else {
theLogger.logWarning("Error while processing request '" +
- conProp.getProperty(httpHeader.CONNECTION_PROP_REQUESTLINE,"unknown") + "':" +
+ conProp.getProperty(HeaderFramework.CONNECTION_PROP_REQUESTLINE,"unknown") + "':" +
"\n" + Thread.currentThread().getName() +
"\n" + errorMessage);
}
@@ -1450,7 +1459,7 @@ public final class httpdProxyHandler {
private static void forceConnectionClose(final Properties conProp) {
if (conProp != null) {
- conProp.setProperty(httpHeader.CONNECTION_PROP_PERSISTENT,"close");
+ conProp.setProperty(HeaderFramework.CONNECTION_PROP_PERSISTENT,"close");
}
}
@@ -1488,14 +1497,14 @@ public final class httpdProxyHandler {
// getting some connection properties
String orgHostPort = "80";
- String orgHostName = conProp.getProperty(httpHeader.CONNECTION_PROP_HOST,"unknown").toLowerCase();
+ String orgHostName = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HOST,"unknown").toLowerCase();
int pos = orgHostName.indexOf(":");
if (pos != -1) {
orgHostPort = orgHostName.substring(pos+1);
orgHostName = orgHostName.substring(0,pos);
}
- final String orgHostPath = conProp.getProperty(httpHeader.CONNECTION_PROP_PATH,"");
- String orgHostArgs = conProp.getProperty(httpHeader.CONNECTION_PROP_ARGS,"");
+ final String orgHostPath = conProp.getProperty(HeaderFramework.CONNECTION_PROP_PATH,"");
+ String orgHostArgs = conProp.getProperty(HeaderFramework.CONNECTION_PROP_ARGS,"");
if (orgHostArgs.length() > 0) orgHostArgs = "?" + orgHostArgs;
detailedErrorMsgMap.put("hostName", orgHostName);
@@ -1550,10 +1559,10 @@ public final class httpdProxyHandler {
return detailedErrorMsgMap;
}
- private static synchronized String generateUserAgent(final httpHeader requestHeaders) {
+ private static synchronized String generateUserAgent(final HeaderFramework requestHeaders) {
userAgentStr.setLength(0);
- final String browserUserAgent = requestHeaders.get(httpHeader.USER_AGENT, HTTPLoader.yacyUserAgent);
+ final String browserUserAgent = requestHeaders.get(HeaderFramework.USER_AGENT, HTTPLoader.yacyUserAgent);
final int pos = browserUserAgent.lastIndexOf(')');
if (pos >= 0) {
userAgentStr
@@ -1591,8 +1600,8 @@ public final class httpdProxyHandler {
logMessage.append(' ');
// Elapsed time
- final Long requestStart = (Long) conProp.get(httpHeader.CONNECTION_PROP_REQUEST_START);
- final Long requestEnd = (Long) conProp.get(httpHeader.CONNECTION_PROP_REQUEST_END);
+ final Long requestStart = (Long) conProp.get(HeaderFramework.CONNECTION_PROP_REQUEST_START);
+ final Long requestEnd = (Long) conProp.get(HeaderFramework.CONNECTION_PROP_REQUEST_END);
final String elapsed = Long.toString(requestEnd.longValue()-requestStart.longValue());
for (int i=0; i<6-elapsed.length(); i++) logMessage.append(' ');
@@ -1600,31 +1609,31 @@ public final class httpdProxyHandler {
logMessage.append(' ');
// Remote Host
- final String clientIP = conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP);
+ final String clientIP = conProp.getProperty(HeaderFramework.CONNECTION_PROP_CLIENTIP);
logMessage.append(clientIP);
logMessage.append(' ');
// Code/Status
- final String respondStatus = conProp.getProperty(httpHeader.CONNECTION_PROP_PROXY_RESPOND_STATUS);
- final String respondCode = conProp.getProperty(httpHeader.CONNECTION_PROP_PROXY_RESPOND_CODE,"UNKNOWN");
+ final String respondStatus = conProp.getProperty(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_STATUS);
+ final String respondCode = conProp.getProperty(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_CODE,"UNKNOWN");
logMessage.append(respondCode);
logMessage.append("/");
logMessage.append(respondStatus);
logMessage.append(' ');
// Bytes
- final Long bytes = (Long) conProp.get(httpHeader.CONNECTION_PROP_PROXY_RESPOND_SIZE);
+ final Long bytes = (Long) conProp.get(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_SIZE);
logMessage.append(bytes.toString());
logMessage.append(' ');
// Method
- final String requestMethod = conProp.getProperty(httpHeader.CONNECTION_PROP_METHOD);
+ final String requestMethod = conProp.getProperty(HeaderFramework.CONNECTION_PROP_METHOD);
logMessage.append(requestMethod);
logMessage.append(' ');
// URL
- final String requestURL = conProp.getProperty(httpHeader.CONNECTION_PROP_URL);
- final String requestArgs = conProp.getProperty(httpHeader.CONNECTION_PROP_ARGS);
+ final String requestURL = conProp.getProperty(HeaderFramework.CONNECTION_PROP_URL);
+ final String requestArgs = conProp.getProperty(HeaderFramework.CONNECTION_PROP_ARGS);
logMessage.append(requestURL);
if (requestArgs != null) {
logMessage.append("?")
@@ -1637,15 +1646,15 @@ public final class httpdProxyHandler {
logMessage.append(' ');
// Peerstatus/Peerhost
- final String host = conProp.getProperty(httpHeader.CONNECTION_PROP_HOST);
+ final String host = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HOST);
logMessage.append("DIRECT/");
logMessage.append(host);
logMessage.append(' ');
// Type
String mime = "-";
- if (conProp.containsKey(httpHeader.CONNECTION_PROP_PROXY_RESPOND_HEADER)) {
- final httpHeader proxyRespondHeader = (httpHeader) conProp.get(httpHeader.CONNECTION_PROP_PROXY_RESPOND_HEADER);
+ if (conProp.containsKey(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_HEADER)) {
+ final HeaderFramework proxyRespondHeader = (HeaderFramework) conProp.get(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_HEADER);
mime = proxyRespondHeader.mime();
if (mime.indexOf(";") != -1) {
mime = mime.substring(0,mime.indexOf(";"));
diff --git a/source/de/anomic/http/httpd.java b/source/de/anomic/http/server/HTTPDemon.java
similarity index 78%
rename from source/de/anomic/http/httpd.java
rename to source/de/anomic/http/server/HTTPDemon.java
index 90f35c153..529f53be4 100644
--- a/source/de/anomic/http/httpd.java
+++ b/source/de/anomic/http/server/HTTPDemon.java
@@ -22,7 +22,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.server;
import java.io.ByteArrayOutputStream;
import java.io.CharArrayWriter;
@@ -62,13 +62,16 @@ import org.apache.commons.httpclient.ContentLengthInputStream;
import de.anomic.data.userDB;
import de.anomic.document.parser.html.CharacterCoding;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.metadata.ResponseHeader;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.order.Digest;
import de.anomic.kelondro.util.ByteBuffer;
import de.anomic.kelondro.util.DateFormatter;
import de.anomic.kelondro.util.FileUtils;
import de.anomic.kelondro.util.MemoryControl;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverCodings;
import de.anomic.server.serverCore;
import de.anomic.server.serverDomains;
@@ -86,7 +89,7 @@ import de.anomic.yacy.logging.Log;
* these methods parse the command line and decide wether to call
* a proxy servlet or a file server servlet
*/
-public final class httpd implements serverHandler, Cloneable {
+public final class HTTPDemon implements serverHandler, Cloneable {
/**
* <p><code>public static final String <strong>ADMIN_ACCOUNT_B64MD5</strong> = "adminAccountBase64MD5"</code></p>
@@ -98,7 +101,7 @@ public final class httpd implements serverHandler, Cloneable {
public static final int ERRORCASE_MESSAGE = 4;
public static final int ERRORCASE_FILE = 5;
private static File TMPDIR = new File(System.getProperty("java.io.tmpdir"));
- private static httpdAlternativeDomainNames alternativeResolver = null;
+ private static AlternativeDomainNames alternativeResolver = null;
/**
* A hashset containing extensions that indicate content that should not be transported
@@ -117,7 +120,7 @@ public final class httpd implements serverHandler, Cloneable {
public static final String hline = "-------------------------------------------------------------------------------";
public static final HashMap<String, String> reverseMappingCache = new HashMap<String, String>();
- private static volatile plasmaSwitchboard switchboard = null;
+ private static volatile Switchboard switchboard = null;
private static String virtualHost = null;
public static boolean keepAliveSupport = false;
@@ -147,10 +150,10 @@ public final class httpd implements serverHandler, Cloneable {
private final static Log log = new Log("HTTPD");
// class methods
- public httpd(final serverSwitch s) {
+ public HTTPDemon(final serverSwitch s) {
// handler info
- httpd.switchboard = (plasmaSwitchboard)s;
- httpd.virtualHost = switchboard.getConfig("fileHost","localhost");
+ HTTPDemon.switchboard = (Switchboard)s;
+ HTTPDemon.virtualHost = switchboard.getConfig("fileHost","localhost");
// authentication: by default none
this.proxyAccounts_init = false;
@@ -258,36 +261,36 @@ public final class httpd implements serverHandler, Cloneable {
* @param header the received http-headers
* @return <code>true</code> if a persistent connection was requested or <code>false</code> otherwise
*/
- private boolean handlePersistentConnection(final httpRequestHeader header) {
+ private boolean handlePersistentConnection(final RequestHeader header) {
if (!keepAliveSupport) {
- this.prop.put(httpHeader.CONNECTION_PROP_PERSISTENT,"close");
+ this.prop.put(HeaderFramework.CONNECTION_PROP_PERSISTENT,"close");
return false;
}
// getting the http version that is used by the client
- final String httpVersion = this.prop.getProperty(httpHeader.CONNECTION_PROP_HTTP_VER, "HTTP/0.9");
+ final String httpVersion = this.prop.getProperty(HeaderFramework.CONNECTION_PROP_HTTP_VER, "HTTP/0.9");
// managing keep-alive: in HTTP/0.9 and HTTP/1.0 every connection is closed
// afterwards. In HTTP/1.1 (and above, in the future?) connections are
// persistent by default, but closed with the "Connection: close"
// property.
- boolean persistent = !(httpVersion.equals(httpHeader.HTTP_VERSION_0_9) || httpVersion.equals(httpHeader.HTTP_VERSION_1_0));
- if ((header.get(httpRequestHeader.CONNECTION, "keep-alive")).toLowerCase().indexOf("close") != -1 ||
- (header.get(httpRequestHeader.PROXY_CONNECTION, "keep-alive")).toLowerCase().indexOf("close") != -1) {
+ boolean persistent = !(httpVersion.equals(HeaderFramework.HTTP_VERSION_0_9) || httpVersion.equals(HeaderFramework.HTTP_VERSION_1_0));
+ if ((header.get(RequestHeader.CONNECTION, "keep-alive")).toLowerCase().indexOf("close") != -1 ||
+ (header.get(RequestHeader.PROXY_CONNECTION, "keep-alive")).toLowerCase().indexOf("close") != -1) {
persistent = false;
}
- final String transferEncoding = header.get(httpHeader.TRANSFER_ENCODING, "identity");
- final boolean isPostRequest = this.prop.getProperty(httpHeader.CONNECTION_PROP_METHOD).equals(httpHeader.METHOD_POST);
- final boolean hasContentLength = header.containsKey(httpHeader.CONTENT_LENGTH);
- final boolean hasTransferEncoding = header.containsKey(httpHeader.TRANSFER_ENCODING) && !transferEncoding.equalsIgnoreCase("identity");
+ final String transferEncoding = header.get(HeaderFramework.TRANSFER_ENCODING, "identity");
+ final boolean isPostRequest = this.prop.getProperty(HeaderFramework.CONNECTION_PROP_METHOD).equals(HeaderFramework.METHOD_POST);
+ final boolean hasContentLength = header.containsKey(HeaderFramework.CONTENT_LENGTH);
+ final boolean hasTransferEncoding = header.containsKey(HeaderFramework.TRANSFER_ENCODING) && !transferEncoding.equalsIgnoreCase("identity");
// if the request does not contain a content-length we have to close the connection
// independently of the value of the connection header
if (persistent && isPostRequest && !(hasContentLength || hasTransferEncoding))
- this.prop.put(httpHeader.CONNECTION_PROP_PERSISTENT,"close");
- else this.prop.put(httpHeader.CONNECTION_PROP_PERSISTENT,persistent?"keep-alive":"close");
+ this.prop.put(HeaderFramework.CONNECTION_PROP_PERSISTENT,"close");
+ else this.prop.put(HeaderFramework.CONNECTION_PROP_PERSISTENT,persistent?"keep-alive":"close");
return persistent;
}
@@ -302,31 +305,31 @@ public final class httpd implements serverHandler, Cloneable {
return 1;
}
- private boolean handleServerAuthentication(final httpRequestHeader header) throws IOException {
+ private boolean handleServerAuthentication(final RequestHeader header) throws IOException {
// getting the http version that is used by the client
- final String httpVersion = this.prop.getProperty(httpHeader.CONNECTION_PROP_HTTP_VER, "HTTP/0.9");
+ final String httpVersion = this.prop.getProperty(HeaderFramework.CONNECTION_PROP_HTTP_VER, "HTTP/0.9");
// reading the authentication settings from switchboard
if (this.serverAccountBase64MD5 == null)
this.serverAccountBase64MD5 = switchboard.getConfig("serverAccountBase64MD5", "");
if (this.serverAccountBase64MD5.length() > 0) {
- final String auth = header.get(httpRequestHeader.AUTHORIZATION);
+ final String auth = header.get(RequestHeader.AUTHORIZATION);
if (auth == null) {
// authorization requested, but no authorizeation given in header. Ask for authenticate:
this.session.out.write((httpVersion + " 401 log-in required" + serverCore.CRLF_STRING +
- httpRequestHeader.WWW_AUTHENTICATE + ": Basic realm=\"log-in\"" + serverCore.CRLF_STRING +
+ RequestHeader.WWW_AUTHENTICATE + ": Basic realm=\"log-in\"" + serverCore.CRLF_STRING +
serverCore.CRLF_STRING).getBytes());
- this.session.out.write((httpHeader.CONTENT_LENGTH + ": 0\r\n").getBytes());
+ this.session.out.write((HeaderFramework.CONTENT_LENGTH + ": 0\r\n").getBytes());
this.session.out.write("\r\n".getBytes());
return false;
} else if (!this.serverAccountBase64MD5.equals(Digest.encodeMD5Hex(auth.trim().substring(6)))) {
// wrong password given: ask for authenticate again
log.logInfo("Wrong log-in for account 'server' in HTTPD.GET " + this.prop.getProperty("PATH") + " from IP " + this.clientIP);
this.session.out.write((httpVersion + " 401 log-in required" + serverCore.CRLF_STRING +
- httpRequestHeader.WWW_AUTHENTICATE + ": Basic realm=\"log-in\"" +
+ RequestHeader.WWW_AUTHENTICATE + ": Basic realm=\"log-in\"" +
serverCore.CRLF_STRING).getBytes());
- this.session.out.write((httpHeader.CONTENT_LENGTH + ": 0\r\n").getBytes());
+ this.session.out.write((HeaderFramework.CONTENT_LENGTH + ": 0\r\n").getBytes());
this.session.out.write("\r\n".getBytes());
this.session.out.flush();
return false;
@@ -335,14 +338,14 @@ public final class httpd implements serverHandler, Cloneable {
return true;
}
- private boolean handleYaCyHopAuthentication(final httpRequestHeader header) {
+ private boolean handleYaCyHopAuthentication(final RequestHeader header) {
// check if the user has allowed that his/her peer is used for hops
if (!this.allowYaCyHop) return false;
// proxy hops must identify with 4 criteria:
// the accessed port must not be port 80
- final String host = this.prop.getProperty(httpHeader.CONNECTION_PROP_HOST);
+ final String host = this.prop.getProperty(HeaderFramework.CONNECTION_PROP_HOST);
if (host == null) return false;
int pos;
if ((pos = host.indexOf(":")) < 0) {
@@ -352,24 +355,24 @@ public final class httpd implements serverHandler, Cloneable {
if (Integer.parseInt(host.substring(pos + 1)) == 80) return false;
// the access path must be into the yacy protocol path; it must start with 'yacy'
- if (!(this.prop.getProperty(httpHeader.CONNECTION_PROP_PATH, "").startsWith("/yacy/"))) return false;
+ if (!(this.prop.getProperty(HeaderFramework.CONNECTION_PROP_PATH, "").startsWith("/yacy/"))) return false;
// the accessing client must identify with user:password, where
// user = addressed peer name
// pw = addressed peer hash (b64-hash)
- final String auth = header.get(httpRequestHeader.PROXY_AUTHORIZATION,"xxxxxx");
+ final String auth = header.get(RequestHeader.PROXY_AUTHORIZATION,"xxxxxx");
if (getAlternativeResolver() != null) {
final String test = Base64Order.standardCoder.encodeString(getAlternativeResolver().myName() + ":" + getAlternativeResolver().myID());
if (!test.equals(auth.trim().substring(6))) return false;
}
// the accessing client must use a yacy user-agent
- if (!((header.get(httpHeader.USER_AGENT,"")).startsWith("yacy"))) return false;
+ if (!((header.get(HeaderFramework.USER_AGENT,"")).startsWith("yacy"))) return false;
// furthermore, YaCy hops must not exceed a specific access frequency
// check access requester frequency: protection against DoS against this peer
- final String requester = this.prop.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP);
+ final String requester = this.prop.getProperty(HeaderFramework.CONNECTION_PROP_CLIENTIP);
if (requester == null) return false;
if (lastAccessDelta(YaCyHopAccessRequester, requester) < 10000) return false;
YaCyHopAccessRequester.put(requester, Long.valueOf(System.currentTimeMillis()));
@@ -388,7 +391,7 @@ public final class httpd implements serverHandler, Cloneable {
return System.currentTimeMillis() - lastAccess.longValue();
}
- private boolean handleProxyAuthentication(final httpRequestHeader header) throws IOException {
+ private boolean handleProxyAuthentication(final RequestHeader header) throws IOException {
// getting the http version that is used by the client
final String httpVersion = this.prop.getProperty("HTTP", "HTTP/0.9");
@@ -399,7 +402,7 @@ public final class httpd implements serverHandler, Cloneable {
}
if (this.use_proxyAccounts) {
- final String auth = header.get(httpRequestHeader.PROXY_AUTHORIZATION,"xxxxxx");
+ final String auth = header.get(RequestHeader.PROXY_AUTHORIZATION,"xxxxxx");
userDB.Entry entry=switchboard.userDB.ipAuth(this.clientIP);
if(entry == null){
entry=switchboard.userDB.proxyAuth(auth, this.clientIP);
@@ -422,8 +425,8 @@ public final class httpd implements serverHandler, Cloneable {
}
// ask for authenticate
this.session.out.write((httpVersion + " 407 Proxy Authentication Required" + serverCore.CRLF_STRING +
- httpRequestHeader.PROXY_AUTHENTICATE + ": Basic realm=\"log-in\"" + serverCore.CRLF_STRING).getBytes());
- this.session.out.write((httpHeader.CONTENT_LENGTH + ": 0\r\n").getBytes());
+ RequestHeader.PROXY_AUTHENTICATE + ": Basic realm=\"log-in\"" + serverCore.CRLF_STRING).getBytes());
+ this.session.out.write((HeaderFramework.CONTENT_LENGTH + ": 0\r\n").getBytes());
this.session.out.write("\r\n".getBytes());
this.session.out.flush();
return false;
@@ -469,25 +472,25 @@ public final class httpd implements serverHandler, Cloneable {
public Boolean GET(final String arg) {
try {
// parsing the http request line
- parseRequestLine(httpHeader.METHOD_GET,arg);
+ parseRequestLine(HeaderFramework.METHOD_GET,arg);
// we now know the HTTP version. depending on that, we read the header
- final String httpVersion = this.prop.getProperty(httpHeader.CONNECTION_PROP_HTTP_VER, httpHeader.HTTP_VERSION_0_9);
- final httpRequestHeader header = (httpVersion.equals(httpHeader.HTTP_VERSION_0_9))
- ? new httpRequestHeader(reverseMappingCache)
- : httpRequestHeader.readHeader(this.prop,this.session);
+ final String httpVersion = this.prop.getProperty(HeaderFramework.CONNECTION_PROP_HTTP_VER, HeaderFramework.HTTP_VERSION_0_9);
+ final RequestHeader header = (httpVersion.equals(HeaderFramework.HTTP_VERSION_0_9))
+ ? new RequestHeader(reverseMappingCache)
+ : RequestHeader.readHeader(this.prop,this.session);
// handling transparent proxy support
- httpHeader.handleTransparentProxySupport(header, this.prop, virtualHost, httpdProxyHandler.isTransparentProxy);
+ HeaderFramework.handleTransparentProxySupport(header, this.prop, virtualHost, HTTPDProxyHandler.isTransparentProxy);
// determines if the connection should be kept alive
handlePersistentConnection(header);
- if (this.prop.getProperty(httpHeader.CONNECTION_PROP_HOST).equals(virtualHost)) {
+ if (this.prop.getProperty(HeaderFramework.CONNECTION_PROP_HOST).equals(virtualHost)) {
// pass to server
if (this.allowServer) {
if (this.handleServerAuthentication(header)) {
- httpdFileHandler.doGet(this.prop, header, this.session.out);
+ HTTPDFileHandler.doGet(this.prop, header, this.session.out);
}
} else {
// not authorized through firewall blocking (ip does not match filter)
@@ -498,7 +501,7 @@ public final class httpd implements serverHandler, Cloneable {
// pass to proxy
if (((this.allowYaCyHop) && (handleYaCyHopAuthentication(header))) ||
((this.allowProxy) && (handleProxyAuthentication(header)))) {
- httpdProxyHandler.doGet(this.prop, header, this.session.out);
+ HTTPDProxyHandler.doGet(this.prop, header, this.session.out);
} else {
// not authorized through firewall blocking (ip does not match filter)
this.session.out.write((httpVersion + " 403 refused (IP not granted)" + serverCore.CRLF_STRING + serverCore.CRLF_STRING + "you are not allowed to connect to this proxy, because you are using a non-granted IP. allowed are only connections that match with the following filter: " + switchboard.getConfig("proxyClient", "*") + serverCore.CRLF_STRING).getBytes());
@@ -506,7 +509,7 @@ public final class httpd implements serverHandler, Cloneable {
}
}
- return this.prop.getProperty(httpHeader.CONNECTION_PROP_PERSISTENT).equals("keep-alive") ? serverCore.RESUME_CONNECTION : serverCore.TERMINATE_CONNECTION;
+ return this.prop.getProperty(HeaderFramework.CONNECTION_PROP_PERSISTENT).equals("keep-alive") ? serverCore.RESUME_CONNECTION : serverCore.TERMINATE_CONNECTION;
} catch (final Exception e) {
logUnexpectedError(e);
return serverCore.TERMINATE_CONNECTION;
@@ -537,26 +540,26 @@ public final class httpd implements serverHandler, Cloneable {
public Boolean HEAD(final String arg) {
try {
- parseRequestLine(httpHeader.METHOD_HEAD,arg);
+ parseRequestLine(HeaderFramework.METHOD_HEAD,arg);
// we now know the HTTP version. depending on that, we read the header
- httpRequestHeader header;
- final String httpVersion = this.prop.getProperty(httpHeader.CONNECTION_PROP_HTTP_VER, httpHeader.HTTP_VERSION_0_9);
- if (httpVersion.equals(httpHeader.HTTP_VERSION_0_9)) header = new httpRequestHeader(reverseMappingCache);
- else header = httpRequestHeader.readHeader(this.prop,this.session);
+ RequestHeader header;
+ final String httpVersion = this.prop.getProperty(HeaderFramework.CONNECTION_PROP_HTTP_VER, HeaderFramework.HTTP_VERSION_0_9);
+ if (httpVersion.equals(HeaderFramework.HTTP_VERSION_0_9)) header = new RequestHeader(reverseMappingCache);
+ else header = RequestHeader.readHeader(this.prop,this.session);
// handle transparent proxy support
- httpHeader.handleTransparentProxySupport(header, this.prop, virtualHost, httpdProxyHandler.isTransparentProxy);
+ HeaderFramework.handleTransparentProxySupport(header, this.prop, virtualHost, HTTPDProxyHandler.isTransparentProxy);
// determines if the connection should be kept alive
handlePersistentConnection(header);
// return multi-line message
- if (this.prop.getProperty(httpHeader.CONNECTION_PROP_HOST).equals(virtualHost)) {
+ if (this.prop.getProperty(HeaderFramework.CONNECTION_PROP_HOST).equals(virtualHost)) {
// pass to server
if (allowServer) {
if (handleServerAuthentication(header)) {
- httpdFileHandler.doHead(prop, header, this.session.out);
+ HTTPDFileHandler.doHead(prop, header, this.session.out);
}
} else {
// not authorized through firewall blocking (ip does not match filter)
@@ -568,7 +571,7 @@ public final class httpd implements serverHandler, Cloneable {
// pass to proxy
if (((this.allowYaCyHop) && (handleYaCyHopAuthentication(header))) ||
((this.allowProxy) && (handleProxyAuthentication(header)))) {
- httpdProxyHandler.doHead(prop, header, this.session.out);
+ HTTPDProxyHandler.doHead(prop, header, this.session.out);
} else {
// not authorized through firewall blocking (ip does not match filter)
session.out.write((httpVersion + " 403 refused (IP not granted)" +
@@ -576,7 +579,7 @@ public final class httpd implements serverHandler, Cloneable {
return serverCore.TERMINATE_CONNECTION;
}
}
- return this.prop.getProperty(httpHeader.CONNECTION_PROP_PERSISTENT).equals("keep-alive") ? serverCore.RESUME_CONNECTION : serverCore.TERMINATE_CONNECTION;
+ return this.prop.getProperty(HeaderFramework.CONNECTION_PROP_PERSISTENT).equals("keep-alive") ? serverCore.RESUME_CONNECTION : serverCore.TERMINATE_CONNECTION;
} catch (final Exception e) {
logUnexpectedError(e);
return serverCore.TERMINATE_CONNECTION;
@@ -585,22 +588,22 @@ public final class httpd implements serverHandler, Cloneable {
public Boolean POST(final String arg) {
try {
- parseRequestLine(httpHeader.METHOD_POST,arg);
+ parseRequestLine(HeaderFramework.METHOD_POST,arg);
// we now know the HTTP version. depending on that, we read the header
- httpRequestHeader header;
- final String httpVersion = this.prop.getProperty(httpHeader.CONNECTION_PROP_HTTP_VER, httpHeader.HTTP_VERSION_0_9);
- if (httpVersion.equals(httpHeader.HTTP_VERSION_0_9)) header = new httpRequestHeader(reverseMappingCache);
- else header = httpRequestHeader.readHeader(this.prop,this.session);
+ RequestHeader header;
+ final String httpVersion = this.prop.getProperty(HeaderFramework.CONNECTION_PROP_HTTP_VER, HeaderFramework.HTTP_VERSION_0_9);
+ if (httpVersion.equals(HeaderFramework.HTTP_VERSION_0_9)) header = new RequestHeader(reverseMappingCache);
+ else header = RequestHeader.readHeader(this.prop,this.session);
// handle transfer-coding
final InputStream sessionIn;
- final String transferEncoding = header.get(httpHeader.TRANSFER_ENCODING);
+ final String transferEncoding = header.get(HeaderFramework.TRANSFER_ENCODING);
if (transferEncoding != null) {
- if (!httpHeader.HTTP_VERSION_1_1.equals(httpVersion)) {
+ if (!HeaderFramework.HTTP_VERSION_1_1.equals(httpVersion)) {
log.logWarning("client "+ session.getName() +" uses transfer-coding with HTTP version "+ httpVersion +"!");
}
- if("chunked".equalsIgnoreCase(header.get(httpHeader.TRANSFER_ENCODING))) {
+ if("chunked".equalsIgnoreCase(header.get(HeaderFramework.TRANSFER_ENCODING))) {
sessionIn = new ChunkedInputStream(this.session.in);
} else {
// "A server which receives an entity-body with a transfer-coding it does
@@ -614,17 +617,17 @@ public final class httpd implements serverHandler, Cloneable {
}
// handle transparent proxy support
- httpHeader.handleTransparentProxySupport(header, this.prop, virtualHost, httpdProxyHandler.isTransparentProxy);
+ HeaderFramework.handleTransparentProxySupport(header, this.prop, virtualHost, HTTPDProxyHandler.isTransparentProxy);
// determines if the connection should be kept alive
handlePersistentConnection(header);
// return multi-line message
- if (prop.getProperty(httpHeader.CONNECTION_PROP_HOST).equals(virtualHost)) {
+ if (prop.getProperty(HeaderFramework.CONNECTION_PROP_HOST).equals(virtualHost)) {
// pass to server
if (allowServer) {
if (handleServerAuthentication(header)) {
- httpdFileHandler.doPost(prop, header, this.session.out, sessionIn);
+ HTTPDFileHandler.doPost(prop, header, this.session.out, sessionIn);
}
} else {
// not authorized through firewall blocking (ip does not match filter)
@@ -635,7 +638,7 @@ public final class httpd implements serverHandler, Cloneable {
// pass to proxy
if (((this.allowYaCyHop) && (handleYaCyHopAuthentication(header))) ||
((this.allowProxy) && (handleProxyAuthentication(header)))) {
- httpdProxyHandler.doPost(prop, header, this.session.out, sessionIn);
+ HTTPDProxyHandler.doPost(prop, header, this.session.out, sessionIn);
} else {
// not authorized through firewall blocking (ip does not match filter)
session.out.write((httpVersion + " 403 refused (IP not granted)" + serverCore.CRLF_STRING + serverCore.CRLF_STRING + "you are not allowed to connect to this proxy, because you are using the non-granted IP " + clientIP + ". allowed are only connections that match with the following filter: " + switchboard.getConfig("proxyClient", "*") + serverCore.CRLF_STRING).getBytes());
@@ -644,7 +647,7 @@ public final class httpd implements serverHandler, Cloneable {
}
if(sessionIn instanceof ChunkedInputStream) sessionIn.close(); // read to end, but do not close the stream (maybe HTTP/1.1 persistent)
//return serverCore.RESUME_CONNECTION;
- return this.prop.getProperty(httpHeader.CONNECTION_PROP_PERSISTENT).equals("keep-alive") ? serverCore.RESUME_CONNECTION : serverCore.TERMINATE_CONNECTION;
+ return this.prop.getProperty(HeaderFramework.CONNECTION_PROP_PERSISTENT).equals("keep-alive") ? serverCore.RESUME_CONNECTION : serverCore.TERMINATE_CONNECTION;
} catch (final Exception e) {
logUnexpectedError(e);
return serverCore.TERMINATE_CONNECTION;
@@ -663,10 +666,10 @@ public final class httpd implements serverHandler, Cloneable {
httpVersion = arg.substring(pos + 1);
arg = arg.substring(0, pos);
}
- prop.setProperty(httpHeader.CONNECTION_PROP_HTTP_VER, httpVersion);
+ prop.setProperty(HeaderFramework.CONNECTION_PROP_HTTP_VER, httpVersion);
// parse hostname and port
- prop.setProperty(httpHeader.CONNECTION_PROP_HOST, arg);
+ prop.setProperty(HeaderFramework.CONNECTION_PROP_HOST, arg);
pos = arg.indexOf(":");
int port = 443;
if (pos >= 0) {
@@ -675,14 +678,14 @@ public final class httpd implements serverHandler, Cloneable {
}
// setting other connection properties
- prop.setProperty(httpHeader.CONNECTION_PROP_CLIENTIP, this.clientIP);
- prop.setProperty(httpHeader.CONNECTION_PROP_METHOD, httpHeader.METHOD_CONNECT);
- prop.setProperty(httpHeader.CONNECTION_PROP_PATH, "/");
- prop.setProperty(httpHeader.CONNECTION_PROP_EXT, "");
- prop.setProperty(httpHeader.CONNECTION_PROP_URL, "");
+ prop.setProperty(HeaderFramework.CONNECTION_PROP_CLIENTIP, this.clientIP);
+ prop.setProperty(HeaderFramework.CONNECTION_PROP_METHOD, HeaderFramework.METHOD_CONNECT);
+ prop.setProperty(HeaderFramework.CONNECTION_PROP_PATH, "/");
+ prop.setProperty(HeaderFramework.CONNECTION_PROP_EXT, "");
+ prop.setProperty(HeaderFramework.CONNECTION_PROP_URL, "");
// parse remaining lines
- final httpRequestHeader header = httpRequestHeader.readHeader(this.prop,this.session);
+ final RequestHeader header = RequestHeader.readHeader(this.prop,this.session);
if (!(allowProxy)) {
// not authorized through firewall blocking (ip does not match filter)
@@ -701,7 +704,7 @@ public final class httpd implements serverHandler, Cloneable {
// pass to proxy
if (((this.allowYaCyHop) && (handleYaCyHopAuthentication(header))) ||
((this.allowProxy) && (this.handleProxyAuthentication(header)))) {
- httpdProxyHandler.doConnect(prop, header, this.session.in, this.session.out);
+ HTTPDProxyHandler.doConnect(prop, header, this.session.in, this.session.out);
} else {
// not authorized through firewall blocking (ip does not match filter)
session.out.write((httpVersion + " 403 refused (IP not granted)" + serverCore.CRLF_STRING + serverCore.CRLF_STRING + "you are not allowed to connect to this proxy, because you are using the non-granted IP " + clientIP + ". allowed are only connections that match with the following filter: " + switchboard.getConfig("proxyClient", "*") + serverCore.CRLF_STRING).getBytes());
@@ -713,21 +716,21 @@ public final class httpd implements serverHandler, Cloneable {
private final void parseRequestLine(final String cmd, final String s) {
// parsing the header
- httpRequestHeader.parseRequestLine(cmd,s,this.prop,virtualHost);
+ RequestHeader.parseRequestLine(cmd,s,this.prop,virtualHost);
// track the request
- final String path = this.prop.getProperty(httpHeader.CONNECTION_PROP_URL);
- final String args = this.prop.getProperty(httpHeader.CONNECTION_PROP_ARGS, "");
+ final String path = this.prop.getProperty(HeaderFramework.CONNECTION_PROP_URL);
+ final String args = this.prop.getProperty(HeaderFramework.CONNECTION_PROP_ARGS, "");
switchboard.track(this.userAddress.getHostName(), (args.length() > 0) ? path + "?" + args : path);
// reseting the empty request counter
this.emptyRequestCount = 0;
// counting the amount of received requests within this permanent connection
- this.prop.setProperty(httpHeader.CONNECTION_PROP_KEEP_ALIVE_COUNT, Integer.toString(++this.keepAliveRequestCount));
+ this.prop.setProperty(HeaderFramework.CONNECTION_PROP_KEEP_ALIVE_COUNT, Integer.toString(++this.keepAliveRequestCount));
// setting the client-IP
- this.prop.setProperty(httpHeader.CONNECTION_PROP_CLIENTIP, this.clientIP);
+ this.prop.setProperty(HeaderFramework.CONNECTION_PROP_CLIENTIP, this.clientIP);
}
// some static methods that needs to be used from any CGI
@@ -883,7 +886,7 @@ public final class httpd implements serverHandler, Cloneable {
* @throws IOException
*/
@SuppressWarnings("unchecked")
- public static HashMap<String, byte[]> parseMultipart(final httpRequestHeader header, final serverObjects args, final InputStream in)
+ public static HashMap<String, byte[]> parseMultipart(final RequestHeader header, final serverObjects args, final InputStream in)
throws IOException {
final InputStream body = prepareBody(header, in);
@@ -944,14 +947,14 @@ public final class httpd implements serverHandler, Cloneable {
* @return
* @throws IOException
*/
- private static InputStream prepareBody(final httpRequestHeader header, final InputStream in) throws IOException {
+ private static InputStream prepareBody(final RequestHeader header, final InputStream in) throws IOException {
InputStream body = in;
// data may be compressed
- final String bodyEncoding = header.get(httpHeader.CONTENT_ENCODING);
- if(httpHeader.CONTENT_ENCODING_GZIP.equalsIgnoreCase(bodyEncoding) && !(body instanceof GZIPInputStream)) {
+ final String bodyEncoding = header.get(HeaderFramework.CONTENT_ENCODING);
+ if(HeaderFramework.CONTENT_ENCODING_GZIP.equalsIgnoreCase(bodyEncoding) && !(body instanceof GZIPInputStream)) {
body = new GZIPInputStream(body);
// length of uncompressed data is unknown
- header.remove(httpHeader.CONTENT_LENGTH);
+ header.remove(HeaderFramework.CONTENT_LENGTH);
} else {
// ensure the end of data (if client keeps alive the connection)
final long clength = header.getContentLength();
@@ -968,7 +971,7 @@ public final class httpd implements serverHandler, Cloneable {
* @author danielr
* @since 07.08.2008
*/
- private static class yacyContextRequest extends httpRequestHeader implements RequestContext {
+ private static class yacyContextRequest extends RequestHeader implements RequestContext {
private static final long serialVersionUID = -8936741958551376593L;
@@ -1033,8 +1036,8 @@ public final class httpd implements serverHandler, Cloneable {
}
@Override
- public httpd clone() {
- return new httpd(switchboard);
+ public HTTPDemon clone() {
+ return new HTTPDemon(switchboard);
}
public static final void sendRespondBody(
@@ -1102,27 +1105,27 @@ public final class httpd implements serverHandler, Cloneable {
final Object detailedErrorMsgFile,
final serverObjects detailedErrorMsgValues,
final Throwable stackTrace,
- httpResponseHeader header
+ ResponseHeader header
) throws IOException {
FileInputStream fis = null;
ByteArrayOutputStream o = null;
try {
// setting the proper http status message
- final String httpVersion = conProp.getProperty(httpHeader.CONNECTION_PROP_HTTP_VER,"HTTP/1.1");
+ final String httpVersion = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HTTP_VER,"HTTP/1.1");
if ((httpStatusText == null)||(httpStatusText.length()==0)) {
- if (httpVersion.equals("HTTP/1.0") && httpHeader.http1_0.containsKey(Integer.toString(httpStatusCode)))
- httpStatusText = httpHeader.http1_0.get(Integer.toString(httpStatusCode));
- else if (httpVersion.equals("HTTP/1.1") && httpHeader.http1_1.containsKey(Integer.toString(httpStatusCode)))
- httpStatusText = httpHeader.http1_1.get(Integer.toString(httpStatusCode));
+ if (httpVersion.equals("HTTP/1.0") && HeaderFramework.http1_0.containsKey(Integer.toString(httpStatusCode)))
+ httpStatusText = HeaderFramework.http1_0.get(Integer.toString(httpStatusCode));
+ else if (httpVersion.equals("HTTP/1.1") && HeaderFramework.http1_1.containsKey(Integer.toString(httpStatusCode)))
+ httpStatusText = HeaderFramework.http1_1.get(Integer.toString(httpStatusCode));
else httpStatusText = "Unknown";
}
// generating the desired request url
- String host = conProp.getProperty(httpHeader.CONNECTION_PROP_HOST);
- final String path = conProp.getProperty(httpHeader.CONNECTION_PROP_PATH,"/");
- final String args = conProp.getProperty(httpHeader.CONNECTION_PROP_ARGS);
- final String method = conProp.getProperty(httpHeader.CONNECTION_PROP_METHOD);
+ String host = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HOST);
+ final String path = conProp.getProperty(HeaderFramework.CONNECTION_PROP_PATH,"/");
+ final String args = conProp.getProperty(HeaderFramework.CONNECTION_PROP_ARGS);
+ final String method = conProp.getProperty(HeaderFramework.CONNECTION_PROP_METHOD);
int port = 80;
final int pos = host.indexOf(":");
@@ -1133,7 +1136,7 @@ public final class httpd implements serverHandler, Cloneable {
String urlString;
try {
- urlString = (new yacyURL((method.equals(httpHeader.METHOD_CONNECT)?"https":"http"), host, port, (args == null) ? path : path + "?" + args)).toString();
+ urlString = (new yacyURL((method.equals(HeaderFramework.METHOD_CONNECT)?"https":"http"), host, port, (args == null) ? path : path + "?" + args)).toString();
} catch (final MalformedURLException e) {
urlString = "invalid URL";
}
@@ -1144,7 +1147,7 @@ public final class httpd implements serverHandler, Cloneable {
// tp.put("host", serverCore.publicIP().getHostAddress());
// tp.put("port", switchboard.getConfig("port", "8080"));
- final String clientIP = conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP, "127.0.0.1");
+ final String clientIP = conProp.getProperty(HeaderFramework.CONNECTION_PROP_CLIENTIP, "127.0.0.1");
// check if ip is local ip address
final InetAddress hostAddress = serverDomains.dnsResolve(clientIP);
@@ -1171,7 +1174,7 @@ public final class httpd implements serverHandler, Cloneable {
tp.put("peerName", (getAlternativeResolver() == null) ? "" : getAlternativeResolver().myName());
tp.put("errorMessageType", errorcase);
tp.put("httpStatus", Integer.toString(httpStatusCode) + " " + httpStatusText);
- tp.put("requestMethod", conProp.getProperty(httpHeader.CONNECTION_PROP_METHOD));
+ tp.put("requestMethod", conProp.getProperty(HeaderFramework.CONNECTION_PROP_METHOD));
tp.put("requestURL", urlString);
switch (errorcase) {
@@ -1209,7 +1212,7 @@ public final class httpd implements serverHandler, Cloneable {
// rewrite the file
final File htRootPath = new File(switchboard.getRootPath(), switchboard.getConfig("htRootPath","htroot"));
- httpTemplate.writeTemplate(
+ TemplateEngine.writeTemplate(
fis = new FileInputStream(new File(htRootPath, "/proxymsg/error.html")),
o = new ByteArrayOutputStream(512),
tp,
@@ -1219,15 +1222,15 @@ public final class httpd implements serverHandler, Cloneable {
o.close(); o = null;
if(header == null)
- header = new httpResponseHeader();
- header.put(httpHeader.CONNECTION_PROP_PROXY_RESPOND_STATUS, Integer.toString(httpStatusCode));
- header.put(httpHeader.DATE, systemDate);
- header.put(httpHeader.CONTENT_TYPE, "text/html");
- header.put(httpHeader.CONTENT_LENGTH, Integer.toString(result.length));
- header.put(httpHeader.PRAGMA, "no-cache");
+ header = new ResponseHeader();
+ header.put(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_STATUS, Integer.toString(httpStatusCode));
+ header.put(HeaderFramework.DATE, systemDate);
+ header.put(HeaderFramework.CONTENT_TYPE, "text/html");
+ header.put(HeaderFramework.CONTENT_LENGTH, Integer.toString(result.length));
+ header.put(HeaderFramework.PRAGMA, "no-cache");
sendRespondHeader(conProp,respond,httpVersion,httpStatusCode,httpStatusText,header);
- if (! method.equals(httpHeader.METHOD_HEAD)) {
+ if (! method.equals(HeaderFramework.METHOD_HEAD)) {
// write the array to the client
FileUtils.copy(result, respond);
}
@@ -1248,20 +1251,20 @@ public final class httpd implements serverHandler, Cloneable {
final long contentLength,
Date moddate,
final Date expires,
- httpResponseHeader headers,
+ ResponseHeader headers,
final String contentEnc,
final String transferEnc,
final boolean nocache
) throws IOException {
- final String reqMethod = conProp.getProperty(httpHeader.CONNECTION_PROP_METHOD);
+ final String reqMethod = conProp.getProperty(HeaderFramework.CONNECTION_PROP_METHOD);
- if ((transferEnc != null) && !httpVersion.equals(httpHeader.HTTP_VERSION_1_1)) {
+ if ((transferEnc != null) && !httpVersion.equals(HeaderFramework.HTTP_VERSION_1_1)) {
throw new IllegalArgumentException("Transfer encoding is only supported for http/1.1 connections. The current connection version is " + httpVersion);
}
- if (!reqMethod.equals(httpHeader.METHOD_HEAD)){
- if (!conProp.getProperty(httpHeader.CONNECTION_PROP_PERSISTENT,"close").equals("close")) {
+ if (!reqMethod.equals(HeaderFramework.METHOD_HEAD)){
+ if (!conProp.getProperty(HeaderFramework.CONNECTION_PROP_PERSISTENT,"close").equals("close")) {
if (transferEnc == null && contentLength < 0) {
throw new IllegalArgumentException("Message MUST contain a Content-Length or a non-identity transfer-coding header field.");
}
@@ -1271,32 +1274,32 @@ public final class httpd implements serverHandler, Cloneable {
}
}
- if(headers==null) headers = new httpResponseHeader();
+ if(headers==null) headers = new ResponseHeader();
final Date now = new Date(System.currentTimeMillis());
- headers.put(httpHeader.SERVER, "AnomicHTTPD (www.anomic.de)");
- headers.put(httpHeader.DATE, DateFormatter.formatRFC1123(now));
+ headers.put(HeaderFramework.SERVER, "AnomicHTTPD (www.anomic.de)");
+ headers.put(HeaderFramework.DATE, DateFormatter.formatRFC1123(now));
if (moddate.after(now)) {
System.out.println("*** DEBUG: correcting moddate = " + moddate.toString() + " to now = " + now.toString());
moddate = now;
}
- headers.put(httpHeader.LAST_MODIFIED, DateFormatter.formatRFC1123(moddate));
+ headers.put(HeaderFramework.LAST_MODIFIED, DateFormatter.formatRFC1123(moddate));
if (nocache) {
- if (httpVersion.toUpperCase().equals(httpHeader.HTTP_VERSION_1_1)) headers.put(httpHeader.CACHE_CONTROL, "no-cache");
- else headers.put(httpHeader.PRAGMA, "no-cache");
+ if (httpVersion.toUpperCase().equals(HeaderFramework.HTTP_VERSION_1_1)) headers.put(HeaderFramework.CACHE_CONTROL, "no-cache");
+ else headers.put(HeaderFramework.PRAGMA, "no-cache");
}
if (contentType == null)
contentType = "text/html; charset=UTF-8";
else if (contentType.startsWith("text/") && contentType.toLowerCase().indexOf("charset=")==-1)
contentType +="; charset=" + Charset.defaultCharset().name();
- headers.put(httpHeader.CONTENT_TYPE, contentType);
- if (contentLength > 0) headers.put(httpHeader.CONTENT_LENGTH, Long.toString(contentLength));
+ headers.put(HeaderFramework.CONTENT_TYPE, contentType);
+ if (contentLength > 0) headers.put(HeaderFramework.CONTENT_LENGTH, Long.toString(contentLength));
//if (cookie != null) headers.put(httpHeader.SET_COOKIE, cookie);
- if (expires != null) headers.put(httpHeader.EXPIRES, DateFormatter.formatRFC1123(expires));
- if (contentEnc != null) headers.put(httpHeader.CONTENT_ENCODING, contentEnc);
- if (transferEnc != null) headers.put(httpHeader.TRANSFER_ENCODING, transferEnc);
+ if (expires != null) headers.put(HeaderFramework.EXPIRES, DateFormatter.formatRFC1123(expires));
+ if (contentEnc != null) headers.put(HeaderFramework.CONTENT_ENCODING, contentEnc);
+ if (transferEnc != null) headers.put(HeaderFramework.TRANSFER_ENCODING, transferEnc);
sendRespondHeader(conProp, respond, httpVersion, httpStatusCode, httpStatusText, headers);
}
@@ -1306,7 +1309,7 @@ public final class httpd implements serverHandler, Cloneable {
final OutputStream respond,
final String httpVersion,
final int httpStatusCode,
- final httpResponseHeader header
+ final ResponseHeader header
) throws IOException {
sendRespondHeader(conProp,respond,httpVersion,httpStatusCode,null,header);
}
@@ -1317,52 +1320,52 @@ public final class httpd implements serverHandler, Cloneable {
String httpVersion,
final int httpStatusCode,
String httpStatusText,
- httpResponseHeader responseHeader
+ ResponseHeader responseHeader
) throws IOException {
if (respond == null) throw new NullPointerException("The outputstream must not be null.");
if (conProp == null) throw new NullPointerException("The connection property structure must not be null.");
- if (httpVersion == null) httpVersion = conProp.getProperty(httpHeader.CONNECTION_PROP_HTTP_VER,httpHeader.HTTP_VERSION_1_1);
- if (responseHeader == null) responseHeader = new httpResponseHeader();
+ if (httpVersion == null) httpVersion = conProp.getProperty(HeaderFramework.CONNECTION_PROP_HTTP_VER,HeaderFramework.HTTP_VERSION_1_1);
+ if (responseHeader == null) responseHeader = new ResponseHeader();
try {
if ((httpStatusText == null)||(httpStatusText.length()==0)) {
- if (httpVersion.equals(httpHeader.HTTP_VERSION_1_0) && httpHeader.http1_0.containsKey(Integer.toString(httpStatusCode)))
- httpStatusText = httpHeader.http1_0.get(Integer.toString(httpStatusCode));
- else if (httpVersion.equals(httpHeader.HTTP_VERSION_1_1) && httpHeader.http1_1.containsKey(Integer.toString(httpStatusCode)))
- httpStatusText = httpHeader.http1_1.get(Integer.toString(httpStatusCode));
+ if (httpVersion.equals(HeaderFramework.HTTP_VERSION_1_0) && HeaderFramework.http1_0.containsKey(Integer.toString(httpStatusCode)))
+ httpStatusText = HeaderFramework.http1_0.get(Integer.toString(httpStatusCode));
+ else if (httpVersion.equals(HeaderFramework.HTTP_VERSION_1_1) && HeaderFramework.http1_1.containsKey(Integer.toString(httpStatusCode)))
+ httpStatusText = HeaderFramework.http1_1.get(Integer.toString(httpStatusCode));
else httpStatusText = "Unknown";
}
final StringBuilder header = new StringBuilder(560);
// "HTTP/0.9" does not have a status line or header in the response
- if (! httpVersion.toUpperCase().equals(httpHeader.HTTP_VERSION_0_9)) {
+ if (! httpVersion.toUpperCase().equals(HeaderFramework.HTTP_VERSION_0_9)) {
// write status line
header.append(httpVersion).append(" ")
.append(Integer.toString(httpStatusCode)).append(" ")
.append(httpStatusText).append("\r\n");
// prepare header
- if (!responseHeader.containsKey(httpHeader.DATE))
- responseHeader.put(httpHeader.DATE, DateFormatter.formatRFC1123(new Date()));
- if (!responseHeader.containsKey(httpHeader.CONTENT_TYPE))
- responseHeader.put(httpHeader.CONTENT_TYPE, "text/html; charset=UTF-8"); // fix this
- if (!responseHeader.containsKey(httpRequestHeader.CONNECTION) && conProp.containsKey(httpHeader.CONNECTION_PROP_PERSISTENT))
- responseHeader.put(httpRequestHeader.CONNECTION, conProp.getProperty(httpHeader.CONNECTION_PROP_PERSISTENT));
- if (!responseHeader.containsKey(httpRequestHeader.PROXY_CONNECTION) && conProp.containsKey(httpHeader.CONNECTION_PROP_PERSISTENT))
- responseHeader.put(httpRequestHeader.PROXY_CONNECTION, conProp.getProperty(httpHeader.CONNECTION_PROP_PERSISTENT));
+ if (!responseHeader.containsKey(HeaderFramework.DATE))
+ responseHeader.put(HeaderFramework.DATE, DateFormatter.formatRFC1123(new Date()));
+ if (!responseHeader.containsKey(HeaderFramework.CONTENT_TYPE))
+ responseHeader.put(HeaderFramework.CONTENT_TYPE, "text/html; charset=UTF-8"); // fix this
+ if (!responseHeader.containsKey(RequestHeader.CONNECTION) && conProp.containsKey(HeaderFramework.CONNECTION_PROP_PERSISTENT))
+ responseHeader.put(RequestHeader.CONNECTION, conProp.getProperty(HeaderFramework.CONNECTION_PROP_PERSISTENT));
+ if (!responseHeader.containsKey(RequestHeader.PROXY_CONNECTION) && conProp.containsKey(HeaderFramework.CONNECTION_PROP_PERSISTENT))
+ responseHeader.put(RequestHeader.PROXY_CONNECTION, conProp.getProperty(HeaderFramework.CONNECTION_PROP_PERSISTENT));
- if (conProp.containsKey(httpHeader.CONNECTION_PROP_PERSISTENT) &&
- conProp.getProperty(httpHeader.CONNECTION_PROP_PERSISTENT).equals("keep-alive") &&
- !responseHeader.containsKey(httpHeader.TRANSFER_ENCODING) &&
- !responseHeader.containsKey(httpHeader.CONTENT_LENGTH))
- responseHeader.put(httpHeader.CONTENT_LENGTH, "0");
+ if (conProp.containsKey(HeaderFramework.CONNECTION_PROP_PERSISTENT) &&
+ conProp.getProperty(HeaderFramework.CONNECTION_PROP_PERSISTENT).equals("keep-alive") &&
+ !responseHeader.containsKey(HeaderFramework.TRANSFER_ENCODING) &&
+ !responseHeader.containsKey(HeaderFramework.CONTENT_LENGTH))
+ responseHeader.put(HeaderFramework.CONTENT_LENGTH, "0");
// adding some yacy specific headers
- responseHeader.put(httpHeader.X_YACY_KEEP_ALIVE_REQUEST_COUNT,conProp.getProperty(httpHeader.CONNECTION_PROP_KEEP_ALIVE_COUNT));
- responseHeader.put(httpHeader.X_YACY_ORIGINAL_REQUEST_LINE,conProp.getProperty(httpHeader.CONNECTION_PROP_REQUESTLINE));
- responseHeader.put(httpHeader.X_YACY_PREVIOUS_REQUEST_LINE,conProp.getProperty(httpHeader.CONNECTION_PROP_PREV_REQUESTLINE));
+ responseHeader.put(HeaderFramework.X_YACY_KEEP_ALIVE_REQUEST_COUNT,conProp.getProperty(HeaderFramework.CONNECTION_PROP_KEEP_ALIVE_COUNT));
+ responseHeader.put(HeaderFramework.X_YACY_ORIGINAL_REQUEST_LINE,conProp.getProperty(HeaderFramework.CONNECTION_PROP_REQUESTLINE));
+ responseHeader.put(HeaderFramework.X_YACY_PREVIOUS_REQUEST_LINE,conProp.getProperty(HeaderFramework.CONNECTION_PROP_PREV_REQUESTLINE));
//read custom headers
/*
@@ -1371,11 +1374,11 @@ public final class httpd implements serverHandler, Cloneable {
httpHeader outgoingHeader=requestProperties.getOutgoingHeader();
if (outgoingHeader!=null)
{*/
- final Iterator<httpResponseHeader.Entry> it = responseHeader.getCookies();
+ final Iterator<ResponseHeader.Entry> it = responseHeader.getCookies();
while(it.hasNext()) {
//Append user properties to the main String
//TODO: Should we check for user properites. What if they intersect properties that are already in header?
- final httpResponseHeader.Entry e = it.next();
+ final ResponseHeader.Entry e = it.next();
header.append(e.getKey()).append(": ").append(e.getValue()).append("\r\n");
}
@@ -1411,8 +1414,8 @@ public final class httpd implements serverHandler, Cloneable {
respond.flush();
}
- conProp.put(httpHeader.CONNECTION_PROP_PROXY_RESPOND_HEADER,responseHeader);
- conProp.put(httpHeader.CONNECTION_PROP_PROXY_RESPOND_STATUS,Integer.toString(httpStatusCode));
+ conProp.put(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_HEADER,responseHeader);
+ conProp.put(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_STATUS,Integer.toString(httpStatusCode));
} catch (final Exception e) {
// any interruption may be caused be network error or because the user has closed
// the windows during transmission. We simply pass it as IOException
@@ -1520,14 +1523,14 @@ public final class httpd implements serverHandler, Cloneable {
/**
* @param alternativeResolver the alternativeResolver to set
*/
- public static void setAlternativeResolver(httpdAlternativeDomainNames alternativeResolver) {
- httpd.alternativeResolver = alternativeResolver;
+ public static void setAlternativeResolver(AlternativeDomainNames alternativeResolver) {
+ HTTPDemon.alternativeResolver = alternativeResolver;
}
/**
* @return the alternativeResolver
*/
- static httpdAlternativeDomainNames getAlternativeResolver() {
+ static AlternativeDomainNames getAlternativeResolver() {
return alternativeResolver;
}
}
diff --git a/source/de/anomic/http/ProxyLogFormatter.java b/source/de/anomic/http/server/ProxyLogFormatter.java
similarity index 95%
rename from source/de/anomic/http/ProxyLogFormatter.java
rename to source/de/anomic/http/server/ProxyLogFormatter.java
index c340e7c2e..a737e5c0f 100644
--- a/source/de/anomic/http/ProxyLogFormatter.java
+++ b/source/de/anomic/http/server/ProxyLogFormatter.java
@@ -23,7 +23,7 @@
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.server;
import java.util.logging.LogRecord;
import java.util.logging.SimpleFormatter;
diff --git a/source/de/anomic/http/httpdRobotsTxtConfig.java b/source/de/anomic/http/server/RobotsTxtConfig.java
similarity index 93%
rename from source/de/anomic/http/httpdRobotsTxtConfig.java
rename to source/de/anomic/http/server/RobotsTxtConfig.java
index c4fdd8972..7e8f975c4 100644
--- a/source/de/anomic/http/httpdRobotsTxtConfig.java
+++ b/source/de/anomic/http/server/RobotsTxtConfig.java
@@ -26,12 +26,12 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.server;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverSwitch;
-public final class httpdRobotsTxtConfig {
+public final class RobotsTxtConfig {
public static final String WIKI = "wiki";
public static final String BLOG = "blog";
@@ -61,9 +61,9 @@ public final class httpdRobotsTxtConfig {
private boolean bookmarksDisallowed = false;
private boolean profileDisallowed = true;
- public httpdRobotsTxtConfig() { }
+ public RobotsTxtConfig() { }
- public httpdRobotsTxtConfig(final String[] active) {
+ public RobotsTxtConfig(final String[] active) {
if (active == null) return;
for (int i=0; i<active.length; i++) {
if (active[i] == null) continue;
@@ -83,10 +83,10 @@ public final class httpdRobotsTxtConfig {
}
}
- public static httpdRobotsTxtConfig init(final serverSwitch env) {
- final String cfg = env.getConfig(plasmaSwitchboardConstants.ROBOTS_TXT, plasmaSwitchboardConstants.ROBOTS_TXT_DEFAULT);
- if (cfg == null) return new httpdRobotsTxtConfig();
- return new httpdRobotsTxtConfig(cfg.split(","));
+ public static RobotsTxtConfig init(final serverSwitch env) {
+ final String cfg = env.getConfig(SwitchboardConstants.ROBOTS_TXT, SwitchboardConstants.ROBOTS_TXT_DEFAULT);
+ if (cfg == null) return new RobotsTxtConfig();
+ return new RobotsTxtConfig(cfg.split(","));
}
public String toString() {
diff --git a/source/de/anomic/http/httpSSI.java b/source/de/anomic/http/server/ServerSideIncludes.java
similarity index 74%
rename from source/de/anomic/http/httpSSI.java
rename to source/de/anomic/http/server/ServerSideIncludes.java
index d43517dbb..6b516c20b 100644
--- a/source/de/anomic/http/httpSSI.java
+++ b/source/de/anomic/http/server/ServerSideIncludes.java
@@ -25,15 +25,18 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.http;
+package de.anomic.http.server;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Properties;
+import de.anomic.http.io.ChunkedOutputStream;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.ByteBuffer;
-public class httpSSI {
+public class ServerSideIncludes {
public static void writeSSI(final ByteBuffer in, final OutputStream out, final String authorization, final String requesthost) throws IOException {
writeSSI(in, 0, out, authorization, requesthost);
@@ -44,8 +47,8 @@ public class httpSSI {
int q;
while (p >= 0) {
q = in.indexOf("-->".getBytes(), p + 10);
- if (out instanceof httpChunkedOutputStream) {
- ((httpChunkedOutputStream) out).write(in, off, p - off);
+ if (out instanceof ChunkedOutputStream) {
+ ((ChunkedOutputStream) out).write(in, off, p - off);
} else {
out.write(in.getBytes(off, p - off));
}
@@ -53,8 +56,8 @@ public class httpSSI {
off = q + 3;
p = in.indexOf("<!--#".getBytes(), off);
}
- if (out instanceof httpChunkedOutputStream) {
- ((httpChunkedOutputStream) out).write(in, off, in.length() - off);
+ if (out instanceof ChunkedOutputStream) {
+ ((ChunkedOutputStream) out).write(in, off, in.length() - off);
} else {
out.write(in.getBytes(off, in.length() - off));
}
@@ -81,13 +84,13 @@ public class httpSSI {
// set up virtual connection properties to call httpdFileHander.doGet()
final Properties conProp = new Properties();
- final httpRequestHeader header = new httpRequestHeader(httpd.reverseMappingCache);
- conProp.setProperty(httpHeader.CONNECTION_PROP_METHOD, httpHeader.METHOD_GET);
- conProp.setProperty(httpHeader.CONNECTION_PROP_PATH, path);
- conProp.setProperty(httpHeader.CONNECTION_PROP_ARGS, args);
- conProp.setProperty(httpHeader.CONNECTION_PROP_HTTP_VER, httpHeader.HTTP_VERSION_0_9);
- conProp.setProperty(httpHeader.CONNECTION_PROP_CLIENTIP, requesthost);
- header.put(httpRequestHeader.AUTHORIZATION, authorization);
- httpdFileHandler.doGet(conProp, header, out);
+ final RequestHeader header = new RequestHeader(HTTPDemon.reverseMappingCache);
+ conProp.setProperty(HeaderFramework.CONNECTION_PROP_METHOD, HeaderFramework.METHOD_GET);
+ conProp.setProperty(HeaderFramework.CONNECTION_PROP_PATH, path);
+ conProp.setProperty(HeaderFramework.CONNECTION_PROP_ARGS, args);
+ conProp.setProperty(HeaderFramework.CONNECTION_PROP_HTTP_VER, HeaderFramework.HTTP_VERSION_0_9);
+ conProp.setProperty(HeaderFramework.CONNECTION_PROP_CLIENTIP, requesthost);
+ header.put(RequestHeader.AUTHORIZATION, authorization);
+ HTTPDFileHandler.doGet(conProp, header, out);
}
}
diff --git a/source/de/anomic/http/httpTemplate.java b/source/de/anomic/http/server/TemplateEngine.java
similarity index 99%
rename from source/de/anomic/http/httpTemplate.java
rename to source/de/anomic/http/server/TemplateEngine.java
index 372bfebee..41d8380a0 100644
--- a/source/de/anomic/http/httpTemplate.java
+++ b/source/de/anomic/http/server/TemplateEngine.java
@@ -44,7 +44,7 @@
//the intact and unchanged copyright notice.
//Contributions and changes to the program code must be marked as such.
-package de.anomic.http;
+package de.anomic.http.server;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
@@ -119,7 +119,7 @@ import de.anomic.yacy.logging.Log;
* <i>#(alternative)#::#{repeat}##[test]##{/repeat}##(/alternative)#</i><br>
* would be adressed as "alternative_repeat_"+number+"_test"
*/
-public final class httpTemplate {
+public final class TemplateEngine {
public final static byte hash = (byte)'#';
@@ -440,7 +440,7 @@ public final class httpTemplate {
BufferedReader br = null;
try{
//br = new BufferedReader(new InputStreamReader(new FileInputStream( filename ))); //Simple Include
- br = new BufferedReader( new InputStreamReader(new FileInputStream( httpdFileHandler.getLocalizedFile(new String(filename,"UTF-8"))),"UTF-8") ); //YaCy (with Locales)
+ br = new BufferedReader( new InputStreamReader(new FileInputStream( HTTPDFileHandler.getLocalizedFile(new String(filename,"UTF-8"))),"UTF-8") ); //YaCy (with Locales)
//Read the Include
String line = "";
while ((line = br.readLine()) != null) {
diff --git a/source/de/anomic/kelondro/text/MetadataRepository.java b/source/de/anomic/kelondro/text/MetadataRepository.java
index 7fb824416..e0a6bc28e 100644
--- a/source/de/anomic/kelondro/text/MetadataRepository.java
+++ b/source/de/anomic/kelondro/text/MetadataRepository.java
@@ -40,9 +40,9 @@ import java.util.TreeSet;
import de.anomic.data.Blacklist;
import de.anomic.document.parser.html.CharacterCoding;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpResponse;
-import de.anomic.http.httpRemoteProxyConfig;
+import de.anomic.http.client.Client;
+import de.anomic.http.client.RemoteProxyConfig;
+import de.anomic.http.metadata.ResponseContainer;
import de.anomic.kelondro.index.Cache;
import de.anomic.kelondro.index.HandleSet;
import de.anomic.kelondro.index.Row;
@@ -230,7 +230,7 @@ public final class MetadataRepository implements Iterable<byte[]> {
*
* @param proxyConfig
*/
- public void deadlinkCleaner(final httpRemoteProxyConfig proxyConfig) {
+ public void deadlinkCleaner(final RemoteProxyConfig proxyConfig) {
final Log log = new Log("URLDBCLEANUP");
final HashSet<String> damagedURLS = new HashSet<String>();
try {
@@ -271,9 +271,9 @@ public final class MetadataRepository implements Iterable<byte[]> {
final yacyURL newUrl = new yacyURL(newUrlStr, null);
// doing a http head request to test if the url is correct
- final httpClient client = new httpClient(10000);
+ final Client client = new Client(10000);
client.setProxy(proxyConfig);
- httpResponse res = null;
+ ResponseContainer res = null;
try {
res = client.HEAD(newUrl.toString());
} finally {
diff --git a/source/de/anomic/kelondro/text/Segment.java b/source/de/anomic/kelondro/text/Segment.java
index 47d22c7cb..7348774b1 100644
--- a/source/de/anomic/kelondro/text/Segment.java
+++ b/source/de/anomic/kelondro/text/Segment.java
@@ -49,7 +49,7 @@ import de.anomic.kelondro.text.navigationPrototype.NavigationReferenceRow;
import de.anomic.kelondro.text.referencePrototype.WordReference;
import de.anomic.kelondro.text.referencePrototype.WordReferenceFactory;
import de.anomic.kelondro.text.referencePrototype.WordReferenceRow;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.tools.iso639;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.logging.Log;
@@ -132,7 +132,7 @@ public final class Segment {
} catch (final IOException e) {
e.printStackTrace();
}
- plasmaSwitchboard.getSwitchboard().peers.mySeed().resetCounters();
+ Switchboard.getSwitchboard().peers.mySeed().resetCounters();
}
public File getLocation() {
@@ -359,7 +359,7 @@ public final class Segment {
urlHashs.add(entry.metadataHash());
} else {
url = ue.metadata().url();
- if ((url == null) || (plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_CRAWLER, url) == true)) {
+ if ((url == null) || (Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_CRAWLER, url) == true)) {
urlHashs.add(entry.metadataHash());
}
}
diff --git a/source/de/anomic/net/UPnP.java b/source/de/anomic/net/UPnP.java
index e54243906..b41764be3 100644
--- a/source/de/anomic/net/UPnP.java
+++ b/source/de/anomic/net/UPnP.java
@@ -36,14 +36,14 @@ import net.sbbi.upnp.DiscoveryEventHandler;
import net.sbbi.upnp.devices.UPNPRootDevice;
import net.sbbi.upnp.impls.InternetGatewayDevice;
import net.sbbi.upnp.messages.UPNPResponseException;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.yacy.logging.Log;
public class UPnP {
public final static Log log = new Log("UPNP");
- private static plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
+ private static Switchboard sb = Switchboard.getSwitchboard();
private final static int discoveryTimeout = 5000; // seconds to receive a response from devices
private static InternetGatewayDevice[] IGDs = null;
@@ -91,7 +91,7 @@ public class UPnP {
}
private static String getRemoteHost() {
- return sb.getConfig(plasmaSwitchboardConstants.UPNP_REMOTEHOST, "");
+ return sb.getConfig(SwitchboardConstants.UPNP_REMOTEHOST, "");
}
/**
@@ -200,7 +200,7 @@ public class UPnP {
if (newIGD[0] == null) return;
log.logInfo("discovered device: " + newIGD[0].getIGDRootDevice().getFriendlyName());
if (UPnP.setIGDs(newIGD) &&
- plasmaSwitchboard.getSwitchboard().getConfigBool(plasmaSwitchboardConstants.UPNP_ENABLED, false))
+ Switchboard.getSwitchboard().getConfigBool(SwitchboardConstants.UPNP_ENABLED, false))
UPnP.addPortMapping();
Listener.unregister();
}
diff --git a/source/de/anomic/net/natLib.java b/source/de/anomic/net/natLib.java
index 60ff1b19b..81f278399 100644
--- a/source/de/anomic/net/natLib.java
+++ b/source/de/anomic/net/natLib.java
@@ -29,9 +29,9 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
-import de.anomic.http.httpClient;
+import de.anomic.http.client.Client;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverDomains;
import de.anomic.tools.disorderHeap;
import de.anomic.tools.nxTools;
@@ -46,7 +46,7 @@ public class natLib {
rm status.htm
*/
try {
- ArrayList<String> x = FileUtils.strings(httpClient.wget("http://admin:"+password+"@192.168.0.1:80/status.htm", null, 10000), "UTF-8");
+ ArrayList<String> x = FileUtils.strings(Client.wget("http://admin:"+password+"@192.168.0.1:80/status.htm", null, 10000), "UTF-8");
x = nxTools.grep(x, 1, "IP Address");
if ((x == null) || (x.size() == 0)) return null;
final String line = nxTools.tail1(x);
@@ -59,7 +59,7 @@ public class natLib {
private static String getWhatIsMyIP() {
try {
ArrayList<String> x = FileUtils.strings(
- httpClient.wget("http://www.whatismyip.com/", null, 10000), "UTF-8");
+ Client.wget("http://www.whatismyip.com/", null, 10000), "UTF-8");
x = nxTools.grep(x, 0, "Your IP is");
final String line = nxTools.tail1(x);
return nxTools.awk(line, " ", 4);
@@ -71,7 +71,7 @@ public class natLib {
private static String getStanford() {
try {
ArrayList<String> x = FileUtils.strings(
- httpClient.wget("http://www.slac.stanford.edu/cgi-bin/nph-traceroute.pl", null, 10000),
+ Client.wget("http://www.slac.stanford.edu/cgi-bin/nph-traceroute.pl", null, 10000),
"UTF-8");
x = nxTools.grep(x, 0, "firewall protecting your browser");
final String line = nxTools.tail1(x);
@@ -83,7 +83,7 @@ public class natLib {
private static String getIPID() {
try {
- ArrayList<String> x = FileUtils.strings(httpClient.wget("http://ipid.shat.net/", null, 10000), "UTF-8");
+ ArrayList<String> x = FileUtils.strings(Client.wget("http://ipid.shat.net/", null, 10000), "UTF-8");
x = nxTools.grep(x, 2, "Your IP address");
final String line = nxTools.tail1(x);
return nxTools.awk(nxTools.awk(nxTools.awk(line, " ", 5), ">", 2), "<", 1);
@@ -114,7 +114,7 @@ public class natLib {
//TODO: This is not IPv6 compatible
public static boolean isProper(final String ip) {
- final plasmaSwitchboard sb=plasmaSwitchboard.getSwitchboard();
+ final Switchboard sb=Switchboard.getSwitchboard();
if (sb != null) {
if (sb.isRobinsonMode()) return true;
final String yacyDebugMode = sb.getConfig("yacyDebugMode", "false");
diff --git a/source/de/anomic/plasma/plasmaStore.java b/source/de/anomic/plasma/plasmaStore.java
deleted file mode 100644
index f65e33239..000000000
--- a/source/de/anomic/plasma/plasmaStore.java
+++ /dev/null
@@ -1,143 +0,0 @@
-// plasmaStore.java
-// -----------------------
-// part of YACY
-// (C) by Michael Peter Christen; [email protected]
-// first published on http://www.anomic.de
-// Frankfurt, Germany, 2004
-// last major change: 20.01.2004
-//
-// You agree that the Author(s) is (are) not responsible for cost,
-// loss of data or any harm that may be caused by usage of this softare or
-// this documentation. The usage of this software is on your own risk. The
-// installation and usage (starting/running) of this software may allow other
-// people or application to access your computer and any attached devices and
-// is highly dependent on the configuration of the software which must be
-// done by the user of the software;the author(s) is (are) also
-// not responsible for proper configuration and usage of the software, even
-// if provoked by documentation provided together with the software.
-//
-// THE SOFTWARE THAT FOLLOWS AS ART OF PROGRAMMING BELOW THIS SECTION
-// IS PUBLISHED UNDER THE GPL AS DOCUMENTED IN THE FILE gpl.txt ASIDE THIS
-// FILE AND AS IN http://www.gnu.org/licenses/gpl.txt
-// ANY CHANGES TO THIS FILE ACCORDING TO THE GPL CAN BE DONE TO THE
-// LINES THAT FOLLOWS THIS COPYRIGHT NOTICE HERE, BUT CHANGES MUST NOT
-// BE DONE ABOVE OR INSIDE THE COPYRIGHT NOTICE. A RE-DISTRIBUTION
-// MUST CONTAIN THE INTACT AND UNCHANGED COPYRIGHT NOTICE.
-// CONTRIBUTIONS AND CHANGES TO THE PROGRAM CODE SHOULD BE MARKED AS SUCH.
-
-/*
- This class provides storage functions for the plasma search engine.
- Unlike the plasmaSwitchboard, which holds run-time information,
- this class holds general index information that is in run-time
- specific.
-*/
-
-package de.anomic.plasma;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-public class plasmaStore {
-
-
- // some static helper methods
- public static void saveGzip(final File f, final byte[] content) throws IOException {
- java.util.zip.GZIPOutputStream gzipout = null;
- try {
- f.getParentFile().mkdirs();
- gzipout = new java.util.zip.GZIPOutputStream(new FileOutputStream(f));
- gzipout.write(content, 0, content.length);
- } finally {
- if (gzipout!=null)try{gzipout.close();}catch(final Exception e){}
- }
- }
-
- public static byte[] loadGzip(final File f) throws IOException {
- java.util.zip.GZIPInputStream gzipin = null;
- try {
- gzipin = new java.util.zip.GZIPInputStream(new FileInputStream(f));
- byte[] result = new byte[1024];
- final byte[] buffer = new byte[512];
- byte[] b;
- int len = 0;
- int last;
- while ((last = gzipin.read(buffer, 0, buffer.length)) > 0) {
- // assert the buffer to the result
- while (result.length - len < last) {
- // the result array is too small, increase space
- b = new byte[result.length * 2];
- System.arraycopy(result, 0, b, 0, len);
- result = b; b = null;
- }
- // copy the last read
- System.arraycopy(buffer, 0, result, len, last);
- len += last;
- }
- gzipin.close();
- // finished with reading. now cut the result to the right size
- b = new byte[len];
- System.arraycopy(result, 0, b, 0, len);
- return b;
- } finally {
- if (gzipin != null) try{gzipin.close();}catch(final Exception e){}
- }
- }
-
- /* public static void saveProperties(File f, Properties props, String comment) throws IOException {
- File fp = f.getParentFile();
- if (fp != null) fp.mkdirs();
- FileOutputStream fos = new FileOutputStream(f);
- props.store(fos, comment);
- fos.close();
- }
-
- public static Properties loadProperties(File f) throws IOException {
- Properties p = new Properties();
- FileInputStream fis = new FileInputStream(f);
- p.load(fis);
- fis.close();
- return p;
- }
- */
-
- /*
- private static long[] appendFileToStack(File fragment, File dest) throws IOException {
- // returns a long[2] with
- // long[0] = startOfFileFragemt in dest
- // long[1] = lengthOfFileFragment in dest
- long l = fragment.length();
- long p = dest.length();
- RandomAccessFile fo = new RandomAccessFile(dest, "rw");
- FileInputStream fi = new FileInputStream(fragment);
- byte[] buffer = new byte[1024];
- int c;
- fo.seek(p);
- while ((c = fi.read(buffer)) >= 0)
- fo.write(buffer, 0, c);
- fi.close();
- fo.close();
- long[] r = new long[2];
- r[0] = p;
- r[1] = l;
- return r;
- }
- */
-
- /*
- public static void main(String[] args) {
- try {
- HashSet set = new HashSet();
- for (int i = 0; i < args.length; i++) set.add(args[i]);
- plasmaStore store = new plasmaStore(new File("DATABASE"));
- List result = plasmaSearch.search(set);
- for (int i = 0; i < result.size(); i++) {
- ((plasmaLURL.entry) result.get(i)).print();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- */
-}
diff --git a/source/de/anomic/search/IndexCollector.java b/source/de/anomic/search/IndexCollector.java
index eb77736e9..43482ef16 100644
--- a/source/de/anomic/search/IndexCollector.java
+++ b/source/de/anomic/search/IndexCollector.java
@@ -43,10 +43,10 @@ import de.anomic.kelondro.text.TermSearch;
import de.anomic.kelondro.text.referencePrototype.WordReference;
import de.anomic.kelondro.text.referencePrototype.WordReferenceVars;
import de.anomic.kelondro.util.SortStack;
-import de.anomic.plasma.plasmaProfiling;
import de.anomic.search.QueryParams;
import de.anomic.server.serverProfiling;
import de.anomic.yacy.yacyURL;
+import de.anomic.ymage.ProfilingGraph;
public final class IndexCollector extends Thread {
@@ -145,14 +145,14 @@ public final class IndexCollector extends Thread {
ReferenceContainer<WordReference> index = search.joined();
insertRanked(index, true, index.size());
- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), QueryEvent.JOIN, index.size(), System.currentTimeMillis() - timer), false);
+ serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), QueryEvent.JOIN, index.size(), System.currentTimeMillis() - timer), false);
try {
while ((index = this.rwiQueue.take()) != poison) {
// normalize entries
final ArrayList<WordReferenceVars> decodedEntries = this.order.normalizeWith(index);
- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), QueryEvent.NORMALIZING, index.size(), System.currentTimeMillis() - timer), false);
+ serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), QueryEvent.NORMALIZING, index.size(), System.currentTimeMillis() - timer), false);
// iterate over normalized entries and select some that are better than currently stored
timer = System.currentTimeMillis();
@@ -234,7 +234,7 @@ public final class IndexCollector extends Thread {
e.printStackTrace();
}
//if ((query.neededResults() > 0) && (container.size() > query.neededResults())) remove(true, true);
- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), QueryEvent.PRESORT, index.size(), System.currentTimeMillis() - timer), false);
+ serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), QueryEvent.PRESORT, index.size(), System.currentTimeMillis() - timer), false);
}
public Map<byte[], ReferenceContainer<WordReference>> searchContainerMap() {
diff --git a/source/de/anomic/search/QueryEvent.java b/source/de/anomic/search/QueryEvent.java
index 2c990ff5a..40c428b68 100644
--- a/source/de/anomic/search/QueryEvent.java
+++ b/source/de/anomic/search/QueryEvent.java
@@ -51,8 +51,6 @@ import de.anomic.kelondro.util.MemoryControl;
import de.anomic.kelondro.util.SetTools;
import de.anomic.kelondro.util.SortStack;
import de.anomic.kelondro.util.SortStore;
-import de.anomic.plasma.plasmaProfiling;
-import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.search.RankingProcess.NavigatorEntry;
import de.anomic.search.SnippetCache.MediaSnippet;
import de.anomic.server.serverProfiling;
@@ -62,6 +60,7 @@ import de.anomic.yacy.yacySeedDB;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.dht.FlatWordPartitionScheme;
import de.anomic.yacy.logging.Log;
+import de.anomic.ymage.ProfilingGraph;
public final class QueryEvent {
@@ -131,10 +130,10 @@ public final class QueryEvent {
// snippets do not need to match with the complete query hashes,
// only with the query minus the stopwords which had not been used for the search
- final TreeSet<byte[]> filtered = SetTools.joinConstructive(query.queryHashes, plasmaSwitchboard.stopwordHashes);
+ final TreeSet<byte[]> filtered = SetTools.joinConstructive(query.queryHashes, Switchboard.stopwordHashes);
this.snippetFetchWordHashes = (TreeSet<byte[]>) query.queryHashes.clone();
if ((filtered != null) && (filtered.size() > 0)) {
- SetTools.excludeDestructive(this.snippetFetchWordHashes, plasmaSwitchboard.stopwordHashes);
+ SetTools.excludeDestructive(this.snippetFetchWordHashes, Switchboard.stopwordHashes);
}
final long start = System.currentTimeMillis();
@@ -170,11 +169,11 @@ public final class QueryEvent {
rankedCache,
rcAbstracts,
fetchpeers,
- plasmaSwitchboard.urlBlacklist,
+ Switchboard.urlBlacklist,
query.ranking,
query.constraint,
(query.domType == QueryParams.SEARCHDOM_GLOBALDHT) ? null : preselectedPeerHashes);
- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), "remote search thread start", this.primarySearchThreads.length, System.currentTimeMillis() - timer), false);
+ serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), "remote search thread start", this.primarySearchThreads.length, System.currentTimeMillis() - timer), false);
// finished searching
Log.logFine("SEARCH_EVENT", "SEARCH TIME AFTER GLOBAL-TRIGGER TO " + primarySearchThreads.length + " PEERS: " + ((System.currentTimeMillis() - start) / 1000) + " seconds");
@@ -208,7 +207,7 @@ public final class QueryEvent {
IACount.put(wordhash, Integer.valueOf(container.size()));
IAResults.put(wordhash, ReferenceContainer.compressIndex(container, null, 1000).toString());
}
- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), "abstract generation", this.rankedCache.searchContainerMap().size(), System.currentTimeMillis() - timer), false);
+ serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), "abstract generation", this.rankedCache.searchContainerMap().size(), System.currentTimeMillis() - timer), false);
}
}
@@ -218,11 +217,11 @@ public final class QueryEvent {
this.workerThreads[i] = new resultWorker(i, 10000, (query.onlineSnippetFetch) ? 2 : 0);
this.workerThreads[i].start();
}
- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), this.workerThreads.length + " online snippet fetch threads started", 0, 0), false);
+ serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), this.workerThreads.length + " online snippet fetch threads started", 0, 0), false);
// clean up events
cleanupEvents(false);
- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), "event-cleanup", 0, 0), false);
+ serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), "event-cleanup", 0, 0), false);
// store this search to a cache so it can be re-used
if (MemoryControl.available() < 1024 * 1024 * 10) cleanupEvents(true);
@@ -469,7 +468,7 @@ public final class QueryEvent {
String id = query.id(false);
QueryEvent event = lastEvents.get(id);
- if (plasmaSwitchboard.getSwitchboard().crawlQueues.noticeURL.size() > 0 && event != null && System.currentTimeMillis() - event.eventTime > 60000) {
+ if (Switchboard.getSwitchboard().crawlQueues.noticeURL.size() > 0 && event != null && System.currentTimeMillis() - event.eventTime > 60000) {
// if a local crawl is ongoing, don't use the result from the cache to use possibly more results that come from the current crawl
// to prevent that this happens during a person switches between the different result pages, a re-search happens no more than
// once a minute
@@ -597,7 +596,7 @@ public final class QueryEvent {
public ResultEntry oneResult(final int item) {
// check if we already retrieved this item (happens if a search
// pages is accessed a second time)
- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), "obtain one result entry - start", 0, 0), false);
+ serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), "obtain one result entry - start", 0, 0), false);
if (this.result.sizeStore() > item) {
// we have the wanted result already in the result array .. return that
return this.result.element(item).element;
@@ -740,7 +739,7 @@ public final class QueryEvent {
//System.out.println("DEBUG-INDEXABSTRACT ***: peer " + peer + " has urls: " + urls);
//System.out.println("DEBUG-INDEXABSTRACT ***: peer " + peer + " from words: " + words);
secondarySearchThreads[c++] = yacySearch.secondaryRemoteSearch(
- words, "", urls, indexSegment, peers, crawlResults, this.rankedCache, peer, plasmaSwitchboard.urlBlacklist,
+ words, "", urls, indexSegment, peers, crawlResults, this.rankedCache, peer, Switchboard.urlBlacklist,
query.ranking, query.constraint, preselectedPeerHashes);
}
diff --git a/source/de/anomic/search/RankingProcess.java b/source/de/anomic/search/RankingProcess.java
index 38b7cef27..f07268eda 100644
--- a/source/de/anomic/search/RankingProcess.java
+++ b/source/de/anomic/search/RankingProcess.java
@@ -54,10 +54,9 @@ import de.anomic.kelondro.text.referencePrototype.WordReference;
import de.anomic.kelondro.text.referencePrototype.WordReferenceVars;
import de.anomic.kelondro.util.SortStack;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaProfiling;
-import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverProfiling;
import de.anomic.yacy.yacyURL;
+import de.anomic.ymage.ProfilingGraph;
public final class RankingProcess {
@@ -133,7 +132,7 @@ public final class RankingProcess {
query.maxDistance);
this.localSearchInclusion = search.inclusion();
final ReferenceContainer<WordReference> index = search.joined();
- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), QueryEvent.JOIN, index.size(), System.currentTimeMillis() - timer), false);
+ serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), QueryEvent.JOIN, index.size(), System.currentTimeMillis() - timer), false);
if (index.size() == 0) {
return;
}
@@ -158,7 +157,7 @@ public final class RankingProcess {
// normalize entries
final ArrayList<WordReferenceVars> decodedEntries = this.order.normalizeWith(index);
- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), QueryEvent.NORMALIZING, index.size(), System.currentTimeMillis() - timer), false);
+ serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), QueryEvent.NORMALIZING, index.size(), System.currentTimeMillis() - timer), false);
// iterate over normalized entries and select some that are better than currently stored
timer = System.currentTimeMillis();
@@ -239,7 +238,7 @@ public final class RankingProcess {
}
//if ((query.neededResults() > 0) && (container.size() > query.neededResults())) remove(true, true);
- serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), QueryEvent.PRESORT, index.size(), System.currentTimeMillis() - timer), false);
+ serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), QueryEvent.PRESORT, index.size(), System.currentTimeMillis() - timer), false);
}
private boolean testFlags(final WordReference ientry) {
@@ -525,8 +524,8 @@ public final class RankingProcess {
"http_html_php_ftp_www_com_org_net_gov_edu_index_home_page_for_usage_the_and_".indexOf(word) < 0 &&
!query.queryHashes.contains(Word.word2hash(word)) &&
word.matches("[a-z]+") &&
- !plasmaSwitchboard.badwords.contains(word) &&
- !plasmaSwitchboard.stopwords.contains(word)) {
+ !Switchboard.badwords.contains(word) &&
+ !Switchboard.stopwords.contains(word)) {
c = ref.get(word);
if (c == null) ref.put(word, 1); else ref.put(word, c.intValue() + 1);
}
diff --git a/source/de/anomic/search/SnippetCache.java b/source/de/anomic/search/SnippetCache.java
index 89010aabc..e01a67fe4 100644
--- a/source/de/anomic/search/SnippetCache.java
+++ b/source/de/anomic/search/SnippetCache.java
@@ -46,14 +46,13 @@ import de.anomic.document.Word;
import de.anomic.document.Document;
import de.anomic.document.parser.html.CharacterCoding;
import de.anomic.document.parser.html.ImageEntry;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpResponseHeader;
+import de.anomic.http.client.Client;
+import de.anomic.http.client.Cache;
+import de.anomic.http.metadata.ResponseHeader;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;
import de.anomic.kelondro.util.ScoreCluster;
import de.anomic.kelondro.util.SetTools;
-import de.anomic.plasma.plasmaHTCache;
-import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.yacy.yacySearch;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.logging.Log;
@@ -86,11 +85,11 @@ public class SnippetCache {
*/
private static final HashMap<String, yacyURL> faviconCache = new HashMap<String, yacyURL>();
private static Log log = null;
- private static plasmaSwitchboard sb = null;
+ private static Switchboard sb = null;
public static void init(
final Log logx,
- final plasmaSwitchboard switchboard
+ final Switchboard switchboard
) {
log = logx;
sb = switchboard;
@@ -327,7 +326,7 @@ public class SnippetCache {
// if the snippet is not in the cache, we can try to get it from the htcache
long resContentLength = 0;
InputStream resContent = null;
- httpResponseHeader responseHeader = null;
+ ResponseHeader responseHeader = null;
try {
// first try to get the snippet from metadata
String loc;
@@ -345,16 +344,16 @@ public class SnippetCache {
return new TextSnippet(url, loc, SOURCE_METADATA, null, null, faviconCache.get(url.hash()));
} else {
// trying to load the resource from the cache
- resContent = plasmaHTCache.getResourceContentStream(url);
- responseHeader = plasmaHTCache.loadResponseHeader(url);
- if (resContent != null && ((resContentLength = plasmaHTCache.getResourceContentLength(url)) > maxDocLen) && (!fetchOnline)) {
+ resContent = Cache.getResourceContentStream(url);
+ responseHeader = Cache.loadResponseHeader(url);
+ if (resContent != null && ((resContentLength = Cache.getResourceContentLength(url)) > maxDocLen) && (!fetchOnline)) {
// content may be too large to be parsed here. To be fast, we omit calculation of snippet here
return new TextSnippet(url, null, ERROR_SOURCE_LOADING, queryhashes, "resource available, but too large: " + resContentLength + " bytes");
} else if (fetchOnline) {
// if not found try to download it
// download resource using the crawler and keep resource in memory if possible
- final Response entry = plasmaSwitchboard.getSwitchboard().crawlQueues.loadResourceFromWeb(url, true, reindexing);
+ final Response entry = Switchboard.getSwitchboard().crawlQueues.loadResourceFromWeb(url, true, reindexing);
// getting resource metadata (e.g. the http headers for http resources)
if (entry != null) {
@@ -367,8 +366,8 @@ public class SnippetCache {
resContent = new ByteArrayInputStream(resourceArray);
resContentLength = resourceArray.length;
} else {
- resContent = plasmaHTCache.getResourceContentStream(url);
- resContentLength = plasmaHTCache.getResourceContentLength(url);
+ resContent = Cache.getResourceContentStream(url);
+ resContentLength = Cache.getResourceContentLength(url);
}
}
@@ -454,19 +453,19 @@ public class SnippetCache {
// load resource
long resContentLength = 0;
InputStream resContent = null;
- httpResponseHeader responseHeader = null;
+ ResponseHeader responseHeader = null;
try {
// trying to load the resource from the cache
- resContent = plasmaHTCache.getResourceContentStream(url);
- responseHeader = plasmaHTCache.loadResponseHeader(url);
+ resContent = Cache.getResourceContentStream(url);
+ responseHeader = Cache.loadResponseHeader(url);
if (resContent != null) {
// if the content was found
- resContentLength = plasmaHTCache.getResourceContentLength(url);
+ resContentLength = Cache.getResourceContentLength(url);
} else if (fetchOnline) {
// if not found try to download it
// download resource using the crawler and keep resource in memory if possible
- final Response entry = plasmaSwitchboard.getSwitchboard().crawlQueues.loadResourceFromWeb(url, forText, global);
+ final Response entry = Switchboard.getSwitchboard().crawlQueues.loadResourceFromWeb(url, forText, global);
// getting resource metadata (e.g. the http headers for http resources)
if (entry != null) {
@@ -477,8 +476,8 @@ public class SnippetCache {
resContent = new ByteArrayInputStream(resourceArray);
resContentLength = resourceArray.length;
} else {
- resContent = plasmaHTCache.getResourceContentStream(url);
- resContentLength = plasmaHTCache.getResourceContentLength(url);
+ resContent = Cache.getResourceContentStream(url);
+ resContentLength = Cache.getResourceContentLength(url);
}
}
@@ -837,7 +836,7 @@ public class SnippetCache {
* @return the extracted data
* @throws ParserException
*/
- public static Document parseDocument(final yacyURL url, final long contentLength, final InputStream resourceStream, httpResponseHeader responseHeader) throws ParserException {
+ public static Document parseDocument(final yacyURL url, final long contentLength, final InputStream resourceStream, ResponseHeader responseHeader) throws ParserException {
try {
if (resourceStream == null) return null;
@@ -845,7 +844,7 @@ public class SnippetCache {
if (responseHeader == null) {
// try to get the header from the htcache directory
try {
- responseHeader = plasmaHTCache.loadResponseHeader(url);
+ responseHeader = Cache.loadResponseHeader(url);
} catch (final Exception e) {
// ignore this. resource info loading failed
}
@@ -858,7 +857,7 @@ public class SnippetCache {
// getting URL mimeType
try {
- responseHeader = httpClient.whead(url.toString());
+ responseHeader = Client.whead(url.toString());
} catch (final Exception e) {
// ingore this. http header download failed
}
@@ -898,14 +897,14 @@ public class SnippetCache {
long contentLength = -1;
// trying to load the resource body from cache
- InputStream resource = plasmaHTCache.getResourceContentStream(url);
+ InputStream resource = Cache.getResourceContentStream(url);
if (resource != null) {
- contentLength = plasmaHTCache.getResourceContentLength(url);
+ contentLength = Cache.getResourceContentLength(url);
} else if (fetchOnline) {
// if the content is not available in cache try to download it from web
// try to download the resource using a crawler
- final Response entry = plasmaSwitchboard.getSwitchboard().crawlQueues.loadResourceFromWeb(url, forText, reindexing);
+ final Response entry = Switchboard.getSwitchboard().crawlQueues.loadResourceFromWeb(url, forText, reindexing);
if (entry == null) return null; // not found in web
// read resource body (if it is there)
@@ -913,8 +912,8 @@ public class SnippetCache {
// in case that the resource was not in ram, read it from disk
if (resourceArray == null) {
- resource = plasmaHTCache.getResourceContentStream(url);
- contentLength = plasmaHTCache.getResourceContentLength(url);
+ resource = Cache.getResourceContentStream(url);
+ contentLength = Cache.getResourceContentLength(url);
} else {
resource = new ByteArrayInputStream(resourceArray);
contentLength = resourceArray.length;
@@ -934,18 +933,18 @@ public class SnippetCache {
(snippet.getErrorCode() == ERROR_PARSER_FAILED) ||
(snippet.getErrorCode() == ERROR_PARSER_NO_LINES)) {
log.logInfo("error: '" + snippet.getError() + "', remove url = " + snippet.getUrl().toNormalform(false, true) + ", cause: " + snippet.getError());
- plasmaSwitchboard.getSwitchboard().indexSegment.urlMetadata().remove(urlHash);
+ Switchboard.getSwitchboard().indexSegment.urlMetadata().remove(urlHash);
final QueryEvent event = QueryEvent.getEvent(eventID);
- assert plasmaSwitchboard.getSwitchboard() != null;
- assert plasmaSwitchboard.getSwitchboard().indexSegment != null;
+ assert Switchboard.getSwitchboard() != null;
+ assert Switchboard.getSwitchboard().indexSegment != null;
assert event != null : "eventID = " + eventID;
assert event.getQuery() != null;
- plasmaSwitchboard.getSwitchboard().indexSegment.termIndex().remove(event.getQuery().queryHashes, urlHash);
+ Switchboard.getSwitchboard().indexSegment.termIndex().remove(event.getQuery().queryHashes, urlHash);
event.remove(urlHash);
}
if (snippet.getErrorCode() == ERROR_NO_MATCH) {
log.logInfo("error: '" + snippet.getError() + "', remove words '" + querystring + "' for url = " + snippet.getUrl().toNormalform(false, true) + ", cause: " + snippet.getError());
- plasmaSwitchboard.getSwitchboard().indexSegment.termIndex().remove(snippet.remaingHashes, urlHash);
+ Switchboard.getSwitchboard().indexSegment.termIndex().remove(snippet.remaingHashes, urlHash);
QueryEvent.getEvent(eventID).remove(urlHash);
}
return snippet.getError();
diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/search/Switchboard.java
similarity index 83%
rename from source/de/anomic/plasma/plasmaSwitchboard.java
rename to source/de/anomic/search/Switchboard.java
index 7cace9704..e0e6db315 100644
--- a/source/de/anomic/plasma/plasmaSwitchboard.java
+++ b/source/de/anomic/search/Switchboard.java
@@ -83,7 +83,7 @@
*/
-package de.anomic.plasma;
+package de.anomic.search;
import java.io.BufferedInputStream;
import java.io.File;
@@ -148,13 +148,14 @@ import de.anomic.document.ParserException;
import de.anomic.document.Word;
import de.anomic.document.Document;
import de.anomic.document.parser.xml.RSSFeed;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRemoteProxyConfig;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.http.httpResponseHeader;
-import de.anomic.http.httpd;
-import de.anomic.http.httpdRobotsTxtConfig;
+import de.anomic.http.client.Client;
+import de.anomic.http.client.RemoteProxyConfig;
+import de.anomic.http.client.Cache;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.metadata.ResponseHeader;
+import de.anomic.http.server.HTTPDemon;
+import de.anomic.http.server.RobotsTxtConfig;
import de.anomic.kelondro.order.Digest;
import de.anomic.kelondro.order.NaturalOrder;
import de.anomic.kelondro.text.Segment;
@@ -165,11 +166,7 @@ import de.anomic.kelondro.util.FileUtils;
import de.anomic.kelondro.util.MemoryControl;
import de.anomic.kelondro.util.SetTools;
import de.anomic.net.UPnP;
-import de.anomic.search.QueryParams;
-import de.anomic.search.RankingProfile;
-import de.anomic.search.QueryEvent;
-import de.anomic.search.RankingProcess;
-import de.anomic.search.SnippetCache;
+import de.anomic.search.blockrank.CRDistribution;
import de.anomic.server.serverAbstractSwitch;
import de.anomic.server.serverBusyThread;
import de.anomic.server.serverCore;
@@ -191,7 +188,6 @@ import de.anomic.yacy.yacyNewsPool;
import de.anomic.yacy.yacyNewsRecord;
import de.anomic.yacy.yacySeed;
import de.anomic.yacy.Tray;
-import de.anomic.yacy.yacyBuildProperties;
import de.anomic.yacy.yacySeedDB;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.yacyUpdateLocation;
@@ -199,8 +195,9 @@ import de.anomic.yacy.yacyRelease;
import de.anomic.yacy.dht.Dispatcher;
import de.anomic.yacy.dht.PeerSelection;
import de.anomic.yacy.logging.Log;
+import de.anomic.ymage.WebStructureGraph;
-public final class plasmaSwitchboard extends serverAbstractSwitch implements serverSwitch {
+public final class Switchboard extends serverAbstractSwitch implements serverSwitch {
// load slots
public static int xstackCrawlSlots = 2000;
@@ -242,15 +239,15 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
public blogBoardComments blogCommentDB;
public RobotsTxt robots;
public boolean rankingOn;
- public plasmaRankingDistribution rankingOwnDistribution;
- public plasmaRankingDistribution rankingOtherDistribution;
+ public CRDistribution rankingOwnDistribution;
+ public CRDistribution rankingOtherDistribution;
public HashMap<String, Object[]> outgoingCookies, incomingCookies;
public volatile long proxyLastAccess, localSearchLastAccess, remoteSearchLastAccess;
public yacyCore yc;
public ResourceObserver observer;
public userDB userDB;
public bookmarksDB bookmarksDB;
- public plasmaWebStructure webStructure;
+ public WebStructureGraph webStructure;
public ImporterManager dbImportManager;
public ArrayList<QueryParams> localSearches; // array of search result properties as HashMaps
public ArrayList<QueryParams> remoteSearches; // array of search result properties as HashMaps
@@ -270,7 +267,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
public serverProcessor<indexingQueueEntry> indexingAnalysisProcessor;
public serverProcessor<indexingQueueEntry> indexingStorageProcessor;
- public httpdRobotsTxtConfig robotstxtConfig = null;
+ public RobotsTxtConfig robotstxtConfig = null;
private final serverSemaphore shutdownSync = new serverSemaphore(0);
@@ -281,9 +278,9 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
public Hashtable<String, Object[]> crawlJobsStatus = new Hashtable<String, Object[]>();
- private static plasmaSwitchboard sb = null;
+ private static Switchboard sb = null;
- public plasmaSwitchboard(final File rootPath, final String initPath, final String configPath, final boolean applyPro) throws IOException {
+ public Switchboard(final File rootPath, final String initPath, final String configPath, final boolean applyPro) throws IOException {
super(rootPath, initPath, configPath, applyPro);
serverProfiling.startSystemProfiling();
sb=this;
@@ -293,31 +290,31 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
if (applyPro) this.log.logInfo("This is the pro-version of YaCy");
// UPnP port mapping
- if (getConfigBool(plasmaSwitchboardConstants.UPNP_ENABLED, false))
+ if (getConfigBool(SwitchboardConstants.UPNP_ENABLED, false))
serverInstantBusyThread.oneTimeJob(UPnP.class, "addPortMapping", UPnP.log, 0);
// init TrayIcon if possible
Tray.init(this);
// remote proxy configuration
- httpRemoteProxyConfig.init(this);
+ RemoteProxyConfig.init(this);
// load values from configs
- final File indexPrimaryPath = getConfigPath(plasmaSwitchboardConstants.INDEX_PRIMARY_PATH, plasmaSwitchboardConstants.INDEX_PATH_DEFAULT);
+ final File indexPrimaryPath = getConfigPath(SwitchboardConstants.INDEX_PRIMARY_PATH, SwitchboardConstants.INDEX_PATH_DEFAULT);
this.log.logConfig("Index Primary Path: " + indexPrimaryPath.toString());
- this.listsPath = getConfigPath(plasmaSwitchboardConstants.LISTS_PATH, plasmaSwitchboardConstants.LISTS_PATH_DEFAULT);
+ this.listsPath = getConfigPath(SwitchboardConstants.LISTS_PATH, SwitchboardConstants.LISTS_PATH_DEFAULT);
this.log.logConfig("Lists Path: " + this.listsPath.toString());
- this.htDocsPath = getConfigPath(plasmaSwitchboardConstants.HTDOCS_PATH, plasmaSwitchboardConstants.HTDOCS_PATH_DEFAULT);
+ this.htDocsPath = getConfigPath(SwitchboardConstants.HTDOCS_PATH, SwitchboardConstants.HTDOCS_PATH_DEFAULT);
this.log.logConfig("HTDOCS Path: " + this.htDocsPath.toString());
- this.rankingPath = getConfigPath(plasmaSwitchboardConstants.RANKING_PATH, plasmaSwitchboardConstants.RANKING_PATH_DEFAULT);
+ this.rankingPath = getConfigPath(SwitchboardConstants.RANKING_PATH, SwitchboardConstants.RANKING_PATH_DEFAULT);
this.log.logConfig("Ranking Path: " + this.rankingPath.toString());
this.rankingPermissions = new HashMap<String, String>(); // mapping of permission - to filename.
- this.workPath = getConfigPath(plasmaSwitchboardConstants.WORK_PATH, plasmaSwitchboardConstants.WORK_PATH_DEFAULT);
+ this.workPath = getConfigPath(SwitchboardConstants.WORK_PATH, SwitchboardConstants.WORK_PATH_DEFAULT);
this.log.logConfig("Work Path: " + this.workPath.toString());
// set a high maximum cache size to current size; this is adopted later automatically
- final int wordCacheMaxCount = (int) getConfigLong(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, 20000);
- setConfig(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, Integer.toString(wordCacheMaxCount));
+ final int wordCacheMaxCount = (int) getConfigLong(SwitchboardConstants.WORDCACHE_MAX_COUNT, 20000);
+ setConfig(SwitchboardConstants.WORDCACHE_MAX_COUNT, Integer.toString(wordCacheMaxCount));
// set network-specific performance attributes
if (this.firstInit) {
@@ -329,7 +326,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// start indexing management
log.logConfig("Starting Indexing Management");
- final String networkName = getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "");
+ final String networkName = getConfig(SwitchboardConstants.NETWORK_NAME, "");
final long fileSizeMax = (serverSystem.isWindows) ? sb.getConfigLong("filesize.max.win", (long) Integer.MAX_VALUE) : sb.getConfigLong("filesize.max.other", (long) Integer.MAX_VALUE);
final int redundancy = (int) sb.getConfigLong("network.unit.dhtredundancy.senior", 1);
final int partitionExponent = (int) sb.getConfigLong("network.unit.dht.partitionExponent", 0);
@@ -378,13 +375,13 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
30000);
// set up local robots.txt
- this.robotstxtConfig = httpdRobotsTxtConfig.init(this);
+ this.robotstxtConfig = RobotsTxtConfig.init(this);
// setting timestamp of last proxy access
this.proxyLastAccess = System.currentTimeMillis() - 10000;
this.localSearchLastAccess = System.currentTimeMillis() - 10000;
this.remoteSearchLastAccess = System.currentTimeMillis() - 10000;
- this.webStructure = new plasmaWebStructure(log, rankingPath, "LOCAL/010_cr/", getConfig("CRDist0Path", plasmaRankingDistribution.CR_OWN), new File(queuesRoot, "webStructure.map"));
+ this.webStructure = new WebStructureGraph(log, rankingPath, "LOCAL/010_cr/", getConfig("CRDist0Path", CRDistribution.CR_OWN), new File(queuesRoot, "webStructure.map"));
// configuring list path
if (!(listsPath.exists())) listsPath.mkdirs();
@@ -392,7 +389,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// load coloured lists
if (blueList == null) {
// read only once upon first instantiation of this class
- final String f = getConfig(plasmaSwitchboardConstants.LIST_BLUE, plasmaSwitchboardConstants.LIST_BLUE_DEFAULT);
+ final String f = getConfig(SwitchboardConstants.LIST_BLUE, SwitchboardConstants.LIST_BLUE_DEFAULT);
final File plasmaBlueListFile = new File(f);
if (f != null) blueList = SetTools.loadList(plasmaBlueListFile, NaturalOrder.naturalComparator); else blueList= new TreeSet<String>();
blueListHashes = Word.words2hashes(blueList);
@@ -402,10 +399,10 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
}
// load the black-list / inspired by [AS]
- final File blacklistsPath = getConfigPath(plasmaSwitchboardConstants.LISTS_PATH, plasmaSwitchboardConstants.LISTS_PATH_DEFAULT);
+ final File blacklistsPath = getConfigPath(SwitchboardConstants.LISTS_PATH, SwitchboardConstants.LISTS_PATH_DEFAULT);
String[] blacklistClassName = new String[] {
- getConfig(plasmaSwitchboardConstants.BLACKLIST_CLASS, plasmaSwitchboardConstants.BLACKLIST_CLASS_DEFAULT),
- plasmaSwitchboardConstants.BLACKLIST_CLASS_DEFAULT
+ getConfig(SwitchboardConstants.BLACKLIST_CLASS, SwitchboardConstants.BLACKLIST_CLASS_DEFAULT),
+ SwitchboardConstants.BLACKLIST_CLASS_DEFAULT
};
this.log.logConfig("Starting blacklist engine ...");
@@ -436,7 +433,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// load badwords (to filter the topwords)
if (badwords == null) {
- final File badwordsFile = new File(rootPath, plasmaSwitchboardConstants.LIST_BADWORDS_DEFAULT);
+ final File badwordsFile = new File(rootPath, SwitchboardConstants.LIST_BADWORDS_DEFAULT);
badwords = SetTools.loadList(badwordsFile, NaturalOrder.naturalComparator);
badwordHashes = Word.words2hashes(badwords);
this.log.logConfig("loaded badwords from file " + badwordsFile.getName() +
@@ -446,7 +443,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// load stopwords
if (stopwords == null) {
- final File stopwordsFile = new File(rootPath, plasmaSwitchboardConstants.LIST_STOPWORDS_DEFAULT);
+ final File stopwordsFile = new File(rootPath, SwitchboardConstants.LIST_STOPWORDS_DEFAULT);
stopwords = SetTools.loadList(stopwordsFile, NaturalOrder.naturalComparator);
stopwordHashes = Word.words2hashes(stopwords);
this.log.logConfig("loaded stopwords from file " + stopwordsFile.getName() + ", " +
@@ -472,21 +469,21 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
log.logConfig("Starting HT Cache Manager");
// create the cache directory
- htCachePath = getConfigPath(plasmaSwitchboardConstants.HTCACHE_PATH, plasmaSwitchboardConstants.HTCACHE_PATH_DEFAULT);
+ htCachePath = getConfigPath(SwitchboardConstants.HTCACHE_PATH, SwitchboardConstants.HTCACHE_PATH_DEFAULT);
this.log.logInfo("HTCACHE Path = " + htCachePath.getAbsolutePath());
- final long maxCacheSize = 1024 * 1024 * Long.parseLong(getConfig(plasmaSwitchboardConstants.PROXY_CACHE_SIZE, "2")); // this is megabyte
- plasmaHTCache.init(htCachePath, peers.mySeed().hash, maxCacheSize);
+ final long maxCacheSize = 1024 * 1024 * Long.parseLong(getConfig(SwitchboardConstants.PROXY_CACHE_SIZE, "2")); // this is megabyte
+ Cache.init(htCachePath, peers.mySeed().hash, maxCacheSize);
// create the surrogates directories
- surrogatesInPath = getConfigPath(plasmaSwitchboardConstants.SURROGATES_IN_PATH, plasmaSwitchboardConstants.SURROGATES_IN_PATH_DEFAULT);
+ surrogatesInPath = getConfigPath(SwitchboardConstants.SURROGATES_IN_PATH, SwitchboardConstants.SURROGATES_IN_PATH_DEFAULT);
this.log.logInfo("surrogates.in Path = " + surrogatesInPath.getAbsolutePath());
surrogatesInPath.mkdirs();
- surrogatesOutPath = getConfigPath(plasmaSwitchboardConstants.SURROGATES_OUT_PATH, plasmaSwitchboardConstants.SURROGATES_OUT_PATH_DEFAULT);
+ surrogatesOutPath = getConfigPath(SwitchboardConstants.SURROGATES_OUT_PATH, SwitchboardConstants.SURROGATES_OUT_PATH_DEFAULT);
this.log.logInfo("surrogates.out Path = " + surrogatesOutPath.getAbsolutePath());
surrogatesOutPath.mkdirs();
// create the release download directory
- releasePath = getConfigPath(plasmaSwitchboardConstants.RELEASE_PATH, plasmaSwitchboardConstants.RELEASE_PATH_DEFAULT);
+ releasePath = getConfigPath(SwitchboardConstants.RELEASE_PATH, SwitchboardConstants.RELEASE_PATH_DEFAULT);
releasePath.mkdirs();
this.log.logInfo("RELEASE Path = " + releasePath.getAbsolutePath());
@@ -512,7 +509,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// define a realtime parsable mimetype list
log.logConfig("Parser: Initializing Mime Type deny list");
- Parser.setDenyMime(getConfig(plasmaSwitchboardConstants.PARSER_MIME_DENY, null));
+ Parser.setDenyMime(getConfig(SwitchboardConstants.PARSER_MIME_DENY, null));
// start a loader
log.logConfig("Starting Crawl Loader");
@@ -527,15 +524,15 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
* b) remote triggered crawl
* c) global crawl trigger
*/
- this.crawlJobsStatus.put(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL, new Object[]{
+ this.crawlJobsStatus.put(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL, new Object[]{
new Object(),
- Boolean.valueOf(getConfig(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL + "_isPaused", "false"))});
- this.crawlJobsStatus.put(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL, new Object[]{
+ Boolean.valueOf(getConfig(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL + "_isPaused", "false"))});
+ this.crawlJobsStatus.put(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL, new Object[]{
new Object(),
- Boolean.valueOf(getConfig(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL + "_isPaused", "false"))});
- this.crawlJobsStatus.put(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER, new Object[]{
+ Boolean.valueOf(getConfig(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL + "_isPaused", "false"))});
+ this.crawlJobsStatus.put(SwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER, new Object[]{
new Object(),
- Boolean.valueOf(getConfig(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER + "_isPaused", "false"))});
+ Boolean.valueOf(getConfig(SwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER + "_isPaused", "false"))});
// init cookie-Monitor
this.log.logConfig("Starting Cookie Monitor");
@@ -549,8 +546,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
this.remoteSearches = new ArrayList<QueryParams>();
// init messages: clean up message symbol
- final File notifierSource = new File(getRootPath(), getConfig(plasmaSwitchboardConstants.HTROOT_PATH, plasmaSwitchboardConstants.HTROOT_PATH_DEFAULT) + "/env/grafics/empty.gif");
- final File notifierDest = new File(getConfigPath(plasmaSwitchboardConstants.HTDOCS_PATH, plasmaSwitchboardConstants.HTDOCS_PATH_DEFAULT), "notifier.gif");
+ final File notifierSource = new File(getRootPath(), getConfig(SwitchboardConstants.HTROOT_PATH, SwitchboardConstants.HTROOT_PATH_DEFAULT) + "/env/grafics/empty.gif");
+ final File notifierDest = new File(getConfigPath(SwitchboardConstants.HTDOCS_PATH, SwitchboardConstants.HTDOCS_PATH_DEFAULT), "notifier.gif");
try {
FileUtils.copy(notifierSource, notifierDest);
} catch (final IOException e) {
@@ -568,12 +565,12 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
CRDist1Percent = 30
CRDist1Target = kaskelix.de:8080,yacy.dyndns.org:8000,suma-lab.de:8080
**/
- rankingOn = getConfig(plasmaSwitchboardConstants.RANKING_DIST_ON, "true").equals("true") && networkName.equals("freeworld");
- rankingOwnDistribution = new plasmaRankingDistribution(log, peers, new File(rankingPath, getConfig(plasmaSwitchboardConstants.RANKING_DIST_0_PATH, plasmaRankingDistribution.CR_OWN)), (int) getConfigLong(plasmaSwitchboardConstants.RANKING_DIST_0_METHOD, plasmaRankingDistribution.METHOD_ANYSENIOR), (int) getConfigLong(plasmaSwitchboardConstants.RANKING_DIST_0_METHOD, 0), getConfig(plasmaSwitchboardConstants.RANKING_DIST_0_TARGET, ""));
- rankingOtherDistribution = new plasmaRankingDistribution(log, peers, new File(rankingPath, getConfig(plasmaSwitchboardConstants.RANKING_DIST_1_PATH, plasmaRankingDistribution.CR_OTHER)), (int) getConfigLong(plasmaSwitchboardConstants.RANKING_DIST_1_METHOD, plasmaRankingDistribution.METHOD_MIXEDSENIOR), (int) getConfigLong(plasmaSwitchboardConstants.RANKING_DIST_1_METHOD, 30), getConfig(plasmaSwitchboardConstants.RANKING_DIST_1_TARGET, "kaskelix.de:8080,yacy.dyndns.org:8000"));
+ rankingOn = getConfig(SwitchboardConstants.RANKING_DIST_ON, "true").equals("true") && networkName.equals("freeworld");
+ rankingOwnDistribution = new CRDistribution(log, peers, new File(rankingPath, getConfig(SwitchboardConstants.RANKING_DIST_0_PATH, CRDistribution.CR_OWN)), (int) getConfigLong(SwitchboardConstants.RANKING_DIST_0_METHOD, CRDistribution.METHOD_ANYSENIOR), (int) getConfigLong(SwitchboardConstants.RANKING_DIST_0_METHOD, 0), getConfig(SwitchboardConstants.RANKING_DIST_0_TARGET, ""));
+ rankingOtherDistribution = new CRDistribution(log, peers, new File(rankingPath, getConfig(SwitchboardConstants.RANKING_DIST_1_PATH, CRDistribution.CR_OTHER)), (int) getConfigLong(SwitchboardConstants.RANKING_DIST_1_METHOD, CRDistribution.METHOD_MIXEDSENIOR), (int) getConfigLong(SwitchboardConstants.RANKING_DIST_1_METHOD, 30), getConfig(SwitchboardConstants.RANKING_DIST_1_TARGET, "kaskelix.de:8080,yacy.dyndns.org:8000"));
// init nameCacheNoCachingList
- serverDomains.setNoCachingPatterns(getConfig(plasmaSwitchboardConstants.HTTPC_NAME_CACHE_CACHING_PATTERNS_NO,""));
+ serverDomains.setNoCachingPatterns(getConfig(SwitchboardConstants.HTTPC_NAME_CACHE_CACHING_PATTERNS_NO,""));
// generate snippets cache
log.logConfig("Initializing Snippet Cache");
@@ -595,7 +592,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
"global.any".indexOf(getConfig("network.unit.domain", "global")) >= 0);
// initializing dht chunk generation
- this.dhtMaxReferenceCount = (int) getConfigLong(plasmaSwitchboardConstants.INDEX_DIST_CHUNK_SIZE_START, 50);
+ this.dhtMaxReferenceCount = (int) getConfigLong(SwitchboardConstants.INDEX_DIST_CHUNK_SIZE_START, 50);
// init robinson cluster
// before we do that, we wait some time until the seed list is loaded.
@@ -634,25 +631,25 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
log.logConfig("Starting Threads");
MemoryControl.gc(10000, "plasmaSwitchboard, help for profiler"); // help for profiler - thq
- deployThread(plasmaSwitchboardConstants.CLEANUP, "Cleanup", "simple cleaning process for monitoring information", null,
- new serverInstantBusyThread(this, plasmaSwitchboardConstants.CLEANUP_METHOD_START, plasmaSwitchboardConstants.CLEANUP_METHOD_JOBCOUNT, plasmaSwitchboardConstants.CLEANUP_METHOD_FREEMEM), 600000); // all 5 Minutes, wait 10 minutes until first run
- deployThread(plasmaSwitchboardConstants.SURROGATES, "Surrogates", "A thread that polls the SURROGATES path and puts all Documents in one surroagte file into the indexing queue.", null,
- new serverInstantBusyThread(this, plasmaSwitchboardConstants.SURROGATES_METHOD_START, plasmaSwitchboardConstants.SURROGATES_METHOD_JOBCOUNT, plasmaSwitchboardConstants.SURROGATES_METHOD_FREEMEM), 10000);
- deployThread(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL, "Remote Crawl Job", "thread that performes a single crawl/indexing step triggered by a remote peer", null,
- new serverInstantBusyThread(crawlQueues, plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_METHOD_START, plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_METHOD_JOBCOUNT, plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_METHOD_FREEMEM), 30000);
- deployThread(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER, "Remote Crawl URL Loader", "thread that loads remote crawl lists from other peers", "",
- new serverInstantBusyThread(crawlQueues, plasmaSwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER_METHOD_START, plasmaSwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER_METHOD_JOBCOUNT, plasmaSwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER_METHOD_FREEMEM), 30000); // error here?
- deployThread(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL, "Local Crawl", "thread that performes a single crawl step from the local crawl queue", "/IndexCreateWWWLocalQueue_p.html",
- new serverInstantBusyThread(crawlQueues, plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL_METHOD_START, plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL_METHOD_JOBCOUNT, plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL_METHOD_FREEMEM), 10000);
- deployThread(plasmaSwitchboardConstants.SEED_UPLOAD, "Seed-List Upload", "task that a principal peer performes to generate and upload a seed-list to a ftp account", null,
- new serverInstantBusyThread(yc, plasmaSwitchboardConstants.SEED_UPLOAD_METHOD_START, plasmaSwitchboardConstants.SEED_UPLOAD_METHOD_JOBCOUNT, plasmaSwitchboardConstants.SEED_UPLOAD_METHOD_FREEMEM), 180000);
- deployThread(plasmaSwitchboardConstants.PEER_PING, "YaCy Core", "this is the p2p-control and peer-ping task", null,
- new serverInstantBusyThread(yc, plasmaSwitchboardConstants.PEER_PING_METHOD_START, plasmaSwitchboardConstants.PEER_PING_METHOD_JOBCOUNT, plasmaSwitchboardConstants.PEER_PING_METHOD_FREEMEM), 2000);
- deployThread(plasmaSwitchboardConstants.INDEX_DIST, "DHT Distribution", "selection, transfer and deletion of index entries that are not searched on your peer, but on others", null,
- new serverInstantBusyThread(this, plasmaSwitchboardConstants.INDEX_DIST_METHOD_START, plasmaSwitchboardConstants.INDEX_DIST_METHOD_JOBCOUNT, plasmaSwitchboardConstants.INDEX_DIST_METHOD_FREEMEM), 5000,
- Long.parseLong(getConfig(plasmaSwitchboardConstants.INDEX_DIST_IDLESLEEP , "5000")),
- Long.parseLong(getConfig(plasmaSwitchboardConstants.INDEX_DIST_BUSYSLEEP , "0")),
- Long.parseLong(getConfig(plasmaSwitchboardConstants.INDEX_DIST_MEMPREREQ , "1000000")));
+ deployThread(SwitchboardConstants.CLEANUP, "Cleanup", "simple cleaning process for monitoring information", null,
+ new serverInstantBusyThread(this, SwitchboardConstants.CLEANUP_METHOD_START, SwitchboardConstants.CLEANUP_METHOD_JOBCOUNT, SwitchboardConstants.CLEANUP_METHOD_FREEMEM), 600000); // all 5 Minutes, wait 10 minutes until first run
+ deployThread(SwitchboardConstants.SURROGATES, "Surrogates", "A thread that polls the SURROGATES path and puts all Documents in one surroagte file into the indexing queue.", null,
+ new serverInstantBusyThread(this, SwitchboardConstants.SURROGATES_METHOD_START, SwitchboardConstants.SURROGATES_METHOD_JOBCOUNT, SwitchboardConstants.SURROGATES_METHOD_FREEMEM), 10000);
+ deployThread(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL, "Remote Crawl Job", "thread that performes a single crawl/indexing step triggered by a remote peer", null,
+ new serverInstantBusyThread(crawlQueues, SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_METHOD_START, SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_METHOD_JOBCOUNT, SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_METHOD_FREEMEM), 30000);
+ deployThread(SwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER, "Remote Crawl URL Loader", "thread that loads remote crawl lists from other peers", "",
+ new serverInstantBusyThread(crawlQueues, SwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER_METHOD_START, SwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER_METHOD_JOBCOUNT, SwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER_METHOD_FREEMEM), 30000); // error here?
+ deployThread(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL, "Local Crawl", "thread that performes a single crawl step from the local crawl queue", "/IndexCreateWWWLocalQueue_p.html",
+ new serverInstantBusyThread(crawlQueues, SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL_METHOD_START, SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL_METHOD_JOBCOUNT, SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL_METHOD_FREEMEM), 10000);
+ deployThread(SwitchboardConstants.SEED_UPLOAD, "Seed-List Upload", "task that a principal peer performes to generate and upload a seed-list to a ftp account", null,
+ new serverInstantBusyThread(yc, SwitchboardConstants.SEED_UPLOAD_METHOD_START, SwitchboardConstants.SEED_UPLOAD_METHOD_JOBCOUNT, SwitchboardConstants.SEED_UPLOAD_METHOD_FREEMEM), 180000);
+ deployThread(SwitchboardConstants.PEER_PING, "YaCy Core", "this is the p2p-control and peer-ping task", null,
+ new serverInstantBusyThread(yc, SwitchboardConstants.PEER_PING_METHOD_START, SwitchboardConstants.PEER_PING_METHOD_JOBCOUNT, SwitchboardConstants.PEER_PING_METHOD_FREEMEM), 2000);
+ deployThread(SwitchboardConstants.INDEX_DIST, "DHT Distribution", "selection, transfer and deletion of index entries that are not searched on your peer, but on others", null,
+ new serverInstantBusyThread(this, SwitchboardConstants.INDEX_DIST_METHOD_START, SwitchboardConstants.INDEX_DIST_METHOD_JOBCOUNT, SwitchboardConstants.INDEX_DIST_METHOD_FREEMEM), 5000,
+ Long.parseLong(getConfig(SwitchboardConstants.INDEX_DIST_IDLESLEEP , "5000")),
+ Long.parseLong(getConfig(SwitchboardConstants.INDEX_DIST_BUSYSLEEP , "0")),
+ Long.parseLong(getConfig(SwitchboardConstants.INDEX_DIST_MEMPREREQ , "1000000")));
// test routine for snippet fetch
//Set query = new HashSet();
@@ -707,7 +704,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
Map<String, String> initProps;
if (networkUnitDefinition.startsWith("http://")) {
try {
- setConfig(plasmaSwitchboard.loadHashMap(new yacyURL(networkUnitDefinition, null)));
+ setConfig(Switchboard.loadHashMap(new yacyURL(networkUnitDefinition, null)));
} catch (final MalformedURLException e) { }
} else {
final File networkUnitDefinitionFile = (networkUnitDefinition.startsWith("/")) ? new File(networkUnitDefinition) : new File(getRootPath(), networkUnitDefinition);
@@ -718,7 +715,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
}
if (networkGroupDefinition.startsWith("http://")) {
try {
- setConfig(plasmaSwitchboard.loadHashMap(new yacyURL(networkGroupDefinition, null)));
+ setConfig(Switchboard.loadHashMap(new yacyURL(networkGroupDefinition, null)));
} catch (final MalformedURLException e) { }
} else {
final File networkGroupDefinitionFile = new File(getRootPath(), networkGroupDefinition);
@@ -767,8 +764,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
licensedURLs = new URLLicense(8);
// set white/blacklists
- this.networkWhitelist = serverDomains.makePatterns(getConfig(plasmaSwitchboardConstants.NETWORK_WHITELIST, ""));
- this.networkBlacklist = serverDomains.makePatterns(getConfig(plasmaSwitchboardConstants.NETWORK_BLACKLIST, ""));
+ this.networkWhitelist = serverDomains.makePatterns(getConfig(SwitchboardConstants.NETWORK_WHITELIST, ""));
+ this.networkBlacklist = serverDomains.makePatterns(getConfig(SwitchboardConstants.NETWORK_BLACKLIST, ""));
/*
// in intranet and portal network set robinson mode
@@ -793,10 +790,10 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
public void switchNetwork(final String networkDefinition) {
log.logInfo("SWITCH NETWORK: switching to '" + networkDefinition + "'");
// pause crawls
- final boolean lcp = crawlJobIsPaused(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
- if (!lcp) pauseCrawlJob(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
- final boolean rcp = crawlJobIsPaused(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
- if (!rcp) pauseCrawlJob(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
+ final boolean lcp = crawlJobIsPaused(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
+ if (!lcp) pauseCrawlJob(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
+ final boolean rcp = crawlJobIsPaused(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
+ if (!rcp) pauseCrawlJob(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
// trigger online caution
proxyLastAccess = System.currentTimeMillis() + 3000; // at least 3 seconds online caution to prevent unnecessary action on database meanwhile
log.logInfo("SWITCH NETWORK: SHUT DOWN OF OLD INDEX DATABASE...");
@@ -820,12 +817,12 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// start up
setConfig("network.unit.definition", networkDefinition);
overwriteNetworkDefinition();
- final File indexPrimaryPath = getConfigPath(plasmaSwitchboardConstants.INDEX_PRIMARY_PATH, plasmaSwitchboardConstants.INDEX_PATH_DEFAULT);
- final int wordCacheMaxCount = (int) getConfigLong(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, 20000);
+ final File indexPrimaryPath = getConfigPath(SwitchboardConstants.INDEX_PRIMARY_PATH, SwitchboardConstants.INDEX_PATH_DEFAULT);
+ final int wordCacheMaxCount = (int) getConfigLong(SwitchboardConstants.WORDCACHE_MAX_COUNT, 20000);
final long fileSizeMax = (serverSystem.isWindows) ? sb.getConfigLong("filesize.max.win", (long) Integer.MAX_VALUE) : sb.getConfigLong("filesize.max.other", (long) Integer.MAX_VALUE);
final int redundancy = (int) sb.getConfigLong("network.unit.dhtredundancy.senior", 1);
final int partitionExponent = (int) sb.getConfigLong("network.unit.dht.partitionExponent", 0);
- final String networkName = getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "");
+ final String networkName = getConfig(SwitchboardConstants.NETWORK_NAME, "");
this.networkRoot = new File(new File(indexPrimaryPath, networkName), "NETWORK");
this.queuesRoot = new File(new File(indexPrimaryPath, networkName), "QUEUES");
this.networkRoot.mkdirs();
@@ -856,7 +853,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// create new web structure
- this.webStructure = new plasmaWebStructure(log, rankingPath, "LOCAL/010_cr/", getConfig("CRDist0Path", plasmaRankingDistribution.CR_OWN), new File(queuesRoot, "webStructure.map"));
+ this.webStructure = new WebStructureGraph(log, rankingPath, "LOCAL/010_cr/", getConfig("CRDist0Path", CRDistribution.CR_OWN), new File(queuesRoot, "webStructure.map"));
// load the robots.txt database
this.log.logConfig("Initializing robots.txt DB");
@@ -884,8 +881,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
}
// start up crawl jobs
- continueCrawlJob(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
- continueCrawlJob(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
+ continueCrawlJob(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
+ continueCrawlJob(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
log.logInfo("SWITCH NETWORK: FINISHED START UP, new network is now '" + networkDefinition + "'.");
// check status of account configuration: when local url crawling is allowed, it is not allowed
@@ -894,10 +891,10 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// addresses that can steer a YaCy peer
if ((crawlStacker.acceptLocalURLs()) && (getConfigBool("adminAccountForLocalhost", false))) {
setConfig("adminAccountForLocalhost", false);
- if (getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").startsWith("0000")) {
+ if (getConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, "").startsWith("0000")) {
// the password was set automatically with a random value.
// We must remove that here to prevent that a user cannot log in any more
- setConfig(httpd.ADMIN_ACCOUNT_B64MD5, "");
+ setConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, "");
// after this a message must be generated to alert the user to set a new password
log.logInfo("RANDOM PASSWORD REMOVED! User must set a new password");
}
@@ -907,10 +904,10 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
}
public void setRemotecrawlPPM(int ppm) {
- setConfig(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_BUSYSLEEP, 60000 / ppm);
- setConfig(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_IDLESLEEP, Math.max(10000, 180000 / ppm));
- setConfig(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER_BUSYSLEEP, Math.max(15000, 1800000 / ppm));
- setConfig(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER_IDLESLEEP, Math.max(30000, 3600000 / ppm));
+ setConfig(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_BUSYSLEEP, 60000 / ppm);
+ setConfig(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_IDLESLEEP, Math.max(10000, 180000 / ppm));
+ setConfig(SwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER_BUSYSLEEP, Math.max(15000, 1800000 / ppm));
+ setConfig(SwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER_IDLESLEEP, Math.max(30000, 3600000 / ppm));
}
public void initMessages() throws IOException {
@@ -956,7 +953,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
this.log.logConfig(this.bookmarksDB.tagsSize()+" Tag, "+this.bookmarksDB.bookmarksSize()+" Bookmarks");
}
- public static plasmaSwitchboard getSwitchboard(){
+ public static Switchboard getSwitchboard(){
return sb;
}
@@ -964,14 +961,14 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// we are in robinson mode, if we do not exchange index by dht distribution
// we need to take care that search requests and remote indexing requests go only
// to the peers in the same cluster, if we run a robinson cluster.
- return !getConfigBool(plasmaSwitchboardConstants.INDEX_DIST_ALLOW, false) && !getConfigBool(plasmaSwitchboardConstants.INDEX_RECEIVE_ALLOW, false);
+ return !getConfigBool(SwitchboardConstants.INDEX_DIST_ALLOW, false) && !getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, false);
}
public boolean isPublicRobinson() {
// robinson peers may be member of robinson clusters, which can be public or private
// this does not check the robinson attribute, only the specific subtype of the cluster
- final String clustermode = getConfig(plasmaSwitchboardConstants.CLUSTER_MODE, plasmaSwitchboardConstants.CLUSTER_MODE_PUBLIC_PEER);
- return (clustermode.equals(plasmaSwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER)) || (clustermode.equals(plasmaSwitchboardConstants.CLUSTER_MODE_PUBLIC_PEER));
+ final String clustermode = getConfig(SwitchboardConstants.CLUSTER_MODE, SwitchboardConstants.CLUSTER_MODE_PUBLIC_PEER);
+ return (clustermode.equals(SwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER)) || (clustermode.equals(SwitchboardConstants.CLUSTER_MODE_PUBLIC_PEER));
}
public boolean isInMyCluster(final String peer) {
@@ -981,12 +978,12 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// if this robinson mode does not define a cluster membership, false is returned
if (peer == null) return false;
if (!isRobinsonMode()) return false;
- final String clustermode = getConfig(plasmaSwitchboardConstants.CLUSTER_MODE, plasmaSwitchboardConstants.CLUSTER_MODE_PUBLIC_PEER);
- if (clustermode.equals(plasmaSwitchboardConstants.CLUSTER_MODE_PRIVATE_CLUSTER)) {
+ final String clustermode = getConfig(SwitchboardConstants.CLUSTER_MODE, SwitchboardConstants.CLUSTER_MODE_PUBLIC_PEER);
+ if (clustermode.equals(SwitchboardConstants.CLUSTER_MODE_PRIVATE_CLUSTER)) {
// check if we got the request from a peer in the private cluster
- final String network = getConfig(plasmaSwitchboardConstants.CLUSTER_PEERS_IPPORT, "");
+ final String network = getConfig(SwitchboardConstants.CLUSTER_PEERS_IPPORT, "");
return network.indexOf(peer) >= 0;
- } else if (clustermode.equals(plasmaSwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER)) {
+ } else if (clustermode.equals(SwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER)) {
// check if we got the request from a peer in the public cluster
return this.clusterhashes.containsKey(peer.getBytes());
} else {
@@ -999,12 +996,12 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// if this robinson mode does not define a cluster membership, false is returned
if (seed == null) return false;
if (!isRobinsonMode()) return false;
- final String clustermode = getConfig(plasmaSwitchboardConstants.CLUSTER_MODE, plasmaSwitchboardConstants.CLUSTER_MODE_PUBLIC_PEER);
- if (clustermode.equals(plasmaSwitchboardConstants.CLUSTER_MODE_PRIVATE_CLUSTER)) {
+ final String clustermode = getConfig(SwitchboardConstants.CLUSTER_MODE, SwitchboardConstants.CLUSTER_MODE_PUBLIC_PEER);
+ if (clustermode.equals(SwitchboardConstants.CLUSTER_MODE_PRIVATE_CLUSTER)) {
// check if we got the request from a peer in the private cluster
- final String network = getConfig(plasmaSwitchboardConstants.CLUSTER_PEERS_IPPORT, "");
+ final String network = getConfig(SwitchboardConstants.CLUSTER_PEERS_IPPORT, "");
return network.indexOf(seed.getPublicAddress()) >= 0;
- } else if (clustermode.equals(plasmaSwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER)) {
+ } else if (clustermode.equals(SwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER)) {
// check if we got the request from a peer in the public cluster
return this.clusterhashes.containsKey(seed.hash.getBytes());
} else {
@@ -1049,9 +1046,9 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
* @return
*/
public String onlineCaution() {
- if (System.currentTimeMillis() - this.proxyLastAccess < Integer.parseInt(getConfig(plasmaSwitchboardConstants.PROXY_ONLINE_CAUTION_DELAY, "30000"))) return "proxy";
- if (System.currentTimeMillis() - this.localSearchLastAccess < Integer.parseInt(getConfig(plasmaSwitchboardConstants.LOCALSEACH_ONLINE_CAUTION_DELAY, "30000"))) return "localsearch";
- if (System.currentTimeMillis() - this.remoteSearchLastAccess < Integer.parseInt(getConfig(plasmaSwitchboardConstants.REMOTESEARCH_ONLINE_CAUTION_DELAY, "30000"))) return"remotesearch";
+ if (System.currentTimeMillis() - this.proxyLastAccess < Integer.parseInt(getConfig(SwitchboardConstants.PROXY_ONLINE_CAUTION_DELAY, "30000"))) return "proxy";
+ if (System.currentTimeMillis() - this.localSearchLastAccess < Integer.parseInt(getConfig(SwitchboardConstants.LOCALSEACH_ONLINE_CAUTION_DELAY, "30000"))) return "localsearch";
+ if (System.currentTimeMillis() - this.remoteSearchLastAccess < Integer.parseInt(getConfig(SwitchboardConstants.REMOTESEARCH_ONLINE_CAUTION_DELAY, "30000"))) return"remotesearch";
return null;
}
@@ -1148,7 +1145,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
if (entry.getContent() != null) {
final String error = (entry.initiator() == null) ? entry.shallStoreCacheForProxy() : null;
if (error == null) {
- plasmaHTCache.storeFile(entry.url(), entry.getContent());
+ Cache.storeFile(entry.url(), entry.getContent());
if (this.log.isFine()) this.log.logFine("WROTE FILE (" + entry.getContent().length + " bytes) for " + entry.url());
} else {
if (this.log.isWarning()) this.log.logWarning("WRITE OF FILE " + entry.url() + " FORBIDDEN: " + error);
@@ -1168,7 +1165,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
} else {
if (!entry.profile().storeHTCache()) {
try {
- plasmaHTCache.deleteFromCache(entry.url());
+ Cache.deleteFromCache(entry.url());
} catch (IOException e) {
e.printStackTrace();
}
@@ -1196,7 +1193,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
indexingStorageProcessor.awaitShutdown(12000);
crawlStacker.close();
this.dbImportManager.close();
- httpClient.closeAllConnections();
+ Client.closeAllConnections();
wikiDB.close();
blogDB.close();
blogCommentDB.close();
@@ -1211,7 +1208,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
log.logConfig("SWITCHBOARD SHUTDOWN STEP 3: sending termination signal to database manager (stand by...)");
indexSegment.close();
peers.close();
- plasmaHTCache.close();
+ Cache.close();
UPnP.deletePortMapping();
Tray.removeTray();
log.logConfig("SWITCHBOARD SHUTDOWN TERMINATED");
@@ -1232,7 +1229,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// check if the document should be indexed
String noIndexReason = "unspecified indexing error";
- if (queueEntry.processCase(peers.mySeed().hash) == plasmaSwitchboardConstants.PROCESSCASE_4_PROXY_LOAD) {
+ if (queueEntry.processCase(peers.mySeed().hash) == SwitchboardConstants.PROCESSCASE_4_PROXY_LOAD) {
// proxy-load
noIndexReason = queueEntry.shallIndexCacheForProxy();
} else {
@@ -1396,9 +1393,9 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
}
// set a random password if no password is configured
- if (!crawlStacker.acceptLocalURLs() && getConfigBool("adminAccountForLocalhost", false) && getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() == 0) {
+ if (!crawlStacker.acceptLocalURLs() && getConfigBool("adminAccountForLocalhost", false) && getConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, "").length() == 0) {
// make a 'random' password
- setConfig(httpd.ADMIN_ACCOUNT_B64MD5, "0000" + Digest.encodeMD5Hex(System.getProperties().toString() + System.currentTimeMillis()));
+ setConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, "0000" + Digest.encodeMD5Hex(System.getProperties().toString() + System.currentTimeMillis()));
setConfig("adminAccount", "");
}
@@ -1431,7 +1428,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
} catch (final IOException e) {};
// close unused connections
- httpClient.cleanup();
+ Client.cleanup();
// do transmission of CR-files
checkInterruption();
@@ -1581,8 +1578,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
*/
public void pauseCrawlJob(final String jobType) {
final Object[] status = this.crawlJobsStatus.get(jobType);
- synchronized(status[plasmaSwitchboardConstants.CRAWLJOB_SYNC]) {
- status[plasmaSwitchboardConstants.CRAWLJOB_STATUS] = Boolean.TRUE;
+ synchronized(status[SwitchboardConstants.CRAWLJOB_SYNC]) {
+ status[SwitchboardConstants.CRAWLJOB_STATUS] = Boolean.TRUE;
}
setConfig(jobType + "_isPaused", "true");
}
@@ -1593,10 +1590,10 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
*/
public void continueCrawlJob(final String jobType) {
final Object[] status = this.crawlJobsStatus.get(jobType);
- synchronized(status[plasmaSwitchboardConstants.CRAWLJOB_SYNC]) {
- if (((Boolean)status[plasmaSwitchboardConstants.CRAWLJOB_STATUS]).booleanValue()) {
- status[plasmaSwitchboardConstants.CRAWLJOB_STATUS] = Boolean.FALSE;
- status[plasmaSwitchboardConstants.CRAWLJOB_SYNC].notifyAll();
+ synchronized(status[SwitchboardConstants.CRAWLJOB_SYNC]) {
+ if (((Boolean)status[SwitchboardConstants.CRAWLJOB_STATUS]).booleanValue()) {
+ status[SwitchboardConstants.CRAWLJOB_STATUS] = Boolean.FALSE;
+ status[SwitchboardConstants.CRAWLJOB_SYNC].notifyAll();
}
}
setConfig(jobType + "_isPaused", "false");
@@ -1608,8 +1605,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
*/
public boolean crawlJobIsPaused(final String jobType) {
final Object[] status = this.crawlJobsStatus.get(jobType);
- synchronized(status[plasmaSwitchboardConstants.CRAWLJOB_SYNC]) {
- return ((Boolean)status[plasmaSwitchboardConstants.CRAWLJOB_STATUS]).booleanValue();
+ synchronized(status[SwitchboardConstants.CRAWLJOB_SYNC]) {
+ return ((Boolean)status[SwitchboardConstants.CRAWLJOB_STATUS]).booleanValue();
}
}
@@ -1651,7 +1648,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
try {
// parse the document
- document = Parser.parseSource(entry.url(), entry.getMimeType(), entry.getCharacterEncoding(), plasmaHTCache.getResourceContent(entry.url()));
+ document = Parser.parseSource(entry.url(), entry.getMimeType(), entry.getCharacterEncoding(), Cache.getResourceContent(entry.url()));
assert(document != null) : "Unexpected error. Parser returned null.";
} catch (final ParserException e) {
this.log.logWarning("Unable to parse the resource '" + entry.url() + "'. " + e.getMessage());
@@ -1671,7 +1668,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// put anchors on crawl stack
final long stackStartTime = System.currentTimeMillis();
if (
- ((processCase == plasmaSwitchboardConstants.PROCESSCASE_4_PROXY_LOAD) || (processCase == plasmaSwitchboardConstants.PROCESSCASE_5_LOCAL_CRAWLING)) &&
+ ((processCase == SwitchboardConstants.PROCESSCASE_4_PROXY_LOAD) || (processCase == SwitchboardConstants.PROCESSCASE_5_LOCAL_CRAWLING)) &&
((entry.profile() == null) || (entry.depth() < entry.profile().depth()))
) {
final Map<yacyURL, String> hl = document.getHyperlinks();
@@ -1800,7 +1797,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
serverProfiling.update("indexed", queueEntry.url().toNormalform(true, false), false);
// if this was performed for a remote crawl request, notify requester
- if ((processCase == plasmaSwitchboardConstants.PROCESSCASE_6_GLOBAL_CRAWLING) && (queueEntry.initiator() != null)) {
+ if ((processCase == SwitchboardConstants.PROCESSCASE_6_GLOBAL_CRAWLING) && (queueEntry.initiator() != null)) {
final yacySeed initiatorPeer = peers.get(queueEntry.initiator());
if (initiatorPeer != null) {
log.logInfo("Sending crawl receipt for '" + queueEntry.url().toNormalform(false, true) + "' to " + initiatorPeer.getName());
@@ -1910,32 +1907,32 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
}
}
- public int adminAuthenticated(final httpRequestHeader requestHeader) {
+ public int adminAuthenticated(final RequestHeader requestHeader) {
// authorization for localhost, only if flag is set to grant localhost access as admin
- final String clientIP = requestHeader.get(httpHeader.CONNECTION_PROP_CLIENTIP, "");
+ final String clientIP = requestHeader.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "");
final String refererHost = requestHeader.refererHost();
final boolean accessFromLocalhost = serverCore.isLocalhost(clientIP) && (refererHost.length() == 0 || serverCore.isLocalhost(refererHost));
if (getConfigBool("adminAccountForLocalhost", false) && accessFromLocalhost) return 3; // soft-authenticated for localhost
// get the authorization string from the header
- final String authorization = (requestHeader.get(httpRequestHeader.AUTHORIZATION, "xxxxxx")).trim().substring(6);
+ final String authorization = (requestHeader.get(RequestHeader.AUTHORIZATION, "xxxxxx")).trim().substring(6);
// security check against too long authorization strings
if (authorization.length() > 256) return 0;
// authorization by encoded password, only for localhost access
- final String adminAccountBase64MD5 = getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "");
+ final String adminAccountBase64MD5 = getConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, "");
if (accessFromLocalhost && (adminAccountBase64MD5.equals(authorization))) return 3; // soft-authenticated for localhost
// authorization by hit in userDB
- if (userDB.hasAdminRight(requestHeader.get(httpRequestHeader.AUTHORIZATION, "xxxxxx"), requestHeader.getHeaderCookies())) return 4; //return, because 4=max
+ if (userDB.hasAdminRight(requestHeader.get(RequestHeader.AUTHORIZATION, "xxxxxx"), requestHeader.getHeaderCookies())) return 4; //return, because 4=max
// authorization with admin keyword in configuration
- return httpd.staticAdminAuthenticated(authorization, this);
+ return HTTPDemon.staticAdminAuthenticated(authorization, this);
}
- public boolean verifyAuthentication(final httpRequestHeader header, final boolean strict) {
+ public boolean verifyAuthentication(final RequestHeader header, final boolean strict) {
// handle access rights
switch (adminAuthenticated(header)) {
case 0: // wrong password given
@@ -1964,15 +1961,15 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
serverBusyThread thread;
- thread = getThread(plasmaSwitchboardConstants.INDEX_DIST);
+ thread = getThread(SwitchboardConstants.INDEX_DIST);
if (thread != null) {
- setConfig(plasmaSwitchboardConstants.INDEX_DIST_BUSYSLEEP , thread.setBusySleep(Math.max(2000, thread.setBusySleep(newBusySleep * 2))));
+ setConfig(SwitchboardConstants.INDEX_DIST_BUSYSLEEP , thread.setBusySleep(Math.max(2000, thread.setBusySleep(newBusySleep * 2))));
thread.setIdleSleep(30000);
}
- thread = getThread(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
+ thread = getThread(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL);
if (thread != null) {
- setConfig(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL_BUSYSLEEP , thread.setBusySleep(newBusySleep));
+ setConfig(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL_BUSYSLEEP , thread.setBusySleep(newBusySleep));
thread.setIdleSleep(2000);
}
}
@@ -2005,7 +2002,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
if (!this.getConfigBool("network.unit.dht", true)) {
return "no DHT distribution: disabled by network.unit.dht";
}
- if (getConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW, "false").equalsIgnoreCase("false")) {
+ if (getConfig(SwitchboardConstants.INDEX_DIST_ALLOW, "false").equalsIgnoreCase("false")) {
return "no DHT distribution: not enabled (ser setting)";
}
if (indexSegment.urlMetadata().size() < 10) {
@@ -2014,10 +2011,10 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
if (indexSegment.termIndex().sizesMax() < 100) {
return "no DHT distribution: not enough words - wordIndex.size() = " + indexSegment.termIndex().sizesMax();
}
- if ((getConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW_WHILE_CRAWLING, "false").equalsIgnoreCase("false")) && (crawlQueues.noticeURL.notEmptyLocal())) {
+ if ((getConfig(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_CRAWLING, "false").equalsIgnoreCase("false")) && (crawlQueues.noticeURL.notEmptyLocal())) {
return "no DHT distribution: crawl in progress: noticeURL.stackSize() = " + crawlQueues.noticeURL.size() + ", sbQueue.size() = " + getActiveQueueSize();
}
- if ((getConfig(plasmaSwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, "false").equalsIgnoreCase("false")) && (getActiveQueueSize() > 1)) {
+ if ((getConfig(SwitchboardConstants.INDEX_DIST_ALLOW_WHILE_INDEXING, "false").equalsIgnoreCase("false")) && (getActiveQueueSize() > 1)) {
return "no DHT distribution: indexing in progress: noticeURL.stackSize() = " + crawlQueues.noticeURL.size() + ", sbQueue.size() = " + getActiveQueueSize();
}
return null; // this means; yes, please do dht transfer
@@ -2127,7 +2124,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
peers.mySeed().put(yacySeed.ICOUNT, Integer.toString(indexSegment.termIndex().sizesMax())); // the minimum number of words that the peer has indexed (as it says)
peers.mySeed().put(yacySeed.SCOUNT, Integer.toString(peers.sizeConnected())); // the number of seeds that the peer has stored
peers.mySeed().put(yacySeed.CCOUNT, Double.toString(((int) ((peers.sizeConnected() + peers.sizeDisconnected() + peers.sizePotential()) * 60.0 / (uptime + 1.01)) * 100) / 100.0)); // the number of clients that the peer connects (as connects/hour)
- peers.mySeed().put(yacySeed.VERSION, yacyBuildProperties.getLongVersion());
+ peers.mySeed().put(yacySeed.VERSION, getConfig("version", ""));
peers.mySeed().setFlagDirectConnect(true);
peers.mySeed().setLastSeenUTC();
peers.mySeed().put(yacySeed.UTC, DateFormatter.UTCDiffString());
@@ -2146,7 +2143,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
Iterator<String> enu;
int lc;
final int sc = peers.sizeConnected();
- httpResponseHeader header;
+ ResponseHeader header;
yacyCore.log.logInfo("BOOTSTRAP: " + sc + " seeds known from previous run");
@@ -2163,14 +2160,14 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
) {
// load the seed list
try {
- final httpRequestHeader reqHeader = new httpRequestHeader();
- reqHeader.put(httpHeader.PRAGMA, "no-cache");
- reqHeader.put(httpHeader.CACHE_CONTROL, "no-cache");
- reqHeader.put(httpHeader.USER_AGENT, HTTPLoader.yacyUserAgent);
+ final RequestHeader reqHeader = new RequestHeader();
+ reqHeader.put(HeaderFramework.PRAGMA, "no-cache");
+ reqHeader.put(HeaderFramework.CACHE_CONTROL, "no-cache");
+ reqHeader.put(HeaderFramework.USER_AGENT, HTTPLoader.yacyUserAgent);
url = new yacyURL(seedListFileURL, null);
final long start = System.currentTimeMillis();
- header = httpClient.whead(url.toString(), reqHeader);
+ header = Client.whead(url.toString(), reqHeader);
final long loadtime = System.currentTimeMillis() - start;
if (header == null) {
if (loadtime > getConfigLong("bootstrapLoadTimeout", 6000)) {
@@ -2184,7 +2181,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
yacyCore.log.logInfo("BOOTSTRAP: seed-list URL " + seedListFileURL + " too old (" + (header.age() / 86400000) + " days)");
} else {
ssc++;
- final byte[] content = httpClient.wget(url.toString(), reqHeader, (int) getConfigLong("bootstrapLoadTimeout", 20000));
+ final byte[] content = Client.wget(url.toString(), reqHeader, (int) getConfigLong("bootstrapLoadTimeout", 20000));
seedList = FileUtils.strings(content, "UTF-8");
enu = seedList.iterator();
lc = 0;
@@ -2249,9 +2246,9 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
public static Map<String, String> loadHashMap(final yacyURL url) {
try {
// sending request
- final httpRequestHeader reqHeader = new httpRequestHeader();
- reqHeader.put(httpHeader.USER_AGENT, HTTPLoader.yacyUserAgent);
- final HashMap<String, String> result = FileUtils.table(httpClient.wget(url.toString(), reqHeader, 10000), "UTF-8");
+ final RequestHeader reqHeader = new RequestHeader();
+ reqHeader.put(HeaderFramework.USER_AGENT, HTTPLoader.yacyUserAgent);
+ final HashMap<String, String> result = FileUtils.table(Client.wget(url.toString(), reqHeader, 10000), "UTF-8");
if (result == null) return new HashMap<String, String>();
return result;
} catch (final Exception e) {
@@ -2261,9 +2258,9 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
}
class delayedShutdown extends Thread {
- private final plasmaSwitchboard sb;
+ private final Switchboard sb;
private final long delay;
- public delayedShutdown(final plasmaSwitchboard sb, final long delay) {
+ public delayedShutdown(final Switchboard sb, final long delay) {
this.sb = sb;
this.delay = delay;
}
diff --git a/source/de/anomic/plasma/plasmaSwitchboardConstants.java b/source/de/anomic/search/SwitchboardConstants.java
similarity index 96%
rename from source/de/anomic/plasma/plasmaSwitchboardConstants.java
rename to source/de/anomic/search/SwitchboardConstants.java
index a42618c63..f10df8070 100644
--- a/source/de/anomic/plasma/plasmaSwitchboardConstants.java
+++ b/source/de/anomic/search/SwitchboardConstants.java
@@ -24,15 +24,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.plasma;
+package de.anomic.search;
-import de.anomic.http.httpdRobotsTxtConfig;
+import de.anomic.http.server.RobotsTxtConfig;
/**
* @author danielr
*
*/
-public final class plasmaSwitchboardConstants {
+public final class SwitchboardConstants {
public static final int CRAWLJOB_SYNC = 0;
public static final int CRAWLJOB_STATUS = 1;
@@ -78,7 +78,7 @@ public final class plasmaSwitchboardConstants {
* <p>Name of the local crawler thread, popping one entry off the Local Crawl Queue, and passing it to the
* proxy cache enqueue thread to download and further process it</p>
*
- * @see plasmaSwitchboard#PROXY_CACHE_ENQUEUE
+ * @see Switchboard#PROXY_CACHE_ENQUEUE
*/
public static final String CRAWLJOB_LOCAL_CRAWL = "50_localcrawl";
public static final String CRAWLJOB_LOCAL_CRAWL_METHOD_START = "coreCrawlJob";
@@ -91,7 +91,7 @@ public final class plasmaSwitchboardConstants {
* <p><code>public static final String <strong>CRAWLJOB_REMOTE_CRAWL_LOADER</strong> = "60_remotecrawlloader"</code></p>
* <p>Name of the remote crawl list loading thread</p>
*
- * @see plasmaSwitchboard#CRAWLJOB_REMOTE_CRAWL_LOADER
+ * @see Switchboard#CRAWLJOB_REMOTE_CRAWL_LOADER
*/
public static final String CRAWLJOB_REMOTE_CRAWL_LOADER = "60_remotecrawlloader";
public static final String CRAWLJOB_REMOTE_CRAWL_LOADER_METHOD_START = "remoteCrawlLoaderJob";
@@ -218,7 +218,7 @@ public final class plasmaSwitchboardConstants {
* <p><code>public static final String <strong>INDEX_DIST_ALLOW</strong> = "allowDistributeIndex"</code></p>
* <p>Name of the setting whether Index Distribution shall be allowed (and the DHT-thread therefore started) or not</p>
*
- * @see plasmaSwitchboard#INDEX_DIST_ALLOW_WHILE_CRAWLING
+ * @see Switchboard#INDEX_DIST_ALLOW_WHILE_CRAWLING
*/
public static final String INDEX_DIST_ALLOW = "allowDistributeIndex";
public static final String INDEX_RECEIVE_ALLOW = "allowReceiveIndex";
@@ -228,7 +228,7 @@ public final class plasmaSwitchboardConstants {
* the Local Crawler Queue is filled.</p>
* <p>This setting only has effect if {@link #INDEX_DIST_ALLOW} is enabled</p>
*
- * @see plasmaSwitchboard#INDEX_DIST_ALLOW
+ * @see Switchboard#INDEX_DIST_ALLOW
*/
public static final String INDEX_DIST_ALLOW_WHILE_CRAWLING = "allowDistributeIndexWhileCrawling";
public static final String INDEX_DIST_ALLOW_WHILE_INDEXING = "allowDistributeIndexWhileIndexing";
@@ -266,8 +266,8 @@ public final class plasmaSwitchboardConstants {
* <p>Name of the setting which file-/folder-layout the proxy cache shall use. Possible values are {@link #PROXY_CACHE_LAYOUT_TREE}
* and {@link #PROXY_CACHE_LAYOUT_HASH}</p>
*
- * @see plasmaSwitchboard#PROXY_CACHE_LAYOUT_TREE
- * @see plasmaSwitchboard#PROXY_CACHE_LAYOUT_HASH
+ * @see Switchboard#PROXY_CACHE_LAYOUT_TREE
+ * @see Switchboard#PROXY_CACHE_LAYOUT_HASH
*/
public static final String PROXY_YACY_ONLY = "proxyYacyOnly";
@@ -294,7 +294,7 @@ public final class plasmaSwitchboardConstants {
public static final String WORDCACHE_MAX_COUNT = "wordCacheMaxCount";
public static final String HTTPC_NAME_CACHE_CACHING_PATTERNS_NO = "httpc.nameCacheNoCachingPatterns";
public static final String ROBOTS_TXT = "httpd.robots.txt";
- public static final String ROBOTS_TXT_DEFAULT = httpdRobotsTxtConfig.LOCKED + "," + httpdRobotsTxtConfig.DIRS;
+ public static final String ROBOTS_TXT_DEFAULT = RobotsTxtConfig.LOCKED + "," + RobotsTxtConfig.DIRS;
/**
* <p><code>public static final String <strong>BLACKLIST_CLASS</strong> = "Blacklist.class"</code></p>
* <p>Name of the setting which Blacklist backend shall be used. Due to different requirements of users, the
@@ -320,7 +320,7 @@ public final class plasmaSwitchboardConstants {
* downloaded webpages and their respective ressources and HTTP-headers are stored. It is the location containing
* the proxy-cache</p>
*
- * @see plasmaSwitchboard#PROXY_CACHE_LAYOUT for details on the file-layout in this path
+ * @see Switchboard#PROXY_CACHE_LAYOUT for details on the file-layout in this path
*/
public static final String HTCACHE_PATH = "proxyCache";
public static final String HTCACHE_PATH_DEFAULT = "DATA/HTCACHE";
@@ -367,8 +367,8 @@ public final class plasmaSwitchboardConstants {
* <p>Name of the setting specifying the folder beginning from the YaCy-installation's top-folder, where all
* ranking files are stored, self-generated as well as received ranking files</p>
*
- * @see plasmaSwitchboard#RANKING_DIST_0_PATH
- * @see plasmaSwitchboard#RANKING_DIST_1_PATH
+ * @see Switchboard#RANKING_DIST_0_PATH
+ * @see Switchboard#RANKING_DIST_1_PATH
*/
public static final String RANKING_PATH = "rankingPath";
public static final String RANKING_PATH_DEFAULT = "DATA/RANKING";
@@ -377,13 +377,13 @@ public final class plasmaSwitchboardConstants {
* <p>Name of the setting specifying the folder beginning from the YaCy-installation's top-folder, where all
* DBs containing "work" of the user are saved. Such include bookmarks, messages, wiki, blog</p>
*
- * @see plasmaSwitchboard#DBFILE_BLOG
- * @see plasmaSwitchboard#DBFILE_BOOKMARKS
- * @see plasmaSwitchboard#DBFILE_BOOKMARKS_DATES
- * @see plasmaSwitchboard#DBFILE_BOOKMARKS_TAGS
- * @see plasmaSwitchboard#DBFILE_MESSAGE
- * @see plasmaSwitchboard#DBFILE_WIKI
- * @see plasmaSwitchboard#DBFILE_WIKI_BKP
+ * @see Switchboard#DBFILE_BLOG
+ * @see Switchboard#DBFILE_BOOKMARKS
+ * @see Switchboard#DBFILE_BOOKMARKS_DATES
+ * @see Switchboard#DBFILE_BOOKMARKS_TAGS
+ * @see Switchboard#DBFILE_MESSAGE
+ * @see Switchboard#DBFILE_WIKI
+ * @see Switchboard#DBFILE_WIKI_BKP
*/
public static final String WORK_PATH = "workPath";
public static final String WORK_PATH_DEFAULT = "DATA/WORK";
diff --git a/source/de/anomic/plasma/plasmaRankingDistribution.java b/source/de/anomic/search/blockrank/CRDistribution.java
similarity index 94%
rename from source/de/anomic/plasma/plasmaRankingDistribution.java
rename to source/de/anomic/search/blockrank/CRDistribution.java
index b96cb6d3e..d4dc09385 100644
--- a/source/de/anomic/plasma/plasmaRankingDistribution.java
+++ b/source/de/anomic/search/blockrank/CRDistribution.java
@@ -23,7 +23,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.plasma;
+package de.anomic.search.blockrank;
import java.io.File;
import java.io.IOException;
@@ -37,7 +37,7 @@ import de.anomic.yacy.yacySeedDB;
import de.anomic.yacy.yacyVersion;
import de.anomic.yacy.logging.Log;
-public final class plasmaRankingDistribution {
+public final class CRDistribution {
public static final String CR_OWN = "GLOBAL/010_owncr";
public static final String CR_OTHER = "GLOBAL/014_othercr/";
@@ -57,7 +57,7 @@ public final class plasmaRankingDistribution {
private final yacySeedDB seedDB;
private static Random random = new Random(System.currentTimeMillis());
- public plasmaRankingDistribution(final Log log, final yacySeedDB seedDB, final File sourcePath, final int method, final int percentage, final String addresses) {
+ public CRDistribution(final Log log, final yacySeedDB seedDB, final File sourcePath, final int method, final int percentage, final String addresses) {
this.log = log;
this.seedDB = seedDB;
this.sourcePath = sourcePath;
diff --git a/source/de/anomic/plasma/plasmaRankingCRProcess.java b/source/de/anomic/search/blockrank/CRProcess.java
similarity index 97%
rename from source/de/anomic/plasma/plasmaRankingCRProcess.java
rename to source/de/anomic/search/blockrank/CRProcess.java
index d2e17389d..cd32140f0 100644
--- a/source/de/anomic/plasma/plasmaRankingCRProcess.java
+++ b/source/de/anomic/search/blockrank/CRProcess.java
@@ -24,7 +24,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.plasma;
+package de.anomic.search.blockrank;
import java.io.File;
import java.io.IOException;
@@ -47,7 +47,7 @@ import de.anomic.kelondro.util.MemoryControl;
import de.anomic.kelondro.util.AttrSeq;
import de.anomic.kelondro.util.FileUtils;
-public class plasmaRankingCRProcess {
+public class CRProcess {
/*
header.append("# Name=YaCy " + ((type.equals("crl")) ? "Local" : "Global") + " Citation Reference Ticket"); header.append((char) 13); header.append((char) 10);
diff --git a/source/de/anomic/plasma/plasmaRankingRCIEvaluation.java b/source/de/anomic/search/blockrank/RCIEvaluation.java
similarity index 99%
rename from source/de/anomic/plasma/plasmaRankingRCIEvaluation.java
rename to source/de/anomic/search/blockrank/RCIEvaluation.java
index 4595b47b1..688f7e3e9 100644
--- a/source/de/anomic/plasma/plasmaRankingRCIEvaluation.java
+++ b/source/de/anomic/search/blockrank/RCIEvaluation.java
@@ -24,7 +24,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.plasma;
+package de.anomic.search.blockrank;
import java.io.File;
import java.io.IOException;
@@ -41,7 +41,7 @@ import de.anomic.kelondro.util.FileUtils;
import de.anomic.search.RankingProcess;
import de.anomic.yacy.yacyURL;
-public class plasmaRankingRCIEvaluation {
+public class RCIEvaluation {
public static int[] rcieval(final AttrSeq rci) {
// collect information about which entry has how many references
diff --git a/source/de/anomic/server/serverDomains.java b/source/de/anomic/server/serverDomains.java
index 20b04f162..3b036b668 100644
--- a/source/de/anomic/server/serverDomains.java
+++ b/source/de/anomic/server/serverDomains.java
@@ -38,7 +38,7 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
public class serverDomains {
@@ -580,7 +580,7 @@ public class serverDomains {
public static String myPublicIP() {
// if a static IP was configured, we have to return it here ...
- final plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
+ final Switchboard sb = Switchboard.getSwitchboard();
if (sb != null) {
final String staticIP = sb.getConfig("staticIP", "");
if ((!staticIP.equals(""))) {
diff --git a/source/de/anomic/server/serverObjects.java b/source/de/anomic/server/serverObjects.java
index 02048b859..74d662abb 100644
--- a/source/de/anomic/server/serverObjects.java
+++ b/source/de/anomic/server/serverObjects.java
@@ -54,7 +54,7 @@ import java.util.Map;
import de.anomic.document.parser.html.CharacterCoding;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.tools.Formatter;
public class serverObjects extends HashMap<String, String> implements Cloneable {
@@ -221,11 +221,11 @@ public class serverObjects extends HashMap<String, String> implements Cloneable
public String putWiki(final String key, final String wikiCode){
- return this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode));
+ return this.put(key, Switchboard.wikiParser.transform(wikiCode));
}
public String putWiki(final String key, final byte[] wikiCode) {
try {
- return this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode));
+ return this.put(key, Switchboard.wikiParser.transform(wikiCode));
} catch (final UnsupportedEncodingException e) {
return this.put(key, "Internal error pasting wiki-code: " + e.getMessage());
}
diff --git a/source/de/anomic/server/servletProperties.java b/source/de/anomic/server/servletProperties.java
index 3fdbb8d01..674b113c6 100644
--- a/source/de/anomic/server/servletProperties.java
+++ b/source/de/anomic/server/servletProperties.java
@@ -21,7 +21,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US
package de.anomic.server;
-import de.anomic.http.httpResponseHeader;
+import de.anomic.http.metadata.ResponseHeader;
public class servletProperties extends serverObjects {
@@ -38,7 +38,7 @@ public class servletProperties extends serverObjects {
private String prefix="";
- private httpResponseHeader outgoingHeader;
+ private ResponseHeader outgoingHeader;
public servletProperties(){
super();
@@ -48,13 +48,13 @@ public class servletProperties extends serverObjects {
super(so);
}
- public void setOutgoingHeader(final httpResponseHeader outgoingHeader) {
+ public void setOutgoingHeader(final ResponseHeader outgoingHeader) {
this.outgoingHeader = outgoingHeader;
}
- public httpResponseHeader getOutgoingHeader() {
+ public ResponseHeader getOutgoingHeader() {
if(outgoingHeader == null)
- return new httpResponseHeader();
+ return new ResponseHeader();
return outgoingHeader;
}
diff --git a/source/de/anomic/tools/gzip.java b/source/de/anomic/tools/gzip.java
index 4238d003a..f4bdbc0ce 100644
--- a/source/de/anomic/tools/gzip.java
+++ b/source/de/anomic/tools/gzip.java
@@ -25,6 +25,7 @@ import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
@@ -107,6 +108,50 @@ public class gzip {
bOut.close();
}
+
+ // some static helper methods
+ public static void saveGzip(final File f, final byte[] content) throws IOException {
+ java.util.zip.GZIPOutputStream gzipout = null;
+ try {
+ f.getParentFile().mkdirs();
+ gzipout = new java.util.zip.GZIPOutputStream(new FileOutputStream(f));
+ gzipout.write(content, 0, content.length);
+ } finally {
+ if (gzipout!=null)try{gzipout.close();}catch(final Exception e){}
+ }
+ }
+
+ public static byte[] loadGzip(final File f) throws IOException {
+ java.util.zip.GZIPInputStream gzipin = null;
+ try {
+ gzipin = new java.util.zip.GZIPInputStream(new FileInputStream(f));
+ byte[] result = new byte[1024];
+ final byte[] buffer = new byte[512];
+ byte[] b;
+ int len = 0;
+ int last;
+ while ((last = gzipin.read(buffer, 0, buffer.length)) > 0) {
+ // assert the buffer to the result
+ while (result.length - len < last) {
+ // the result array is too small, increase space
+ b = new byte[result.length * 2];
+ System.arraycopy(result, 0, b, 0, len);
+ result = b; b = null;
+ }
+ // copy the last read
+ System.arraycopy(buffer, 0, result, len, last);
+ len += last;
+ }
+ gzipin.close();
+ // finished with reading. now cut the result to the right size
+ b = new byte[len];
+ System.arraycopy(result, 0, b, 0, len);
+ return b;
+ } finally {
+ if (gzipin != null) try{gzipin.close();}catch(final Exception e){}
+ }
+ }
+
private static void help() {
System.out.println("AnomicGzip (2004) by Michael Christen");
System.out.println("usage: gzip [-u] <file> [<target-file>]");
diff --git a/source/de/anomic/tools/loaderThreads.java b/source/de/anomic/tools/loaderThreads.java
index 038fc58b0..b00c2a417 100644
--- a/source/de/anomic/tools/loaderThreads.java
+++ b/source/de/anomic/tools/loaderThreads.java
@@ -25,10 +25,10 @@ import java.util.ArrayList;
import java.util.Hashtable;
import de.anomic.crawler.retrieval.HTTPLoader;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpRemoteProxyConfig;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.client.Client;
+import de.anomic.http.client.RemoteProxyConfig;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
import de.anomic.kelondro.util.FileUtils;
import de.anomic.yacy.yacyURL;
@@ -38,7 +38,7 @@ public class loaderThreads {
protected int timeout;
protected String user;
protected String password;
- protected httpRemoteProxyConfig remoteProxyConfig;
+ protected RemoteProxyConfig remoteProxyConfig;
// management objects for collection of threads
Hashtable<String, Thread> threads;
@@ -124,9 +124,9 @@ public class loaderThreads {
public void run() {
try {
- final httpRequestHeader reqHeader = new httpRequestHeader();
- reqHeader.put(httpHeader.USER_AGENT, HTTPLoader.crawlerUserAgent);
- page = httpClient.wget(url.toString(), reqHeader, timeout);
+ final RequestHeader reqHeader = new RequestHeader();
+ reqHeader.put(HeaderFramework.USER_AGENT, HTTPLoader.crawlerUserAgent);
+ page = Client.wget(url.toString(), reqHeader, timeout);
loaded = true;
process.feed(page);
if (process.status() == loaderCore.STATUS_FAILED) {
diff --git a/source/de/anomic/yacy/Tray.java b/source/de/anomic/yacy/Tray.java
index 43dbc6b67..38b5d45a8 100644
--- a/source/de/anomic/yacy/Tray.java
+++ b/source/de/anomic/yacy/Tray.java
@@ -37,13 +37,13 @@ import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverSystem;
public final class Tray {
- protected static plasmaSwitchboard sb;
+ protected static Switchboard sb;
private static nativeTrayIcon ti;
private static boolean isIntegrated; // browser integration
@@ -55,13 +55,13 @@ public final class Tray {
public static boolean lockBrowserPopup = true;
- public static void init(final plasmaSwitchboard par_sb) {
+ public static void init(final Switchboard par_sb) {
sb = par_sb;
- isIntegrated = sb.getConfigBool(plasmaSwitchboardConstants.BROWSERINTEGRATION, false);
- trayLabel = sb.getConfig(plasmaSwitchboardConstants.TRAY_LABEL, "YaCy");
+ isIntegrated = sb.getConfigBool(SwitchboardConstants.BROWSERINTEGRATION, false);
+ trayLabel = sb.getConfig(SwitchboardConstants.TRAY_LABEL, "YaCy");
try {
- final boolean trayIcon = sb.getConfigBool(plasmaSwitchboardConstants.TRAY_ICON_ENABLED, false);
- if (trayIcon && (serverSystem.isWindows || sb.getConfigBool(plasmaSwitchboardConstants.TRAY_ICON_FORCED, false))) {
+ final boolean trayIcon = sb.getConfigBool(SwitchboardConstants.TRAY_ICON_ENABLED, false);
+ if (trayIcon && (serverSystem.isWindows || sb.getConfigBool(SwitchboardConstants.TRAY_ICON_FORCED, false))) {
System.setProperty("java.awt.headless", "false");
if(nativeTrayIcon.isSupported()) {
diff --git a/source/de/anomic/yacy/yacyAccessible.java b/source/de/anomic/yacy/yacyAccessible.java
index 45707e466..60770810e 100644
--- a/source/de/anomic/yacy/yacyAccessible.java
+++ b/source/de/anomic/yacy/yacyAccessible.java
@@ -31,7 +31,7 @@ package de.anomic.yacy;
import java.io.File;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
public class yacyAccessible {
public long lastUpdated;
@@ -43,7 +43,7 @@ public class yacyAccessible {
*/
public static void setNewPortLink(final int newPort){
try {
- final plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
+ final Switchboard sb = Switchboard.getSwitchboard();
final File shortcut = new File(sb.getRootPath() + "/addon/YaCy-Search.html".replace("/", File.separator));
final String content = "<meta http-equiv=\"refresh\" content=\"0;url=http://localhost:" + newPort + "/\">";
FileUtils.copy(content.getBytes(), shortcut);
@@ -58,7 +58,7 @@ public class yacyAccessible {
*/
public static void setNewPortBat(final int newPort){
try {
- final plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
+ final Switchboard sb = Switchboard.getSwitchboard();
final File shortcut = new File(sb.getRootPath() + "/addon/YaCy-Search.bat".replace("/", File.separator));
final String content = "rundll32 url.dll,FileProtocolHandler \"http://localhost:" + newPort + "\"";
FileUtils.copy(content.getBytes(), shortcut);
diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.java
index 4fddbfdda..5675f157e 100644
--- a/source/de/anomic/yacy/yacyClient.java
+++ b/source/de/anomic/yacy/yacyClient.java
@@ -64,13 +64,13 @@ import de.anomic.data.Blacklist;
import de.anomic.document.Word;
import de.anomic.document.parser.xml.RSSFeed;
import de.anomic.document.parser.xml.RSSReader;
-import de.anomic.http.DefaultCharsetFilePart;
-import de.anomic.http.DefaultCharsetStringPart;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpResponse;
-import de.anomic.http.httpRemoteProxyConfig;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.client.DefaultCharsetFilePart;
+import de.anomic.http.client.DefaultCharsetStringPart;
+import de.anomic.http.client.Client;
+import de.anomic.http.client.RemoteProxyConfig;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.metadata.ResponseContainer;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.order.Bitfield;
import de.anomic.kelondro.order.Digest;
@@ -82,11 +82,11 @@ import de.anomic.kelondro.text.metadataPrototype.URLMetadataRow;
import de.anomic.kelondro.text.referencePrototype.WordReference;
import de.anomic.kelondro.util.ByteBuffer;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
import de.anomic.search.RankingProfile;
import de.anomic.search.RankingProcess;
import de.anomic.search.SnippetCache;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverCore;
import de.anomic.server.serverDomains;
import de.anomic.tools.crypt;
@@ -119,7 +119,7 @@ public final class yacyClient {
HashMap<String, String> result = null;
final String salt = crypt.randomSalt();
- final List<Part> post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), null, salt);
+ final List<Part> post = yacyNetwork.basicRequestPost(Switchboard.getSwitchboard(), null, salt);
for (int retry = 0; retry < 4; retry++) try {
// generate request
post.add(new DefaultCharsetStringPart("count", "20"));
@@ -269,13 +269,13 @@ public final class yacyClient {
* @throws IOException
*/
private static byte[] wput(final String url, final String vhost, final List<Part> post, final int timeout, final boolean gzipBody) throws IOException {
- final httpRequestHeader header = new httpRequestHeader();
- header.put(httpHeader.USER_AGENT, HTTPLoader.yacyUserAgent);
- header.put(httpHeader.HOST, vhost);
- final httpClient client = new httpClient(timeout, header);
+ final RequestHeader header = new RequestHeader();
+ header.put(HeaderFramework.USER_AGENT, HTTPLoader.yacyUserAgent);
+ header.put(HeaderFramework.HOST, vhost);
+ final Client client = new Client(timeout, header);
client.setProxy(proxyConfig());
- httpResponse res = null;
+ ResponseContainer res = null;
byte[] content = null;
try {
// send request/data
@@ -308,7 +308,7 @@ public final class yacyClient {
public static yacySeed querySeed(final yacySeed target, final String seedHash) {
// prepare request
final String salt = crypt.randomSalt();
- final List<Part> post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), target.hash, salt);
+ final List<Part> post = yacyNetwork.basicRequestPost(Switchboard.getSwitchboard(), target.hash, salt);
post.add(new DefaultCharsetStringPart("object", "seed"));
post.add(new DefaultCharsetStringPart("env", seedHash));
@@ -329,7 +329,7 @@ public final class yacyClient {
public static int queryRWICount(final yacySeed target, final String wordHash) {
// prepare request
final String salt = crypt.randomSalt();
- final List<Part> post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), target.hash, salt);
+ final List<Part> post = yacyNetwork.basicRequestPost(Switchboard.getSwitchboard(), target.hash, salt);
post.add(new DefaultCharsetStringPart("object", "rwicount"));
post.add(new DefaultCharsetStringPart("ttl", "0"));
post.add(new DefaultCharsetStringPart("env", wordHash));
@@ -352,7 +352,7 @@ public final class yacyClient {
// prepare request
final String salt = crypt.randomSalt();
- final List<Part> post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), target.hash, salt);
+ final List<Part> post = yacyNetwork.basicRequestPost(Switchboard.getSwitchboard(), target.hash, salt);
post.add(new DefaultCharsetStringPart("object", "lurlcount"));
post.add(new DefaultCharsetStringPart("ttl", "0"));
post.add(new DefaultCharsetStringPart("env", ""));
@@ -384,7 +384,7 @@ public final class yacyClient {
// prepare request
final String salt = crypt.randomSalt();
- final List<Part> post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), target.hash, salt);
+ final List<Part> post = yacyNetwork.basicRequestPost(Switchboard.getSwitchboard(), target.hash, salt);
post.add(new DefaultCharsetStringPart("call", "remotecrawl"));
post.add(new DefaultCharsetStringPart("count", Integer.toString(maxCount)));
post.add(new DefaultCharsetStringPart("time", Long.toString(maxTime)));
@@ -460,7 +460,7 @@ public final class yacyClient {
// prepare request
final String salt = crypt.randomSalt();
- final List<Part> post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), target.hash, salt);
+ final List<Part> post = yacyNetwork.basicRequestPost(Switchboard.getSwitchboard(), target.hash, salt);
post.add(new DefaultCharsetStringPart("myseed", mySeed.genSeedStr(salt)));
post.add(new DefaultCharsetStringPart("count", Integer.toString(Math.max(10, count))));
post.add(new DefaultCharsetStringPart("resource", ((global) ? "global" : "local")));
@@ -553,7 +553,7 @@ public final class yacyClient {
continue; // block with backlist
}
- final String urlRejectReason = plasmaSwitchboard.getSwitchboard().crawlStacker.urlInAcceptedDomain(metadata.url());
+ final String urlRejectReason = Switchboard.getSwitchboard().crawlStacker.urlInAcceptedDomain(metadata.url());
if (urlRejectReason != null) {
yacyCore.log.logInfo("remote search (client): rejected url '" + metadata.url() + "' (" + urlRejectReason + ") from peer " + target.getName());
continue; // reject url outside of our domain
@@ -676,7 +676,7 @@ public final class yacyClient {
// prepare request
final String salt = crypt.randomSalt();
- final List<Part> post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), targetHash, salt);
+ final List<Part> post = yacyNetwork.basicRequestPost(Switchboard.getSwitchboard(), targetHash, salt);
post.add(new DefaultCharsetStringPart("process", "permission"));
// send request
@@ -696,7 +696,7 @@ public final class yacyClient {
// prepare request
final String salt = crypt.randomSalt();
- final List<Part> post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), targetHash, salt);
+ final List<Part> post = yacyNetwork.basicRequestPost(Switchboard.getSwitchboard(), targetHash, salt);
post.add(new DefaultCharsetStringPart("process", "post"));
post.add(new DefaultCharsetStringPart("myseed", seedDB.mySeed().genSeedStr(salt)));
post.add(new DefaultCharsetStringPart("subject", subject));
@@ -735,7 +735,7 @@ public final class yacyClient {
// prepare request
final String salt = crypt.randomSalt();
- final List<Part> post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), null, salt);
+ final List<Part> post = yacyNetwork.basicRequestPost(Switchboard.getSwitchboard(), null, salt);
post.add(new DefaultCharsetStringPart("process", "permission"));
post.add(new DefaultCharsetStringPart("purpose", "crcon"));
post.add(new DefaultCharsetStringPart("filename", filename));
@@ -758,7 +758,7 @@ public final class yacyClient {
// prepare request
final String salt = crypt.randomSalt();
- final List<Part> post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), null, salt);
+ final List<Part> post = yacyNetwork.basicRequestPost(Switchboard.getSwitchboard(), null, salt);
post.add(new DefaultCharsetStringPart("process", "store"));
post.add(new DefaultCharsetStringPart("purpose", "crcon"));
post.add(new DefaultCharsetStringPart("filesize", Long.toString(file.length)));
@@ -829,7 +829,7 @@ public final class yacyClient {
// prepare request
final String salt = crypt.randomSalt();
- final List<Part> post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), target.hash, salt);
+ final List<Part> post = yacyNetwork.basicRequestPost(Switchboard.getSwitchboard(), target.hash, salt);
post.add(new DefaultCharsetStringPart("process", process));
post.add(new DefaultCharsetStringPart("urlhash", ((entry == null) ? "" : entry.hash())));
post.add(new DefaultCharsetStringPart("result", result));
@@ -959,7 +959,7 @@ public final class yacyClient {
// prepare post values
final String salt = crypt.randomSalt();
- final List<Part> post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), targetSeed.hash, salt);
+ final List<Part> post = yacyNetwork.basicRequestPost(Switchboard.getSwitchboard(), targetSeed.hash, salt);
// enabling gzip compression for post request body
if (gzipBody && (targetSeed.getVersion() < yacyVersion.YACY_SUPPORTS_GZIP_POST_REQUESTS_CHUNKED)) {
@@ -1014,7 +1014,7 @@ public final class yacyClient {
// prepare post values
final String salt = crypt.randomSalt();
- final List<Part> post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), targetSeed.hash, salt);
+ final List<Part> post = yacyNetwork.basicRequestPost(Switchboard.getSwitchboard(), targetSeed.hash, salt);
// enabling gzip compression for post request body
if (gzipBody && (targetSeed.getVersion() < yacyVersion.YACY_SUPPORTS_GZIP_POST_REQUESTS_CHUNKED)) {
@@ -1053,7 +1053,7 @@ public final class yacyClient {
// this post a message to the remote message board
final String salt = crypt.randomSalt();
- final List<Part> post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), targetSeed.hash, salt);
+ final List<Part> post = yacyNetwork.basicRequestPost(Switchboard.getSwitchboard(), targetSeed.hash, salt);
String address = targetSeed.getClusterAddress();
if (address == null) { address = "localhost:8080"; }
@@ -1070,8 +1070,8 @@ public final class yacyClient {
* proxy for "to YaCy connections"
* @return
*/
- private static final httpRemoteProxyConfig proxyConfig() {
- final httpRemoteProxyConfig p = httpRemoteProxyConfig.getRemoteProxyConfig();
+ private static final RemoteProxyConfig proxyConfig() {
+ final RemoteProxyConfig p = RemoteProxyConfig.getRemoteProxyConfig();
return ((p != null) && (p.useProxy()) && (p.useProxy4Yacy())) ? p : null;
}
@@ -1079,16 +1079,16 @@ public final class yacyClient {
if(args.length > 1) {
System.out.println("yacyClient Test");
try {
- final plasmaSwitchboard sb = new plasmaSwitchboard(new File(args[0]), "httpProxy.init", "DATA/SETTINGS/yacy.conf", false);
+ final Switchboard sb = new Switchboard(new File(args[0]), "httpProxy.init", "DATA/SETTINGS/yacy.conf", false);
/*final yacyCore core =*/ new yacyCore(sb);
sb.loadSeedLists();
final yacySeed target = sb.peers.getConnected(args[1]);
final byte[] wordhashe = Word.word2hash("test");
//System.out.println("permission=" + permissionMessage(args[1]));
- final httpRequestHeader reqHeader = new httpRequestHeader();
- reqHeader.put(httpHeader.USER_AGENT, HTTPLoader.crawlerUserAgent);
- final byte[] content = httpClient.wget(
+ final RequestHeader reqHeader = new RequestHeader();
+ reqHeader.put(HeaderFramework.USER_AGENT, HTTPLoader.crawlerUserAgent);
+ final byte[] content = Client.wget(
"http://" + target.getPublicAddress() + "/yacy/search.html" +
"?myseed=" + sb.peers.mySeed().genSeedStr(null) +
"&youare=" + target.hash + "&key=" +
@@ -1096,7 +1096,7 @@ public final class yacyClient {
"&count=10" +
"&resource=global" +
"&query=" + new String(wordhashe) +
- "&network.unit.name=" + plasmaSwitchboard.getSwitchboard().getConfig(plasmaSwitchboardConstants.NETWORK_NAME, yacySeed.DFLT_NETWORK_UNIT),
+ "&network.unit.name=" + Switchboard.getSwitchboard().getConfig(SwitchboardConstants.NETWORK_NAME, yacySeed.DFLT_NETWORK_UNIT),
reqHeader, 10000, target.getHexHash() + ".yacyh");
final HashMap<String, String> result = FileUtils.table(content, "UTF-8");
System.out.println("Result=" + result.toString());
diff --git a/source/de/anomic/yacy/yacyCore.java b/source/de/anomic/yacy/yacyCore.java
index 279989cac..5839989af 100644
--- a/source/de/anomic/yacy/yacyCore.java
+++ b/source/de/anomic/yacy/yacyCore.java
@@ -54,7 +54,7 @@ import java.util.Map;
import de.anomic.content.RSSMessage;
import de.anomic.document.parser.xml.RSSFeed;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverCore;
import de.anomic.server.serverSemaphore;
import de.anomic.yacy.dht.PeerSelection;
@@ -82,14 +82,14 @@ public class yacyCore {
// public static boolean terminate = false;
// class variables
- plasmaSwitchboard sb;
+ Switchboard sb;
public static int yacyTime() {
// the time since startup of yacy in seconds
return Math.max(0, (int) ((System.currentTimeMillis() - serverCore.startupTime) / 1000));
}
- public yacyCore(final plasmaSwitchboard sb) {
+ public yacyCore(final Switchboard sb) {
final long time = System.currentTimeMillis();
this.sb = sb;
@@ -305,7 +305,7 @@ public class yacyCore {
// getting a list of peers to contact
if (sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN).equals(yacySeed.PEERTYPE_VIRGIN)) {
if (attempts > PING_INITIAL) { attempts = PING_INITIAL; }
- final Map<byte[], String> ch = plasmaSwitchboard.getSwitchboard().clusterhashes;
+ final Map<byte[], String> ch = Switchboard.getSwitchboard().clusterhashes;
seeds = PeerSelection.seedsByAge(sb.peers, true, attempts - ((ch == null) ? 0 : ch.size())); // best for fast connection
// add also all peers from cluster if this is a public robinson cluster
if (ch != null) {
@@ -614,7 +614,7 @@ public class yacyCore {
}
}
- public static final String saveSeedList(final plasmaSwitchboard sb) {
+ public static final String saveSeedList(final Switchboard sb) {
try {
// return an error if this is not successful, and NULL if everything is fine
String logt;
@@ -683,7 +683,6 @@ public class yacyCore {
if (log.isFine()) log.logFine("SaveSeedList: Using seed uploading method '" + seedUploadMethod + "' for seed-list uploading." +
"\n\tPrevious peerType is '" + sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR) + "'.");
-// logt = seedDB.uploadCache(seedFTPServer, seedFTPAccount, seedFTPPassword, seedFTPPath, seedURL);
logt = sb.peers.uploadCache(uploader, sb, sb.peers, seedURL);
if (logt != null) {
if (logt.indexOf("Error") >= 0) {
diff --git a/source/de/anomic/yacy/yacyNetwork.java b/source/de/anomic/yacy/yacyNetwork.java
index 9f1fb560e..60b032f72 100644
--- a/source/de/anomic/yacy/yacyNetwork.java
+++ b/source/de/anomic/yacy/yacyNetwork.java
@@ -33,11 +33,11 @@ import java.util.List;
import org.apache.commons.httpclient.methods.multipart.Part;
-import de.anomic.http.DefaultCharsetStringPart;
+import de.anomic.http.client.DefaultCharsetStringPart;
import de.anomic.kelondro.order.Digest;
import de.anomic.kelondro.util.DateFormatter;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -47,8 +47,8 @@ public class yacyNetwork {
if ((post == null) || (env == null)) return false;
// identify network
- final String unitName = post.get(plasmaSwitchboardConstants.NETWORK_NAME, yacySeed.DFLT_NETWORK_UNIT); // the network unit
- if (!unitName.equals(env.getConfig(plasmaSwitchboardConstants.NETWORK_NAME, yacySeed.DFLT_NETWORK_UNIT))) {
+ final String unitName = post.get(SwitchboardConstants.NETWORK_NAME, yacySeed.DFLT_NETWORK_UNIT); // the network unit
+ if (!unitName.equals(env.getConfig(SwitchboardConstants.NETWORK_NAME, yacySeed.DFLT_NETWORK_UNIT))) {
return false;
}
@@ -72,7 +72,7 @@ public class yacyNetwork {
return false;
}
- public static final List<Part> basicRequestPost(final plasmaSwitchboard sb, final String targetHash, final String salt) {
+ public static final List<Part> basicRequestPost(final Switchboard sb, final String targetHash, final String salt) {
// put in all the essentials for routing and network authentification
// generate a session key
final ArrayList<Part> post = new ArrayList<Part>();
@@ -87,7 +87,7 @@ public class yacyNetwork {
post.add(new DefaultCharsetStringPart("myUTC", Long.toString(System.currentTimeMillis())));
// network identification
- post.add(new DefaultCharsetStringPart(plasmaSwitchboardConstants.NETWORK_NAME, plasmaSwitchboard.getSwitchboard().getConfig(plasmaSwitchboardConstants.NETWORK_NAME, yacySeed.DFLT_NETWORK_UNIT)));
+ post.add(new DefaultCharsetStringPart(SwitchboardConstants.NETWORK_NAME, Switchboard.getSwitchboard().getConfig(SwitchboardConstants.NETWORK_NAME, yacySeed.DFLT_NETWORK_UNIT)));
// authentification essentials
final String authentificationControl = sb.getConfig("network.unit.protocol.control", "uncontrolled");
diff --git a/source/de/anomic/yacy/yacyNewsPool.java b/source/de/anomic/yacy/yacyNewsPool.java
index a5bcbd1ba..8b8c6d1f7 100644
--- a/source/de/anomic/yacy/yacyNewsPool.java
+++ b/source/de/anomic/yacy/yacyNewsPool.java
@@ -51,7 +51,7 @@ import java.util.Iterator;
import java.util.Map;
import de.anomic.data.Blacklist;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
public class yacyNewsPool {
@@ -323,13 +323,13 @@ public class yacyNewsPool {
if (record.created().getTime() == 0) return;
final Map<String, String> attributes = record.attributes();
if (attributes.containsKey("url")){
- if (plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_NEWS, new yacyURL(attributes.get("url"), null))){
+ if (Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_NEWS, new yacyURL(attributes.get("url"), null))){
System.out.println("DEBUG: ignored news-entry url blacklisted: " + attributes.get("url"));
return;
}
}
if (attributes.containsKey("startURL")){
- if (plasmaSwitchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_NEWS, new yacyURL(attributes.get("startURL"), null))){
+ if (Switchboard.urlBlacklist.isListed(Blacklist.BLACKLIST_NEWS, new yacyURL(attributes.get("startURL"), null))){
System.out.println("DEBUG: ignored news-entry url blacklisted: " + attributes.get("startURL"));
return;
}
diff --git a/source/de/anomic/yacy/yacyRelease.java b/source/de/anomic/yacy/yacyRelease.java
index 65ebd4b07..64946157a 100644
--- a/source/de/anomic/yacy/yacyRelease.java
+++ b/source/de/anomic/yacy/yacyRelease.java
@@ -46,13 +46,13 @@ import java.util.TreeSet;
import de.anomic.crawler.retrieval.HTTPLoader;
import de.anomic.document.parser.html.ContentScraper;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpResponse;
-import de.anomic.http.httpRequestHeader;
+import de.anomic.http.client.Client;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.metadata.ResponseContainer;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.server.serverCharBuffer;
import de.anomic.server.serverCore;
import de.anomic.server.serverSystem;
@@ -98,7 +98,7 @@ public final class yacyRelease extends yacyVersion {
// according to update properties, decide if we should retrieve update information
// if true, the release that can be obtained is returned.
// if false, null is returned
- final plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
+ final Switchboard sb = Switchboard.getSwitchboard();
// check if release was installed by packagemanager
if (yacyBuildProperties.isPkgManager()) {
@@ -256,7 +256,7 @@ public final class yacyRelease extends yacyVersion {
continue;
}
}
- plasmaSwitchboard.getSwitchboard().setConfig("update.time.lookup", System.currentTimeMillis());
+ Switchboard.getSwitchboard().setConfig("update.time.lookup", System.currentTimeMillis());
return new DevAndMainVersions(devReleases, mainReleases);
}
@@ -276,19 +276,19 @@ public final class yacyRelease extends yacyVersion {
* @return file object of release file, null in case of failure
*/
public File downloadRelease() {
- final File storagePath = plasmaSwitchboard.getSwitchboard().releasePath;
+ final File storagePath = Switchboard.getSwitchboard().releasePath;
File download = null;
// setup httpClient
- final httpRequestHeader reqHeader = new httpRequestHeader();
- reqHeader.put(httpHeader.USER_AGENT, HTTPLoader.yacyUserAgent);
+ final RequestHeader reqHeader = new RequestHeader();
+ reqHeader.put(HeaderFramework.USER_AGENT, HTTPLoader.yacyUserAgent);
- httpResponse res = null;
+ ResponseContainer res = null;
final String name = this.getUrl().getFileName();
byte[] signatureBytes = null;
// download signature first, if public key is available
if (this.publicKey != null) {
- final byte[] signatureData = httpClient.wget(this.getUrl().toString() + ".sig", reqHeader, 6000);
+ final byte[] signatureData = Client.wget(this.getUrl().toString() + ".sig", reqHeader, 6000);
if (signatureData == null) {
Log.logWarning("yacyVersion", "download of signature " + this.getUrl().toString() + " failed. ignoring signature file.");
} else try {
@@ -299,7 +299,7 @@ public final class yacyRelease extends yacyVersion {
// in case that the download of a signature file failed (can be caused by bad working http servers), then it is assumed that no signature exists
}
try {
- final httpClient client = new httpClient(120000, reqHeader);
+ final Client client = new Client(120000, reqHeader);
res = client.GET(this.getUrl().toString());
final boolean unzipped = res.getResponseHeader().gzip() && (res.getResponseHeader().mime().toLowerCase().equals("application/x-tar")); // if true, then the httpc has unzipped the file
@@ -349,7 +349,7 @@ public final class yacyRelease extends yacyVersion {
}
}
this.releaseFile = download;
- plasmaSwitchboard.getSwitchboard().setConfig("update.time.download", System.currentTimeMillis());
+ Switchboard.getSwitchboard().setConfig("update.time.download", System.currentTimeMillis());
return this.releaseFile;
}
@@ -383,7 +383,7 @@ public final class yacyRelease extends yacyVersion {
* script, which waits until yacy is terminated and starts it again
*/
public static void restart() {
- final plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
+ final Switchboard sb = Switchboard.getSwitchboard();
final String apphome = sb.getRootPath().toString();
if (serverSystem.isWindows) {
@@ -479,7 +479,7 @@ public final class yacyRelease extends yacyVersion {
}
//byte[] script = ("cd " + plasmaSwitchboard.getSwitchboard().getRootPath() + ";while [ -e ../yacy.running ]; do sleep 1;done;tar xfz " + release + ";cp -Rf yacy/* ../../;rm -Rf yacy;cd ../../;startYACY.sh").getBytes();
try {
- final plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
+ final Switchboard sb = Switchboard.getSwitchboard();
final String apphome = sb.getRootPath().toString();
Log.logInfo("UPDATE", "INITIATED");
try{
diff --git a/source/de/anomic/yacy/yacySeedDB.java b/source/de/anomic/yacy/yacySeedDB.java
index 1510bca2e..aeb8bec63 100644
--- a/source/de/anomic/yacy/yacySeedDB.java
+++ b/source/de/anomic/yacy/yacySeedDB.java
@@ -40,18 +40,17 @@ import java.util.Map;
import java.util.TreeMap;
import de.anomic.crawler.retrieval.HTTPLoader;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpHeader;
-import de.anomic.http.httpResponse;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.http.httpd;
-import de.anomic.http.httpdAlternativeDomainNames;
+import de.anomic.http.client.Client;
+import de.anomic.http.metadata.HeaderFramework;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.metadata.ResponseContainer;
+import de.anomic.http.server.HTTPDemon;
+import de.anomic.http.server.AlternativeDomainNames;
import de.anomic.kelondro.blob.Heap;
import de.anomic.kelondro.blob.MapDataMining;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.util.kelondroException;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaHTCache;
import de.anomic.server.serverCore;
import de.anomic.server.serverDomains;
import de.anomic.server.serverSwitch;
@@ -59,7 +58,7 @@ import de.anomic.yacy.dht.PartitionScheme;
import de.anomic.yacy.dht.VerticalWordPartitionScheme;
import de.anomic.yacy.logging.Log;
-public final class yacySeedDB implements httpdAlternativeDomainNames {
+public final class yacySeedDB implements AlternativeDomainNames {
// global statics
@@ -136,7 +135,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {
lastSeedUpload_seedDBSize = sizeConnected();
// tell the httpdProxy how to find this table as address resolver
- httpd.setAlternativeResolver(this);
+ HTTPDemon.setAlternativeResolver(this);
// create or init news database
this.newsPool = new yacyNewsPool(networkRoot);
@@ -599,7 +598,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {
yacySeed seed = null;
// local peer?
- if (httpd.isThisHostIP(peerIP)) {
+ if (HTTPDemon.isThisHostIP(peerIP)) {
if (this.mySeed == null) initMySeed();
return mySeed;
}
@@ -751,10 +750,6 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {
public String uploadCache(final yacySeedUploader uploader,
final serverSwitch sb,
final yacySeedDB seedDB,
-// String seedFTPServer,
-// String seedFTPAccount,
-// String seedFTPPassword,
-// File seedFTPPath,
final yacyURL seedURL) throws Exception {
// upload a seed file, if possible
@@ -764,7 +759,7 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {
File seedFile = null;
try {
// create a seed file which for uploading ...
- seedFile = File.createTempFile("seedFile",".txt", plasmaHTCache.cachePath);
+ seedFile = File.createTempFile("seedFile",".txt", seedDB.myOwnSeedFile.getParentFile());
seedFile.deleteOnExit();
if (Log.isFine("YACY")) Log.logFine("YACY", "SaveSeedList: Storing seedlist into tempfile " + seedFile.toString());
final ArrayList<String> uv = storeCache(seedFile, true);
@@ -798,15 +793,15 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {
private ArrayList<String> downloadSeedFile(final yacyURL seedURL) throws IOException {
// Configure http headers
- final httpRequestHeader reqHeader = new httpRequestHeader();
- reqHeader.put(httpHeader.PRAGMA, "no-cache");
- reqHeader.put(httpHeader.CACHE_CONTROL, "no-cache"); // httpc uses HTTP/1.0 is this necessary?
- reqHeader.put(httpHeader.USER_AGENT, HTTPLoader.yacyUserAgent);
+ final RequestHeader reqHeader = new RequestHeader();
+ reqHeader.put(HeaderFramework.PRAGMA, "no-cache");
+ reqHeader.put(HeaderFramework.CACHE_CONTROL, "no-cache"); // httpc uses HTTP/1.0 is this necessary?
+ reqHeader.put(HeaderFramework.USER_AGENT, HTTPLoader.yacyUserAgent);
// init http-client
- final httpClient client = new httpClient(10000, reqHeader);
+ final Client client = new Client(10000, reqHeader);
byte[] content = null;
- httpResponse res = null;
+ ResponseContainer res = null;
try {
// send request
res = client.GET(seedURL.toString());
diff --git a/source/de/anomic/yacy/yacyVersion.java b/source/de/anomic/yacy/yacyVersion.java
index a713b0dc1..45461f256 100644
--- a/source/de/anomic/yacy/yacyVersion.java
+++ b/source/de/anomic/yacy/yacyVersion.java
@@ -4,7 +4,7 @@ import java.util.Comparator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.search.Switchboard;
import de.anomic.yacy.logging.Log;
public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVersion> {
@@ -85,7 +85,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
public static final yacyVersion thisVersion() {
// construct a virtual release name for this release
if (thisVersion == null) {
- final plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
+ final Switchboard sb = Switchboard.getSwitchboard();
if (sb == null) return null;
thisVersion = new yacyVersion(
"yacy" +
diff --git a/source/de/anomic/plasma/plasmaGrafics.java b/source/de/anomic/ymage/NetworkGraph.java
similarity index 96%
rename from source/de/anomic/plasma/plasmaGrafics.java
rename to source/de/anomic/ymage/NetworkGraph.java
index 8c2b90266..15530b099 100644
--- a/source/de/anomic/plasma/plasmaGrafics.java
+++ b/source/de/anomic/ymage/NetworkGraph.java
@@ -26,7 +26,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.plasma;
+package de.anomic.ymage;
import java.awt.Color;
import java.awt.Graphics2D;
@@ -37,14 +37,14 @@ import java.util.Iterator;
import de.anomic.search.QueryParams;
import de.anomic.search.QueryEvent;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.yacy.yacySearch;
import de.anomic.yacy.yacySeed;
import de.anomic.yacy.yacySeedDB;
import de.anomic.yacy.dht.FlatWordPartitionScheme;
-import de.anomic.ymage.ymageMatrix;
-import de.anomic.ymage.ymageToolPrint;
-public class plasmaGrafics {
+public class NetworkGraph {
private static int shortestName = 10;
private static int longestName = 12;
@@ -117,7 +117,7 @@ public class plasmaGrafics {
if (primarySearches == null) return null; // this was a local search and there are no threads
// get a copy of a recent network picture
- final ymageMatrix eventPicture = getNetworkPicture(seedDB, 120000, plasmaSwitchboard.getSwitchboard().getConfig(plasmaSwitchboardConstants.NETWORK_NAME, "unspecified"), plasmaSwitchboard.getSwitchboard().getConfig("network.unit.description", "unspecified"), COL_BACKGROUND);
+ final ymageMatrix eventPicture = getNetworkPicture(seedDB, 120000, Switchboard.getSwitchboard().getConfig(SwitchboardConstants.NETWORK_NAME, "unspecified"), Switchboard.getSwitchboard().getConfig("network.unit.description", "unspecified"), COL_BACKGROUND);
//if (eventPicture instanceof ymageMatrix) eventPicture = (ymageMatrix) eventPicture; //new ymageMatrix((ymageMatrix) eventPicture);
// TODO: fix cloning of ymageMatrix pictures
diff --git a/source/de/anomic/plasma/plasmaProfiling.java b/source/de/anomic/ymage/ProfilingGraph.java
similarity index 98%
rename from source/de/anomic/plasma/plasmaProfiling.java
rename to source/de/anomic/ymage/ProfilingGraph.java
index b204c46c6..e82fac3ca 100644
--- a/source/de/anomic/plasma/plasmaProfiling.java
+++ b/source/de/anomic/ymage/ProfilingGraph.java
@@ -24,17 +24,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.plasma;
+package de.anomic.ymage;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import de.anomic.server.serverProfiling;
import de.anomic.server.serverProfiling.Event;
-import de.anomic.ymage.ymageChart;
-import de.anomic.ymage.ymageMatrix;
-public class plasmaProfiling {
+public class ProfilingGraph {
private static ymageChart bufferChart = null;
diff --git a/source/de/anomic/plasma/plasmaWebStructure.java b/source/de/anomic/ymage/WebStructureGraph.java
similarity index 97%
rename from source/de/anomic/plasma/plasmaWebStructure.java
rename to source/de/anomic/ymage/WebStructureGraph.java
index 07e50f363..ae99bb25e 100644
--- a/source/de/anomic/plasma/plasmaWebStructure.java
+++ b/source/de/anomic/ymage/WebStructureGraph.java
@@ -25,7 +25,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-package de.anomic.plasma;
+package de.anomic.ymage;
import java.io.File;
import java.io.IOException;
@@ -46,7 +46,7 @@ import de.anomic.kelondro.util.FileUtils;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.logging.Log;
-public class plasmaWebStructure {
+public class WebStructureGraph {
public static int maxCRLDump = 500000;
public static int maxCRGDump = 200000;
@@ -59,7 +59,7 @@ public class plasmaWebStructure {
private final String crlFile, crgFile;
TreeMap<String, String> structure_old, structure_new; // <b64hash(6)>','<host> to <date-yyyymmdd(8)>{<target-b64hash(6)><target-count-hex(4)>}*
- public plasmaWebStructure(final Log log, final File rankingPath, final String crlFile, final String crgFile, final File structureFile) {
+ public WebStructureGraph(final Log log, final File rankingPath, final String crlFile, final String crgFile, final File structureFile) {
this.log = log;
this.rankingPath = rankingPath;
this.crlFile = crlFile;
@@ -264,9 +264,9 @@ public class plasmaWebStructure {
String host = resolveDomHash2DomString(domhash);
if (host == null) return null;
// collect the references
- plasmaWebStructure.structureEntry sentry;
+ WebStructureGraph.structureEntry sentry;
HashMap<String, Integer> domhashes = new HashMap<String, Integer>();
- Iterator<plasmaWebStructure.structureEntry> i = structureEntryIterator(false);
+ Iterator<WebStructureGraph.structureEntry> i = structureEntryIterator(false);
while (i.hasNext()) {
sentry = i.next();
if (sentry.references.containsKey(domhash)) domhashes.put(sentry.domhash, sentry.references.get(domhash));
@@ -286,9 +286,9 @@ public class plasmaWebStructure {
public HashMap<String, Integer> incomingDomains(final String domhash) {
// collect the references
- plasmaWebStructure.structureEntry sentry;
+ WebStructureGraph.structureEntry sentry;
HashMap<String, Integer> domains = new HashMap<String, Integer>();
- Iterator<plasmaWebStructure.structureEntry> i = structureEntryIterator(false);
+ Iterator<WebStructureGraph.structureEntry> i = structureEntryIterator(false);
while (i.hasNext()) {
sentry = i.next();
if (sentry.references.containsKey(domhash)) domains.put(sentry.domain, sentry.references.get(domhash));
diff --git a/source/de/anomic/ymage/ymageOSM.java b/source/de/anomic/ymage/ymageOSM.java
index 683fabed9..f5acda301 100644
--- a/source/de/anomic/ymage/ymageOSM.java
+++ b/source/de/anomic/ymage/ymageOSM.java
@@ -36,8 +36,8 @@ import java.net.MalformedURLException;
import javax.imageio.ImageIO;
import de.anomic.crawler.retrieval.Response;
-import de.anomic.plasma.plasmaHTCache;
-import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.http.client.Cache;
+import de.anomic.search.Switchboard;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.logging.Log;
@@ -77,12 +77,12 @@ public class ymageOSM {
return null;
}
System.out.println("*** DEBUG: fetching OSM tile: " + tileURL.toNormalform(true, true));
- InputStream tileStream = plasmaHTCache.getResourceContentStream(tileURL);
+ InputStream tileStream = Cache.getResourceContentStream(tileURL);
if (tileStream == null) {
// download resource using the crawler and keep resource in memory if possible
Response entry = null;
try {
- entry = plasmaSwitchboard.getSwitchboard().crawlQueues.loadResourceFromWeb(tileURL, false, false);
+ entry = Switchboard.getSwitchboard().crawlQueues.loadResourceFromWeb(tileURL, false, false);
} catch (IOException e) {
Log.logWarning("yamyOSM", "cannot load: " + e.getMessage());
return null;
diff --git a/source/migration.java b/source/migration.java
index 4967f9144..bbb6cf31a 100644
--- a/source/migration.java
+++ b/source/migration.java
@@ -23,12 +23,12 @@ import java.io.IOException;
import java.util.List;
import de.anomic.data.listManager;
-import de.anomic.http.httpd;
+import de.anomic.http.server.HTTPDemon;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.order.Digest;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.yacy.logging.Log;
public class migration {
@@ -40,7 +40,7 @@ public class migration {
}
- public static void migrate(final plasmaSwitchboard sb, final int fromRev, final int toRev){
+ public static void migrate(final Switchboard sb, final int fromRev, final int toRev){
if(fromRev < toRev){
if(fromRev < TAGDB_WITH_TAGHASH){
migrateBookmarkTagsDB(sb);
@@ -58,7 +58,7 @@ public class migration {
/*
* remove the static defaultfiles. We use them through a overlay now.
*/
- public static void migrateDefaultFiles(final plasmaSwitchboard sb){
+ public static void migrateDefaultFiles(final Switchboard sb){
File file=new File(sb.htDocsPath, "share/dir.html");
if(file.exists())
delete(file);
@@ -78,7 +78,7 @@ public class migration {
if(file.exists())
delete(file);
}
- public static void installSkins(final plasmaSwitchboard sb){
+ public static void installSkins(final Switchboard sb){
final File skinsPath = sb.getConfigPath("skinPath", "DATA/SKINS");
final File defaultSkinsPath = new File(sb.getRootPath(), "skins");
if(defaultSkinsPath.exists()){
@@ -98,7 +98,7 @@ public class migration {
}
final File skinsDir=sb.getConfigPath("skinPath", "DATA/SKINS");
final File skinFile=new File(skinsDir, skin+".css");
- final File htdocsPath=new File(sb.getConfigPath(plasmaSwitchboardConstants.HTDOCS_PATH, plasmaSwitchboardConstants.HTROOT_PATH_DEFAULT), "env");
+ final File htdocsPath=new File(sb.getConfigPath(SwitchboardConstants.HTDOCS_PATH, SwitchboardConstants.HTROOT_PATH_DEFAULT), "env");
final File styleFile=new File(htdocsPath, "style.css");
if(!skinFile.exists()){
if(styleFile.exists()){
@@ -126,7 +126,7 @@ public class migration {
Log.logWarning("MIGRATION", "could not create directories for "+ path);
}
}
- public static void migrateBookmarkTagsDB(final plasmaSwitchboard sb){
+ public static void migrateBookmarkTagsDB(final Switchboard sb){
sb.bookmarksDB.close();
final File tagsDBFile=new File(sb.workPath, "bookmarkTags.db");
if(tagsDBFile.exists()){
@@ -147,7 +147,7 @@ public class migration {
if(!filename.delete())
Log.logWarning("MIGRATION", "could not delete "+ filename);
}
- public static void migrateWorkFiles(final plasmaSwitchboard sb){
+ public static void migrateWorkFiles(final Switchboard sb){
File file=new File(sb.getRootPath(), "DATA/SETTINGS/wiki.db");
File file2;
if (file.exists()) {
@@ -194,7 +194,7 @@ public class migration {
}
}
- public static void presetPasswords(final plasmaSwitchboard sb) {
+ public static void presetPasswords(final Switchboard sb) {
// set preset accounts/passwords
String acc;
if ((acc = sb.getConfig("serverAccount", "")).length() > 0) {
@@ -202,7 +202,7 @@ public class migration {
sb.setConfig("serverAccount", "");
}
if ((acc = sb.getConfig("adminAccount", "")).length() > 0) {
- sb.setConfig(httpd.ADMIN_ACCOUNT_B64MD5, Digest.encodeMD5Hex(Base64Order.standardCoder.encodeString(acc)));
+ sb.setConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, Digest.encodeMD5Hex(Base64Order.standardCoder.encodeString(acc)));
sb.setConfig("adminAccount", "");
}
@@ -216,7 +216,7 @@ public class migration {
sb.setConfig("serverAccountBase64", "");
}
if ((acc = sb.getConfig("adminAccountBase64", "")).length() > 0) {
- sb.setConfig(httpd.ADMIN_ACCOUNT_B64MD5, Digest.encodeMD5Hex(acc));
+ sb.setConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, Digest.encodeMD5Hex(acc));
sb.setConfig("adminAccountBase64", "");
}
if ((acc = sb.getConfig("uploadAccountBase64", "")).length() > 0) {
@@ -229,7 +229,7 @@ public class migration {
}
}
- public static void migrateSwitchConfigSettings(final plasmaSwitchboard sb) {
+ public static void migrateSwitchConfigSettings(final Switchboard sb) {
// migration for additional parser settings
String value = "";
diff --git a/source/yacy.java b/source/yacy.java
index 9a6ab3c96..f7f273c97 100644
--- a/source/yacy.java
+++ b/source/yacy.java
@@ -47,10 +47,10 @@ import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import de.anomic.data.translator;
import de.anomic.document.Word;
-import de.anomic.http.httpClient;
-import de.anomic.http.httpResponse;
-import de.anomic.http.httpRequestHeader;
-import de.anomic.http.httpd;
+import de.anomic.http.client.Client;
+import de.anomic.http.metadata.RequestHeader;
+import de.anomic.http.metadata.ResponseContainer;
+import de.anomic.http.server.HTTPDemon;
import de.anomic.kelondro.blob.Heap;
import de.anomic.kelondro.blob.MapDataMining;
import de.anomic.kelondro.index.RowCollection;
@@ -65,8 +65,8 @@ import de.anomic.kelondro.util.DateFormatter;
import de.anomic.kelondro.util.MemoryControl;
import de.anomic.kelondro.util.ScoreCluster;
import de.anomic.kelondro.util.FileUtils;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.plasma.plasmaSwitchboardConstants;
+import de.anomic.search.Switchboard;
+import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverCore;
import de.anomic.server.serverSemaphore;
import de.anomic.server.serverSystem;
@@ -129,10 +129,10 @@ public final class yacy {
public static final String hline = "-------------------------------------------------------------------------------";
/**
- * a reference to the {@link plasmaSwitchboard} created by the
+ * a reference to the {@link Switchboard} created by the
* {@link yacy#startup(String, long, long)} method.
*/
- private static plasmaSwitchboard sb = null;
+ private static Switchboard sb = null;
/**
* Semaphore needed by {@link yacy#setUpdaterCallback(serverUpdaterCallback)} to block
@@ -217,7 +217,7 @@ public final class yacy {
if(!oldconffile.renameTo(newconfFile))
Log.logSevere("STARTUP", "WARNING: the file " + oldconffile + " can not be renamed to "+ newconfFile +"!");
}
- sb = new plasmaSwitchboard(homePath, "defaults/yacy.init".replace("/", File.separator), newconf, pro);
+ sb = new Switchboard(homePath, "defaults/yacy.init".replace("/", File.separator), newconf, pro);
//sbSync.V(); // signal that the sb reference was set
// save information about available memory at startup time
@@ -249,7 +249,7 @@ public final class yacy {
// create some directories
final File htRootPath = new File(homePath, sb.getConfig("htRootPath", "htroot"));
- final File htDocsPath = sb.getConfigPath(plasmaSwitchboardConstants.HTDOCS_PATH, plasmaSwitchboardConstants.HTDOCS_PATH_DEFAULT);
+ final File htDocsPath = sb.getConfigPath(SwitchboardConstants.HTDOCS_PATH, SwitchboardConstants.HTDOCS_PATH_DEFAULT);
mkdirIfNeseccary(htDocsPath);
//final File htTemplatePath = new File(homePath, sb.getConfig("htTemplatePath","htdocs"));
@@ -292,13 +292,13 @@ public final class yacy {
// set user-agent
final String userAgent = "yacy/" + Double.toString(version) + " (www.yacy.net; "
- + httpClient.getSystemOST() + ")";
- httpClient.setUserAgent(userAgent);
+ + Client.getSystemOST() + ")";
+ Client.setUserAgent(userAgent);
// start main threads
final String port = sb.getConfig("port", "8080");
try {
- final httpd protocolHandler = new httpd(sb);
+ final HTTPDemon protocolHandler = new HTTPDemon(sb);
final serverCore server = new serverCore(
timeout /*control socket timeout in milliseconds*/,
true /* block attacks (wrong protocol) */,
@@ -318,12 +318,12 @@ public final class yacy {
server.setLog(new Log("SERVER"));
// open the browser window
- final boolean browserPopUpTrigger = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_TRIGGER, "true").equals("true");
+ final boolean browserPopUpTrigger = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_TRIGGER, "true").equals("true");
if (browserPopUpTrigger) {
- final String browserPopUpPage = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_PAGE, "ConfigBasic.html");
+ final String browserPopUpPage = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "ConfigBasic.html");
//boolean properPW = (sb.getConfig("adminAccount", "").length() == 0) && (sb.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() > 0);
//if (!properPW) browserPopUpPage = "ConfigBasic.html";
- final String browserPopUpApplication = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_APPLICATION, "firefox");
+ final String browserPopUpApplication = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_APPLICATION, "firefox");
serverSystem.openBrowser((server.withSSL()?"https":"http") + "://localhost:" + serverCore.getPortNr(port) + "/" + browserPopUpPage, browserPopUpApplication);
}
@@ -407,12 +407,12 @@ public final class yacy {
if (server.isAlive()) try {
// TODO only send request, don't read response (cause server is already down resulting in error)
final yacyURL u = new yacyURL((server.withSSL()?"https":"http")+"://localhost:" + serverCore.getPortNr(port), null);
- httpClient.wget(u.toString(), null, 10000); // kick server
+ Client.wget(u.toString(), null, 10000); // kick server
Log.logConfig("SHUTDOWN", "sent termination signal to server socket");
} catch (final IOException ee) {
Log.logConfig("SHUTDOWN", "termination signal to server socket missed (server shutdown, ok)");
}
- httpClient.closeAllConnections();
+ Client.closeAllConnections();
MultiThreadedHttpConnectionManager.shutdownAll();
// idle until the processes are down
@@ -550,14 +550,14 @@ public final class yacy {
final int port = serverCore.getPortNr(config.getProperty("port", "8080"));
// read password
- String encodedPassword = (String) config.get(httpd.ADMIN_ACCOUNT_B64MD5);
+ String encodedPassword = (String) config.get(HTTPDemon.ADMIN_ACCOUNT_B64MD5);
if (encodedPassword == null) encodedPassword = ""; // not defined
// send 'wget' to web interface
- final httpRequestHeader requestHeader = new httpRequestHeader();
- requestHeader.put(httpRequestHeader.AUTHORIZATION, "realm=" + encodedPassword); // for http-authentify
- final httpClient con = new httpClient(10000, requestHeader);
- httpResponse res = null;
+ final RequestHeader requestHeader = new RequestHeader();
+ requestHeader.put(RequestHeader.AUTHORIZATION, "realm=" + encodedPassword); // for http-authentify
+ final Client con = new Client(10000, requestHeader);
+ ResponseContainer res = null;
try {
res = con.GET("http://localhost:"+ port +"/" + path);
@@ -1038,10 +1038,10 @@ public final class yacy {
* machine shuts down. Signals the plasmaSwitchboard to shut down.
*/
class shutdownHookThread extends Thread {
- private plasmaSwitchboard sb = null;
+ private Switchboard sb = null;
private Thread mainThread = null;
- public shutdownHookThread(final Thread mainThread, final plasmaSwitchboard sb) {
+ public shutdownHookThread(final Thread mainThread, final Switchboard sb) {
super();
this.sb = sb;
this.mainThread = mainThread;