Skip to content

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

* Complete number localization and provide a more reasonable interface to serverObjects: - put(key, value) methods are now used if a value added to the map should be kept as it is. Numbers are transformed (but not formatted) to an equivalent String representation. - putASIS(...) have been removed, now done with simple put(...) (see above). - puNum(...) can be used for number values which should be stored in a formatted way, either depending on the current locale setting for yacy (default) or in a "none" locale (see javadocs and setLocalize()). - putHTML(...) escapes special characters into corresponding HTML enities ('<' => '&lt;') which was done with put(...) before and so was called too often, becauses it is necessary only for very few cases. Additionally there is a "forXML" mode which only replaces < > & ". In short: Use put(...) for almost everything, use putXY(...) if you need some special transformation of the value. A few bugs have been fixed as well, and there should be a small performance improvement for complex pages with a lot of values.

fuchsi0e1738899f81
diff --git a/htroot/AccessTracker_p.html b/htroot/AccessTracker_p.html
index a5360ebb5..b26a23dae 100644
--- a/htroot/AccessTracker_p.html
+++ b/htroot/AccessTracker_p.html
@@ -81,6 +81,18 @@
<td>#[querystring]#</td>
</tr>
#{/list}#
+ <tr class="TableHeader">
+ <td></td>
+ <td></td>
+ <td></td>
+ <td>&#216; #[querycount_avg]#</td>
+ <td>&#216; #[resultcount_avg]#</td>
+ <td>&#216; #[querytime_avg]#</td>
+ <td>&#216; #[resulttime_avg]#</td>
+ <td>&#216; #[urltime_avg]#</td>
+ <td>&#216; #[snippettime_avg]#</td>
+ <td></td>
+ </tr>
</table>
::
<h2>Local Search Host Tracker</h2>
@@ -101,6 +113,12 @@
<td>#{dates}##[date]# #{/dates}#</td>
</tr>
#{/list}#
+ <tr class="TableHeader">
+ <td></td>
+ <td>&#931; #[total]#</td>
+ <td>&#931; #[qph_sum]#</td>
+ <td></td>
+ </tr>
</table>
::
<h2>Remote Search Log</h2>
@@ -133,6 +151,18 @@
<td>#[queryhashes]#</td>
</tr>
#{/list}#
+ <tr class="TableHeader">
+ <td></td>
+ <td></td>
+ <td></td>
+ <td>&#216; #[querycount_avg]#</td>
+ <td>&#216; #[resultcount_avg]#</td>
+ <td>&#216; #[querytime_avg]#</td>
+ <td>&#216; #[resulttime_avg]#</td>
+ <td>&#216; #[urltime_avg]#</td>
+ <td>&#216; #[snippettime_avg]#</td>
+ <td></td>
+ </tr>
</table>
::
<h2>Remote Search Host Tracker</h2>
@@ -155,6 +185,13 @@
<td>#{dates}##[date]# #{/dates}#</td>
</tr>
#{/list}#
+ <tr class="TableHeader">
+ <td></td>
+ <td></td>
+ <td>&#931; #[total]#</td>
+ <td>&#931; #[qph_sum]#</td>
+ <td></td>
+ </tr>
</table>
#(/page)#
#%env/templates/footer.template%#
diff --git a/htroot/AccessTracker_p.java b/htroot/AccessTracker_p.java
index 2a3120759..0a8617822 100644
--- a/htroot/AccessTracker_p.java
+++ b/htroot/AccessTracker_p.java
@@ -59,6 +59,7 @@ public class AccessTracker_p {
// return variable that accumulates replacements
serverObjects prop = new serverObjects();
+ prop.setLocalized(!((String)header.get("PATH")).endsWith(".xml"));
int page = 0;
if (post != null) page = post.getInt("page", 0);
prop.put("page", page);
@@ -74,11 +75,11 @@ public class AccessTracker_p {
while ((entCount < maxCount) && (i.hasNext())) {
host = (String) i.next();
access = switchboard.accessTrack(host);
- prop.put("page_list_" + entCount + "_host", host);
- prop.put("page_list_" + entCount + "_countSecond", access.tailMap(new Long(System.currentTimeMillis() - 1000)).size());
- prop.put("page_list_" + entCount + "_countMinute", access.tailMap(new Long(System.currentTimeMillis() - 1000 * 60)).size());
- prop.put("page_list_" + entCount + "_count10Minutes", access.tailMap(new Long(System.currentTimeMillis() - 1000 * 60 * 10)).size());
- prop.put("page_list_" + entCount + "_countHour", access.tailMap(new Long(System.currentTimeMillis() - 1000 * 60 * 60)).size());
+ prop.putHTML("page_list_" + entCount + "_host", host);
+ prop.putNum("page_list_" + entCount + "_countSecond", access.tailMap(Long.valueOf(System.currentTimeMillis() - 1000)).size());
+ prop.putNum("page_list_" + entCount + "_countMinute", access.tailMap(Long.valueOf(System.currentTimeMillis() - 1000 * 60)).size());
+ prop.putNum("page_list_" + entCount + "_count10Minutes", access.tailMap(Long.valueOf(System.currentTimeMillis() - 1000 * 60 * 10)).size());
+ prop.putNum("page_list_" + entCount + "_countHour", access.tailMap(Long.valueOf(System.currentTimeMillis() - 1000 * 60 * 60)).size());
entCount++;
}
} catch (ConcurrentModificationException e) {} // we dont want to synchronize this
@@ -97,9 +98,9 @@ public class AccessTracker_p {
Iterator ii = treemapclone(access).entrySet().iterator();
while (ii.hasNext()) {
entry = (Map.Entry) ii.next();
- prop.put("page_list_" + entCount + "_host", host);
- prop.put("page_list_" + entCount + "_date", serverDate.shortSecondTime(new Date(((Long) entry.getKey()).longValue())));
- prop.put("page_list_" + entCount + "_path", (String) entry.getValue());
+ prop.putHTML("page_list_" + entCount + "_host", host);
+ prop.putHTML("page_list_" + entCount + "_date", serverDate.shortSecondTime(new Date(((Long) entry.getKey()).longValue())));
+ prop.putHTML("page_list_" + entCount + "_path", (String) entry.getValue());
entCount++;
}
} catch (ConcurrentModificationException e) {} // we dont want to synchronize this
@@ -113,9 +114,9 @@ public class AccessTracker_p {
Iterator ii = treemapclone(access).entrySet().iterator();
while (ii.hasNext()) {
entry = (Map.Entry) ii.next();
- prop.put("page_list_" + entCount + "_host", host);
+ prop.putHTML("page_list_" + entCount + "_host", host);
prop.put("page_list_" + entCount + "_date", serverDate.shortSecondTime(new Date(((Long) entry.getKey()).longValue())));
- prop.put("page_list_" + entCount + "_path", (String) entry.getValue());
+ prop.putHTML("page_list_" + entCount + "_path", (String) entry.getValue());
entCount++;
}
}
@@ -129,40 +130,64 @@ public class AccessTracker_p {
Long trackerHandle;
HashMap searchProfile;
int m = Math.min(maxCount, array.size());
+ long qcountSum = 0;
+ long qtimeSum = 0;
+ long rcountSum = 0;
+ long utimeSum = 0;
+ long stimeSum = 0;
+ long rtimeSum = 0;
+
for (int entCount = 0; entCount < m; entCount++) {
searchProfile = (HashMap) array.get(array.size() - entCount - 1);
trackerHandle = (Long) searchProfile.get("time");
// put values in template
- prop.put("page_list_" + entCount + "_dark", ((dark) ? 1 : 0) ); dark =! dark;
- prop.put("page_list_" + entCount + "_host", (String) searchProfile.get("host"));
+ prop.put("page_list_" + entCount + "_dark", ((dark) ? 1 : 0) );
+ dark =! dark;
+ prop.putHTML("page_list_" + entCount + "_host", (String) searchProfile.get("host"));
prop.put("page_list_" + entCount + "_date", serverDate.shortSecondTime(new Date(trackerHandle.longValue())));
- prop.put("page_list_" + entCount + "_timestamp", Long.toString(trackerHandle.longValue()));
+ prop.put("page_list_" + entCount + "_timestamp", trackerHandle.longValue());
if (page == 2) {
// local search
- prop.put("page_list_" + entCount + "_offset", ((Integer) searchProfile.get("offset")).toString());
+ prop.putNum("page_list_" + entCount + "_offset", ((Integer) searchProfile.get("offset")).longValue());
prop.put("page_list_" + entCount + "_querystring", searchProfile.get("querystring"));
} else {
// remote search
- prop.put("page_list_" + entCount + "_peername", (String) searchProfile.get("peername"));
+ prop.putHTML("page_list_" + entCount + "_peername", (String) searchProfile.get("peername"));
prop.put("page_list_" + entCount + "_queryhashes", plasmaSearchQuery.anonymizedQueryHashes((Set) searchProfile.get("queryhashes")));
}
- prop.put("page_list_" + entCount + "_querycount", ((Integer) searchProfile.get("querycount")).toString());
- prop.put("page_list_" + entCount + "_querytime", ((Long) searchProfile.get("querytime")).toString());
- prop.put("page_list_" + entCount + "_resultcount", ((Integer) searchProfile.get("resultcount")).toString());
- prop.put("page_list_" + entCount + "_urltime", ((Long) searchProfile.get("resulturltime")).toString());
- prop.put("page_list_" + entCount + "_snippettime", ((Long) searchProfile.get("resultsnippettime")).toString());
- prop.put("page_list_" + entCount + "_resulttime", ((Long) searchProfile.get("resulttime")).toString());
+ prop.putNum("page_list_" + entCount + "_querycount", ((Integer) searchProfile.get("querycount")).longValue());
+ prop.putNum("page_list_" + entCount + "_querytime", ((Long) searchProfile.get("querytime")).longValue());
+ prop.putNum("page_list_" + entCount + "_resultcount", ((Integer) searchProfile.get("resultcount")).longValue());
+ prop.putNum("page_list_" + entCount + "_urltime", ((Long) searchProfile.get("resulturltime")).longValue());
+ prop.putNum("page_list_" + entCount + "_snippettime", ((Long) searchProfile.get("resultsnippettime")).longValue());
+ prop.putNum("page_list_" + entCount + "_resulttime", ((Long) searchProfile.get("resulttime")).longValue());
+ qcountSum += ((Integer) searchProfile.get("querycount")).intValue();
+ qtimeSum += ((Long) searchProfile.get("querytime")).longValue();
+ rcountSum += ((Integer) searchProfile.get("resultcount")).intValue();
+ utimeSum += ((Long) searchProfile.get("resulturltime")).longValue();
+ stimeSum += ((Long) searchProfile.get("resultsnippettime")).longValue();
+ rtimeSum += ((Long) searchProfile.get("resulttime")).longValue();
}
prop.put("page_list", m);
prop.put("page_num", m);
- prop.put("page_total", (page == 2) ? switchboard.localSearches.size() : switchboard.remoteSearches.size());
+
+ // Put -1 instead of NaN as result for empty search list
+ if (m == 0) m = -1;
+ prop.putNum("page_querycount_avg", (double)qcountSum/m);
+ prop.putNum("page_querytime_avg", (double)qtimeSum/m);
+ prop.putNum("page_resultcount_avg", (double)rcountSum/m);
+ prop.putNum("page_urltime_avg", (double)utimeSum/m);
+ prop.putNum("page_snippettime_avg", (double)stimeSum/m);
+ prop.putNum("page_resulttime_avg", (double)rtimeSum/m);
+ prop.putNum("page_total", (page == 2) ? switchboard.localSearches.size() : switchboard.remoteSearches.size());
}
if ((page == 3) || (page == 5)) {
Iterator i = (page == 3) ? switchboard.localSearchTracker.entrySet().iterator() : switchboard.remoteSearchTracker.entrySet().iterator();
String host;
TreeSet handles;
int entCount = 0;
+ int qphSum = 0;
Map.Entry entry;
try {
while ((entCount < maxCount) && (i.hasNext())) {
@@ -180,23 +205,25 @@ public class AccessTracker_p {
}
prop.put("page_list_" + entCount + "_dates", dateCount);
int qph = handles.tailSet(new Long(System.currentTimeMillis() - 1000 * 60 * 60)).size();
+ qphSum += qph;
prop.put("page_list_" + entCount + "_qph", qph);
prop.put("page_list_" + entCount + "_dark", ((dark) ? 1 : 0) ); dark =! dark;
- prop.put("page_list_" + entCount + "_host", host);
+ prop.putHTML("page_list_" + entCount + "_host", host);
if (page == 5) {
yacySeed remotepeer = yacyCore.seedDB.lookupByIP(natLib.getInetAddress(host), true, true, true);
- prop.put("page_list_" + entCount + "_peername", (remotepeer == null) ? "UNKNOWN" : remotepeer.getName());
+ prop.putHTML("page_list_" + entCount + "_peername", (remotepeer == null) ? "UNKNOWN" : remotepeer.getName());
}
- prop.put("page_list_" + entCount + "_count", new Integer(handles.size()).toString());
+ prop.putHTML("page_list_" + entCount + "_count", new Integer(handles.size()).toString());
// next
entCount++;
}
} catch (ConcurrentModificationException e) {} // we dont want to synchronize this
prop.put("page_list", entCount);
- prop.put("page_num", entCount);
- prop.put("page_total", (page == 3) ? switchboard.localSearches.size() : switchboard.remoteSearches.size());
+ prop.putNum("page_num", entCount);
+ prop.putNum("page_total", (page == 3) ? switchboard.localSearches.size() : switchboard.remoteSearches.size());
+ prop.putNum("page_qph_sum", qphSum);
}
// return rewrite properties
return prop;
diff --git a/htroot/BlacklistCleaner_p.java b/htroot/BlacklistCleaner_p.java
index c5490cdb9..8939789ac 100644
--- a/htroot/BlacklistCleaner_p.java
+++ b/htroot/BlacklistCleaner_p.java
@@ -102,7 +102,7 @@ public class BlacklistCleaner_p {
String[] supportedBlacklistTypes = supportedBlacklistTypesStr.split(",");
if (post == null) {
- prop.put("results", 0);
+ prop.put("results", "0");
putBlacklists(prop, listManager.getDirListing(listManager.listsPath), blacklistToUse);
return prop;
}
@@ -110,27 +110,27 @@ public class BlacklistCleaner_p {
if (post.containsKey("listNames")) {
blacklistToUse = (String)post.get("listNames");
if (blacklistToUse.length() == 0 || !listManager.listSetContains("listManager.listsPath", blacklistToUse))
- prop.put("results", 2);
+ prop.put("results", "2");
}
putBlacklists(prop, listManager.getDirListing(listManager.listsPath), blacklistToUse);
if (blacklistToUse != null) {
- prop.put("results", 1);
+ prop.put("results", "1");
if (post.containsKey("delete")) {
- prop.put(RESULTS + "modified", 1);
+ prop.put(RESULTS + "modified", "1");
prop.put(RESULTS + "modified_delCount", removeEntries(blacklistToUse, supportedBlacklistTypes, getByPrefix(post, "select", true, true)));
} else if (post.containsKey("alter")) {
- prop.put(RESULTS + "modified", 2);
+ prop.put(RESULTS + "modified", "2");
prop.put(RESULTS + "modified_alterCount", alterEntries(blacklistToUse, supportedBlacklistTypes, getByPrefix(post, "select", true, false), getByPrefix(post, "entry", false, false)));
}
// list illegal entries
HashMap ies = getIllegalEntries(blacklistToUse, supportedBlacklistTypes, plasmaSwitchboard.urlBlacklist);
prop.put(RESULTS + "entries", ies.size());
- prop.put(RESULTS + "blEngine", plasmaSwitchboard.urlBlacklist.getEngineInfo());
- prop.put(RESULTS + "disabled", (ies.size() == 0) ? 1 : 0);
+ prop.putHTML(RESULTS + "blEngine", plasmaSwitchboard.urlBlacklist.getEngineInfo());
+ prop.put(RESULTS + "disabled", (ies.size() == 0) ? "1" : "0");
if (ies.size() > 0) {
prop.put(RESULTS + DISABLED + "entries", ies.size());
Iterator it = ies.keySet().iterator();
@@ -139,7 +139,7 @@ public class BlacklistCleaner_p {
while (it.hasNext()) {
s = (String)it.next();
prop.put(RESULTS + DISABLED + ENTRIES + i + "_error", ((Integer)ies.get(s)).longValue());
- prop.put(RESULTS + DISABLED + ENTRIES + i + "_entry", s);
+ prop.putHTML(RESULTS + DISABLED + ENTRIES + i + "_entry", s);
i++;
}
}
@@ -155,19 +155,19 @@ public class BlacklistCleaner_p {
if (supported) {
if (lists.length > 0) {
- prop.put("disabled", 0);
+ prop.put("disabled", "0");
prop.put(DISABLED + "blacklists", lists.length);
for (int i=0; i<lists.length; i++) {
- prop.put(DISABLED + BLACKLISTS + i + "_name", lists[i]);
- prop.put(DISABLED + BLACKLISTS + i + "_selected", (lists[i].equals(selected)) ? 1 : 0);
+ prop.putHTML(DISABLED + BLACKLISTS + i + "_name", lists[i]);
+ prop.put(DISABLED + BLACKLISTS + i + "_selected", (lists[i].equals(selected)) ? "1" : "0");
}
} else {
- prop.put("disabled", 2);
+ prop.put("disabled", "2");
}
} else {
- prop.put("disabled", 1);
+ prop.put("disabled", "1");
for (int i=0; i<supportedBLEngines.length; i++)
- prop.put(DISABLED + "engines_" + i + "_name", supportedBLEngines[i].getName());
+ prop.putHTML(DISABLED + "engines_" + i + "_name", supportedBLEngines[i].getName());
prop.put(DISABLED + "engines", supportedBLEngines.length);
}
}
@@ -323,7 +323,7 @@ public class BlacklistCleaner_p {
supportedBlacklistTypes[blTypes],
host,
path);
- }
+ }
}
}
pw.close();
diff --git a/htroot/Blacklist_p.java b/htroot/Blacklist_p.java
index d985ba32e..c3c095011 100644
--- a/htroot/Blacklist_p.java
+++ b/htroot/Blacklist_p.java
@@ -86,13 +86,13 @@ public class Blacklist_p {
String blacklistToUse = null;
serverObjects prop = new serverObjects();
- prop.put("blacklistEngine", plasmaSwitchboard.urlBlacklist.getEngineInfo());
+ prop.putHTML("blacklistEngine", plasmaSwitchboard.urlBlacklist.getEngineInfo());
// do all post operations
if (post != null) {
if(post.containsKey("testList")) {
- prop.put("testlist",1);
+ prop.put("testlist", "1");
String urlstring = post.get("testurl", "");
if(!urlstring.startsWith("http://")) urlstring = "http://"+urlstring;
yacyURL testurl = null;
@@ -100,19 +100,19 @@ public class Blacklist_p {
testurl = new yacyURL(urlstring, null);
} catch (MalformedURLException e) { }
if(testurl != null) {
- prop.put("testlist_url",testurl.toString());
+ prop.putHTML("testlist_url",testurl.toString());
if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_CRAWLER, testurl))
- prop.put("testlist_listedincrawler",1);
+ prop.put("testlist_listedincrawler", "1");
if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_DHT, testurl))
- prop.put("testlist_listedindht",1);
+ prop.put("testlist_listedindht", "1");
if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_NEWS, testurl))
- prop.put("testlist_listedinnews",1);
+ prop.put("testlist_listedinnews", "1");
if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_PROXY, testurl))
- prop.put("testlist_listedinproxy",1);
+ prop.put("testlist_listedinproxy", "1");
if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_SEARCH, testurl))
- prop.put("testlist_listedinsearch",1);
+ prop.put("testlist_listedinsearch", "1");
if(plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_SURFTIPS, testurl))
- prop.put("testlist_listedinsurftips",1);
+ prop.put("testlist_listedinsurftips", "1");
}
else prop.put("testlist_url","not valid");
}
@@ -179,7 +179,7 @@ public class Blacklist_p {
blacklistToUse = (String)post.get("selectedListName");
if (blacklistToUse == null || blacklistToUse.trim().length() == 0) {
- prop.put("LOCATION","");
+ prop.put("LOCATION", "");
return prop;
}
@@ -201,7 +201,7 @@ public class Blacklist_p {
blacklistToUse = (String)post.get("selectedListName");
if (blacklistToUse == null || blacklistToUse.trim().length() == 0) {
- prop.put("LOCATION","");
+ prop.put("LOCATION", "");
return prop;
}
@@ -210,26 +210,26 @@ public class Blacklist_p {
listManager.removeFromListSet(BLACKLIST_SHARED, blacklistToUse);
} else { // inactive list -> enable
listManager.updateListSet(BLACKLIST_SHARED, blacklistToUse);
- }
+ }
} else if (post.containsKey("deleteBlacklistEntry")) {
/* ===========================================================
* Delete a blacklist entry
- * =========================================================== */
+ * =========================================================== */
// get the current selected blacklist name
blacklistToUse = (String)post.get("currentBlacklist");
if (blacklistToUse == null || blacklistToUse.trim().length() == 0) {
- prop.put("LOCATION","");
+ prop.put("LOCATION", "");
return prop;
- }
+ }
// get the entry that should be deleted
String oldEntry = (String)post.get("selectedEntry");
if (oldEntry == null || oldEntry.trim().length() == 0) {
- prop.put("LOCATION",header.get("PATH") + "?selectList=&selectedListName=" + blacklistToUse);
+ prop.put("LOCATION", header.get("PATH") + "?selectList=&selectedListName=" + blacklistToUse);
return prop;
- }
+ }
// load blacklist data from file
ArrayList list = listManager.getListArray(new File(listManager.listsPath, blacklistToUse));
@@ -251,28 +251,28 @@ public class Blacklist_p {
// add default empty path pattern
pos = oldEntry.length();
oldEntry = oldEntry + "/.*";
- }
+ }
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));
- }
- }
+ }
+ }
} else if (post.containsKey("addBlacklistEntry")) {
/* ===========================================================
* Add a new blacklist entry
- * =========================================================== */
+ * =========================================================== */
blacklistToUse = (String)post.get("currentBlacklist");
if (blacklistToUse == null || blacklistToUse.trim().length() == 0) {
- prop.put("LOCATION","");
+ prop.put("LOCATION", "");
return prop;
- }
+ }
String newEntry = (String)post.get("newEntry");
if (newEntry.trim().length() == 0) {
- prop.put("LOCATION",header.get("PATH") + "?selectList=&selectedListName=" + blacklistToUse);
+ prop.put("LOCATION", header.get("PATH") + "?selectList=&selectedListName=" + blacklistToUse);
return prop;
}
@@ -315,7 +315,7 @@ public class Blacklist_p {
blacklistToUse = (String)post.get("targetBlacklist");
if (blacklistToUse == null || blacklistToUse.trim().length() == 0) {
- prop.put("LOCATION","");
+ prop.put("LOCATION", "");
return prop;
}
@@ -364,7 +364,7 @@ public class Blacklist_p {
// get the current selected blacklist name
blacklistToUse = (String)post.get("currentBlacklist");
if (blacklistToUse == null || blacklistToUse.trim().length() == 0) {
- prop.put("LOCATION","");
+ prop.put("LOCATION", "");
return prop;
}
@@ -429,7 +429,7 @@ public class Blacklist_p {
prop.put(DISABLED + "Itemlist_" + entryCount + "_item", nextEntry);
entryCount++;
}
- prop.put(DISABLED + "Itemlist", entryCount);
+ prop.put(DISABLED + "Itemlist", entryCount);
// List known hosts for BlackList retrieval
@@ -447,7 +447,7 @@ public class Blacklist_p {
while ((peername = (String) hostList.firstKey()) != null) {
final String Hash = (String) hostList.get(peername);
prop.put(DISABLED + "otherHosts_" + peerCount + "_hash", Hash);
- prop.put(DISABLED + "otherHosts_" + peerCount + "_name", peername);
+ prop.putHTML(DISABLED + "otherHosts_" + peerCount + "_name", peername, true);
hostList.remove(peername);
peerCount++;
}
@@ -460,42 +460,42 @@ public class Blacklist_p {
int blacklistCount = 0;
if (dirlist != null) {
for (int i = 0; i <= dirlist.length - 1; i++) {
- prop.put(DISABLED + BLACKLIST + blacklistCount + "_name", dirlist[i]);
- prop.put(DISABLED + BLACKLIST + blacklistCount + "_selected", 0);
+ prop.putHTML(DISABLED + BLACKLIST + blacklistCount + "_name", dirlist[i], true);
+ prop.put(DISABLED + BLACKLIST + blacklistCount + "_selected", "0");
if (dirlist[i].equals(blacklistToUse)) { //current List
- prop.put(DISABLED + BLACKLIST + blacklistCount + "_selected", 1);
+ prop.put(DISABLED + BLACKLIST + blacklistCount + "_selected", "1");
for (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) {
- prop.put(DISABLED + "currentActiveFor_" + blTypes + "_blTypeName",supportedBlacklistTypes[blTypes]);
+ prop.putHTML(DISABLED + "currentActiveFor_" + blTypes + "_blTypeName",supportedBlacklistTypes[blTypes], true);
prop.put(DISABLED + "currentActiveFor_" + blTypes + "_checked",
- listManager.listSetContains(supportedBlacklistTypes[blTypes] + ".BlackLists",dirlist[i])?0:1);
+ listManager.listSetContains(supportedBlacklistTypes[blTypes] + ".BlackLists",dirlist[i]) ? "0" : "1");
}
- prop.put(DISABLED + "currentActiveFor",supportedBlacklistTypes.length);
+ prop.put(DISABLED + "currentActiveFor", supportedBlacklistTypes.length);
}
if (listManager.listSetContains(BLACKLIST_SHARED, dirlist[i])) {
- prop.put(DISABLED + BLACKLIST + blacklistCount + "_shared", 1);
+ prop.put(DISABLED + BLACKLIST + blacklistCount + "_shared", "1");
} else {
- prop.put(DISABLED + BLACKLIST + blacklistCount + "_shared", 0);
+ prop.put(DISABLED + BLACKLIST + blacklistCount + "_shared", "0");
}
int activeCount = 0;
for (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) {
if (listManager.listSetContains(supportedBlacklistTypes[blTypes] + ".BlackLists",dirlist[i])) {
- prop.put(DISABLED + BLACKLIST + blacklistCount + "_active_" + activeCount + "_blTypeName",supportedBlacklistTypes[blTypes]);
+ prop.putHTML(DISABLED + BLACKLIST + blacklistCount + "_active_" + activeCount + "_blTypeName", supportedBlacklistTypes[blTypes]);
activeCount++;
}
}
- prop.put(DISABLED + BLACKLIST + blacklistCount + "_active",activeCount);
+ prop.put(DISABLED + BLACKLIST + blacklistCount + "_active", activeCount);
blacklistCount++;
}
}
prop.put(DISABLED + "blackLists", blacklistCount);
- prop.put(DISABLED + "currentBlacklist", (blacklistToUse==null)?"":blacklistToUse);
- prop.put("disabled", (blacklistToUse == null) ? 1 : 0);
+ prop.putHTML(DISABLED + "currentBlacklist", (blacklistToUse==null) ? "" : blacklistToUse, true);
+ prop.put("disabled", (blacklistToUse == null) ? "1" : "0");
return prop;
}
diff --git a/htroot/Blog.java b/htroot/Blog.java
index 230f62f5e..c615bf917 100644
--- a/htroot/Blog.java
+++ b/htroot/Blog.java
@@ -91,13 +91,13 @@ public class Blog {
final String address = yacyCore.seedDB.mySeed().getPublicAddress();
if(hasRights) {
- prop.put("mode_admin",1);
+ prop.put("mode_admin", "1");
} else {
- prop.put("mode_admin",0);
+ prop.put("mode_admin", "0");
}
if (post == null) {
- prop.put("peername", yacyCore.seedDB.mySeed().getName());
+ prop.putHTML("peername", yacyCore.seedDB.mySeed().getName());
prop.put("address", address);
return putBlogDefault(prop, switchboard, address, 0, 20, hasRights, xml);
}
@@ -197,80 +197,80 @@ public class Blog {
//edit an entry
if(hasRights) {
try {
- prop.put("mode", 1); //edit
+ prop.put("mode", "1"); //edit
prop.put("mode_commentMode", page.getCommentMode());
- prop.put("mode_author", new String(page.author(),"UTF-8"));
+ prop.putHTML("mode_author", new String(page.author(),"UTF-8"), xml);
prop.put("mode_pageid", page.key());
- prop.put("mode_subject", new String(page.subject(), "UTF-8"));
+ prop.putHTML("mode_subject", new String(page.subject(), "UTF-8"), xml);
prop.put("mode_page-code", new String(page.page(), "UTF-8"));
} catch (UnsupportedEncodingException e) {}
}
else {
- prop.put("mode",3); //access denied (no rights)
+ prop.put("mode", "3"); //access denied (no rights)
}
}
else if(post.containsKey("preview")) {
//preview the page
if(hasRights) {
- prop.put("mode", 2);//preview
- prop.put("mode_commentMode", Integer.parseInt(post.get("commentMode", "1")));
- prop.put("mode_pageid", pagename);
+ prop.put("mode", "2");//preview
+ prop.put("mode_commentMode", post.getInt("commentMode", 1));
+ prop.putHTML("mode_pageid", pagename, xml);
try {
- prop.put("mode_author", new String(author, "UTF-8"));
+ prop.putHTML("mode_author", new String(author, "UTF-8"), xml);
} catch (UnsupportedEncodingException e) {
- prop.put("mode_author", new String(author));
+ prop.putHTML("mode_author", new String(author), xml);
}
- prop.put("mode_subject", post.get("subject",""));
+ prop.putHTML("mode_subject", post.get("subject",""), xml);
prop.put("mode_date", dateString(new Date()));
prop.putWiki("mode_page", post.get("content", ""));
- prop.put("mode_page-code", post.get("content", ""));
+ prop.putHTML("mode_page-code", post.get("content", ""), xml);
}
- else prop.put("mode",3); //access denied (no rights)
+ else prop.put("mode", "3"); //access denied (no rights)
}
else if(post.get("delete", "").equals("try")) {
if(hasRights) {
- prop.put("mode",4);
- prop.put("mode_pageid",pagename);
+ prop.put("mode", "4");
+ prop.put("mode_pageid", pagename);
try {
- prop.put("mode_author",new String(page.author(), "UTF-8"));
+ prop.putHTML("mode_author",new String(page.author(), "UTF-8"), xml);
} catch (UnsupportedEncodingException e) {
- prop.put("mode_author",new String(page.author()));
+ prop.putHTML("mode_author",new String(page.author()), xml);
}
try {
- prop.put("mode_subject",new String(page.subject(),"UTF-8"));
+ prop.putHTML("mode_subject",new String(page.subject(),"UTF-8"), xml);
} catch (UnsupportedEncodingException e) {
- prop.put("mode_subject",new String(page.subject()));
+ prop.putHTML("mode_subject",new String(page.subject()), xml);
}
}
- else prop.put("mode",3); //access denied (no rights)
+ else prop.put("mode", "3"); //access denied (no rights)
}
else if(post.containsKey("import")) {
- prop.put("mode",5);
- prop.put("mode_state",0);
+ prop.put("mode", "5");
+ prop.put("mode_state", "0");
}
else if(post.containsKey("xmlfile")) {
- prop.put("mode",5);
+ prop.put("mode", "5");
if(switchboard.blogDB.importXML(new String((byte[])post.get("xmlfile$file")))) {
- prop.put("mode_state",1);
+ prop.put("mode_state", "1");
}
else {
- prop.put("mode_state",2);
+ prop.put("mode_state", "2");
}
}
else {
// show blog-entry/entries
- prop.put("mode", 0); //viewing
+ prop.put("mode", "0"); //viewing
if(pagename.equals(DEFAULT_PAGE)) {
// XXX: where are "peername" and "address" used in the template?
// XXX: "clientname" is already set to the peername, no need for a new setting
- prop.put("peername", yacyCore.seedDB.mySeed().getName());
+ prop.putHTML("peername", yacyCore.seedDB.mySeed().getName(), xml);
prop.put("address", address);
//index all entries
putBlogDefault(prop, switchboard, address, start, num, hasRights, xml);
}
else {
//only show 1 entry
- prop.put("mode_entries",1);
+ prop.put("mode_entries", "1");
putBlogEntry(prop, page, address, 0, hasRights, xml);
}
}
@@ -304,14 +304,14 @@ public class Blog {
hasRights,
xml);
}
- prop.put("mode_entries",count);
+ prop.put("mode_entries", count);
if(i.hasNext()) {
- prop.put("mode_moreentries",1); //more entries are availible
- prop.put("mode_moreentries_start",nextstart);
- prop.put("mode_moreentries_num",num);
+ prop.put("mode_moreentries", "1"); //more entries are availible
+ prop.put("mode_moreentries_start", nextstart);
+ prop.put("mode_moreentries_num", num);
} else {
- prop.put("moreentries",0);
+ prop.put("moreentries", "0");
}
} catch (IOException e) { serverLog.logSevere("BLOG", "Error reading blog-DB", e); }
return prop;
@@ -327,23 +327,23 @@ public class Blog {
// subject
try {
- prop.put("mode_entries_" + number + "_subject", new String(entry.subject(),"UTF-8"));
+ prop.putHTML("mode_entries_" + number + "_subject", new String(entry.subject(),"UTF-8"), xml);
} catch (UnsupportedEncodingException e) {
- prop.put("mode_entries_" + number + "_subject", new String(entry.subject()));
+ prop.putHTML("mode_entries_" + number + "_subject", new String(entry.subject()), xml);
}
// author
try {
- prop.put("mode_entries_" + number + "_author", new String(entry.author(),"UTF-8"));
+ prop.putHTML("mode_entries_" + number + "_author", new String(entry.author(),"UTF-8"), xml);
} catch (UnsupportedEncodingException e) {
- prop.put("mode_entries_" + number + "_author", new String(entry.author()));
+ prop.putHTML("mode_entries_" + number + "_author", new String(entry.author()), xml);
}
// comments
if(entry.getCommentMode() == 0) {
- prop.put("mode_entries_" + number + "_commentsactive", 0);
+ prop.put("mode_entries_" + number + "_commentsactive", "0");
} else {
- prop.put("mode_entries_" + number + "_commentsactive", 1);
+ prop.put("mode_entries_" + number + "_commentsactive", "1");
prop.put("mode_entries_" + number + "_commentsactive_pageid", entry.key());
prop.put("mode_entries_" + number + "_commentsactive_address", address);
try {
@@ -360,17 +360,17 @@ public class Blog {
prop.put("mode_entries_" + number + "_ip", entry.ip());
if(xml) {
- prop.putASIS("mode_entries_" + number + "_page", entry.page());
+ prop.put("mode_entries_" + number + "_page", entry.page());
prop.put("mode_entries_" + number + "_timestamp", entry.timestamp());
} else {
prop.putWiki("mode_entries_" + number + "_page", entry.page());
}
if(hasRights) {
- prop.put("mode_entries_" + number + "_admin", 1);
+ prop.put("mode_entries_" + number + "_admin", "1");
prop.put("mode_entries_" + number + "_admin_pageid",entry.key());
} else {
- prop.put("mode_entries_" + number + "_admin", 0);
+ prop.put("mode_entries_" + number + "_admin", "0");
}
return prop;
diff --git a/htroot/BlogComments.java b/htroot/BlogComments.java
index e22210e62..bc245f83f 100644
--- a/htroot/BlogComments.java
+++ b/htroot/BlogComments.java
@@ -82,8 +82,8 @@ public class BlogComments {
blogBoard.entry page = null;
boolean hasRights = switchboard.verifyAuthentication(header, true);
- if(hasRights) prop.put("mode_admin",1);
- else prop.put("mode_admin",0);
+ if (hasRights) prop.put("mode_admin", "1");
+ else prop.put("mode_admin", "0");
if (post == null) {
post = new serverObjects();
@@ -130,7 +130,7 @@ public class BlogComments {
byte[] content;
if(!post.get("content", "").equals(""))
{
- if(post.get("subject", "").equals("")) post.put("subject", "no title");
+ if(post.get("subject", "").equals("")) post.putHTML("subject", "no title");
try {
content = post.get("content", "").getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
@@ -201,21 +201,21 @@ public class BlogComments {
if(post.containsKey("preview")) {
//preview the page
- prop.put("mode", 1);//preview
+ prop.put("mode", "1");//preview
prop.put("mode_pageid", pagename);
try {
- prop.put("mode_author", new String(author, "UTF-8"));
+ prop.putHTML("mode_author", new String(author, "UTF-8"));
} catch (UnsupportedEncodingException e) {
- prop.put("mode_author", new String(author));
+ prop.putHTML("mode_author", new String(author));
}
- prop.put("mode_subject", post.get("subject",""));
+ prop.putHTML("mode_subject", post.get("subject",""));
prop.put("mode_date", dateString(new Date()));
prop.putWiki("mode_page", post.get("content", ""));
prop.put("mode_page-code", post.get("content", ""));
}
else {
// show blog-entry/entries
- prop.put("mode", 0); //viewing
+ prop.put("mode", "0"); //viewing
if(pagename.equals("blog_default")) {
prop.put("LOCATION","Blog.html");
}
@@ -223,14 +223,14 @@ public class BlogComments {
//show 1 blog entry
prop.put("mode_pageid", page.key());
try {
- prop.put("mode_subject", new String(page.subject(),"UTF-8"));
+ prop.putHTML("mode_subject", new String(page.subject(),"UTF-8"));
} catch (UnsupportedEncodingException e) {
- prop.put("mode_subject", new String(page.subject()));
+ prop.putHTML("mode_subject", new String(page.subject()));
}
try {
- prop.put("mode_author", new String(page.author(),"UTF-8"));
+ prop.putHTML("mode_author", new String(page.author(),"UTF-8"));
} catch (UnsupportedEncodingException e) {
- prop.put("mode_author", new String(page.author()));
+ prop.putHTML("mode_author", new String(page.author()));
}
try {
prop.put("mode_comments", new String(page.commentsSize(),"UTF-8"));
@@ -240,8 +240,8 @@ public class BlogComments {
prop.put("mode_date", dateString(page.date()));
prop.putWiki("mode_page", page.page());
if(hasRights) {
- prop.put("mode_admin", 1);
- prop.put("mode_admin_pageid",page.key());
+ prop.put("mode_admin", "1");
+ prop.put("mode_admin_pageid", page.key());
}
//show all commments
try {
@@ -268,42 +268,42 @@ public class BlogComments {
if (commentMode == 2 && !hasRights && !entry.isAllowed())
continue;
- prop.put("mode", 0);
- prop.put("mode_entries_"+count+"_pageid",entry.key());
+ prop.put("mode", "0");
+ prop.put("mode_entries_"+count+"_pageid", entry.key());
if(!xml) {
- prop.put("mode_entries_"+count+"_subject", new String(entry.subject(),"UTF-8"));
- prop.put("mode_entries_"+count+"_author", new String(entry.author(),"UTF-8"));
+ prop.putHTML("mode_entries_"+count+"_subject", new String(entry.subject(),"UTF-8"));
+ prop.putHTML("mode_entries_"+count+"_author", new String(entry.author(),"UTF-8"));
prop.putWiki("mode_entries_"+count+"_page", entry.page());
}
else {
- prop.put("mode_entries_"+count+"_subject", new String(entry.subject(),"UTF-8"));
- prop.put("mode_entries_"+count+"_author", new String(entry.author(),"UTF-8"));
- prop.putASIS("mode_entries_"+count+"_page", entry.page());
+ prop.putHTML("mode_entries_"+count+"_subject", new String(entry.subject(),"UTF-8"));
+ prop.putHTML("mode_entries_"+count+"_author", new String(entry.author(),"UTF-8"));
+ prop.put("mode_entries_"+count+"_page", entry.page());
prop.put("mode_entries_"+count+"_timestamp", entry.timestamp());
}
prop.put("mode_entries_"+count+"_date", dateString(entry.date()));
prop.put("mode_entries_"+count+"_ip", entry.ip());
if(hasRights) {
- prop.put("mode_entries_"+count+"_admin", 1);
- prop.put("mode_entries_"+count+"_admin_pageid",page.key());
- prop.put("mode_entries_"+count+"_admin_commentid",pageid);
+ prop.put("mode_entries_"+count+"_admin", "1");
+ prop.put("mode_entries_"+count+"_admin_pageid", page.key());
+ prop.put("mode_entries_"+count+"_admin_commentid", pageid);
if(!entry.isAllowed()) {
- prop.put("mode_entries_"+count+"_admin_moderate", 1);
- prop.put("mode_entries_"+count+"_admin_moderate_pageid",page.key());
- prop.put("mode_entries_"+count+"_admin_moderate_commentid",pageid);
+ prop.put("mode_entries_"+count+"_admin_moderate", "1");
+ prop.put("mode_entries_"+count+"_admin_moderate_pageid", page.key());
+ prop.put("mode_entries_"+count+"_admin_moderate_commentid", pageid);
}
}
else prop.put("mode_entries_"+count+"_admin", 0);
++count;
}
- prop.put("mode_entries",count);
+ prop.put("mode_entries", count);
if(i.hasNext()) {
- prop.put("mode_moreentries",1); //more entries are availible
- prop.put("mode_moreentries_start",nextstart);
- prop.put("mode_moreentries_num",num);
+ prop.put("mode_moreentries", "1"); //more entries are availible
+ prop.put("mode_moreentries_start", nextstart);
+ prop.put("mode_moreentries_num", num);
}
- else prop.put("moreentries",0);
+ else prop.put("moreentries", "0");
} catch (IOException e) {
}
diff --git a/htroot/Bookmarks.java b/htroot/Bookmarks.java
index 1f63e0607..615363589 100644
--- a/htroot/Bookmarks.java
+++ b/htroot/Bookmarks.java
@@ -86,24 +86,24 @@ public class Bookmarks {
//redirect to userpage
/*if(username!="" &&(post == null || !post.containsKey("user") && !post.containsKey("mode")))
prop.put("LOCATION", "/Bookmarks.html?user="+username);*/
- prop.put("user",username);
+ prop.put("user", username);
// set peer address
final String address = yacyCore.seedDB.mySeed().getPublicAddress();
prop.put("address", address);
//defaultvalues
- prop.put("mode", 0);
+ prop.put("mode", "0");
if(isAdmin){
- prop.put("mode", 1);
+ prop.put("mode", "1");
}
- prop.put("mode_edit", 0);
+ prop.put("mode_edit", "0");
prop.put("mode_title", "");
prop.put("mode_description", "");
prop.put("mode_url", "");
prop.put("mode_tags", "");
- prop.put("mode_public", 1); //1=is public
- prop.put("mode_feed", 0); //no newsfeed
+ prop.put("mode_public", "1"); //1=is public
+ prop.put("mode_feed", "0"); //no newsfeed
if(post != null){
if(!isAdmin){
@@ -113,11 +113,11 @@ public class Bookmarks {
}else if(post.containsKey("mode")){
String mode=(String) post.get("mode");
if(mode.equals("add")){
- prop.put("mode", 2);
+ prop.put("mode", "2");
}else if(mode.equals("importxml")){
- prop.put("mode", 3);
+ prop.put("mode", "3");
}else if(mode.equals("importbookmarks")){
- prop.put("mode", 4);
+ prop.put("mode", "4");
}
}else if(post.containsKey("add")){ //add an Entry
String url=(String) post.get("url");
@@ -156,15 +156,15 @@ public class Bookmarks {
}
}else if(post.containsKey("edit")){
String urlHash=(String) post.get("edit");
- prop.put("mode", 2);
+ prop.put("mode", "2");
if (urlHash.length() == 0) {
- prop.put("mode_edit", 0); // create mode
- prop.put("mode_title", (String) post.get("title"));
- prop.put("mode_description", (String) post.get("description"));
+ prop.put("mode_edit", "0"); // create mode
+ prop.putHTML("mode_title", (String) post.get("title"));
+ prop.putHTML("mode_description", (String) post.get("description"));
prop.put("mode_url", (String) post.get("url"));
- prop.put("mode_tags", (String) post.get("tags"));
- prop.put("mode_public", 0);
- prop.put("mode_feed", 0);
+ prop.putHTML("mode_tags", (String) post.get("tags"));
+ prop.put("mode_public", "0");
+ prop.put("mode_feed", "0");
} else {
bookmarksDB.Bookmark bookmark = switchboard.bookmarksDB.getBookmark(urlHash);
if (bookmark == null) {
@@ -174,32 +174,32 @@ public class Bookmarks {
if (urlentry != null) {
indexURLEntry.Components comp = urlentry.comp();
document = plasmaSnippetCache.retrieveDocument(comp.url(), true, 5000, true);
- prop.put("mode_edit", 0); // create mode
+ prop.put("mode_edit", "0"); // create mode
prop.put("mode_url", comp.url().toNormalform(false, true));
- prop.put("mode_title", comp.title());
- prop.put("mode_description", (document == null) ? comp.title(): document.getTitle());
- prop.put("mode_author", comp.author());
- prop.put("mode_tags", (document == null) ? comp.tags() : document.getKeywords(','));
- prop.put("mode_public", 0);
- prop.put("mode_feed", 0); //TODO: check if it IS a feed
+ prop.putHTML("mode_title", comp.title());
+ prop.putHTML("mode_description", (document == null) ? comp.title(): document.getTitle());
+ prop.putHTML("mode_author", comp.author());
+ prop.putHTML("mode_tags", (document == null) ? comp.tags() : document.getKeywords(','));
+ prop.put("mode_public", "0");
+ prop.put("mode_feed", "0"); //TODO: check if it IS a feed
}
if (document != null) document.close();
} else {
// get from the bookmark database
- prop.put("mode_edit", 1); // edit mode
- prop.put("mode_title", bookmark.getTitle());
- prop.put("mode_description", bookmark.getDescription());
+ prop.put("mode_edit", "1"); // edit mode
+ prop.putHTML("mode_title", bookmark.getTitle());
+ prop.putHTML("mode_description", bookmark.getDescription());
prop.put("mode_url", bookmark.getUrl());
- prop.put("mode_tags", bookmark.getTagsString());
+ prop.putHTML("mode_tags", bookmark.getTagsString());
if (bookmark.getPublic()) {
- prop.put("mode_public", 1);
+ prop.put("mode_public", "1");
} else {
- prop.put("mode_public", 0);
+ prop.put("mode_public", "0");
}
if (bookmark.getFeed()) {
- prop.put("mode_feed", 1);
+ prop.put("mode_feed", "1");
} else {
- prop.put("mode_feed", 0);
+ prop.put("mode_feed", "0");
}
}
}
@@ -244,8 +244,8 @@ public class Bookmarks {
prop.put("num-bookmarks", switchboard.bookmarksDB.bookmarksSize());
while(it.hasNext()){
tag=(Tag) it.next();
- prop.put("taglist_"+count+"_name", tag.getFriendlyName());
- prop.put("taglist_"+count+"_tag", tag.getTagName());
+ prop.putHTML("taglist_"+count+"_name", tag.getFriendlyName());
+ prop.putHTML("taglist_"+count+"_tag", tag.getTagName());
prop.put("taglist_"+count+"_num", tag.size());
count++;
}
@@ -274,11 +274,11 @@ public class Bookmarks {
prop.put("bookmarks_"+count+"_link", "/FeedReader_p.html?url="+bookmark.getUrl());
else
prop.put("bookmarks_"+count+"_link",bookmark.getUrl());
- prop.put("bookmarks_"+count+"_title", bookmark.getTitle());
- prop.put("bookmarks_"+count+"_description", bookmark.getDescription());
+ prop.putHTML("bookmarks_"+count+"_title", bookmark.getTitle());
+ prop.putHTML("bookmarks_"+count+"_description", bookmark.getDescription());
prop.put("bookmarks_"+count+"_date", serverDate.dateToiso8601(new Date(bookmark.getTimeStamp())));
prop.put("bookmarks_"+count+"_rfc822date", httpc.dateString(new Date(bookmark.getTimeStamp())));
- prop.put("bookmarks_"+count+"_public", (bookmark.getPublic()? 1:0));
+ prop.put("bookmarks_"+count+"_public", (bookmark.getPublic() ? "1" : "0"));
//List Tags.
tags=bookmark.getTags();
@@ -294,12 +294,12 @@ public class Bookmarks {
count++;
}
}
- prop.put("tag", tagName);
+ prop.putHTML("tag", tagName);
prop.put("start", start);
if(it.hasNext()){
- prop.put("next-page", 1);
+ prop.put("next-page", "1");
prop.put("next-page_start", start+max_count);
- prop.put("next-page_tag", tagName);
+ prop.putHTML("next-page_tag", tagName);
prop.put("next-page_num", max_count);
}
if(start >= max_count){
@@ -307,9 +307,9 @@ public class Bookmarks {
if(start <0){
start=0;
}
- prop.put("prev-page", 1);
+ prop.put("prev-page", "1");
prop.put("prev-page_start", start);
- prop.put("prev-page_tag", tagName);
+ prop.putHTML("prev-page_tag", tagName);
prop.put("prev-page_num", max_count);
}
prop.put("bookmarks", count);
diff --git a/htroot/CacheAdmin_p.java b/htroot/CacheAdmin_p.java
index 27e6aec23..0e45dc940 100644
--- a/htroot/CacheAdmin_p.java
+++ b/htroot/CacheAdmin_p.java
@@ -161,13 +161,13 @@ public class CacheAdmin_p {
final plasmaParserDocument document = switchboard.parser.transformScraper(url, mimeType, sourceCharset, scraper);
- prop.put("info_type_title", scraper.getTitle());
+ prop.putHTML("info_type_title", scraper.getTitle());
int i;
String[] t = document.getSectionTitles();
prop.put("info_type_headlines", t.length);
for (i = 0; i < t.length; i++)
- prop.put("info_type_headlines_" + i + "_headline",
+ prop.putHTML("info_type_headlines_" + i + "_headline",
t[i].replaceAll("\n", "").trim());
formatAnchor(prop, document.getHyperlinks(), "links");
@@ -177,13 +177,13 @@ public class CacheAdmin_p {
formatAnchor(prop, document.getApplinks(), "apps");
formatAnchor(prop, document.getEmaillinks(), "email");
- prop.put("info_type_text", new String(scraper.getText()));
+ prop.putHTML("info_type_text", new String(scraper.getText()));
i = 0;
final Iterator sentences = document.getSentences(false);
if (sentences != null)
while (sentences.hasNext()) {
- prop.put("info_type_lines_" + i + "_line",
+ prop.putHTML("info_type_lines_" + i + "_line",
new String((StringBuffer) sentences.next()).replaceAll("\n", "").trim());
i++;
}
@@ -214,9 +214,9 @@ public class CacheAdmin_p {
tree.ensureCapacity((list == null) ? 70 : (list.length + 1) * 256);
linkPathString(prop, ((pathString.length() == 0) ? ("/") : (pathString)), true);
if (list == null) {
- prop.put("info_empty", 1);
+ prop.put("info_empty", "1");
} else {
- prop.put("info_empty", 0);
+ prop.put("info_empty", "0");
final TreeSet dList = new TreeSet();
final TreeSet fList = new TreeSet();
int size = list.length - 1, i = size;
@@ -247,10 +247,10 @@ public class CacheAdmin_p {
}
}
- prop.put("cachesize", Long.toString(plasmaHTCache.curCacheSize/1024));
- prop.put("cachemax", Long.toString(plasmaHTCache.maxCacheSize/1024));
+ prop.putNum("cachesize", plasmaHTCache.curCacheSize/1024);
+ prop.putNum("cachemax", plasmaHTCache.maxCacheSize/1024);
prop.put("path", path.toString());
- prop.put("info_info", info.toString());
+ prop.putHTML("info_info", info.toString());
/* prop.put("info_tree", tree.toString()); */
// return rewrite properties
@@ -259,9 +259,9 @@ public class CacheAdmin_p {
private static void formatHeader(serverObjects prop, Map header) {
if (header == null) {
- prop.put("info_header", 0);
+ prop.put("info_header", "0");
} else {
- prop.put("info_header", 1);
+ prop.put("info_header", "1");
int i = 0;
final Iterator iter = header.entrySet().iterator();
Map.Entry entry;
@@ -301,12 +301,12 @@ public class CacheAdmin_p {
int i = 0;
while (iter.hasNext()) {
ie = (htmlFilterImageEntry) iter.next();
- prop.put("info_type_use.images_images_" + i + "_name", ie.alt().replaceAll("\n", "").trim());
- prop.put("info_type_use.images_images_" + i + "_link",
+ prop.putHTML("info_type_use.images_images_" + i + "_name", ie.alt().replaceAll("\n", "").trim());
+ prop.putHTML("info_type_use.images_images_" + i + "_link",
de.anomic.data.htmlTools.encodeUnicode2html(ie.url().toNormalform(false, true), false));
i++;
}
- prop.put("info_type_use.images", (i == 0) ? 0 : 1);
+ prop.put("info_type_use.images", (i == 0) ? "0" : "1");
}
private static void linkPathString(serverObjects prop, String path, boolean dir) {
@@ -316,13 +316,12 @@ public class CacheAdmin_p {
if (dir) { e = elements.length; } else { e = elements.length - 1; }
for(i = 0; i < e; i++) {
if (elements[i].length() == 0) continue;
- prop.put("paths_" + count + "_path", dirs);
- prop.put("paths_" + count + "_name", elements[i]);
+ prop.putHTML("paths_" + count + "_path", dirs);
+ prop.putHTML("paths_" + count + "_name", elements[i]);
dirs += "/" + elements[i];
count++;
}
prop.put("paths", count);
return;
}
-
}
diff --git a/htroot/ConfigBasic.java b/htroot/ConfigBasic.java
index d639579a5..4d3b0ee72 100644
--- a/htroot/ConfigBasic.java
+++ b/htroot/ConfigBasic.java
@@ -185,18 +185,18 @@ public class ConfigBasic {
host = serverDomains.myPublicLocalIP().getHostAddress();
}
- prop.put("reconnect", 1);
+ prop.put("reconnect", "1");
prop.put("reconnect_host", host);
prop.put("nextStep_host", host);
prop.put("reconnect_port", port);
- prop.put("nextStep_port", port);
- prop.put("reconnect_sslSupport", theServerCore.withSSL() ? 1:0);
- prop.put("nextStep_sslSupport", theServerCore.withSSL() ? 1:0);
+ prop.put("nextStep_port", port);
+ prop.put("reconnect_sslSupport", theServerCore.withSSL() ? "1" : "0");
+ prop.put("nextStep_sslSupport", theServerCore.withSSL() ? "1" : "0");
// force reconnection in 7 seconds
theServerCore.reconnect(7000);
} else {
- prop.put("reconnect", 0);
+ prop.put("reconnect", "0");
}
// check if values are proper
@@ -209,9 +209,9 @@ public class ConfigBasic {
httpdFileHandler.initDefaultPath();
}
- prop.put("statusName", (properName) ? 1 : 0);
- prop.put("statusPassword", (properPW) ? 1 : 0);
- prop.put("statusPort", (properPort) ? 1 : 0);
+ prop.put("statusName", properName ? "1" : "0");
+ prop.put("statusPassword", properPW ? "1" : "0");
+ prop.put("statusPort", properPort ? "1" : "0");
if (reconnect) {
prop.put("nextStep", NEXTSTEP_RECONNECT);
} else if (!properPW) {
@@ -230,33 +230,33 @@ public class ConfigBasic {
prop.put("defaultPort", env.getConfig("port", "8080"));
lang = env.getConfig("locale.language", "default"); // re-assign lang, may have changed
if (lang.equals("default")) {
- prop.put("langDeutsch", 0);
- prop.put("langEnglish", 1);
+ prop.put("langDeutsch", "0");
+ prop.put("langEnglish", "1");
} else if (lang.equals("de")) {
- prop.put("langDeutsch", 1);
- prop.put("langEnglish", 0);
+ prop.put("langDeutsch", "1");
+ prop.put("langEnglish", "0");
} else {
- prop.put("langDeutsch", 0);
- prop.put("langEnglish", 0);
+ prop.put("langDeutsch", "0");
+ prop.put("langEnglish", "0");
}
return prop;
}
/*
private boolean findUPnPRouter(int timeout) {
- // determine if the upnp port forwarding class is available and load it dynamically
+ // determine if the upnp port forwarding class is available and load it dynamically
Object[] UpnpForwarder = this.getUpnpForwarderClasses();
serverPortForwarding upnp = (serverPortForwarding) UpnpForwarder[0];
- Method scanForRouter = (Method) UpnpForwarder[1];
+ Method scanForRouter = (Method) UpnpForwarder[1];
if ((upnp == null) || (scanForRouter == null)) return false;
// trying to find a upnp router
try {
Object result = scanForRouter.invoke(upnp, new Object[]{new Integer(timeout)});
if ((result != null)&&(result instanceof Boolean)) {
- return ((Boolean)result).booleanValue();
+ return ((Boolean)result).booleanValue();
}
- } catch (Exception e) { // ignore this error
+ } catch (Exception e) { // ignore this error
} catch (Error e) {} // ignore this error
return false;
}
@@ -274,22 +274,22 @@ public class ConfigBasic {
// trying to get the proper method for router scanning
scanForRouter = upnp.getClass().getMethod("routerAvailable", new Class[] {int.class});
- } catch (Exception e) { // ignore this error
- } catch (Error e) {} // ignore this error
+ } catch (Exception e) { // ignore this error
+ } catch (Error e) {} // ignore this error
return new Object[]{upnp,scanForRouter};
}
*/
private void reinitPortForwarding(serverObjects post, serverSwitch env) {
if ((post != null)) {
- try {
+ try {
boolean reinitPortForwarding = false;
if (post.containsKey("enableUpnp")) {
// upnp should be enabled
env.setConfig("portForwarding.Enabled","true");
env.setConfig("portForwarding.Type", "upnp");
- reinitPortForwarding = true;
+ reinitPortForwarding = true;
} else {
String currentForwarder = env.getConfig("portForwarding.Type", "none");
boolean otherForwarderEnabled = serverCore.portForwardingEnabled && serverCore.portForwarding != null && !currentForwarder.equalsIgnoreCase("upnp");
@@ -301,21 +301,20 @@ public class ConfigBasic {
env.setConfig("portForwarding.Type", "none");
reinitPortForwarding = true;
}
- }
+ }
if (reinitPortForwarding) {
if ((serverCore.portForwardingEnabled) && (serverCore.portForwarding != null)) {
// trying to shutdown the current port forwarding channel
- serverCore.portForwarding.disconnect();
- }
+ serverCore.portForwarding.disconnect();
+ }
// trying to reinitialize the port forwarding
serverCore httpd = (serverCore) env.getThread("10_httpd");
- httpd.initPortForwarding();
+ httpd.initPortForwarding();
}
} catch (Exception e) { /* */ }
- }
+ }
}
-
}
diff --git a/htroot/ConfigLanguage_p.java b/htroot/ConfigLanguage_p.java
index 668ac3b7a..8ceb1f15d 100644
--- a/htroot/ConfigLanguage_p.java
+++ b/htroot/ConfigLanguage_p.java
@@ -1,49 +1,49 @@
-// Language_p.java
-// -----------------------
-// part of YACY
-// (C) by Michael Peter Christen; [email protected]
-// first published on http://www.anomic.de
-// Frankfurt, Germany, 2004
-//
-// This File is contributed by Alexander Schier
-// last change: 25.05.2005
-//
-// 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
-//
-// Using this software in any meaning (reading, learning, copying, compiling,
-// running) means that you agree that the Author(s) is (are) not responsible
-// for cost, loss of data or any harm that may be caused directly or indirectly
-// 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.
-//
-// Any changes to this file according to the GPL as documented in the file
-// gpl.txt aside this file in the shipment you received can be done to the
-// lines that follows this copyright notice here, but changes must not be
-// done inside the copyright notive above. A re-distribution must contain
-// the intact and unchanged copyright notice.
-// Contributions and changes to the program code must be marked as such.
-
-// You must compile this file with
-// javac -classpath .:../Classes Blacklist_p.java
-// if the shell's current path is HTROOT
+//Language_p.java
+//-----------------------
+//part of YACY
+//(C) by Michael Peter Christen; [email protected]
+//first published on http://www.anomic.de
+//Frankfurt, Germany, 2004
+
+//This File is contributed by Alexander Schier
+//last change: 25.05.2005
+
+//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
+
+//Using this software in any meaning (reading, learning, copying, compiling,
+//running) means that you agree that the Author(s) is (are) not responsible
+//for cost, loss of data or any harm that may be caused directly or indirectly
+//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.
+
+//Any changes to this file according to the GPL as documented in the file
+//gpl.txt aside this file in the shipment you received can be done to the
+//lines that follows this copyright notice here, but changes must not be
+//done inside the copyright notive above. A re-distribution must contain
+//the intact and unchanged copyright notice.
+//Contributions and changes to the program code must be marked as such.
+
+//You must compile this file with
+//javac -classpath .:../Classes Blacklist_p.java
+//if the shell's current path is HTROOT
import java.io.BufferedWriter;
import java.io.File;
@@ -67,94 +67,93 @@ import de.anomic.yacy.yacyURL;
public class ConfigLanguage_p {
- public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
- //listManager.switchboard = (plasmaSwitchboard) env;
- serverObjects prop = new serverObjects();
- plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
- String langPath = new File(env.getRootPath(), env.getConfig("locale.work", "DATA/LOCALE/locales")).toString();
-
- //Fallback
- //prop.put("currentlang", ""); //is done by Translationtemplate
- prop.put("status", 0);//nothing
-
- String[] langFiles = listManager.getDirListing(langPath);
- if(langFiles == null){
- return prop;
- }
-
- if (post != null){
- //change language
- if(post.containsKey("use_button") && (String)post.get("language") != null){
- translator.changeLang(env, langPath, (String)post.get("language"));
-
- //delete language file
- }else if(post.containsKey("delete")){
- File langfile= new File(langPath, (String)post.get("language"));
- langfile.delete();
-
- //load language file from URL
- } else if (post.containsKey("url")){
- String url = (String)post.get("url");
- ArrayList langVector;
- try{
- yacyURL u = new yacyURL(url, null);
- langVector = nxTools.strings(httpc.wget(u, u.getHost(), 6000, null, null, switchboard.remoteProxyConfig, null, null), "UTF-8");
- }catch(IOException e){
- prop.put("status", 1);//unable to get url
- prop.put("status_url", url);
- return prop;
- }
- try{
- Iterator it = langVector.iterator();
- File langFile = new File(langPath, url.substring(url.lastIndexOf("/"), url.length()));
- BufferedWriter bw = new BufferedWriter(new PrintWriter(new FileWriter(langFile)));
-
- while(it.hasNext()){
- bw.write(it.next() + "\n");
- }
- bw.close();
- }catch(IOException e){
- prop.put("status", 2);//error saving the language file
- return prop;
- }
- if(post.containsKey("use_lang") && ((String)post.get("use_lang")).equals("on")){
- translator.changeLang(env, langPath, url.substring(url.lastIndexOf("/"), url.length()));
- }
- }
- }
-
- //reread language files
- langFiles = listManager.getDirListing(langPath);
- int i;
- HashMap langNames = translator.langMap(env);
+ public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
+ //listManager.switchboard = (plasmaSwitchboard) env;
+ serverObjects prop = new serverObjects();
+ plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
+ String langPath = new File(env.getRootPath(), env.getConfig("locale.work", "DATA/LOCALE/locales")).toString();
+
+ //Fallback
+ //prop.put("currentlang", ""); //is done by Translationtemplate
+ prop.put("status", "0");//nothing
+
+ String[] langFiles = listManager.getDirListing(langPath);
+ if(langFiles == null){
+ return prop;
+ }
+
+ if (post != null){
+ //change language
+ if(post.containsKey("use_button") && (String)post.get("language") != null){
+ translator.changeLang(env, langPath, (String)post.get("language"));
+
+ //delete language file
+ }else if(post.containsKey("delete")){
+ File langfile= new File(langPath, (String)post.get("language"));
+ langfile.delete();
+
+ //load language file from URL
+ } else if (post.containsKey("url")){
+ String url = (String)post.get("url");
+ ArrayList langVector;
+ try{
+ yacyURL u = new yacyURL(url, null);
+ langVector = nxTools.strings(httpc.wget(u, u.getHost(), 6000, null, null, switchboard.remoteProxyConfig, null, null), "UTF-8");
+ }catch(IOException e){
+ prop.put("status", "1");//unable to get url
+ prop.put("status_url", url);
+ return prop;
+ }
+ try{
+ Iterator it = langVector.iterator();
+ File langFile = new File(langPath, url.substring(url.lastIndexOf("/"), url.length()));
+ BufferedWriter bw = new BufferedWriter(new PrintWriter(new FileWriter(langFile)));
+
+ while(it.hasNext()){
+ bw.write(it.next() + "\n");
+ }
+ bw.close();
+ }catch(IOException e){
+ prop.put("status", "2");//error saving the language file
+ return prop;
+ }
+ if(post.containsKey("use_lang") && ((String)post.get("use_lang")).equals("on")){
+ translator.changeLang(env, langPath, url.substring(url.lastIndexOf("/"), url.length()));
+ }
+ }
+ }
+
+ //reread language files
+ langFiles = listManager.getDirListing(langPath);
+ int i;
+ HashMap langNames = translator.langMap(env);
String langKey, langName;
-
+
//virtual entry
- prop.put("langlist_0_file", "default");
- prop.put("langlist_0_name", ((langNames.get("default") == null) ? "default" : (String) langNames.get("default")));
- prop.put("langlist_0_selected", "selected");
-
- for(i=0;i<= langFiles.length-1 ;i++){
- if(langFiles[i].endsWith(".lng")){
- //+1 because of the virtual entry "default" at top
- langKey = langFiles[i].substring(0, langFiles[i].length() -4);
- langName = (String) langNames.get(langKey);
- prop.put("langlist_"+(i+1)+"_file", langFiles[i]);
- prop.put("langlist_"+(i+1)+"_name", ((langName == null) ? langKey : langName));
- if(env.getConfig("locale.language", "default").equals(langKey)) {
- prop.put("langlist_"+(i+1)+"_selected", "selected");
- prop.put("langlist_0_selected", " "); // reset Default
- } else {
- prop.put("langlist_"+(i+1)+"_selected", " ");
- }
- }
- }
- prop.put("langlist", (i+1));
-
- //is done by Translationtemplate
- //langName = (String) langNames.get(env.getConfig("locale.language", "default"));
- //prop.put("currentlang", ((langName == null) ? "default" : langName));
- return prop;
- }
+ prop.put("langlist_0_file", "default");
+ prop.put("langlist_0_name", ((langNames.get("default") == null) ? "default" : (String) langNames.get("default")));
+ prop.put("langlist_0_selected", "selected");
+ for(i=0;i<= langFiles.length-1 ;i++){
+ if(langFiles[i].endsWith(".lng")){
+ //+1 because of the virtual entry "default" at top
+ langKey = langFiles[i].substring(0, langFiles[i].length() -4);
+ langName = (String) langNames.get(langKey);
+ prop.put("langlist_"+(i+1)+"_file", langFiles[i]);
+ prop.put("langlist_"+(i+1)+"_name", ((langName == null) ? langKey : langName));
+ if(env.getConfig("locale.language", "default").equals(langKey)) {
+ prop.put("langlist_"+(i+1)+"_selected", "selected");
+ prop.put("langlist_0_selected", " "); // reset Default
+ } else {
+ prop.put("langlist_"+(i+1)+"_selected", " ");
+ }
+ }
+ }
+ prop.put("langlist", (i+1));
+
+ //is done by Translationtemplate
+ //langName = (String) langNames.get(env.getConfig("locale.language", "default"));
+ //prop.put("currentlang", ((langName == null) ? "default" : langName));
+ return prop;
+ }
}
diff --git a/htroot/ConfigNetwork_p.java b/htroot/ConfigNetwork_p.java
index fea7dd84f..4811c02a4 100644
--- a/htroot/ConfigNetwork_p.java
+++ b/htroot/ConfigNetwork_p.java
@@ -54,26 +54,26 @@ public class ConfigNetwork_p {
indexDistribute = false;
indexReceive = false;
if ((clustermode.equals("privatepeer")) || (clustermode.equals("publicpeer"))) {
- prop.put("commitRobinsonWithoutRemoteIndexing", 1);
+ prop.put("commitRobinsonWithoutRemoteIndexing", "1");
crawlResponse = false;
}
if ((clustermode.equals("privatecluster")) || (clustermode.equals("publiccluster"))) {
- prop.put("commitRobinsonWithRemoteIndexing", 1);
+ prop.put("commitRobinsonWithRemoteIndexing", "1");
crawlResponse = true;
}
commit = 1;
} else {
if (!indexDistribute && !indexReceive) {
- prop.put("commitDHTIsRobinson", 1);
+ prop.put("commitDHTIsRobinson", "1");
commit = 2;
} else if (indexDistribute && indexReceive) {
commit = 1;
} else {
- prop.put("commitDHTNoGlobalSearch", 1);
+ prop.put("commitDHTNoGlobalSearch", "1");
commit = 1;
}
if (!crawlResponse) {
- prop.put("commitCrawlPlea", 1);
+ prop.put("commitCrawlPlea", "1");
}
}
@@ -138,7 +138,7 @@ public class ConfigNetwork_p {
prop.put("commit", commit);
// write remote crawl request settings
- prop.put("crawlResponse", sb.getConfigBool("crawlResponse", false) ? 1 : 0);
+ prop.put("crawlResponse", sb.getConfigBool("crawlResponse", false) ? "1" : "0");
long RTCbusySleep = 100;
try {
RTCbusySleep = Integer.parseInt(env.getConfig(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_BUSYSLEEP, "100"));
@@ -148,31 +148,31 @@ public class ConfigNetwork_p {
boolean indexDistribute = sb.getConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, "true").equals("true");
boolean indexReceive = sb.getConfig("allowReceiveIndex", "true").equals("true");
- prop.put("indexDistributeChecked", (indexDistribute) ? 1 : 0);
- prop.put("indexDistributeWhileCrawling.on", (sb.getConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_CRAWLING, "true").equals("true")) ? 1 : 0);
- prop.put("indexDistributeWhileCrawling.off", (sb.getConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_CRAWLING, "true").equals("true")) ? 0 : 1);
- prop.put("indexDistributeWhileIndexing.on", (sb.getConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_INDEXING, "true").equals("true")) ? 1 : 0);
- prop.put("indexDistributeWhileIndexing.off", (sb.getConfig(plasmaSwitchboard.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);
- prop.put("peertags", serverCodings.set2string(yacyCore.seedDB.mySeed().getPeerTags(), ",", false));
+ prop.put("indexDistributeChecked", (indexDistribute) ? "1" : "0");
+ prop.put("indexDistributeWhileCrawling.on", (sb.getConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_CRAWLING, "true").equals("true")) ? "1" : "0");
+ prop.put("indexDistributeWhileCrawling.off", (sb.getConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_CRAWLING, "true").equals("true")) ? "0" : "1");
+ prop.put("indexDistributeWhileIndexing.on", (sb.getConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_INDEXING, "true").equals("true")) ? "1" : "0");
+ prop.put("indexDistributeWhileIndexing.off", (sb.getConfig(plasmaSwitchboard.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");
+ prop.putHTML("peertags", serverCodings.set2string(yacyCore.seedDB.mySeed().getPeerTags(), ",", false));
// set seed information directly
yacyCore.seedDB.mySeed().setFlagAcceptRemoteCrawl(sb.getConfigBool("crawlResponse", false));
yacyCore.seedDB.mySeed().setFlagAcceptRemoteIndex(indexReceive);
// set p2p/robinson mode flags and values
- prop.put("p2p.checked", (indexDistribute || indexReceive) ? 1 : 0);
- prop.put("robinson.checked", (indexDistribute || indexReceive) ? 0 : 1);
+ prop.put("p2p.checked", (indexDistribute || indexReceive) ? "1" : "0");
+ prop.put("robinson.checked", (indexDistribute || indexReceive) ? "0" : "1");
prop.put("cluster.peers.ipport", sb.getConfig("cluster.peers.ipport", ""));
prop.put("cluster.peers.yacydomain", sb.getConfig("cluster.peers.yacydomain", ""));
prop.put("cluster.peers.yacydomain.hashes", (sb.clusterhashes.size() == 0) ? "" : sb.clusterhashes.toString());
// set p2p mode flags
- prop.put("privatepeerChecked", (sb.getConfig("cluster.mode", "").equals("privatepeer")) ? 1 : 0);
- prop.put("privateclusterChecked", (sb.getConfig("cluster.mode", "").equals("privatecluster")) ? 1 : 0);
- prop.put("publicclusterChecked", (sb.getConfig("cluster.mode", "").equals("publiccluster")) ? 1 : 0);
- prop.put("publicpeerChecked", (sb.getConfig("cluster.mode", "").equals("publicpeer")) ? 1 : 0);
+ prop.put("privatepeerChecked", (sb.getConfig("cluster.mode", "").equals("privatepeer")) ? "1" : "0");
+ prop.put("privateclusterChecked", (sb.getConfig("cluster.mode", "").equals("privatecluster")) ? "1" : "0");
+ prop.put("publicclusterChecked", (sb.getConfig("cluster.mode", "").equals("publiccluster")) ? "1" : "0");
+ prop.put("publicpeerChecked", (sb.getConfig("cluster.mode", "").equals("publicpeer")) ? "1" : "0");
return prop;
}
diff --git a/htroot/ConfigProfile_p.java b/htroot/ConfigProfile_p.java
index 62a0aac1e..5cfdcf7f6 100644
--- a/htroot/ConfigProfile_p.java
+++ b/htroot/ConfigProfile_p.java
@@ -91,8 +91,8 @@ public class ConfigProfile_p {
profile.setProperty("comment", (String)post.get("comment"));
- prop.put("name", profile.getProperty("name", ""));
- prop.put("nickname", profile.getProperty("nickname", ""));
+ prop.putHTML("name", profile.getProperty("name", ""));
+ prop.putHTML("nickname", profile.getProperty("nickname", ""));
prop.put("homepage", profile.getProperty("homepage", ""));
prop.put("email", profile.getProperty("email", ""));
@@ -102,7 +102,7 @@ public class ConfigProfile_p {
prop.put("msn", profile.getProperty("msn", ""));
prop.put("skype", profile.getProperty("skype", ""));
- prop.put("comment", profile.getProperty("comment", ""));
+ prop.putHTML("comment", profile.getProperty("comment", ""));
// write new values
FileOutputStream fileOut = null;
@@ -122,8 +122,8 @@ public class ConfigProfile_p {
}
else{
- prop.put("name", profile.getProperty("name", ""));
- prop.put("nickname", profile.getProperty("nickname", ""));
+ prop.putHTML("name", profile.getProperty("name", ""));
+ prop.putHTML("nickname", profile.getProperty("nickname", ""));
prop.put("homepage", profile.getProperty("homepage", ""));
prop.put("email", profile.getProperty("email", ""));
@@ -133,7 +133,7 @@ public class ConfigProfile_p {
prop.put("msn", profile.getProperty("msn", ""));
prop.put("skype", profile.getProperty("skype", ""));
- prop.put("comment", profile.getProperty("comment", ""));
+ prop.putHTML("comment", profile.getProperty("comment", ""));
}
return prop;
diff --git a/htroot/ConfigRobotsTxt_p.java b/htroot/ConfigRobotsTxt_p.java
index 8d542914a..d61f8b155 100644
--- a/htroot/ConfigRobotsTxt_p.java
+++ b/htroot/ConfigRobotsTxt_p.java
@@ -83,19 +83,19 @@ public class ConfigRobotsTxt_p {
}
}
- 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(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");
return prop;
}
}
diff --git a/htroot/ConfigSkins_p.java b/htroot/ConfigSkins_p.java
index 9a80f2b1e..bd4c66193 100644
--- a/htroot/ConfigSkins_p.java
+++ b/htroot/ConfigSkins_p.java
@@ -97,7 +97,7 @@ public class ConfigSkins_p {
//Fallback
prop.put("currentskin", "");
- prop.put("status", 0);//nothing
+ prop.put("status", "0"); //nothing
String[] skinFiles = listManager.getDirListing(skinPath);
if(skinFiles == null){
@@ -129,7 +129,7 @@ public class ConfigSkins_p {
yacyURL u = new yacyURL(url, null);
skinVector = nxTools.strings(httpc.wget(u, u.getHost(), 6000, null, null, switchboard.remoteProxyConfig, null, null), "UTF-8");
}catch(IOException e){
- prop.put("status", 1);//unable to get URL
+ prop.put("status", "1");//unable to get URL
prop.put("status_url", url);
return prop;
}
@@ -143,7 +143,7 @@ public class ConfigSkins_p {
}
bw.close();
}catch(IOException e){
- prop.put("status", 2);//error saving the skin
+ prop.put("status", "2");//error saving the skin
return prop;
}
if(post.containsKey("use_skin") && ((String)post.get("use_skin")).equals("on")){
@@ -167,5 +167,4 @@ public class ConfigSkins_p {
prop.put("currentskin", env.getConfig("currentSkin", "default"));
return prop;
}
-
}
diff --git a/htroot/ConfigUpdate_p.java b/htroot/ConfigUpdate_p.java
index 037e18464..8be4358d5 100644
--- a/htroot/ConfigUpdate_p.java
+++ b/htroot/ConfigUpdate_p.java
@@ -45,8 +45,8 @@ public class ConfigUpdate_p {
final serverObjects prop = new serverObjects();
final plasmaSwitchboard sb = (plasmaSwitchboard) env;
- prop.put("candeploy_configCommit", 0);
- prop.put("candeploy_autoUpdate", 0);
+ prop.put("candeploy_configCommit", "0");
+ prop.put("candeploy_autoUpdate", "0");
if (post != null) {
if (post.containsKey("downloadRelease")) {
@@ -69,7 +69,7 @@ public class ConfigUpdate_p {
if (post.containsKey("autoUpdate")) {
yacyVersion updateVersion = yacyVersion.rulebasedUpdateInfo(true);
if (updateVersion == null) {
- prop.put("candeploy_autoUpdate", 2); // no more recent release found
+ prop.put("candeploy_autoUpdate", "2"); // no more recent release found
} else try {
// there is a version that is more recent. Load it and re-start with it
sb.getLog().logInfo("AUTO-UPDATE: downloading more recent release " + updateVersion.url);
@@ -79,15 +79,15 @@ public class ConfigUpdate_p {
boolean devenvironment = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1")).startsWith("dev");
if (devenvironment) {
sb.getLog().logInfo("AUTO-UPDATE: omiting update because this is a development environment");
- prop.put("candeploy_autoUpdate", 3);
+ prop.put("candeploy_autoUpdate", "3");
} else if ((!releaseFile.exists()) || (releaseFile.length() == 0)) {
sb.getLog().logInfo("AUTO-UPDATE: omiting update because download failed (file cannot be found or is too small)");
- prop.put("candeploy_autoUpdate", 4);
+ prop.put("candeploy_autoUpdate", "4");
} else {
yacyVersion.deployRelease(updateVersion.name);
sb.terminate(5000);
sb.getLog().logInfo("AUTO-UPDATE: deploy and restart initiated");
- prop.put("candeploy_autoUpdate", 1);
+ prop.put("candeploy_autoUpdate", "1");
}
} catch (IOException e) {
sb.getLog().logSevere("AUTO-UPDATE: could not download and install release " + updateVersion.url + ": " + e.getMessage());
@@ -95,7 +95,7 @@ public class ConfigUpdate_p {
}
if (post.containsKey("configSubmit")) {
- prop.put("candeploy_configCommit", 1);
+ prop.put("candeploy_configCommit", "1");
sb.setConfig("update.process", (post.get("updateMode", "manual").equals("manual")) ? "manual" : "auto");
sb.setConfig("update.cycle", Math.max(12, post.getLong("cycle", 168)));
sb.setConfig("update.blacklist", post.get("blacklist", ""));
@@ -107,9 +107,9 @@ public class ConfigUpdate_p {
if (serverSystem.canExecUnix) {
// we can deploy a new system with (i.e.)
// cd DATA/RELEASE;tar xfz $1;cp -Rf yacy/* ../../;rm -Rf yacy
- prop.put("candeploy", 1);
+ prop.put("candeploy", "1");
} else {
- prop.put("candeploy", 0);
+ prop.put("candeploy", "0");
}
// version information
@@ -125,7 +125,7 @@ public class ConfigUpdate_p {
yacyVersion release, dflt;
String[] downloaded = sb.releasePath.list();
- prop.put("candeploy_deployenabled", (downloaded.length == 0) ? 0 : ((devenvironment) ? 1 : 2)); // prevent that a developer-version is over-deployed
+ prop.put("candeploy_deployenabled", (downloaded.length == 0) ? "0" : ((devenvironment) ? "1" : "2")); // prevent that a developer-version is over-deployed
TreeSet downloadedreleases = new TreeSet();
for (int j = 0; j < downloaded.length; j++) {
@@ -144,7 +144,7 @@ public class ConfigUpdate_p {
release = (yacyVersion) i.next();
prop.put("candeploy_downloadedreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);
prop.put("candeploy_downloadedreleases_" + relcount + "_file", release.name);
- prop.put("candeploy_downloadedreleases_" + relcount + "_selected", (release == dflt) ? 1 : 0);
+ prop.put("candeploy_downloadedreleases_" + relcount + "_selected", (release == dflt) ? "1" : "0");
relcount++;
}
prop.put("candeploy_downloadedreleases", relcount);
@@ -160,7 +160,7 @@ public class ConfigUpdate_p {
release = (yacyVersion) i.next();
prop.put("candeploy_availreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);
prop.put("candeploy_availreleases_" + relcount + "_url", release.url.toString());
- prop.put("candeploy_availreleases_" + relcount + "_selected", 0);
+ prop.put("candeploy_availreleases_" + relcount + "_selected", "0");
relcount++;
}
// dev
@@ -172,23 +172,23 @@ public class ConfigUpdate_p {
release = (yacyVersion) i.next();
prop.put("candeploy_availreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);
prop.put("candeploy_availreleases_" + relcount + "_url", release.url.toString());
- prop.put("candeploy_availreleases_" + relcount + "_selected", (release == dflt) ? 1 : 0);
+ prop.put("candeploy_availreleases_" + relcount + "_selected", (release == dflt) ? "1" : "0");
relcount++;
}
prop.put("candeploy_availreleases", relcount);
// properties for automated system update
- prop.put("candeploy_manualUpdateChecked", (sb.getConfig("update.process", "manual").equals("manual")) ? 1 : 0);
- prop.put("candeploy_autoUpdateChecked", (sb.getConfig("update.process", "manual").equals("auto")) ? 1 : 0);
+ prop.put("candeploy_manualUpdateChecked", (sb.getConfig("update.process", "manual").equals("manual")) ? "1" : "0");
+ prop.put("candeploy_autoUpdateChecked", (sb.getConfig("update.process", "manual").equals("auto")) ? "1" : "0");
prop.put("candeploy_cycle", sb.getConfigLong("update.cycle", 168));
prop.put("candeploy_blacklist", sb.getConfig("update.blacklist", ""));
- prop.put("candeploy_releaseTypeMainChecked", (sb.getConfig("update.concept", "any").equals("any")) ? 0 : 1);
- prop.put("candeploy_releaseTypeAnyChecked", (sb.getConfig("update.concept", "any").equals("any")) ? 1 : 0);
- prop.put("candeploy_lastlookup", (sb.getConfigLong("update.time.lookup", 0) == 0) ? 0 : 1);
+ prop.put("candeploy_releaseTypeMainChecked", (sb.getConfig("update.concept", "any").equals("any")) ? "0" : "1");
+ prop.put("candeploy_releaseTypeAnyChecked", (sb.getConfig("update.concept", "any").equals("any")) ? "1" : "0");
+ prop.put("candeploy_lastlookup", (sb.getConfigLong("update.time.lookup", 0) == 0) ? "0" : "1");
prop.put("candeploy_lastlookup_time", new Date(sb.getConfigLong("update.time.lookup", 0)).toString());
- prop.put("candeploy_lastdownload", (sb.getConfigLong("update.time.download", 0) == 0) ? 0 : 1);
+ prop.put("candeploy_lastdownload", (sb.getConfigLong("update.time.download", 0) == 0) ? "0" : "1");
prop.put("candeploy_lastdownload_time", new Date(sb.getConfigLong("update.time.download", 0)).toString());
- prop.put("candeploy_lastdeploy", (sb.getConfigLong("update.time.deploy", 0) == 0) ? 0 : 1);
+ prop.put("candeploy_lastdeploy", (sb.getConfigLong("update.time.deploy", 0) == 0) ? "0" : "1");
prop.put("candeploy_lastdeploy_time", new Date(sb.getConfigLong("update.time.deploy", 0)).toString());
/*
diff --git a/htroot/Config_p.java b/htroot/Config_p.java
index 132ce1df2..1d9824cca 100644
--- a/htroot/Config_p.java
+++ b/htroot/Config_p.java
@@ -90,5 +90,4 @@ public class Config_p {
prop.put("options", count);
return prop;
}
-
}
diff --git a/htroot/Connections_p.java b/htroot/Connections_p.java
index 353ee1e46..d2f07c888 100644
--- a/htroot/Connections_p.java
+++ b/htroot/Connections_p.java
@@ -202,42 +202,43 @@ public final class Connections_p {
}
}
- prop.put("list_" + idx + "_dark", ((dark) ? 1 : 0) ); dark=!dark;
+ prop.put("list_" + idx + "_dark", dark ? "1" : "0");
+ dark=!dark;
try {
prop.put("list_" + idx + "_sessionID",URLEncoder.encode(currentSession.getName(),"UTF8"));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- prop.put("list_" + idx + "_sessionName",currentSession.getName());
- prop.put("list_" + idx + "_proto",prot);
+ prop.put("list_" + idx + "_sessionName", currentSession.getName());
+ prop.put("list_" + idx + "_proto", prot);
if (sessionTime > 1000*60) {
- prop.put("list_" + idx + "_ms",0);
+ prop.put("list_" + idx + "_ms", "0");
prop.put("list_" + idx + "_ms_duration",serverDate.intervalToString(sessionTime));
} else {
- prop.put("list_" + idx + "_ms",1);
- prop.put("list_" + idx + "_ms_duration",Long.toString(sessionTime));
+ prop.put("list_" + idx + "_ms", "1");
+ prop.putNum("list_" + idx + "_ms_duration", sessionTime);
}
prop.put("list_" + idx + "_source",(seed!=null)?seed.getName()+".yacy":userAddress.getHostAddress()+":"+userPort);
prop.put("list_" + idx + "_dest",(dest==null)?"-":dest);
if (blockingRequest) {
- prop.put("list_" + idx + "_running",0);
- prop.put("list_" + idx + "_running_reqNr",Integer.toString(commandCount+1));
+ prop.put("list_" + idx + "_running", "0");
+ prop.putNum("list_" + idx + "_running_reqNr", commandCount+1);
numActivePending++;
} else {
- prop.put("list_" + idx + "_running",1);
- prop.put("list_" + idx + "_running_command",(commandLine==null)?"":commandLine);
+ prop.put("list_" + idx + "_running", "1");
+ prop.put("list_" + idx + "_running_command", commandLine==null ? "" :commandLine);
numActiveRunning++;
}
- prop.put("list_" + idx + "_used",Integer.toString(commandCount));
+ prop.putNum("list_" + idx + "_used", commandCount);
idx++;
}
}
- prop.put("list",idx);
+ prop.put("list", idx);
- prop.put("numMax",Integer.toString(numMax));
- prop.put("numActiveRunning",Integer.toString(numActiveRunning));
- prop.put("numActivePending",Integer.toString(numActivePending));
+ prop.putNum("numMax", numMax);
+ prop.putNum("numActiveRunning", numActiveRunning);
+ prop.putNum("numActivePending", numActivePending);
// client sessions
httpc[] a = httpc.allConnections();
@@ -247,10 +248,10 @@ public final class Connections_p {
httpc clientConnection = a[i];
if (clientConnection != null) {
prop.put("clientList_" + c + "_clientProtocol", (clientConnection.ssl) ? "HTTPS" : "HTTP");
- prop.put("clientList_" + c + "_clientLifetime", System.currentTimeMillis() - clientConnection.initTime);
- prop.put("clientList_" + c + "_clientIdletime", System.currentTimeMillis() - clientConnection.lastIO);
+ prop.putNum("clientList_" + c + "_clientLifetime", System.currentTimeMillis() - clientConnection.initTime);
+ prop.putNum("clientList_" + c + "_clientIdletime", System.currentTimeMillis() - clientConnection.lastIO);
prop.put("clientList_" + c + "_clientTargetHost", clientConnection.adressed_host + ":" + clientConnection.adressed_port);
- prop.put("clientList_" + c + "_clientCommand", (clientConnection.command == null) ? "-" : clientConnection.command);
+ prop.putHTML("clientList_" + c + "_clientCommand", (clientConnection.command == null) ? "-" : clientConnection.command);
prop.put("clientList_" + c + "_clientID", clientConnection.hashCode());
c++;
}
@@ -261,5 +262,4 @@ public final class Connections_p {
// return rewrite values for templates
return prop;
}
-
}
diff --git a/htroot/CookieMonitorIncoming_p.java b/htroot/CookieMonitorIncoming_p.java
index 6d03ad926..8d7b87222 100644
--- a/htroot/CookieMonitorIncoming_p.java
+++ b/htroot/CookieMonitorIncoming_p.java
@@ -81,12 +81,13 @@ public class CookieMonitorIncoming_p {
cookies = (Object[]) oa[2];
// put values in template
- prop.put("list_" + entCount + "_dark", ((dark) ? 1 : 0) ); dark =! dark;
+ prop.put("list_" + entCount + "_dark", dark ? "1" : "0");
+ dark =! dark;
prop.put("list_" + entCount + "_host", host);
prop.put("list_" + entCount + "_date", httpc.dateString(date));
prop.put("list_" + entCount + "_client", client);
while (tmpCount < cookies.length){
- prop.put("list_" + entCount + "_cookies_" + tmpCount + "_item", ((String) cookies[tmpCount]));
+ prop.putHTML("list_" + entCount + "_cookies_" + tmpCount + "_item", ((String) cookies[tmpCount]));
tmpCount++;
}
prop.put("list_" + entCount + "_cookies", tmpCount);
@@ -101,5 +102,4 @@ public class CookieMonitorIncoming_p {
// return rewrite properties
return prop;
}
-
}
diff --git a/htroot/CookieMonitorOutgoing_p.java b/htroot/CookieMonitorOutgoing_p.java
index 571639cee..5666f235f 100644
--- a/htroot/CookieMonitorOutgoing_p.java
+++ b/htroot/CookieMonitorOutgoing_p.java
@@ -81,12 +81,13 @@ public class CookieMonitorOutgoing_p {
cookies = (Object[]) oa[2];
// put values in template
- prop.put("list_" + entCount + "_dark", ((dark) ? 1 : 0) ); dark =! dark;
+ prop.put("list_" + entCount + "_dark", dark ? "1" : "0" );
+ dark =! dark;
prop.put("list_" + entCount + "_host", host);
prop.put("list_" + entCount + "_date", httpc.dateString(date));
prop.put("list_" + entCount + "_client", client);
while (tmpCount < cookies.length){
- prop.put("list_" + entCount + "_cookies_" + tmpCount + "_item", ((String) cookies[tmpCount]));
+ prop.putHTML("list_" + entCount + "_cookies_" + tmpCount + "_item", ((String) cookies[tmpCount]));
tmpCount++;
}
prop.put("list_" + entCount + "_cookies", tmpCount);
diff --git a/htroot/CookieTest.java b/htroot/CookieTest.java
index 4eabcc2e9..42adbe504 100644
--- a/htroot/CookieTest.java
+++ b/htroot/CookieTest.java
@@ -90,7 +90,7 @@ public class CookieTest {
}
prop.setOutgoingHeader(outgoingHeader);
- prop.put("coockiesout",0);
+ prop.put("coockiesout", "0");
//header.
}
@@ -102,18 +102,15 @@ public class CookieTest {
outgoingHeader.setCookie(cookieName,cookieValue);
prop.setOutgoingHeader(outgoingHeader);
- prop.put("cookiesin",1);
- prop.put("cookiesin_0_name",cookieName);
- prop.put("cookiesin_0_value",cookieValue);
+ prop.put("cookiesin", "1");
+ prop.put("cookiesin_0_name", cookieName);
+ prop.putHTML("cookiesin_0_value", cookieValue);
//header.
}
- prop.put("cookiesout",1);
- prop.put("cookiesout_0_string", header.getHeaderCookies().replaceAll(";",";<br />"));
+ prop.put("cookiesout", "1");
+ prop.putHTML("cookiesout_0_string", header.getHeaderCookies().replaceAll(";",";<br />"));
return prop;
}
-
-
-
}
diff --git a/htroot/CrawlProfileEditor_p.java b/htroot/CrawlProfileEditor_p.java
index 2e8f26464..860d83002 100644
--- a/htroot/CrawlProfileEditor_p.java
+++ b/htroot/CrawlProfileEditor_p.java
@@ -112,7 +112,7 @@ public class CrawlProfileEditor_p {
prop.put("profiles_" + count + "_name", selentry.name());
prop.put("profiles_" + count + "_handle", selentry.handle());
if (handle.equals(selentry.handle()))
- prop.put("profiles_" + count + "_selected", 1);
+ prop.put("profiles_" + count + "_selected", "1");
count++;
}
prop.put("profiles", count);
@@ -131,8 +131,8 @@ public class CrawlProfileEditor_p {
if (!cval.equals(val)) sb.profilesActiveCrawls.changeEntry(selentry, tee.name, val);
}
} catch (IOException ex) {
- prop.put("error", 1);
- prop.put("error_message", ex.getMessage());
+ prop.put("error", "1");
+ prop.putHTML("error_message", ex.getMessage());
}
}
}
@@ -162,9 +162,9 @@ public class CrawlProfileEditor_p {
// generate edit field
if (selentry == null) {
- prop.put("edit", 0);
+ prop.put("edit", "0");
} else {
- prop.put("edit", 1);
+ prop.put("edit", "1");
prop.put("edit_name", selentry.name());
prop.put("edit_handle", selentry.handle());
it = labels.iterator();
@@ -172,12 +172,12 @@ public class CrawlProfileEditor_p {
while (it.hasNext()) {
eentry ee = (eentry) it.next();
Object val = selentry.map().get(ee.name);
- prop.put("edit_entries_" + count + "_readonly", ee.readonly ? 1 : 0);
+ prop.put("edit_entries_" + count + "_readonly", ee.readonly ? "1" : "0");
prop.put("edit_entries_" + count + "_readonly_name", ee.name);
prop.put("edit_entries_" + count + "_readonly_label", ee.label);
prop.put("edit_entries_" + count + "_readonly_type", ee.type);
if (ee.type == eentry.BOOLEAN) {
- prop.put("edit_entries_" + count + "_readonly_type_checked", Boolean.valueOf((String) val).booleanValue() ? 1 : 0);
+ prop.put("edit_entries_" + count + "_readonly_type_checked", Boolean.valueOf((String) val).booleanValue() ? "1" : "0");
} else {
prop.put("edit_entries_" + count + "_readonly_type_value", val);
}
@@ -190,8 +190,8 @@ public class CrawlProfileEditor_p {
}
private static void putProfileEntry(servletProperties prop, plasmaCrawlProfile.entry profile, boolean active, boolean dark, int count, int domlistlength) {
- prop.put("crawlProfiles_" + count + "_dark", ((dark) ? 1 : 0));
- prop.put("crawlProfiles_" + count + "_status", ((active) ? 1 : 0));
+ prop.put("crawlProfiles_" + count + "_dark", dark ? "1" : "0");
+ prop.put("crawlProfiles_" + count + "_status", active ? "1" : "0");
prop.put("crawlProfiles_" + count + "_name", profile.name());
prop.put("crawlProfiles_" + count + "_startURL", profile.startURL());
prop.put("crawlProfiles_" + count + "_handle", profile.handle());
@@ -207,7 +207,7 @@ public class CrawlProfileEditor_p {
if(i == domlistlength){
item = item + " ...";
}
- prop.put("crawlProfiles_"+count+"_crawlingDomFilterContent_"+i+"_item", item);
+ prop.putHTML("crawlProfiles_"+count+"_crawlingDomFilterContent_"+i+"_item", item);
i++;
}
@@ -215,17 +215,17 @@ public class CrawlProfileEditor_p {
// end contrib [MN]
prop.put("crawlProfiles_" + count + "_crawlingDomMaxPages", (profile.domMaxPages() == Integer.MAX_VALUE) ? "unlimited" : ""+profile.domMaxPages());
- prop.put("crawlProfiles_" + count + "_withQuery", (profile.crawlingQ()) ? 1 : 0);
- prop.put("crawlProfiles_" + count + "_storeCache", (profile.storeHTCache()) ? 1 : 0);
- prop.put("crawlProfiles_" + count + "_indexText", (profile.indexText()) ? 1 : 0);
- prop.put("crawlProfiles_" + count + "_indexMedia", (profile.indexMedia()) ? 1 : 0);
- prop.put("crawlProfiles_" + count + "_remoteIndexing", (profile.remoteIndexing()) ? 1 : 0);
+ prop.put("crawlProfiles_" + count + "_withQuery", (profile.crawlingQ()) ? "1" : "0");
+ prop.put("crawlProfiles_" + count + "_storeCache", (profile.storeHTCache()) ? "1" : "0");
+ prop.put("crawlProfiles_" + count + "_indexText", (profile.indexText()) ? "1" : "0");
+ prop.put("crawlProfiles_" + count + "_indexMedia", (profile.indexMedia()) ? "1" : "0");
+ prop.put("crawlProfiles_" + count + "_remoteIndexing", (profile.remoteIndexing()) ? "1" : "0");
prop.put("crawlProfiles_" + count + "_terminateButton", ((!active) || (profile.name().equals("remote")) ||
(profile.name().equals("proxy")) ||
(profile.name().equals("snippetText")) ||
- (profile.name().equals("snippetMedia"))) ? 0 : 1);
+ (profile.name().equals("snippetMedia"))) ? "0" : "1");
prop.put("crawlProfiles_" + count + "_terminateButton_handle", profile.handle());
- prop.put("crawlProfiles_" + count + "_deleteButton", (active) ? 0 : 1);
+ prop.put("crawlProfiles_" + count + "_deleteButton", (active) ? "0" : "1");
prop.put("crawlProfiles_" + count + "_deleteButton_handle", profile.handle());
}
}
diff --git a/htroot/CrawlResults.java b/htroot/CrawlResults.java
index a8e0a3e24..b1c4c1797 100644
--- a/htroot/CrawlResults.java
+++ b/htroot/CrawlResults.java
@@ -126,32 +126,32 @@ public class CrawlResults {
// create table
if (tabletype == 0) {
- prop.put("table", 2);
+ prop.put("table", "2");
} else if (sb.wordIndex.loadedURL.getStackSize(tabletype) == 0) {
- prop.put("table", 0);
+ prop.put("table", "0");
} else {
- prop.put("table", 1);
+ prop.put("table", "1");
if (lines > sb.wordIndex.loadedURL.getStackSize(tabletype)) lines = sb.wordIndex.loadedURL.getStackSize(tabletype);
if (lines == sb.wordIndex.loadedURL.getStackSize(tabletype)) {
- prop.put("table_size", 0);
+ prop.put("table_size", "0");
} else {
- prop.put("table_size", 1);
+ prop.put("table_size", "1");
prop.put("table_size_count", lines);
}
prop.put("table_size_all", sb.wordIndex.loadedURL.getStackSize(tabletype));
if (showControl) {
- prop.put("table_showControl", 1);
- prop.put("table_showControl_feedbackpage", "CrawlResults.html");
+ prop.put("table_showControl", "1");
+ prop.putHTML("table_showControl_feedbackpage", "CrawlResults.html");
prop.put("table_showControl_tabletype", tabletype);
} else
- prop.put("table_showControl", 0);
- prop.put("table_showInit", (showInit) ? 1 : 0);
- prop.put("table_showExec", (showExec) ? 1 : 0);
- prop.put("table_showDate", (showDate) ? 1 : 0);
- prop.put("table_showWords", (showWords) ? 1 : 0);
- prop.put("table_showTitle", (showTitle) ? 1 : 0);
- prop.put("table_showURL", (showURL) ? 1 : 0);
+ prop.put("table_showControl", "0");
+ prop.put("table_showInit", (showInit) ? "1" : "0");
+ prop.put("table_showExec", (showExec) ? "1" : "0");
+ prop.put("table_showDate", (showDate) ? "1" : "0");
+ prop.put("table_showWords", (showWords) ? "1" : "0");
+ prop.put("table_showTitle", (showTitle) ? "1" : "0");
+ prop.put("table_showURL", (showURL) ? "1" : "0");
boolean dark = true;
String urlHash, initiatorHash, executorHash;
@@ -177,71 +177,71 @@ public class CrawlResults {
urltxt = nxTools.shortenURLString(urlstr, 72); // shorten the string text like a URL
cachepath = plasmaHTCache.getCachePath(new yacyURL(urlstr, null)).toString().replace('\\', '/').substring(plasmaHTCache.cachePath.toString().length() + 1);
- prop.put("table_indexed_" + cnt + "_dark", (dark) ? 1 : 0);
+ prop.put("table_indexed_" + cnt + "_dark", (dark) ? "1" : "0");
if (showControl) {
- prop.put("table_indexed_" + cnt + "_showControl", 1);
+ prop.put("table_indexed_" + cnt + "_showControl", "1");
prop.put("table_indexed_" + cnt + "_showControl_feedbackpage", "CrawlResults.html");
prop.put("table_indexed_" + cnt + "_showControl_tabletype", tabletype);
prop.put("table_indexed_" + cnt + "_showControl_urlhash", urlHash);
} else
- prop.put("table_indexed_" + cnt + "_showControl", 0);
+ prop.put("table_indexed_" + cnt + "_showControl", "0");
if (showInit) {
- prop.put("table_indexed_" + cnt + "_showInit", 1);
+ prop.put("table_indexed_" + cnt + "_showInit", "1");
prop.put("table_indexed_" + cnt + "_showInit_initiatorSeed", (initiatorSeed == null) ? "unknown" : initiatorSeed.getName());
} else
- prop.put("table_indexed_" + cnt + "_showInit", 0);
+ prop.put("table_indexed_" + cnt + "_showInit", "0");
if (showExec) {
- prop.put("table_indexed_" + cnt + "_showExec", 1);
+ prop.put("table_indexed_" + cnt + "_showExec", "1");
prop.put("table_indexed_" + cnt + "_showExec_executorSeed", (executorSeed == null) ? "unknown" : executorSeed.getName());
} else
- prop.put("table_indexed_" + cnt + "_showExec", 0);
+ prop.put("table_indexed_" + cnt + "_showExec", "0");
if (showDate) {
- prop.put("table_indexed_" + cnt + "_showDate", 1);
+ prop.put("table_indexed_" + cnt + "_showDate", "1");
prop.put("table_indexed_" + cnt + "_showDate_modified", daydate(urle.moddate()));
} else
- prop.put("table_indexed_" + cnt + "_showDate", 0);
+ prop.put("table_indexed_" + cnt + "_showDate", "0");
if (showWords) {
- prop.put("table_indexed_" + cnt + "_showWords", 1);
+ prop.put("table_indexed_" + cnt + "_showWords", "1");
prop.put("table_indexed_" + cnt + "_showWords_count", urle.wordCount());
} else
- prop.put("table_indexed_" + cnt + "_showWords", 0);
+ prop.put("table_indexed_" + cnt + "_showWords", "0");
if (showTitle) {
- prop.put("table_indexed_" + cnt + "_showTitle", (showTitle) ? 1 : 0);
+ prop.put("table_indexed_" + cnt + "_showTitle", (showTitle) ? "1" : "0");
if (cachepath == null) {
- prop.put("table_indexed_" + cnt + "_showTitle_available", 0);
+ prop.put("table_indexed_" + cnt + "_showTitle_available", "0");
} else {
- prop.put("table_indexed_" + cnt + "_showTitle_available", 1);
+ prop.put("table_indexed_" + cnt + "_showTitle_available", "1");
if (comp.title() == null || comp.title().trim().length() == 0)
- prop.put("table_indexed_" + cnt + "_showTitle_available_nodescr", 0);
+ prop.put("table_indexed_" + cnt + "_showTitle_available_nodescr", "0");
else
- prop.put("table_indexed_" + cnt + "_showTitle_available_nodescr", 1);
- prop.put("table_indexed_" + cnt + "_showTitle_available_nodescr_urldescr", comp.title());
+ prop.put("table_indexed_" + cnt + "_showTitle_available_nodescr", "1");
+ prop.putHTML("table_indexed_" + cnt + "_showTitle_available_nodescr_urldescr", comp.title());
prop.put("table_indexed_" + cnt + "_showTitle_available_cachepath", cachepath);
- prop.put("table_indexed_" + cnt + "_showTitle_available_urltitle", urlstr);
+ prop.putHTML("table_indexed_" + cnt + "_showTitle_available_urltitle", urlstr);
}
} else
- prop.put("table_indexed_" + cnt + "_showTitle", 0);
+ prop.put("table_indexed_" + cnt + "_showTitle", "0");
if (showURL) {
- prop.put("table_indexed_" + cnt + "_showURL", 1);
+ prop.put("table_indexed_" + cnt + "_showURL", "1");
if (cachepath == null) {
- prop.put("table_indexed_" + cnt + "_showURL_available", 0);
+ prop.put("table_indexed_" + cnt + "_showURL_available", "0");
} else {
- prop.put("table_indexed_" + cnt + "_showURL_available", 1);
+ prop.put("table_indexed_" + cnt + "_showURL_available", "1");
prop.put("table_indexed_" + cnt + "_showURL_available_cachepath", cachepath);
- prop.put("table_indexed_" + cnt + "_showURL_available_urltitle", urlstr);
+ prop.putHTML("table_indexed_" + cnt + "_showURL_available_urltitle", urlstr);
prop.put("table_indexed_" + cnt + "_showURL_available_url", urltxt);
}
} else
- prop.put("table_indexed_" + cnt + "_showURL", 0);
+ prop.put("table_indexed_" + cnt + "_showURL", "0");
dark = !dark;
cnt++;
diff --git a/htroot/CrawlStartExpert_p.java b/htroot/CrawlStartExpert_p.java
index 3dc403258..bc2e394d0 100644
--- a/htroot/CrawlStartExpert_p.java
+++ b/htroot/CrawlStartExpert_p.java
@@ -41,59 +41,55 @@ public class CrawlStartExpert_p {
prop.put("crawlingFilter", env.getConfig("crawlingFilter", "0"));
int crawlingIfOlder = (int) env.getConfigLong("crawlingIfOlder", -1);
- prop.put("crawlingIfOlderCheck", (crawlingIfOlder == -1) ? 0 : 1);
- prop.put("crawlingIfOlderUnitYearCheck", 0);
- prop.put("crawlingIfOlderUnitMonthCheck", 0);
- prop.put("crawlingIfOlderUnitDayCheck", 0);
- prop.put("crawlingIfOlderUnitHourCheck", 0);
- prop.put("crawlingIfOlderUnitMinuteCheck", 0);
+ prop.put("crawlingIfOlderCheck", (crawlingIfOlder == -1) ? "0" : "1");
+ prop.put("crawlingIfOlderUnitYearCheck", "0");
+ prop.put("crawlingIfOlderUnitMonthCheck", "0");
+ prop.put("crawlingIfOlderUnitDayCheck", "0");
+ prop.put("crawlingIfOlderUnitHourCheck", "0");
+ prop.put("crawlingIfOlderUnitMinuteCheck", "0");
if ((crawlingIfOlder == -1) || (crawlingIfOlder == Integer.MAX_VALUE)) {
- prop.put("crawlingIfOlderNumber", 1);
- prop.put("crawlingIfOlderUnitYearCheck", 1);
+ prop.put("crawlingIfOlderNumber", "1");
+ prop.put("crawlingIfOlderUnitYearCheck", "1");
} else if (crawlingIfOlder >= 60*24*365) {
prop.put("crawlingIfOlderNumber", Math.round((float)crawlingIfOlder / (float)(60*24*365)));
- prop.put("crawlingIfOlderUnitYearCheck", 1);
+ prop.put("crawlingIfOlderUnitYearCheck", "1");
} else if (crawlingIfOlder >= 60*24*30) {
prop.put("crawlingIfOlderNumber", Math.round((float)crawlingIfOlder / (float)(60*24*30)));
- prop.put("crawlingIfOlderUnitMonthCheck", 1);
+ prop.put("crawlingIfOlderUnitMonthCheck", "1");
} else if (crawlingIfOlder >= 60*24) {
prop.put("crawlingIfOlderNumber", Math.round((float)crawlingIfOlder / (float)(60*24)));
- prop.put("crawlingIfOlderUnitDayCheck", 1);
+ prop.put("crawlingIfOlderUnitDayCheck", "1");
} else if (crawlingIfOlder >= 60) {
prop.put("crawlingIfOlderNumber", Math.round(crawlingIfOlder / 60f));
- prop.put("crawlingIfOlderUnitHourCheck", 1);
+ prop.put("crawlingIfOlderUnitHourCheck", "1");
} else {
prop.put("crawlingIfOlderNumber", crawlingIfOlder);
- prop.put("crawlingIfOlderUnitMinuteCheck", 1);
+ prop.put("crawlingIfOlderUnitMinuteCheck", "1");
}
int crawlingDomFilterDepth = (int) env.getConfigLong("crawlingDomFilterDepth", -1);
- prop.put("crawlingDomFilterCheck", (crawlingDomFilterDepth == -1) ? 0 : 1);
+ prop.put("crawlingDomFilterCheck", (crawlingDomFilterDepth == -1) ? "0" : "1");
prop.put("crawlingDomFilterDepth", (crawlingDomFilterDepth == -1) ? 1 : crawlingDomFilterDepth);
int crawlingDomMaxPages = (int) env.getConfigLong("crawlingDomMaxPages", -1);
- prop.put("crawlingDomMaxCheck", (crawlingDomMaxPages == -1) ? 0 : 1);
+ prop.put("crawlingDomMaxCheck", (crawlingDomMaxPages == -1) ? "0" : "1");
prop.put("crawlingDomMaxPages", (crawlingDomMaxPages == -1) ? 10000 : crawlingDomMaxPages);
- prop.put("crawlingQChecked", env.getConfig("crawlingQ", "").equals("true") ? 1 : 0);
- prop.put("storeHTCacheChecked", env.getConfig("storeHTCache", "").equals("true") ? 1 : 0);
- prop.put("indexingTextChecked", env.getConfig("indexText", "").equals("true") ? 1 : 0);
- prop.put("indexingMediaChecked", env.getConfig("indexMedia", "").equals("true") ? 1 : 0);
- prop.put("crawlOrderChecked", env.getConfig("crawlOrder", "").equals("true") ? 1 : 0);
+ prop.put("crawlingQChecked", env.getConfig("crawlingQ", "").equals("true") ? "1" : "0");
+ prop.put("storeHTCacheChecked", env.getConfig("storeHTCache", "").equals("true") ? "1" : "0");
+ prop.put("indexingTextChecked", env.getConfig("indexText", "").equals("true") ? "1" : "0");
+ prop.put("indexingMediaChecked", env.getConfig("indexMedia", "").equals("true") ? "1" : "0");
+ prop.put("crawlOrderChecked", env.getConfig("crawlOrder", "").equals("true") ? "1" : "0");
long LCbusySleep = Integer.parseInt(env.getConfig(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL_BUSYSLEEP, "100"));
int LCppm = (LCbusySleep == 0) ? 1000 : (int) (60000L / LCbusySleep);
- prop.put("crawlingSpeedMaxChecked", (LCppm >= 1000) ? 1 : 0);
- prop.put("crawlingSpeedCustChecked", ((LCppm > 10) && (LCppm < 1000)) ? 1 : 0);
- prop.put("crawlingSpeedMinChecked", (LCppm <= 10) ? 1 : 0);
+ prop.put("crawlingSpeedMaxChecked", (LCppm >= 1000) ? "1" : "0");
+ prop.put("crawlingSpeedCustChecked", ((LCppm > 10) && (LCppm < 1000)) ? "1" : "0");
+ prop.put("crawlingSpeedMinChecked", (LCppm <= 10) ? "1" : "0");
prop.put("customPPMdefault", ((LCppm > 10) && (LCppm < 1000)) ? Integer.toString(LCppm) : "");
- prop.put("xsstopwChecked", env.getConfig("xsstopw", "").equals("true") ? 1 : 0);
- prop.put("xdstopwChecked", env.getConfig("xdstopw", "").equals("true") ? 1 : 0);
- prop.put("xpstopwChecked", env.getConfig("xpstopw", "").equals("true") ? 1 : 0);
+ prop.put("xsstopwChecked", env.getConfig("xsstopw", "").equals("true") ? "1" : "0");
+ prop.put("xdstopwChecked", env.getConfig("xdstopw", "").equals("true") ? "1" : "0");
+ prop.put("xpstopwChecked", env.getConfig("xpstopw", "").equals("true") ? "1" : "0");
// return rewrite properties
return prop;
}
-
}
-
-
-
diff --git a/htroot/CrawlStartSimple_p.java b/htroot/CrawlStartSimple_p.java
index 84a3008c7..cb4bc6370 100644
--- a/htroot/CrawlStartSimple_p.java
+++ b/htroot/CrawlStartSimple_p.java
@@ -48,53 +48,53 @@ public class CrawlStartSimple_p {
prop.put("crawlingFilter", env.getConfig("crawlingFilter", "0"));
int crawlingIfOlder = (int) env.getConfigLong("crawlingIfOlder", -1);
- prop.put("crawlingIfOlderCheck", (crawlingIfOlder == -1) ? 0 : 1);
- prop.put("crawlingIfOlderUnitYearCheck", 0);
- prop.put("crawlingIfOlderUnitMonthCheck", 0);
- prop.put("crawlingIfOlderUnitDayCheck", 0);
- prop.put("crawlingIfOlderUnitHourCheck", 0);
- prop.put("crawlingIfOlderUnitMinuteCheck", 0);
+ prop.put("crawlingIfOlderCheck", (crawlingIfOlder == -1) ? "0" : "1");
+ prop.put("crawlingIfOlderUnitYearCheck", "0");
+ prop.put("crawlingIfOlderUnitMonthCheck", "0");
+ prop.put("crawlingIfOlderUnitDayCheck", "0");
+ prop.put("crawlingIfOlderUnitHourCheck", "0");
+ prop.put("crawlingIfOlderUnitMinuteCheck", "0");
if ((crawlingIfOlder == -1) || (crawlingIfOlder == Integer.MAX_VALUE)) {
- prop.put("crawlingIfOlderNumber", -1);
- prop.put("crawlingIfOlderUnitYearCheck", 1);
+ prop.put("crawlingIfOlderNumber", "-1");
+ prop.put("crawlingIfOlderUnitYearCheck", "1");
} else if (crawlingIfOlder >= 60*24*365) {
prop.put("crawlingIfOlderNumber", Math.round((float)crawlingIfOlder / (float)(60*24*365)));
- prop.put("crawlingIfOlderUnitYearCheck", 1);
+ prop.put("crawlingIfOlderUnitYearCheck", "1");
} else if (crawlingIfOlder >= 60*24*30) {
prop.put("crawlingIfOlderNumber", Math.round((float)crawlingIfOlder / (float)(60*24*30)));
- prop.put("crawlingIfOlderUnitMonthCheck", 1);
+ prop.put("crawlingIfOlderUnitMonthCheck", "1");
} else if (crawlingIfOlder >= 60*24) {
prop.put("crawlingIfOlderNumber", Math.round((float)crawlingIfOlder / (float)(60*24)));
- prop.put("crawlingIfOlderUnitDayCheck", 1);
+ prop.put("crawlingIfOlderUnitDayCheck", "1");
} else if (crawlingIfOlder >= 60) {
prop.put("crawlingIfOlderNumber", Math.round(crawlingIfOlder / 60f));
- prop.put("crawlingIfOlderUnitHourCheck", 1);
+ prop.put("crawlingIfOlderUnitHourCheck", "1");
} else {
prop.put("crawlingIfOlderNumber", crawlingIfOlder);
- prop.put("crawlingIfOlderUnitMinuteCheck", 1);
+ prop.put("crawlingIfOlderUnitMinuteCheck", "1");
}
int crawlingDomFilterDepth = (int) env.getConfigLong("crawlingDomFilterDepth", -1);
- prop.put("crawlingDomFilterCheck", (crawlingDomFilterDepth == -1) ? 0 : 1);
+ prop.put("crawlingDomFilterCheck", (crawlingDomFilterDepth == -1) ? "0" : "1");
prop.put("crawlingDomFilterDepth", (crawlingDomFilterDepth == -1) ? 1 : crawlingDomFilterDepth);
int crawlingDomMaxPages = (int) env.getConfigLong("crawlingDomMaxPages", -1);
- prop.put("crawlingDomMaxCheck", (crawlingDomMaxPages == -1) ? 0 : 1);
+ prop.put("crawlingDomMaxCheck", (crawlingDomMaxPages == -1) ? "0" : "1");
prop.put("crawlingDomMaxPages", (crawlingDomMaxPages == -1) ? 10000 : crawlingDomMaxPages);
- prop.put("crawlingQChecked", env.getConfig("crawlingQ", "").equals("true") ? 1 : 0);
- prop.put("storeHTCacheChecked", env.getConfig("storeHTCache", "").equals("true") ? 1 : 0);
- prop.put("indexingTextChecked", env.getConfig("indexText", "").equals("true") ? 1 : 0);
- prop.put("indexingMediaChecked", env.getConfig("indexMedia", "").equals("true") ? 1 : 0);
- prop.put("crawlOrderChecked", env.getConfig("crawlOrder", "").equals("true") ? 1 : 0);
+ prop.put("crawlingQChecked", env.getConfig("crawlingQ", "").equals("true") ? "1" : "0");
+ prop.put("storeHTCacheChecked", env.getConfig("storeHTCache", "").equals("true") ? "1" : "0");
+ prop.put("indexingTextChecked", env.getConfig("indexText", "").equals("true") ? "1" : "0");
+ prop.put("indexingMediaChecked", env.getConfig("indexMedia", "").equals("true") ? "1" : "0");
+ prop.put("crawlOrderChecked", env.getConfig("crawlOrder", "").equals("true") ? "1" : "0");
long LCbusySleep = Integer.parseInt(env.getConfig(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL_BUSYSLEEP, "100"));
int LCppm = (LCbusySleep == 0) ? 1000 : (int) (60000L / LCbusySleep);
- prop.put("crawlingSpeedMaxChecked", (LCppm >= 1000) ? 1 : 0);
- prop.put("crawlingSpeedCustChecked", ((LCppm > 10) && (LCppm < 1000)) ? 1 : 0);
- prop.put("crawlingSpeedMinChecked", (LCppm <= 10) ? 1 : 0);
+ prop.put("crawlingSpeedMaxChecked", (LCppm >= 1000) ? "1" : "0");
+ prop.put("crawlingSpeedCustChecked", ((LCppm > 10) && (LCppm < 1000)) ? "1" : "0");
+ prop.put("crawlingSpeedMinChecked", (LCppm <= 10) ? "1" : "0");
prop.put("customPPMdefault", ((LCppm > 10) && (LCppm < 1000)) ? Integer.toString(LCppm) : "");
- prop.put("xsstopwChecked", env.getConfig("xsstopw", "").equals("true") ? 1 : 0);
- prop.put("xdstopwChecked", env.getConfig("xdstopw", "").equals("true") ? 1 : 0);
- prop.put("xpstopwChecked", env.getConfig("xpstopw", "").equals("true") ? 1 : 0);
+ prop.put("xsstopwChecked", env.getConfig("xsstopw", "").equals("true") ? "1" : "0");
+ prop.put("xdstopwChecked", env.getConfig("xdstopw", "").equals("true") ? "1" : "0");
+ prop.put("xpstopwChecked", env.getConfig("xpstopw", "").equals("true") ? "1" : "0");
// create prefetch table
boolean dark = true;
@@ -111,13 +111,13 @@ public class CrawlStartSimple_p {
if (record.category().equals(yacyNewsPool.CATEGORY_CRAWL_START)) {
peer = yacyCore.seedDB.get(record.originator());
if (peer == null) peername = record.originator(); else peername = peer.getName();
- prop.put("otherCrawlStartInProgress_" + showedCrawl + "_dark", ((dark) ? 1 : 0));
+ prop.put("otherCrawlStartInProgress_" + showedCrawl + "_dark", dark ? "1" : "0");
prop.put("otherCrawlStartInProgress_" + showedCrawl + "_cre", record.created());
prop.put("otherCrawlStartInProgress_" + showedCrawl + "_peername", peername);
prop.put("otherCrawlStartInProgress_" + showedCrawl + "_startURL", record.attributes().get("startURL").toString());
prop.put("otherCrawlStartInProgress_" + showedCrawl + "_intention", record.attributes().get("intention").toString());
prop.put("otherCrawlStartInProgress_" + showedCrawl + "_generalDepth", record.attributes().get("generalDepth"));
- prop.put("otherCrawlStartInProgress_" + showedCrawl + "_crawlingQ", (record.attributes().get("crawlingQ").equals("true")) ? 1 : 0);
+ prop.put("otherCrawlStartInProgress_" + showedCrawl + "_crawlingQ", (record.attributes().get("crawlingQ").equals("true")) ? "1" : "0");
showedCrawl++;
if (showedCrawl > 20) break;
}
@@ -133,13 +133,13 @@ public class CrawlStartSimple_p {
if (record.category().equals(yacyNewsPool.CATEGORY_CRAWL_START)) {
peer = yacyCore.seedDB.get(record.originator());
if (peer == null) peername = record.originator(); else peername = peer.getName();
- prop.put("otherCrawlStartFinished_" + showedCrawl + "_dark", ((dark) ? 1 : 0));
+ prop.put("otherCrawlStartFinished_" + showedCrawl + "_dark", dark ? "1" : "0");
prop.put("otherCrawlStartFinished_" + showedCrawl + "_cre", record.created());
prop.put("otherCrawlStartFinished_" + showedCrawl + "_peername", peername);
prop.put("otherCrawlStartFinished_" + showedCrawl + "_startURL", record.attributes().get("startURL").toString());
prop.put("otherCrawlStartFinished_" + showedCrawl + "_intention", record.attributes().get("intention").toString());
prop.put("otherCrawlStartFinished_" + showedCrawl + "_generalDepth", record.attributes().get("generalDepth"));
- prop.put("otherCrawlStartFinished_" + showedCrawl + "_crawlingQ", (record.attributes().get("crawlingQ").equals("true")) ? 1 : 0);
+ prop.put("otherCrawlStartFinished_" + showedCrawl + "_crawlingQ", (record.attributes().get("crawlingQ").equals("true")) ? "1" : "0");
showedCrawl++;
if (showedCrawl > 20) break;
}
@@ -149,14 +149,14 @@ public class CrawlStartSimple_p {
// remote crawl peers
if ((yacyCore.seedDB == null) || (yacyCore.seedDB.mySeed().isVirgin()) || (yacyCore.seedDB.mySeed().isJunior())) {
- prop.put("remoteCrawlPeers", 0);
+ prop.put("remoteCrawlPeers", "0");
} else {
Iterator crawlavail = yacyCore.dhtAgent.getAcceptRemoteCrawlSeeds(yacyURL.dummyHash, true);
Iterator crawlpendi = yacyCore.dhtAgent.getAcceptRemoteCrawlSeeds(yacyURL.dummyHash, false);
if ((!(crawlavail.hasNext())) && (!(crawlpendi.hasNext()))) {
- prop.put("remoteCrawlPeers", 0); //no peers availible
+ prop.put("remoteCrawlPeers", "0"); //no peers availible
} else {
- prop.put("remoteCrawlPeers", 1);
+ prop.put("remoteCrawlPeers", "1");
int maxcount = 100;
int availcount = 0;
yacySeed seed;
@@ -177,14 +177,9 @@ public class CrawlStartSimple_p {
prop.put("remoteCrawlPeers_busy", pendicount);
prop.put("remoteCrawlPeers_num", (availcount + pendicount));
}
-
}
// return rewrite properties
return prop;
}
-
}
-
-
-
diff --git a/htroot/CrawlURLFetchStack_p.java b/htroot/CrawlURLFetchStack_p.java
index 974e8e77a..3d63260f5 100644
--- a/htroot/CrawlURLFetchStack_p.java
+++ b/htroot/CrawlURLFetchStack_p.java
@@ -157,37 +157,37 @@ public class CrawlURLFetchStack_p {
* ================================================================= */
if (post != null) {
if (post.containsKey("addurls")) {
- prop.put("addedUrls", 1);
+ prop.put("addedUrls", "1");
prop.put("addedUrls_added", addURLs(post, post.getInt("addurls", -1), getURLFetcherStack(env)));
}
else if (post.containsKey("setMaxSize")) {
final int count = post.getInt("maxSize", maxURLsPerFetch);
if (count > 0) {
maxURLsPerFetch = count;
- prop.put("set", 1);
+ prop.put("set", "1");
prop.put("set_value", maxURLsPerFetch);
} else {
- prop.put("set", 2);
+ prop.put("set", "2");
prop.put("set_value", count);
}
}
else if (post.containsKey("shiftlcq")) {
final int count = Math.min(post.getInt("shiftloc", 0), sb.noticeURL.stackSize(plasmaCrawlNURL.STACK_TYPE_CORE));
final int failed = shiftFromNotice(sb.noticeURL, plasmaCrawlNURL.STACK_TYPE_CORE, getURLFetcherStack(env), count);
- prop.put("shiftloc", 1);
+ prop.put("shiftloc", "1");
prop.put("shiftloc_value", count - failed);
prop.put("shiftloc_failed", failed);
}
else if (post.containsKey("shiftrcq")) {
final int count = post.getInt("shiftrem", 0);
final int failed = shiftFromNotice(sb.noticeURL, plasmaCrawlNURL.STACK_TYPE_LIMIT, getURLFetcherStack(env), count);
- prop.put("shiftrem", 1);
+ prop.put("shiftrem", "1");
prop.put("shiftrem_value", count - failed);
prop.put("shiftrem_failed", failed);
}
else if (post.containsKey("subupload")) {
if (post.get("upload", "").length() == 0) {
- prop.put("uploadError", 1);
+ prop.put("uploadError", "1");
} else {
final File file = new File(post.get("upload", ""));
final String content = new String((byte[])post.get("upload$file"));
@@ -196,8 +196,8 @@ public class CrawlURLFetchStack_p {
final boolean blCheck = post.containsKey("blacklistCheck");
if (type.equals("plain")) {
prop.put("upload_added", addURLs(content.split("\n"), blCheck, getURLFetcherStack(env)));
- prop.put("upload_failed", 0);
- prop.put("upload", 1);
+ prop.put("upload_failed", "0");
+ prop.put("upload", "1");
} else if (type.equals("html")) {
try {
final htmlFilterContentScraper scraper = new htmlFilterContentScraper(new yacyURL(file));
@@ -217,13 +217,13 @@ public class CrawlURLFetchStack_p {
getURLFetcherStack(env).push(url);
added++;
} catch (MalformedURLException e) { failed++; }
- prop.put("upload", 1);
+ prop.put("upload", "1");
prop.put("upload_added", added);
prop.put("upload_failed", failed);
} catch (Exception e) {
e.printStackTrace();
- prop.put("upload", 2);
- prop.put("upload_error", e.getMessage());
+ prop.put("upload", "2");
+ prop.putHTML("upload_error", e.getMessage());
}
}
}
@@ -247,7 +247,7 @@ public class CrawlURLFetchStack_p {
int count = 0;
while (it.hasNext()) {
String key = (String)it.next();
- prop.put("peers_" + count + "_peer", key);
+ prop.putHTML("peers_" + count + "_peer", key);
prop.put("peers_" + count + "_amount", ((Integer)fetchMap.get(key)).intValue());
count++;
}
diff --git a/htroot/CrawlURLFetch_p.java b/htroot/CrawlURLFetch_p.java
index a8d040e05..14a830ea3 100644
--- a/htroot/CrawlURLFetch_p.java
+++ b/htroot/CrawlURLFetch_p.java
@@ -226,18 +226,18 @@ public class CrawlURLFetch_p {
}
if (fetcher != null) {
- prop.put("runs", 1);
+ prop.put("runs", "1");
prop.put("runs_status",
((fetcher.paused && fetcher.isAlive()) ? STAT_THREAD_PAUSED :
(fetcher.isAlive()) ? STAT_THREAD_ALIVE : STAT_THREAD_STOPPED));
- prop.put("runs_totalRuns", URLFetcher.totalRuns);
- prop.put("runs_totalFetchedURLs", URLFetcher.totalFetchedURLs);
- prop.put("runs_totalFailedURLs", URLFetcher.totalFailed);
- prop.put("runs_lastRun", fetcher.lastRun);
- prop.put("runs_lastFetchedURLs", fetcher.lastFetchedURLs);
+ prop.putNum("runs_totalRuns", URLFetcher.totalRuns);
+ prop.putNum("runs_totalFetchedURLs", URLFetcher.totalFetchedURLs);
+ prop.putNum("runs_totalFailedURLs", URLFetcher.totalFailed);
+ prop.putNum("runs_lastRun", fetcher.lastRun);
+ prop.putNum("runs_lastFetchedURLs", fetcher.lastFetchedURLs);
prop.put("runs_lastServerResponse", (fetcher.lastServerResponse == null)
? "" : fetcher.lastServerResponse);
- prop.put("runs_curDelay", (int)(fetcher.delay / 60000));
+ prop.putNum("runs_curDelay", (int)(fetcher.delay / 60000));
Iterator it = fetcher.failed.keySet().iterator();
int i = 0;
@@ -248,7 +248,7 @@ public class CrawlURLFetch_p {
prop.put("runs_error_" + i + "_url", (String)key);
i++;
}
- prop.put("runs_error", i);
+ prop.put("runs_error", i);
}
return prop;
@@ -256,10 +256,10 @@ public class CrawlURLFetch_p {
private static int listURLs(serverObjects prop) {
if (savedURLs.size() == 0) return 0;
- prop.put("saved", 1);
+ prop.put("saved", "1");
for (int i=0; i<savedURLs.size(); i++)
prop.put("saved_urls_" + i + "_url", savedURLs.get(i));
- prop.put("saved_urls", savedURLs.size());
+ prop.putNum("saved_urls", savedURLs.size());
return savedURLs.size();
}
@@ -292,9 +292,9 @@ public class CrawlURLFetch_p {
peerCount++;
}
prop.put("peersKnown_peers", peerCount);
- prop.put("peersKnown", 1);
+ prop.put("peersKnown", "1");
} else {
- prop.put("peersKnown", 0);
+ prop.put("peersKnown", "0");
}
return peerCount;
}
diff --git a/htroot/FeedReader_p.java b/htroot/FeedReader_p.java
index 94634f004..6fe271302 100644
--- a/htroot/FeedReader_p.java
+++ b/htroot/FeedReader_p.java
@@ -38,13 +38,13 @@ public class FeedReader_p {
public static servletProperties respond(httpHeader header, serverObjects post, serverSwitch env) {
servletProperties prop = new servletProperties();
- prop.put("page", 0);
+ prop.put("page", "0");
if (post != null) {
yacyURL url;
try {
url = new yacyURL((String) post.get("url"), null);
} catch (MalformedURLException e) {
- prop.put("page", 2);
+ prop.put("page", "2");
return prop;
}
@@ -52,25 +52,25 @@ public class FeedReader_p {
// int offset=Integer.parseInt(post.get("offset", "0")); //offset to the first displayed item
rssReader parser = new rssReader(url.toString());
- prop.put("page_title", parser.getChannel().getTitle());
+ prop.putHTML("page_title", parser.getChannel().getTitle());
if (parser.getChannel().getAuthor() == null) {
- prop.put("page_hasAuthor", 0);
+ prop.put("page_hasAuthor", "0");
} else {
- prop.put("page_hasAuthor", 1);
- prop.put("page_hasAuthor_author", parser.getChannel().getAuthor());
+ prop.put("page_hasAuthor", "1");
+ prop.putHTML("page_hasAuthor_author", parser.getChannel().getAuthor());
}
- prop.put("page_description", parser.getChannel().getDescription());
+ prop.putHTML("page_description", parser.getChannel().getDescription());
for (int i = 0; i < parser.items(); i++) {
rssReader.Item item = parser.getItem(i);
- prop.put("page_items_" + i + "_author", item.getAuthor());
- prop.put("page_items_" + i + "_title", item.getTitle());
+ prop.putHTML("page_items_" + i + "_author", item.getAuthor());
+ prop.putHTML("page_items_" + i + "_title", item.getTitle());
prop.put("page_items_" + i + "_link", item.getLink());
- prop.putASIS("page_items_" + i + "_description", item.getDescription());
+ prop.put("page_items_" + i + "_description", item.getDescription());
prop.put("page_items_" + i + "_date", item.getPubDate());
}
prop.put("page_items", parser.items());
- prop.put("page", 1);
+ prop.put("page", "1");
}
// return rewrite properties
diff --git a/htroot/IndexCleaner_p.java b/htroot/IndexCleaner_p.java
index 4ee65f660..a5dc388a5 100755
--- a/htroot/IndexCleaner_p.java
+++ b/htroot/IndexCleaner_p.java
@@ -59,7 +59,7 @@ public class IndexCleaner_p {
plasmaSwitchboard sb = (plasmaSwitchboard) env;
prop.put("title", "DbCleanup_p");
if (post!=null) {
- prop.put("bla", "post!=null");
+ //prop.putHTML("bla", "post!=null");
if (post.get("action").equals("ustart")) {
if (urldbCleanerThread==null || !urldbCleanerThread.isAlive()) {
urldbCleanerThread = sb.wordIndex.loadedURL.makeCleaner();
@@ -93,30 +93,30 @@ public class IndexCleaner_p {
prop.put("LOCATION","");
return prop;
}
- prop.put("bla", "post==null");
+ //prop.put("bla", "post==null");
if (urldbCleanerThread!=null) {
- prop.put("urldb", 1);
- prop.put("urldb_percentUrls", ((double)urldbCleanerThread.totalSearchedUrls/sb.wordIndex.loadedURL.size())*100 + "");
- prop.put("urldb_blacklisted", urldbCleanerThread.blacklistedUrls);
- prop.put("urldb_total", urldbCleanerThread.totalSearchedUrls);
- prop.put("urldb_lastBlacklistedUrl", urldbCleanerThread.lastBlacklistedUrl);
+ prop.put("urldb", "1");
+ prop.putNum("urldb_percentUrls", ((double)urldbCleanerThread.totalSearchedUrls/sb.wordIndex.loadedURL.size())*100);
+ prop.putNum("urldb_blacklisted", urldbCleanerThread.blacklistedUrls);
+ prop.putNum("urldb_total", urldbCleanerThread.totalSearchedUrls);
+ prop.putHTML("urldb_lastBlacklistedUrl", urldbCleanerThread.lastBlacklistedUrl);
prop.put("urldb_lastBlacklistedHash", urldbCleanerThread.lastBlacklistedHash);
- prop.put("urldb_lastUrl", urldbCleanerThread.lastUrl);
+ prop.putHTML("urldb_lastUrl", urldbCleanerThread.lastUrl);
prop.put("urldb_lastHash", urldbCleanerThread.lastHash);
prop.put("urldb_threadAlive", urldbCleanerThread.isAlive() + "");
prop.put("urldb_threadToString", urldbCleanerThread.toString());
double percent = ((double)urldbCleanerThread.blacklistedUrls/urldbCleanerThread.totalSearchedUrls)*100;
- prop.put("urldb_percent", percent + "");
+ prop.putNum("urldb_percent", percent);
}
if (indexCleanerThread!=null) {
- prop.put("rwidb", 1);
+ prop.put("rwidb", "1");
prop.put("rwidb_threadAlive", indexCleanerThread.isAlive() + "");
prop.put("rwidb_threadToString", indexCleanerThread.toString());
- prop.put("rwidb_RWIcountstart", indexCleanerThread.rwiCountAtStart);
- prop.put("rwidb_RWIcountnow", sb.wordIndex.size());
+ prop.putNum("rwidb_RWIcountstart", indexCleanerThread.rwiCountAtStart);
+ prop.putNum("rwidb_RWIcountnow", sb.wordIndex.size());
prop.put("rwidb_wordHashNow", indexCleanerThread.wordHashNow);
prop.put("rwidb_lastWordHash", indexCleanerThread.lastWordHash);
- prop.put("rwidb_lastDeletionCounter", indexCleanerThread.lastDeletionCounter);
+ prop.putNum("rwidb_lastDeletionCounter", indexCleanerThread.lastDeletionCounter);
}
return prop;
diff --git a/htroot/IndexControl_p.java b/htroot/IndexControl_p.java
index 58b870b1b..0b7bfc8fa 100644
--- a/htroot/IndexControl_p.java
+++ b/htroot/IndexControl_p.java
@@ -105,9 +105,9 @@ public class IndexControl_p {
if (!urlstring.startsWith("http://") &&
!urlstring.startsWith("https://")) { urlstring = "http://" + urlstring; }
- prop.put("keystring", keystring);
+ prop.putHTML("keystring", keystring);
prop.put("keyhash", keyhash);
- prop.put("urlstring", urlstring);
+ prop.putHTML("urlstring", urlstring);
prop.put("urlhash", urlhash);
prop.put("result", " ");
@@ -189,7 +189,7 @@ public class IndexControl_p {
urlstring = entry.comp().url().toNormalform(false, true);
prop.put("urlstring", "");
switchboard.urlRemove(urlhash);
- prop.put("result", "Removed URL " + urlstring);
+ prop.putHTML("result", "Removed URL " + urlstring);
}
}
@@ -203,7 +203,7 @@ public class IndexControl_p {
prop.put("result", "No input given; nothing deleted.");
} else {
switchboard.urlRemove(urlhash);
- prop.put("result", "Removed URL " + urlstring);
+ prop.putHTML("result", "Removed URL " + urlstring);
}
}
@@ -217,7 +217,7 @@ public class IndexControl_p {
if (post.containsKey("keyhashsearch")) {
if (keystring.length() == 0 || !plasmaCondenser.word2hash(keystring).equals(keyhash)) {
- prop.put("keystring", "<not possible to compute word from hash>");
+ prop.put("keystring", "&lt;not possible to compute word from hash&gt;");
}
prop.put("urlstring", "");
prop.put("urlhash", "");
@@ -227,7 +227,7 @@ public class IndexControl_p {
// transfer to other peer
if (post.containsKey("keyhashtransfer")) {
if (keystring.length() == 0 || !plasmaCondenser.word2hash(keystring).equals(keyhash)) {
- prop.put("keystring", "<not possible to compute word from hash>");
+ prop.put("keystring", "&lt;not possible to compute word from hash&gt;");
}
// find host & peer
@@ -290,7 +290,7 @@ public class IndexControl_p {
indexContainer container;
int i = 0;
int rows = 0, cols = 0;
- prop.put("keyhashsimilar", 1);
+ prop.put("keyhashsimilar", "1");
while (containerIt.hasNext() && i < 256) {
container = (indexContainer) containerIt.next();
prop.put("keyhashsimilar_rows_"+rows+"_cols_"+cols+"_wordHash", container.getWordHash());
@@ -314,13 +314,13 @@ public class IndexControl_p {
prop.put("urlhash", urlhash);
indexURLEntry entry = switchboard.wordIndex.loadedURL.load(urlhash, null);
if (entry == null) {
- prop.put("urlstring", "unknown url: " + urlstring);
+ prop.putHTML("urlstring", "unknown url: " + urlstring);
prop.put("urlhash", "");
} else {
prop.putAll(genUrlProfile(switchboard, entry, urlhash));
}
} catch (MalformedURLException e) {
- prop.put("urlstring", "bad url: " + urlstring);
+ prop.putHTML("urlstring", "bad url: " + urlstring);
prop.put("urlhash", "");
}
}
@@ -330,7 +330,7 @@ public class IndexControl_p {
if (entry == null) {
prop.put("result", "No Entry for URL hash " + urlhash);
} else {
- prop.put("urlstring", entry.comp().url().toNormalform(false, true));
+ prop.putHTML("urlstring", entry.comp().url().toNormalform(false, true));
prop.putAll(genUrlProfile(switchboard, entry, urlhash));
}
}
@@ -343,7 +343,7 @@ public class IndexControl_p {
indexURLEntry entry;
int i = 0;
int rows = 0, cols = 0;
- prop.put("urlhashsimilar", 1);
+ prop.put("urlhashsimilar", "1");
while (entryIt.hasNext() && i < 256) {
entry = (indexURLEntry) entryIt.next();
if (entry == null) break;
@@ -427,8 +427,8 @@ public class IndexControl_p {
listHosts(prop, keyhash);
// insert constants
- prop.put("wcount", Integer.toString(switchboard.wordIndex.size()));
- prop.put("ucount", Integer.toString(switchboard.wordIndex.loadedURL.size()));
+ prop.putNum("wcount", switchboard.wordIndex.size());
+ prop.putNum("ucount", switchboard.wordIndex.loadedURL.size());
// return rewrite properties
return prop;
}
@@ -443,11 +443,11 @@ public class IndexControl_p {
seed = (yacySeed) e.next();
if (seed != null) {
prop.put("hosts_" + hc + "_hosthash", seed.hash);
- prop.put("hosts_" + hc + "_hostname", seed.hash + " " + seed.get(yacySeed.NAME, "nameless"));
+ prop.putHTML("hosts_" + hc + "_hostname", seed.hash + " " + seed.get(yacySeed.NAME, "nameless"));
hc++;
}
}
- prop.put("hosts", Integer.toString(hc));
+ prop.put("hosts", hc);
} else {
prop.put("hosts", "0");
}
@@ -456,7 +456,7 @@ public class IndexControl_p {
public static serverObjects genUrlProfile(plasmaSwitchboard switchboard, indexURLEntry entry, String urlhash) {
serverObjects prop = new serverObjects();
if (entry == null) {
- prop.put("genUrlProfile", 1);
+ prop.put("genUrlProfile", "1");
prop.put("genUrlProfile_urlhash", urlhash);
return prop;
}
@@ -469,17 +469,17 @@ public class IndexControl_p {
referrer = le.comp().url().toNormalform(false, true);
}
if (comp.url() == null) {
- prop.put("genUrlProfile", 1);
+ prop.put("genUrlProfile", "1");
prop.put("genUrlProfile_urlhash", urlhash);
return prop;
}
- prop.put("genUrlProfile", 2);
- prop.put("genUrlProfile_urlNormalform", comp.url().toNormalform(false, true));
+ prop.put("genUrlProfile", "2");
+ prop.putHTML("genUrlProfile_urlNormalform", comp.url().toNormalform(false, true));
prop.put("genUrlProfile_urlhash", urlhash);
prop.put("genUrlProfile_urlDescr", comp.title());
prop.put("genUrlProfile_moddate", entry.moddate());
prop.put("genUrlProfile_loaddate", entry.loaddate());
- prop.put("genUrlProfile_referrer", referrer);
+ prop.putHTML("genUrlProfile_referrer", referrer);
prop.put("genUrlProfile_doctype", ""+entry.doctype());
prop.put("genUrlProfile_language", entry.language());
prop.put("genUrlProfile_size", entry.size());
@@ -497,11 +497,11 @@ public class IndexControl_p {
prop.put("genUrlList_keyHash", keyhash);
if ((index == null) || (index.size() == 0)) {
- prop.put("genUrlList", 1);
- prop.put("genUrlList_count", 0);
+ prop.put("genUrlList", "1");
+ prop.put("genUrlList_count", "0");
} else {
final Iterator en = index.entries();
- prop.put("genUrlList", 2);
+ prop.put("genUrlList", "2");
String us;
String uh[] = new String[2];
int i = 0;
@@ -527,26 +527,26 @@ public class IndexControl_p {
us = iter.next().toString();
uh = (String[]) tm.get(us);
if (us.equals(uh[0])) {
- prop.put("genUrlList_urlList_"+i+"_urlExists", 0);
+ prop.put("genUrlList_urlList_"+i+"_urlExists", "0");
prop.put("genUrlList_urlList_"+i+"_urlExists_urlhxCount", i);
- prop.put("genUrlList_urlList_"+i+"_urlExists_urlhxValue", uh[0]);
+ prop.putHTML("genUrlList_urlList_"+i+"_urlExists_urlhxValue", uh[0]);
} else {
- prop.put("genUrlList_urlList_"+i+"_urlExists", 1);
+ prop.put("genUrlList_urlList_"+i+"_urlExists", "1");
prop.put("genUrlList_urlList_"+i+"_urlExists_urlhxCount", i);
- prop.put("genUrlList_urlList_"+i+"_urlExists_urlhxValue", uh[0]);
- prop.put("genUrlList_urlList_"+i+"_urlExists_keyString", keystring);
+ prop.putHTML("genUrlList_urlList_"+i+"_urlExists_urlhxValue", uh[0]);
+ prop.putHTML("genUrlList_urlList_"+i+"_urlExists_keyString", keystring);
prop.put("genUrlList_urlList_"+i+"_urlExists_keyHash", keyhash);
- prop.put("genUrlList_urlList_"+i+"_urlExists_urlString", us);
+ prop.putHTML("genUrlList_urlList_"+i+"_urlExists_urlString", us);
prop.put("genUrlList_urlList_"+i+"_urlExists_pos", uh[1]);
url = new yacyURL(us, null);
if (plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_DHT, url)) {
- prop.put("genUrlList_urlList_"+i+"_urlExists_urlhxChecked", 1);
+ prop.put("genUrlList_urlList_"+i+"_urlExists_urlhxChecked", "1");
}
}
i++;
}
prop.put("genUrlList_urlList", i);
- prop.put("genUrlList_keyString", keystring);
+ prop.putHTML("genUrlList_keyString", keystring);
prop.put("genUrlList_count", i);
putBlacklists(prop, listManager.getDirListing(listManager.listsPath));
}
diff --git a/htroot/IndexCreateIndexingQueue_p.java b/htroot/IndexCreateIndexingQueue_p.java
index 154fbe54f..707048202 100644
--- a/htroot/IndexCreateIndexingQueue_p.java
+++ b/htroot/IndexCreateIndexingQueue_p.java
@@ -44,7 +44,6 @@
// if the shell's current path is HTROOT
import java.io.IOException;
-import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Iterator;
@@ -53,6 +52,7 @@ import de.anomic.plasma.plasmaCrawlZURL;
import de.anomic.plasma.plasmaHTCache;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.plasma.plasmaSwitchboardQueue;
+import de.anomic.server.serverMemory;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyCore;
@@ -65,7 +65,7 @@ public class IndexCreateIndexingQueue_p {
// return variable that accumulates replacements
plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
serverObjects prop = new serverObjects();
- prop.put("rejected", 0);
+ prop.put("rejected", "0");
int showRejectedCount = 100;
int showLimit = 100;
@@ -108,9 +108,9 @@ public class IndexCreateIndexingQueue_p {
boolean dark;
if ((switchboard.sbQueue.size() == 0) && (switchboard.indexingTasksInProcess.size() == 0)) {
- prop.put("indexing-queue", 0); //is empty
+ prop.put("indexing-queue", "0"); //is empty
} else {
- prop.put("indexing-queue", 1); // there are entries in the queue or in process
+ prop.put("indexing-queue", "1"); // there are entries in the queue or in process
dark = true;
plasmaSwitchboardQueue.Entry pcentry;
@@ -140,37 +140,37 @@ public class IndexCreateIndexingQueue_p {
long entrySize = pcentry.size();
totalSize += entrySize;
initiator = yacyCore.seedDB.getConnected(pcentry.initiator());
- prop.put("indexing-queue_list_"+entryCount+"_dark", (inProcess)? 2: ((dark) ? 1 : 0));
+ prop.put("indexing-queue_list_"+entryCount+"_dark", inProcess ? "2" : (dark ? "1" : "0"));
prop.put("indexing-queue_list_"+entryCount+"_initiator", ((initiator == null) ? "proxy" : initiator.getName()));
prop.put("indexing-queue_list_"+entryCount+"_depth", pcentry.depth());
prop.put("indexing-queue_list_"+entryCount+"_modified", pcentry.getModificationDate());
- prop.put("indexing-queue_list_"+entryCount+"_anchor", (pcentry.anchorName()==null)?"":pcentry.anchorName());
+ prop.putHTML("indexing-queue_list_"+entryCount+"_anchor", (pcentry.anchorName()==null)?"":pcentry.anchorName());
prop.put("indexing-queue_list_"+entryCount+"_url", pcentry.url().toNormalform(false, true));
- prop.put("indexing-queue_list_"+entryCount+"_size", bytesToString(entrySize));
- prop.put("indexing-queue_list_"+entryCount+"_inProcess", (inProcess)?1:0);
+ prop.put("indexing-queue_list_"+entryCount+"_size", serverMemory.bytesToString(entrySize));
+ prop.put("indexing-queue_list_"+entryCount+"_inProcess", inProcess ? "1" :"0");
prop.put("indexing-queue_list_"+entryCount+"_inProcess_hash", pcentry.urlHash());
dark = !dark;
entryCount++;
}
}
- prop.put("indexing-queue_show", entryCount);//show shown entries
- prop.put("indexing-queue_num", totalCount);//num entries in queue
- prop.put("indexing-queue_totalSize", bytesToString(totalSize));//num entries in queue
- prop.put("indexing-queue_list", entryCount);
+ prop.putNum("indexing-queue_show", entryCount);//show shown entries
+ prop.putNum("indexing-queue_num", totalCount); //num entries in queue
+ prop.put("indexing-queue_totalSize", serverMemory.bytesToString(totalSize));//num entries in queue
+ prop.putNum("indexing-queue_list", entryCount);
}
// failure cases
if (switchboard.errorURL.stackSize() != 0) {
if (showRejectedCount > switchboard.errorURL.stackSize()) showRejectedCount = switchboard.errorURL.stackSize();
- prop.put("rejected", 1);
- prop.put("rejected_num", switchboard.errorURL.stackSize());
+ prop.put("rejected", "1");
+ prop.putNum("rejected_num", switchboard.errorURL.stackSize());
if (showRejectedCount != switchboard.errorURL.stackSize()) {
- prop.put("rejected_only-latest", 1);
- prop.put("rejected_only-latest_num", showRejectedCount);
- prop.put("rejected_only-latest_newnum", ((int) (showRejectedCount * 1.5)));
+ prop.put("rejected_only-latest", "1");
+ prop.putNum("rejected_only-latest_num", showRejectedCount);
+ prop.putNum("rejected_only-latest_newnum", ((int) (showRejectedCount * 1.5)));
}else{
- prop.put("rejected_only-latest", 0);
+ prop.put("rejected_only-latest", "0");
}
dark = true;
yacyURL url;
@@ -191,8 +191,8 @@ public class IndexCreateIndexingQueue_p {
prop.put("rejected_list_"+j+"_initiator", ((initiatorSeed == null) ? "proxy" : initiatorSeed.getName()));
prop.put("rejected_list_"+j+"_executor", ((executorSeed == null) ? "proxy" : executorSeed.getName()));
prop.put("rejected_list_"+j+"_url", url.toNormalform(false, true));
- prop.put("rejected_list_"+j+"_failreason", entry.anycause());
- prop.put("rejected_list_"+j+"_dark", ((dark) ? 1 : 0));
+ prop.putHTML("rejected_list_"+j+"_failreason", entry.anycause());
+ prop.put("rejected_list_"+j+"_dark", dark ? "1" : "0");
dark = !dark;
j++;
} catch (IOException e) {
@@ -205,34 +205,4 @@ public class IndexCreateIndexingQueue_p {
// return rewrite properties
return prop;
}
-
- public static String bytesToString(long byteCount) {
- try {
- StringBuffer byteString = new StringBuffer();
-
- DecimalFormat df = new DecimalFormat( "0.00" );
- if (byteCount > 1073741824) {
- byteString.append(df.format((double)byteCount / (double)1073741824 ))
- .append(" GB");
- } else if (byteCount > 1048576) {
- byteString.append(df.format((double)byteCount / (double)1048576))
- .append(" MB");
- } else if (byteCount > 1024) {
- byteString.append(df.format((double)byteCount /(double)1024))
- .append(" KB");
- } else {
- byteString.append(Long.toString(byteCount))
- .append(" Bytes");
- }
-
- return byteString.toString();
- } catch (Exception e) {
- return "unknown";
- }
-
- }
-
}
-
-
-
diff --git a/htroot/IndexCreateLoaderQueue_p.java b/htroot/IndexCreateLoaderQueue_p.java
index d4f5eff30..b0e1c1e5d 100644
--- a/htroot/IndexCreateLoaderQueue_p.java
+++ b/htroot/IndexCreateLoaderQueue_p.java
@@ -61,9 +61,9 @@ public class IndexCreateLoaderQueue_p {
if (switchboard.cacheLoader.size() == 0) {
- prop.put("loader-set", 0);
+ prop.put("loader-set", "0");
} else {
- prop.put("loader-set", 1);
+ prop.put("loader-set", "1");
boolean dark = true;
ThreadGroup loaderThreads = switchboard.cacheLoader.threadStatus();
@@ -78,7 +78,7 @@ public class IndexCreateLoaderQueue_p {
if (theMsg == null) continue;
initiator = yacyCore.seedDB.getConnected(theMsg.initiator);
- prop.put("loader-set_list_"+count+"_dark", ((dark) ? 1 : 0) );
+ prop.put("loader-set_list_"+count+"_dark", dark ? "1" : "0");
prop.put("loader-set_list_"+count+"_initiator", ((initiator == null) ? "proxy" : initiator.getName()));
prop.put("loader-set_list_"+count+"_depth", theMsg.depth );
prop.put("loader-set_list_"+count+"_url", theMsg.url.toNormalform(false, true)); // null pointer exception here !!! maybe url = null; check reason.
@@ -92,8 +92,4 @@ public class IndexCreateLoaderQueue_p {
// return rewrite properties
return prop;
}
-
}
-
-
-
diff --git a/htroot/IndexCreateWWWGlobalQueue_p.java b/htroot/IndexCreateWWWGlobalQueue_p.java
index 0f78b7e1a..7b563181d 100644
--- a/htroot/IndexCreateWWWGlobalQueue_p.java
+++ b/htroot/IndexCreateWWWGlobalQueue_p.java
@@ -89,8 +89,8 @@ public class IndexCreateWWWGlobalQueue_p {
if (urlHash != null) { switchboard.urlPool.noticeURL.remove(urlHash); c++; }
}
*/
- prop.put("info", 3);//crawling queue cleared
- prop.put("info_numEntries", c);
+ prop.put("info", "3");//crawling queue cleared
+ prop.putNum("info_numEntries", c);
} else if (post.containsKey("deleteEntry")) {
String urlHash = (String) post.get("deleteEntry");
switchboard.noticeURL.removeByURLHash(urlHash);
@@ -101,9 +101,9 @@ public class IndexCreateWWWGlobalQueue_p {
int stackSize = switchboard.noticeURL.stackSize(plasmaCrawlNURL.STACK_TYPE_LIMIT);
if (stackSize == 0) {
- prop.put("crawler-queue", 0);
+ prop.put("crawler-queue", "0");
} else {
- prop.put("crawler-queue", 1);
+ prop.put("crawler-queue", "1");
plasmaCrawlEntry[] crawlerList = switchboard.noticeURL.top(plasmaCrawlNURL.STACK_TYPE_LIMIT, showLimit);
plasmaCrawlEntry urle;
@@ -118,12 +118,12 @@ public class IndexCreateWWWGlobalQueue_p {
initiator = yacyCore.seedDB.getConnected(urle.initiator());
profileHandle = urle.profileHandle();
profileEntry = (profileHandle == null) ? null : switchboard.profilesActiveCrawls.getEntry(profileHandle);
- prop.put("crawler-queue_list_"+showNum+"_dark", ((dark) ? 1 : 0) );
+ prop.put("crawler-queue_list_"+showNum+"_dark", dark ? "1" : "0");
prop.put("crawler-queue_list_"+showNum+"_initiator", ((initiator == null) ? "proxy" : initiator.getName()) );
prop.put("crawler-queue_list_"+showNum+"_profile", ((profileEntry == null) ? "unknown" : profileEntry.name()));
prop.put("crawler-queue_list_"+showNum+"_depth", urle.depth());
prop.put("crawler-queue_list_"+showNum+"_modified", daydate(urle.loaddate()) );
- prop.put("crawler-queue_list_"+showNum+"_anchor", urle.name());
+ prop.putHTML("crawler-queue_list_"+showNum+"_anchor", urle.name());
prop.put("crawler-queue_list_"+showNum+"_url", urle.url().toNormalform(false, true));
prop.put("crawler-queue_list_"+showNum+"_hash", urle.url().hash());
dark = !dark;
@@ -132,16 +132,12 @@ public class IndexCreateWWWGlobalQueue_p {
stackSize--;
}
}
- prop.put("crawler-queue_show-num", showNum); //showin sjow-num most recent
- prop.put("crawler-queue_num", stackSize);//num Entries
- prop.put("crawler-queue_list", showNum);
+ prop.putNum("crawler-queue_show-num", showNum); //showin sjow-num most recent
+ prop.putNum("crawler-queue_num", stackSize);//num Entries
+ prop.putNum("crawler-queue_list", showNum);
}
// return rewrite properties
return prop;
}
-
}
-
-
-
diff --git a/htroot/IndexCreateWWWLocalQueue_p.java b/htroot/IndexCreateWWWLocalQueue_p.java
index e3c5c3843..dc87fb3ff 100644
--- a/htroot/IndexCreateWWWLocalQueue_p.java
+++ b/htroot/IndexCreateWWWLocalQueue_p.java
@@ -154,8 +154,8 @@ public class IndexCreateWWWLocalQueue_p {
}
}
- prop.put("info", 3);//crawling queue cleared
- prop.put("info_numEntries", c);
+ prop.put("info", "3");//crawling queue cleared
+ prop.putNum("info_numEntries", c);
} else if (post.containsKey("deleteEntry")) {
String urlHash = (String) post.get("deleteEntry");
switchboard.noticeURL.removeByURLHash(urlHash);
@@ -166,9 +166,9 @@ public class IndexCreateWWWLocalQueue_p {
int showNum = 0, stackSize = switchboard.noticeURL.stackSize(plasmaCrawlNURL.STACK_TYPE_CORE);
if (stackSize == 0) {
- prop.put("crawler-queue", 0);
+ prop.put("crawler-queue", "0");
} else {
- prop.put("crawler-queue", 1);
+ prop.put("crawler-queue", "1");
plasmaCrawlEntry[] crawlerList = switchboard.noticeURL.top(plasmaCrawlNURL.STACK_TYPE_CORE, (int) (showLimit * 1.20));
plasmaCrawlEntry urle;
@@ -183,12 +183,12 @@ public class IndexCreateWWWLocalQueue_p {
initiator = yacyCore.seedDB.getConnected(urle.initiator());
profileHandle = urle.profileHandle();
profileEntry = (profileHandle == null) ? null : switchboard.profilesActiveCrawls.getEntry(profileHandle);
- prop.put("crawler-queue_list_"+showNum+"_dark", ((dark) ? 1 : 0) );
+ prop.put("crawler-queue_list_"+showNum+"_dark", dark ? "1" : "0");
prop.put("crawler-queue_list_"+showNum+"_initiator", ((initiator == null) ? "proxy" : initiator.getName()) );
prop.put("crawler-queue_list_"+showNum+"_profile", ((profileEntry == null) ? "unknown" : profileEntry.name()));
prop.put("crawler-queue_list_"+showNum+"_depth", urle.depth());
prop.put("crawler-queue_list_"+showNum+"_modified", daydate(urle.loaddate()) );
- prop.put("crawler-queue_list_"+showNum+"_anchor", urle.name());
+ prop.putHTML("crawler-queue_list_"+showNum+"_anchor", urle.name());
prop.put("crawler-queue_list_"+showNum+"_url", urle.url().toNormalform(false, true));
prop.put("crawler-queue_list_"+showNum+"_hash", urle.url().hash());
dark = !dark;
@@ -197,17 +197,13 @@ public class IndexCreateWWWLocalQueue_p {
stackSize--;
}
}
- prop.put("crawler-queue_list", showNum);
- prop.put("crawler-queue_num", stackSize);//num Entries
- prop.put("crawler-queue_show-num", showNum); //showin sjow-num most recent
+ prop.putNum("crawler-queue_list", showNum);
+ prop.putNum("crawler-queue_num", stackSize);//num Entries
+ prop.putNum("crawler-queue_show-num", showNum); //showin sjow-num most recent
}
// return rewrite properties
return prop;
}
-
}
-
-
-
diff --git a/htroot/IndexCreateWWWRemoteQueue_p.java b/htroot/IndexCreateWWWRemoteQueue_p.java
index cb30a2cda..dd2be646d 100644
--- a/htroot/IndexCreateWWWRemoteQueue_p.java
+++ b/htroot/IndexCreateWWWRemoteQueue_p.java
@@ -89,8 +89,8 @@ public class IndexCreateWWWRemoteQueue_p {
if (urlHash != null) { switchboard.urlPool.noticeURL.remove(urlHash); c++; }
}
*/
- prop.put("info", 3); // crawling queue cleared
- prop.put("info_numEntries", c);
+ prop.put("info", "3"); // crawling queue cleared
+ prop.putNum("info_numEntries", c);
} else if (post.containsKey("deleteEntry")) {
String urlHash = (String) post.get("deleteEntry");
sb.noticeURL.removeByURLHash(urlHash);
@@ -101,9 +101,9 @@ public class IndexCreateWWWRemoteQueue_p {
int stackSize = sb.noticeURL.stackSize(plasmaCrawlNURL.STACK_TYPE_REMOTE);
if (stackSize == 0) {
- prop.put("crawler-queue", 0);
+ prop.put("crawler-queue", "0");
} else {
- prop.put("crawler-queue", 1);
+ prop.put("crawler-queue", "1");
plasmaCrawlEntry[] crawlerList = sb.noticeURL.top(plasmaCrawlNURL.STACK_TYPE_REMOTE, showLimit);
plasmaCrawlEntry urle;
@@ -118,12 +118,12 @@ public class IndexCreateWWWRemoteQueue_p {
initiator = yacyCore.seedDB.getConnected(urle.initiator());
profileHandle = urle.profileHandle();
profileEntry = (profileHandle == null) ? null : sb.profilesActiveCrawls.getEntry(profileHandle);
- prop.put("crawler-queue_list_" + showNum + "_dark", ((dark) ? 1 : 0) );
+ prop.put("crawler-queue_list_" + showNum + "_dark", dark ? "1" : "0");
prop.put("crawler-queue_list_" + showNum + "_initiator", ((initiator == null) ? "proxy" : initiator.getName()));
prop.put("crawler-queue_list_" + showNum + "_profile", ((profileEntry == null) ? "unknown" : profileEntry.name()));
prop.put("crawler-queue_list_" + showNum + "_depth", urle.depth());
prop.put("crawler-queue_list_" + showNum + "_modified", daydate(urle.loaddate()) );
- prop.put("crawler-queue_list_" + showNum + "_anchor", urle.name());
+ prop.putHTML("crawler-queue_list_" + showNum + "_anchor", urle.name());
prop.put("crawler-queue_list_" + showNum + "_url", urle.url().toString());
prop.put("crawler-queue_list_" + showNum + "_hash", urle.url().hash());
dark = !dark;
@@ -132,11 +132,10 @@ public class IndexCreateWWWRemoteQueue_p {
stackSize--;
}
}
- prop.put("crawler-queue_show-num", showNum); //showin sjow-num most recent
- prop.put("crawler-queue_num", stackSize);//num Entries
- prop.put("crawler-queue_list", showNum);
+ prop.putNum("crawler-queue_show-num", showNum); //showin sjow-num most recent
+ prop.putNum("crawler-queue_num", stackSize);//num Entries
+ prop.putNum("crawler-queue_list", showNum);
}
-
return prop;
}
}
diff --git a/htroot/IndexImport_p.java b/htroot/IndexImport_p.java
index 6d2c30950..8973f6bfe 100644
--- a/htroot/IndexImport_p.java
+++ b/htroot/IndexImport_p.java
@@ -112,15 +112,15 @@ public final class IndexImport_p {
PrintStream errorOut = new PrintStream(errorMsg);
e.printStackTrace(errorOut);
- prop.put("error",3);
- prop.put("error_error_msg",e.toString());
- prop.put("error_error_stackTrace",errorMsg.toString().replaceAll("\n","<br>"));
+ prop.put("error", "3");
+ prop.putHTML("error_error_msg",e.toString());
+ prop.putHTML("error_error_stackTrace",errorMsg.toString().replaceAll("\n","<br>"));
errorOut.close();
}
} else if (post.containsKey("clearFinishedJobList")) {
switchboard.dbImportManager.finishedJobs.clear();
- prop.put("LOCATION","");
+ prop.put("LOCATION", "");
return prop;
} else if (
(post.containsKey("stopIndexDbImport")) ||
@@ -149,8 +149,8 @@ public final class IndexImport_p {
}
}
- prop.put("wcount", Integer.toString(switchboard.wordIndex.size()));
- prop.put("ucount", Integer.toString(switchboard.wordIndex.loadedURL.size()));
+ prop.putNum("wcount", switchboard.wordIndex.size());
+ prop.putNum("ucount", switchboard.wordIndex.loadedURL.size());
/*
* Loop over all currently running jobs
@@ -162,7 +162,7 @@ public final class IndexImport_p {
dbImporter currThread = importThreads[i];
// get import type
- prop.put("running.jobs_" + i + "_type", currThread.getJobType());
+ prop.put("running.jobs_" + i + "_type", currThread.getJobType());
// root path of the source db
String fullName = currThread.getJobName().toString();
@@ -171,24 +171,24 @@ public final class IndexImport_p {
prop.put("running.jobs_" + i + "_shortName",shortName);
// specifies if the importer is still running
- prop.put("running.jobs_" + i + "_stopped", currThread.isStopped() ? 0:1);
+ prop.put("running.jobs_" + i + "_stopped", currThread.isStopped() ? "0" : "1");
// specifies if the importer was paused
- prop.put("running.jobs_" + i + "_paused", currThread.isPaused() ? 1:0);
+ prop.put("running.jobs_" + i + "_paused", currThread.isPaused() ? "1" : "0");
// setting the status
- prop.put("running.jobs_" + i + "_runningStatus", currThread.isPaused() ? 2 : currThread.isStopped() ? 0 : 1);
+ prop.put("running.jobs_" + i + "_runningStatus", currThread.isPaused() ? "2" : currThread.isStopped() ? "0" : "1");
// other information
- prop.put("running.jobs_" + i + "_percent", Integer.toString(currThread.getProcessingStatusPercent()));
- prop.put("running.jobs_" + i + "_elapsed", serverDate.intervalToString(currThread.getElapsedTime()));
- prop.put("running.jobs_" + i + "_estimated", serverDate.intervalToString(currThread.getEstimatedTime()));
- prop.put("running.jobs_" + i + "_status", currThread.getStatus().replaceAll("\n", "<br>"));
+ prop.putNum("running.jobs_" + i + "_percent", currThread.getProcessingStatusPercent());
+ prop.put("running.jobs_" + i + "_elapsed", serverDate.intervalToString(currThread.getElapsedTime()));
+ prop.put("running.jobs_" + i + "_estimated", serverDate.intervalToString(currThread.getEstimatedTime()));
+ prop.putHTML("running.jobs_" + i + "_status", currThread.getStatus().replaceAll("\n", "<br>"));
// job number of the importer thread
- prop.put("running.jobs_" + i + "_job_nr", Integer.toString(currThread.getJobID()));
+ prop.put("running.jobs_" + i + "_job_nr", currThread.getJobID());
}
- prop.put("running.jobs",activeCount);
+ prop.put("running.jobs", activeCount);
/*
* Loop over all finished jobs
@@ -203,20 +203,18 @@ public final class IndexImport_p {
prop.put("finished.jobs_" + i + "_fullName", fullName);
prop.put("finished.jobs_" + i + "_shortName", shortName);
if (error != null) {
- prop.put("finished.jobs_" + i + "_runningStatus", 1);
- prop.put("finished.jobs_" + i + "_runningStatus_errorMsg", error.replaceAll("\n", "<br>"));
+ prop.put("finished.jobs_" + i + "_runningStatus", "1");
+ prop.putHTML("finished.jobs_" + i + "_runningStatus_errorMsg", error.replaceAll("\n", "<br>"));
} else {
- prop.put("finished.jobs_" + i + "_runningStatus", 0);
+ prop.put("finished.jobs_" + i + "_runningStatus", "0");
}
- prop.put("finished.jobs_" + i + "_percent", Integer.toString(currThread.getProcessingStatusPercent()));
- prop.put("finished.jobs_" + i + "_elapsed", serverDate.intervalToString(currThread.getElapsedTime()));
- prop.put("finished.jobs_" + i + "_status", currThread.getStatus().replaceAll("\n", "<br>"));
+ prop.putNum("finished.jobs_" + i + "_percent", currThread.getProcessingStatusPercent());
+ prop.put("finished.jobs_" + i + "_elapsed", serverDate.intervalToString(currThread.getElapsedTime()));
+ prop.putHTML("finished.jobs_" + i + "_status", currThread.getStatus().replaceAll("\n", "<br>"));
}
prop.put("finished.jobs",finishedJobs.length);
prop.put("date",(new Date()).toString());
return prop;
}
-
-
}
diff --git a/htroot/IndexShare_p.java b/htroot/IndexShare_p.java
index 26e60efe0..5ac16f920 100644
--- a/htroot/IndexShare_p.java
+++ b/htroot/IndexShare_p.java
@@ -65,8 +65,8 @@ public class IndexShare_p {
prop.put("wordfreq", switchboard.getConfig("defaultWordReceiveFrequency","10"));
prop.put("dtable", "");
prop.put("rtable", "");
- prop.put("wcount", Integer.toString(switchboard.wordIndex.size()));
- prop.put("ucount", Integer.toString(switchboard.wordIndex.loadedURL.size()));
+ prop.putNum("wcount", switchboard.wordIndex.size());
+ prop.putNum("ucount", switchboard.wordIndex.loadedURL.size());
return prop; // be save
}
@@ -78,11 +78,10 @@ public class IndexShare_p {
}
// insert constants
- prop.put("wcount", Integer.toString(switchboard.wordIndex.size()));
- prop.put("ucount", Integer.toString(switchboard.wordIndex.loadedURL.size()));
+ prop.putNum("wcount", switchboard.wordIndex.size());
+ prop.putNum("ucount", switchboard.wordIndex.loadedURL.size());
// return rewrite properties
return prop;
}
-
}
diff --git a/htroot/IndexTransfer_p.java b/htroot/IndexTransfer_p.java
index beb1afaf8..4e6029246 100644
--- a/htroot/IndexTransfer_p.java
+++ b/htroot/IndexTransfer_p.java
@@ -95,9 +95,9 @@ public final class IndexTransfer_p {
}
// insert constants
- prop.put("wcount", Integer.toString(switchboard.wordIndex.size()));
- prop.put("ucount", Integer.toString(switchboard.wordIndex.loadedURL.size()));
- prop.put("running",(switchboard.transferIdxThread==null)?0:1);
+ prop.putNum("wcount", switchboard.wordIndex.size());
+ prop.putNum("ucount", switchboard.wordIndex.loadedURL.size());
+ prop.put("running",(switchboard.transferIdxThread==null) ? "0" : "1");
if (switchboard.transferIdxThread != null) {
String[] status = switchboard.transferIdxThread.getStatus();
String[] range = switchboard.transferIdxThread.getRange();
@@ -105,22 +105,22 @@ public final class IndexTransfer_p {
prop.put("running_selection.status",status[0]);
prop.put("running_selection.twrange", range[0]);
- prop.put("running_selection.twchunk", Integer.toString(chunk[0]));
+ prop.put("running_selection.twchunk", chunk[0]);
prop.put("running_transfer.status",status[1]);
prop.put("running_transfer.twrange", range[1]);
- prop.put("running_transfer.twchunk", Integer.toString(chunk[1]));
+ prop.put("running_transfer.twchunk", chunk[1]);
- prop.put("running_twEntityCount",switchboard.transferIdxThread.getTransferedContainerCount());
- prop.put("running_twEntryCount",switchboard.transferIdxThread.getTransferedEntryCount());
- prop.put("running_twPayloadSize",serverMemory.bytesToString(switchboard.transferIdxThread.getTransferedBytes()));
- prop.put("running_twEntityPercent",Float.toString(switchboard.transferIdxThread.getTransferedContainerPercent()));
- prop.put("running_twEntrySpeed",Integer.toString(switchboard.transferIdxThread.getTransferedEntrySpeed()));
+ prop.putNum("running_twEntityCount", switchboard.transferIdxThread.getTransferedContainerCount());
+ prop.putNum("running_twEntryCount", switchboard.transferIdxThread.getTransferedEntryCount());
+ prop.put("running_twPayloadSize", serverMemory.bytesToString(switchboard.transferIdxThread.getTransferedBytes()));
+ prop.putNum("running_twEntityPercent", switchboard.transferIdxThread.getTransferedContainerPercent());
+ prop.putNum("running_twEntrySpeed", switchboard.transferIdxThread.getTransferedEntrySpeed());
- prop.put("running_deleteIndex", switchboard.transferIdxThread.deleteIndex()?1:0);
+ prop.put("running_deleteIndex", switchboard.transferIdxThread.deleteIndex() ? "1" : "0");
prop.put("running_peerName",switchboard.transferIdxThread.getSeed().getName());
- prop.put("running_stopped",(switchboard.transferIdxThread.isFinished()) || (!switchboard.transferIdxThread.isAlive())?1:0);
+ prop.put("running_stopped",(switchboard.transferIdxThread.isFinished()) || (!switchboard.transferIdxThread.isAlive()) ? "1" : "0");
} else {
if (!prop.containsKey("running_status")) prop.put("running_status","Not running");
}
@@ -147,7 +147,7 @@ public final class IndexTransfer_p {
hostList.remove(hostName);
}
} catch (NoSuchElementException ex) {}
- prop.put("running_hosts", Integer.toString(hc));
+ prop.put("running_hosts", hc);
} else {
prop.put("running_hosts", "0");
}
@@ -155,6 +155,4 @@ public final class IndexTransfer_p {
prop.put("date",(new Date()).toString());
return prop;
}
-
-
}
diff --git a/htroot/LogStatistics_p.java b/htroot/LogStatistics_p.java
index 7396299f8..b334e680e 100644
--- a/htroot/LogStatistics_p.java
+++ b/htroot/LogStatistics_p.java
@@ -79,13 +79,13 @@ public class LogStatistics_p {
}
}
- prop.put("submenu", (displaySubmenu) ? 1 : 0);
+ prop.put("submenu", displaySubmenu ? "1" : "0");
if (r == null) {
- prop.put("results", 0);
+ prop.put("results", "0");
return prop;
}
- prop.put("results", 1);
+ prop.put("results", "1");
String[] t;
float l;
prop.put(RESULTS + LogParserPLASMA.DHT_DISTANCE_AVERAGE, r.get(LogParserPLASMA.DHT_DISTANCE_AVERAGE));
@@ -148,9 +148,9 @@ public class LogStatistics_p {
prop.put(RESULTS + LogParserPLASMA.TOTAL_PARSER_TIME + "Unit", t[1]);
prop.put(RESULTS + LogParserPLASMA.TOTAL_PARSER_RUNS, r.get(LogParserPLASMA.TOTAL_PARSER_RUNS));
if ((l /= 1000) == 0) {
- prop.put(RESULTS + "avgExists", 0);
+ prop.put(RESULTS + "avgExists", "0");
} else {
- prop.put(RESULTS + "avgExists", 1);
+ prop.put(RESULTS + "avgExists", "1");
prop.put(RESULTS + "avgExists_avgParserRunsPerMinute", (int) (((Integer) r.get(LogParserPLASMA.TOTAL_PARSER_RUNS)).floatValue() / l));
}
@@ -162,7 +162,7 @@ public class LogStatistics_p {
prop.put(RESULTS + "useDHTRejectPeers_DHTRejectPeers_" + i + "_hash", hashes[i]);
}
prop.put(RESULTS + "DHTRejectPeers", i);
- prop.put(RESULTS + "useDHTRejectPeers", (i > 0) ? 1 : 0);
+ prop.put(RESULTS + "useDHTRejectPeers", (i > 0) ? "1" : "0");
prop.put(RESULTS + "useDHTRejectPeers_DHTRejectPeers", i);
names = ((HashSet)r.get(LogParserPLASMA.DHT_SENT_PEERS_NAME)).toArray();
@@ -173,7 +173,7 @@ public class LogStatistics_p {
prop.put(RESULTS + "useDHTPeers_DHTPeers_" + i + "_hash", hashes[i]);
}
prop.put(RESULTS + "DHTPeers", i);
- prop.put(RESULTS + "useDHTPeers", (i > 0) ? 1 : 0);
+ prop.put(RESULTS + "useDHTPeers", (i > 0) ? "1" : "0");
prop.put(RESULTS + "useDHTPeers_DHTPeers", i);
return prop;
diff --git a/htroot/MessageSend_p.java b/htroot/MessageSend_p.java
index 5307dbb81..68385522f 100644
--- a/htroot/MessageSend_p.java
+++ b/htroot/MessageSend_p.java
@@ -1,48 +1,48 @@
-// MessageSend_p.java
-// -----------------------
-// part of the AnomicHTTPD caching proxy
-// (C) by Michael Peter Christen; [email protected]
-// first published on http://www.anomic.de
-// Frankfurt, Germany, 2004
-// Last major change: 28.06.2003
-//
-// 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
-//
-// Using this software in any meaning (reading, learning, copying, compiling,
-// running) means that you agree that the Author(s) is (are) not responsible
-// for cost, loss of data or any harm that may be caused directly or indirectly
-// 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.
-//
-// Any changes to this file according to the GPL as documented in the file
-// gpl.txt aside this file in the shipment you received can be done to the
-// lines that follows this copyright notice here, but changes must not be
-// done inside the copyright notive above. A re-distribution must contain
-// the intact and unchanged copyright notice.
-// Contributions and changes to the program code must be marked as such.
-
-
-// You must compile this file with
-// javac -classpath .:../Classes MessageSend_p.java
-// if the shell's current path is HTROOT
+//MessageSend_p.java
+//-----------------------
+//part of the AnomicHTTPD caching proxy
+//(C) by Michael Peter Christen; [email protected]
+//first published on http://www.anomic.de
+//Frankfurt, Germany, 2004
+//Last major change: 28.06.2003
+
+//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
+
+//Using this software in any meaning (reading, learning, copying, compiling,
+//running) means that you agree that the Author(s) is (are) not responsible
+//for cost, loss of data or any harm that may be caused directly or indirectly
+//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.
+
+//Any changes to this file according to the GPL as documented in the file
+//gpl.txt aside this file in the shipment you received can be done to the
+//lines that follows this copyright notice here, but changes must not be
+//done inside the copyright notive above. A re-distribution must contain
+//the intact and unchanged copyright notice.
+//Contributions and changes to the program code must be marked as such.
+
+
+//You must compile this file with
+//javac -classpath .:../Classes MessageSend_p.java
+//if the shell's current path is HTROOT
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
@@ -60,67 +60,67 @@ public class MessageSend_p {
private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
public static String dateString(Date date) {
- return SimpleFormatter.format(date);
+ return SimpleFormatter.format(date);
}
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
- serverObjects prop = new serverObjects();
-
- if ((post == null) || (post.get("hash","").length() == 0)) {
- prop.put("mode",2);
- return prop;
- }
-
- String hash = post.get("hash", "");
- String subject = post.get("subject", "");
- String message = post.get("message", "");
-
- if ((message.length() == 0) || (post.containsKey("preview"))) {
+ serverObjects prop = new serverObjects();
+
+ if ((post == null) || (post.get("hash","").length() == 0)) {
+ prop.put("mode", "2");
+ return prop;
+ }
+
+ String hash = post.get("hash", "");
+ String subject = post.get("subject", "");
+ String message = post.get("message", "");
+
+ if ((message.length() == 0) || (post.containsKey("preview"))) {
if (post.containsKey("preview")) {
- prop.put("mode", 1);
+ prop.put("mode", "1");
+ } else {
+ prop.put("mode", "0");
+ }
+
+ // open an editor page for the message
+ // first ask if the other peer is online, and also what kind of document it accepts
+ HashMap result = yacyClient.permissionMessage(hash);
+ //System.out.println("DEBUG: permission request result = " + result.toString());
+ String peerName;
+ yacySeed targetPeer = null;
+ if (hash.equals(yacyCore.seedDB.mySeed().hash)) {
+ peerName = yacyCore.seedDB.mySeed().get(yacySeed.NAME,"nameless");
} else {
- prop.put("mode", 0);
+ targetPeer = yacyCore.seedDB.getConnected(hash);
+ if (targetPeer == null)
+ peerName = "nameless";
+ else
+ peerName = targetPeer.get(yacySeed.NAME,"nameless");
}
- // open an editor page for the message
- // first ask if the other peer is online, and also what kind of document it accepts
- HashMap result = yacyClient.permissionMessage(hash);
- //System.out.println("DEBUG: permission request result = " + result.toString());
- String peerName;
- yacySeed targetPeer = null;
- if (hash.equals(yacyCore.seedDB.mySeed().hash)) {
- peerName = yacyCore.seedDB.mySeed().get(yacySeed.NAME,"nameless");
- } else {
- targetPeer = yacyCore.seedDB.getConnected(hash);
- if (targetPeer == null)
- peerName = "nameless";
- else
- peerName = targetPeer.get(yacySeed.NAME,"nameless");
- }
-
- prop.put("mode_permission_peerName", peerName);
- String response = (result == null) ? "-1" : (String) result.get("response");
- if ((response == null) || (response.equals("-1"))) {
- // we don't have permission or other peer does not exist
- prop.put("mode_permission",0);
-
- if (targetPeer != null) {
- yacyCore.peerActions.peerDeparture(targetPeer, "peer responded upon message send request: " + response);
- }
- } else {
- prop.put("mode_permission",1);
+ prop.putHTML("mode_permission_peerName", peerName, true);
+ String response = (result == null) ? "-1" : (String) result.get("response");
+ if ((response == null) || (response.equals("-1"))) {
+ // we don't have permission or other peer does not exist
+ prop.put("mode_permission", "0");
+
+ if (targetPeer != null) {
+ yacyCore.peerActions.peerDeparture(targetPeer, "peer responded upon message send request: " + response);
+ }
+ } else {
+ prop.put("mode_permission", "1");
// write input form
try {
int messagesize = Integer.parseInt((String) result.get("messagesize"));
int attachmentsize = Integer.parseInt((String) result.get("attachmentsize"));
- prop.put("mode_permission_response", response);
+ prop.putHTML("mode_permission_response", response, true);
prop.put("mode_permission_messagesize", messagesize);
prop.put("mode_permission_attachmentsize", attachmentsize);
- prop.put("mode_permission_subject", subject);
- prop.put("mode_permission_message", message);
+ prop.putHTML("mode_permission_subject", subject, true);
+ prop.putHTML("mode_permission_message", message, true);
prop.put("mode_permission_hash", hash);
if (post.containsKey("preview")) {
prop.putWiki("mode_permission_previewmessage", message);
@@ -129,40 +129,38 @@ public class MessageSend_p {
} catch (NumberFormatException e) {
// "unresolved pattern", the remote peer is alive but had an exception
- prop.put("mode_permission",2);
+ prop.put("mode_permission", "2");
+ }
+ }
+ } else {
+ prop.put("mode", "2");
+ // send written message to peer
+ try {
+ prop.put("mode_status", "0");
+ int messagesize = Integer.parseInt(post.get("messagesize", "0"));
+ //int attachmentsize = Integer.parseInt(post.get("attachmentsize", "0"));
+
+ if (messagesize < 1000) messagesize = 1000; // debug
+ if (subject.length() > 100) subject = subject.substring(0, 100);
+ if (message.length() > messagesize) message = message.substring(0, messagesize);
+ byte[] mb;
+ try {
+ mb = message.getBytes("UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ mb = message.getBytes();
}
- }
- } else {
- prop.put("mode", 2);
- // send written message to peer
- try {
- prop.put("mode_status", 0);
- int messagesize = Integer.parseInt(post.get("messagesize", "0"));
- //int attachmentsize = Integer.parseInt(post.get("attachmentsize", "0"));
-
- if (messagesize < 1000) messagesize = 1000; // debug
- if (subject.length() > 100) subject = subject.substring(0, 100);
- if (message.length() > messagesize) message = message.substring(0, messagesize);
- byte[] mb;
- try {
- mb = message.getBytes("UTF-8");
- } catch (UnsupportedEncodingException e) {
- mb = message.getBytes();
- }
- HashMap result = yacyClient.postMessage(hash, subject, mb);
+ HashMap result = yacyClient.postMessage(hash, subject, mb);
//message has been sent
prop.put("mode_status_response", result.get("response"));
- } catch (NumberFormatException e) {
- prop.put("mode_status", 1);
+ } catch (NumberFormatException e) {
+ prop.put("mode_status", "1");
- // "unresolved pattern", the remote peer is alive but had an exception
- prop.put("mode_status_message", message);
- }
- }
-
- return prop;
+ // "unresolved pattern", the remote peer is alive but had an exception
+ prop.putHTML("mode_status_message", message, true);
+ }
+ }
+ return prop;
}
-
}
diff --git a/htroot/Messages_p.java b/htroot/Messages_p.java
index 4adad2617..5558f48d6 100644
--- a/htroot/Messages_p.java
+++ b/htroot/Messages_p.java
@@ -78,11 +78,11 @@ public class Messages_p {
final String peerAddress = yacyCore.seedDB.mySeed().getPublicAddress();
final String peerName = yacyCore.seedDB.mySeed().getName();
prop.put("peerAddress", peerAddress);
- prop.put("peerName", peerName);
+ prop.putHTML("peerName", peerName, true);
// List known hosts for message sending (from Blacklist_p.java)
if (yacyCore.seedDB != null && yacyCore.seedDB.sizeConnected() > 0) {
- prop.put("peersKnown", 1);
+ prop.put("peersKnown", "1");
int peerCount = 0;
try {
TreeMap hostList = new TreeMap();
@@ -96,18 +96,18 @@ public class Messages_p {
while ((peername = (String) hostList.firstKey()) != null) {
final String Hash = (String) hostList.get(peername);
prop.put(PEERSKNOWN + "peers_" + peerCount + "_hash", Hash);
- prop.put(PEERSKNOWN + "peers_" + peerCount + "_name", peername);
+ prop.putHTML(PEERSKNOWN + "peers_" + peerCount + "_name", peername, true);
hostList.remove(peername);
peerCount++;
}
} catch (Exception e) {/* */}
prop.put(PEERSKNOWN + "peers", peerCount);
} else {
- prop.put("peersKnown", 0);
+ prop.put("peersKnown", "0");
}
- prop.put("mode", 0);
- prop.put("mode_error", 0);
+ prop.put("mode", "0");
+ prop.put("mode_error", "0");
String action = ((post == null) ? "list" : post.get("action", "list"));
messageBoard.entry message;
@@ -127,7 +127,7 @@ public class Messages_p {
}
if (action.equals("list")) {
- prop.put("mode", 0); //list
+ prop.put("mode", "0"); //list
try {
Iterator i = switchboard.messageDB.keys(null, true);
String key;
@@ -137,13 +137,13 @@ public class Messages_p {
while (i.hasNext()) {
key = (String) i.next();
message = switchboard.messageDB.read(key);
- prop.put("mode_messages_"+count+"_dark", ((dark) ? 1 : 0) );
+ prop.put("mode_messages_"+count+"_dark", ((dark) ? "1" : "0") );
prop.put("mode_messages_"+count+"_date", dateString(message.date()));
- prop.put("mode_messages_"+count+"_from", message.author());
- prop.put("mode_messages_"+count+"_to", message.recipient());
- prop.put("mode_messages_"+count+"_subject", message.subject());
- prop.put("mode_messages_"+count+"_category", message.category());
- prop.put("mode_messages_"+count+"_key", key);
+ prop.putHTML("mode_messages_"+count+"_from", message.author(), true);
+ prop.putHTML("mode_messages_"+count+"_to", message.recipient(), true);
+ prop.putHTML("mode_messages_"+count+"_subject", message.subject(), true);
+ prop.putHTML("mode_messages_"+count+"_category", message.category(), true);
+ prop.putHTML("mode_messages_"+count+"_key", key, true);
prop.put("mode_messages_"+count+"_hash", message.authorHash());
if (((String)header.get(httpHeader.CONNECTION_PROP_PATH)).endsWith(".rss")) {
@@ -155,7 +155,7 @@ public class Messages_p {
// also write out the message body (needed for the RSS feed)
try {
- prop.put("mode_messages_"+count+"_body",new String(message.message(), "UTF-8"));
+ prop.putHTML("mode_messages_"+count+"_body",new String(message.message(), "UTF-8"), true);
} catch (UnsupportedEncodingException e) {
// can not happen, because UTF-8 must be supported by every JVM
}
@@ -166,21 +166,21 @@ public class Messages_p {
}
prop.put("mode_messages", count);
} catch (IOException e) {
- prop.put("mode_error", 1);//I/O error reading message table
- prop.put("mode_error_message", e.getMessage());
+ prop.put("mode_error", "1");//I/O error reading message table
+ prop.putHTML("mode_error_message", e.getMessage());
}
}
if (action.equals("view")) {
- prop.put("mode", 1); //view
+ prop.put("mode", "1"); //view
String key = post.get("object", "");
message = switchboard.messageDB.read(key);
if (message == null) throw new NullPointerException("Message with ID " + key + " does not exist");
- prop.put("mode_from", message.author());
- prop.put("mode_to", message.recipient());
+ prop.putHTML("mode_from", message.author(), true);
+ prop.putHTML("mode_to", message.recipient(), true);
prop.put("mode_date", dateString(message.date()));
- prop.put("mode_subject", message.subject());
+ prop.putHTML("mode_subject", message.subject(), true);
String theMessage = null;
try {
theMessage = new String(message.message(), "UTF-8");
@@ -189,7 +189,7 @@ public class Messages_p {
}
prop.putWiki("mode_message", theMessage);
prop.put("mode_hash", message.authorHash());
- prop.put("mode_key", key);
+ prop.putHTML("mode_key", key, true);
}
// return rewrite properties
diff --git a/htroot/Network.java b/htroot/Network.java
index d050c19f5..022ce8d21 100644
--- a/htroot/Network.java
+++ b/htroot/Network.java
@@ -61,7 +61,6 @@ import de.anomic.server.serverCodings;
import de.anomic.server.serverDate;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
-import de.anomic.tools.yFormatter;
import de.anomic.yacy.yacyClient;
import de.anomic.yacy.yacyCore;
import de.anomic.yacy.yacyNewsPool;
@@ -74,17 +73,14 @@ public class Network {
private static final String STR_TABLE_LIST = "table_list_";
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch switchboard) {
- boolean isXML = ((String)header.get("PATH")).endsWith(".xml");
plasmaSwitchboard sb = (plasmaSwitchboard) switchboard;
final long start = System.currentTimeMillis();
- if (isXML) {
- yFormatter.setLocale("none");
- }
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
- prop.put("page_networkTitle", sb.getConfig("network.unit.description", "unspecified"));
- prop.put("page_networkName", sb.getConfig("network.unit.name", "unspecified"));
+ prop.setLocalized(!((String)header.get("PATH")).endsWith(".xml"));
+ prop.putHTML("page_networkTitle", sb.getConfig("network.unit.description", "unspecified"));
+ prop.putHTML("page_networkName", sb.getConfig("network.unit.name", "unspecified"));
final boolean overview = (post == null) || (post.get("page", "0").equals("0"));
final String mySeedType = yacyCore.seedDB.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN);
@@ -124,7 +120,7 @@ public class Network {
} catch (Exception e) {LCount = 0; ICount = 0; RCount = 0;}
// my-info
- prop.put("table_my-name", seed.get(yacySeed.NAME, "-") );
+ prop.putHTML("table_my-name", seed.get(yacySeed.NAME, "-") );
prop.put("table_my-hash", seed.hash );
if (yacyCore.seedDB.mySeed().isVirgin()) {
prop.put("table_my-info", 0);
@@ -151,45 +147,45 @@ public class Network {
prop.put("table_my-version", seed.get(yacySeed.VERSION, "-"));
prop.put("table_my-utc", seed.get(yacySeed.UTC, "-"));
prop.put("table_my-uptime", serverDate.intervalToString(60000 * Long.parseLong(seed.get(yacySeed.UPTIME, ""))));
- prop.put("table_my-LCount", yFormatter.number(LCount));
- prop.put("table_my-ICount", yFormatter.number(ICount));
- prop.put("table_my-RCount", yFormatter.number(RCount));
- prop.put("table_my-sI", yFormatter.number(seed.get(yacySeed.INDEX_OUT, "0")));
- prop.put("table_my-sU", yFormatter.number(seed.get(yacySeed.URL_OUT, "0")));
- prop.put("table_my-rI", yFormatter.number(seed.get(yacySeed.INDEX_IN, "0")));
- prop.put("table_my-rU", yFormatter.number(seed.get(yacySeed.URL_IN, "0")));
- prop.put("table_my-ppm", myppm);
- prop.put("table_my-qph", yFormatter.number(Math.round(100d * myqph) / 100d));
- prop.put("table_my-totalppm", yFormatter.number(sb.totalPPM));
- prop.put("table_my-totalqph", yFormatter.number(Math.round(6000d * sb.totalQPM) / 100d));
- prop.put("table_my-seeds", yFormatter.number(seed.get(yacySeed.SCOUNT, "-")));
- prop.put("table_my-connects", yFormatter.number(seed.get(yacySeed.CCOUNT, "0")));
+ prop.putNum("table_my-LCount", LCount);
+ prop.putNum("table_my-ICount", ICount);
+ prop.putNum("table_my-RCount", RCount);
+ prop.putNum("table_my-sI", Long.parseLong(seed.get(yacySeed.INDEX_OUT, "0")));
+ prop.putNum("table_my-sU", Long.parseLong(seed.get(yacySeed.URL_OUT, "0")));
+ prop.putNum("table_my-rI", Long.parseLong(seed.get(yacySeed.INDEX_IN, "0")));
+ prop.putNum("table_my-rU", Long.parseLong(seed.get(yacySeed.URL_IN, "0")));
+ prop.putNum("table_my-ppm", myppm);
+ prop.putNum("table_my-qph", Math.round(100d * myqph) / 100d);
+ prop.putNum("table_my-totalppm", sb.totalPPM);
+ prop.putNum("table_my-totalqph", Math.round(6000d * sb.totalQPM) / 100d);
+ prop.putNum("table_my-seeds", Long.parseLong(seed.get(yacySeed.SCOUNT, "0")));
+ prop.putNum("table_my-connects", Double.parseDouble(seed.get(yacySeed.CCOUNT, "0")));
prop.put("table_my-url", seed.get("seedURL", ""));
// generating the location string
String location = httpc.userAgent;
int p = location.lastIndexOf(';');
location = (p > 0) ? location.substring(p + 1, location.length() - 1).trim(): "";
- prop.put("table_my-location", location);
+ prop.putHTML("table_my-location", location);
}
// overall results: Network statistics
if (iAmActive) conCount++; else if (mySeedType.equals(yacySeed.PEERTYPE_JUNIOR)) potCount++;
- prop.put("table_active-count", yFormatter.number(conCount));
- prop.put("table_active-links", yFormatter.number(accActLinks));
- prop.put("table_active-words", yFormatter.number(accActWords));
- prop.put("table_passive-count", yFormatter.number(disconCount));
- prop.put("table_passive-links", yFormatter.number(accPassLinks));
- prop.put("table_passive-words", yFormatter.number(accPassWords));
- prop.put("table_potential-count", yFormatter.number(potCount));
- prop.put("table_potential-links", yFormatter.number(accPotLinks));
- prop.put("table_potential-words", yFormatter.number(accPotWords));
- prop.put("table_all-count", yFormatter.number(conCount + disconCount + potCount));
- prop.put("table_all-links", yFormatter.number(accActLinks + accPassLinks + accPotLinks));
- prop.put("table_all-words", yFormatter.number(accActWords + accPassWords + accPotWords));
+ prop.putNum("table_active-count", conCount);
+ prop.putNum("table_active-links", accActLinks);
+ prop.putNum("table_active-words", accActWords);
+ prop.putNum("table_passive-count", disconCount);
+ prop.putNum("table_passive-links", accPassLinks);
+ prop.putNum("table_passive-words", accPassWords);
+ prop.putNum("table_potential-count", potCount);
+ prop.putNum("table_potential-links", accPotLinks);
+ prop.putNum("table_potential-words", accPotWords);
+ prop.putNum("table_all-count", conCount + disconCount + potCount);
+ prop.putNum("table_all-links", accActLinks + accPassLinks + accPotLinks);
+ prop.putNum("table_all-words", accActWords + accPassWords + accPotWords);
- prop.put("table_gppm", otherppm + ((iAmActive) ? myppm : 0));
- prop.put("table_gqph", yFormatter.number(Math.round(6000d * otherqpm + 100d * ((iAmActive) ? myqph : 0d)) / 100d));
+ prop.putNum("table_gppm", otherppm + ((iAmActive) ? myppm : 0));
+ prop.putNum("table_gqph", Math.round(6000d * otherqpm + 100d * ((iAmActive) ? myqph : 0d)) / 100d);
// String comment = "";
prop.put("table_comment", 0);
@@ -210,7 +206,7 @@ public class Network {
// AUTHENTICATE
if (!header.containsKey(httpHeader.AUTHORIZATION)) {
- prop.put("AUTHENTICATE","log-in");
+ prop.putHTML("AUTHENTICATE","log-in");
return prop;
}
@@ -224,7 +220,7 @@ public class Network {
if (added <= 0) {
prop.put("table_comment",1);
- prop.put("table_comment_status","publish: disconnected peer '" + peer.getName() + "/" + post.get("peerHash") + "' from " + peer.getPublicAddress());
+ prop.putHTML("table_comment_status","publish: disconnected peer '" + peer.getName() + "/" + post.get("peerHash") + "' from " + peer.getPublicAddress());
} else {
peer = yacyCore.seedDB.getConnected(peer.hash);
if (peer == null) {
@@ -232,8 +228,8 @@ public class Network {
prop.put("table_comment_status","publish: disconnected peer 'UNKNOWN/" + post.get("peerHash") + "' from UNKNOWN");
} else {
prop.put("table_comment",2);
- prop.put("table_comment_status","publish: handshaked " + peer.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) + " peer '" + peer.getName() + "' at " + peer.getPublicAddress());
- prop.put("table_comment_details",peer.toString());
+ prop.putHTML("table_comment_status","publish: handshaked " + peer.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) + " peer '" + peer.getName() + "' at " + peer.getPublicAddress());
+ prop.putHTML("table_comment_details",peer.toString());
}
}
@@ -320,7 +316,7 @@ public class Network {
} catch (PatternSyntaxException pse){
wrongregex = pse.getPattern();
prop.put("regexerror", 1);
- prop.put("regexerror_wrongregex", wrongregex);
+ prop.putHTML("regexerror_wrongregex", wrongregex);
}
}
while (e.hasNext() && conCount < maxCount) {
@@ -356,15 +352,15 @@ public class Network {
prop.put(STR_TABLE_LIST + conCount + "_updatedWiki", 0);
} else {
prop.put(STR_TABLE_LIST + conCount + "_updatedWiki", 1);
- prop.put(STR_TABLE_LIST + conCount + "_updatedWiki_page", (String) wikiMap.get("page"));
+ prop.putHTML(STR_TABLE_LIST + conCount + "_updatedWiki_page", (String) wikiMap.get("page"));
prop.put(STR_TABLE_LIST + conCount + "_updatedWiki_address", seed.getPublicAddress());
}
if ((blogMap = (Map) updatedBlog.get(seed.hash)) == null) {
prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 0);
} else {
prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 1);
- prop.put(STR_TABLE_LIST + conCount + "_updatedBlog_page", (String) blogMap.get("page"));
- prop.put(STR_TABLE_LIST + conCount + "_updatedBlog_subject", (String) blogMap.get("subject"));
+ prop.putHTML(STR_TABLE_LIST + conCount + "_updatedBlog_page", (String) blogMap.get("page"));
+ prop.putHTML(STR_TABLE_LIST + conCount + "_updatedBlog_subject", (String) blogMap.get("subject"));
prop.put(STR_TABLE_LIST + conCount + "_updatedBlog_address", seed.getPublicAddress());
}
PPM = seed.getPPM();
@@ -378,8 +374,8 @@ public class Network {
if (shortname.length() > 20) {
shortname = shortname.substring(0, 20) + "...";
}
- prop.put(STR_TABLE_LIST + conCount + "_shortname", shortname);
- prop.put(STR_TABLE_LIST + conCount + "_fullname", seed.get(yacySeed.NAME, "deadlink"));
+ prop.putHTML(STR_TABLE_LIST + conCount + "_shortname", shortname);
+ prop.putHTML(STR_TABLE_LIST + conCount + "_fullname", seed.get(yacySeed.NAME, "deadlink"));
userAgent = null;
if (seed.hash.equals(yacyCore.seedDB.mySeed().hash)) {
userAgent = httpc.userAgent;
@@ -395,11 +391,11 @@ public class Network {
prop.put(STR_TABLE_LIST + conCount + "_complete_port", seed.get(yacySeed.PORT, "-") );
prop.put(STR_TABLE_LIST + conCount + "_complete_hash", seed.hash);
prop.put(STR_TABLE_LIST + conCount + "_complete_age", seed.getAge());
- prop.put(STR_TABLE_LIST + conCount + "_complete_CRWCnt", seed.get(yacySeed.CRWCNT, "0"));
- prop.put(STR_TABLE_LIST + conCount + "_complete_CRTCnt", seed.get(yacySeed.CRTCNT, "0"));
- prop.put(STR_TABLE_LIST + conCount + "_complete_seeds", seed.get(yacySeed.SCOUNT, "-"));
- prop.put(STR_TABLE_LIST + conCount + "_complete_connects", yFormatter.number(seed.get(yacySeed.CCOUNT, "0")));
- prop.put(STR_TABLE_LIST + conCount + "_complete_userAgent", userAgent);
+ prop.putNum(STR_TABLE_LIST + conCount + "_complete_CRWCnt", Long.parseLong(seed.get(yacySeed.CRWCNT, "0")));
+ prop.putNum(STR_TABLE_LIST + conCount + "_complete_CRTCnt", Long.parseLong(seed.get(yacySeed.CRTCNT, "0")));
+ prop.putNum(STR_TABLE_LIST + conCount + "_complete_seeds", Long.parseLong(seed.get(yacySeed.SCOUNT, "0")));
+ prop.putNum(STR_TABLE_LIST + conCount + "_complete_connects", Long.parseLong(seed.get(yacySeed.CCOUNT, "0")));
+ prop.putHTML(STR_TABLE_LIST + conCount + "_complete_userAgent", userAgent);
} else {
prop.put(STR_TABLE_LIST + conCount + "_complete", 0);
}
@@ -412,7 +408,7 @@ public class Network {
} else if(seed.isPrincipal()) {
prop.put(STR_TABLE_LIST + conCount + "_type", 2);
}
- prop.put(STR_TABLE_LIST + conCount + "_type_url", seed.get("seedURL", "http://nowhere/"));
+ prop.putHTML(STR_TABLE_LIST + conCount + "_type_url", seed.get("seedURL", "http://nowhere/"));
final long lastseen = Math.abs((System.currentTimeMillis() - seed.getLastSeenUTC()) / 1000 / 60);
if (page == 2 || lastseen > 1440) { // Passive Peers should be passive, also Peers without contact greater than an day
@@ -451,48 +447,45 @@ public class Network {
prop.put(STR_TABLE_LIST + conCount + "_dhtreceive_peertags", "");
} else {
String peertags = serverCodings.set2string(seed.getPeerTags(), ",", false);
- prop.put(STR_TABLE_LIST + conCount + "_dhtreceive_peertags", ((peertags == null) || (peertags.length() == 0)) ? "no tags given" : ("tags = " + peertags));
+ prop.putHTML(STR_TABLE_LIST + conCount + "_dhtreceive_peertags", ((peertags == null) || (peertags.length() == 0)) ? "no tags given" : ("tags = " + peertags));
}
- prop.put(STR_TABLE_LIST + conCount + "_version", yacyVersion.combined2prettyVersion(seed.get(yacySeed.VERSION, "0.1"), shortname));
- prop.put(STR_TABLE_LIST + conCount + "_lastSeen", /*seed.getLastSeenString() + " " +*/ lastseen);
+ prop.putHTML(STR_TABLE_LIST + conCount + "_version", yacyVersion.combined2prettyVersion(seed.get(yacySeed.VERSION, "0.1"), shortname));
+ prop.putNum(STR_TABLE_LIST + conCount + "_lastSeen", /*seed.getLastSeenString() + " " +*/ lastseen);
prop.put(STR_TABLE_LIST + conCount + "_utc", seed.get(yacySeed.UTC, "-"));
- prop.put(STR_TABLE_LIST + conCount + "_uptime", serverDate.intervalToString(60000 * Long.parseLong(seed.get(yacySeed.UPTIME, "0"))));
- prop.put(STR_TABLE_LIST + conCount + "_LCount", yFormatter.number(seed.get(yacySeed.LCOUNT, "0")));
- prop.put(STR_TABLE_LIST + conCount + "_ICount", yFormatter.number(seed.get(yacySeed.ICOUNT, "0")));
- prop.put(STR_TABLE_LIST + conCount + "_RCount", yFormatter.number(seed.get(yacySeed.RCOUNT, "0")));
- prop.put(STR_TABLE_LIST + conCount + "_sI", yFormatter.number(seed.get(yacySeed.INDEX_OUT, "0")));
- prop.put(STR_TABLE_LIST + conCount + "_sU", yFormatter.number(seed.get(yacySeed.URL_OUT, "0")));
- prop.put(STR_TABLE_LIST + conCount + "_rI", yFormatter.number(seed.get(yacySeed.INDEX_IN, "0")));
- prop.put(STR_TABLE_LIST + conCount + "_rU", yFormatter.number(seed.get(yacySeed.URL_IN, "0")));
- prop.put(STR_TABLE_LIST + conCount + "_ppm", PPM);
- prop.put(STR_TABLE_LIST + conCount + "_qph", yFormatter.number(Math.round(6000d * QPM) / 100d));
+ prop.putHTML(STR_TABLE_LIST + conCount + "_uptime", serverDate.intervalToString(60000 * Long.parseLong(seed.get(yacySeed.UPTIME, "0"))));
+ prop.putNum(STR_TABLE_LIST + conCount + "_LCount", Long.parseLong(seed.get(yacySeed.LCOUNT, "0")));
+ prop.putNum(STR_TABLE_LIST + conCount + "_ICount", Long.parseLong(seed.get(yacySeed.ICOUNT, "0")));
+ prop.putNum(STR_TABLE_LIST + conCount + "_RCount", Long.parseLong(seed.get(yacySeed.RCOUNT, "0")));
+ prop.putNum(STR_TABLE_LIST + conCount + "_sI", Long.parseLong(seed.get(yacySeed.INDEX_OUT, "0")));
+ prop.putNum(STR_TABLE_LIST + conCount + "_sU", Long.parseLong(seed.get(yacySeed.URL_OUT, "0")));
+ prop.putNum(STR_TABLE_LIST + conCount + "_rI", Long.parseLong(seed.get(yacySeed.INDEX_IN, "0")));
+ prop.putNum(STR_TABLE_LIST + conCount + "_rU", Long.parseLong(seed.get(yacySeed.URL_IN, "0")));
+ prop.putNum(STR_TABLE_LIST + conCount + "_ppm", PPM);
+ prop.putNum(STR_TABLE_LIST + conCount + "_qph", Math.round(6000d * QPM) / 100d);
conCount++;
} // seed != null
} // while
if (iAmActive) { yacyCore.seedDB.removeMySeed(); }
- prop.put("table_list", conCount);
+ prop.putNum("table_list", conCount);
prop.put("table", 1);
- prop.put("table_num", conCount);
- prop.put("table_total", ((page == 1) && (iAmActive)) ? (size + 1) : size );
+ prop.putNum("table_num", conCount);
+ prop.putNum("table_total", ((page == 1) && (iAmActive)) ? (size + 1) : size );
prop.put("table_complete", ((complete)? 1 : 0) );
}
}
prop.put("page", page);
prop.put("table_page", page);
- prop.put("table_searchpattern", post.get("match", ""));
+ prop.putHTML("table_searchpattern", post.get("match", ""));
switch (page) {
- case 1 : prop.put("table_peertype", "senior/principal"); break;
- case 2 : prop.put("table_peertype", "senior/principal"); break;
- case 3 : prop.put("table_peertype", yacySeed.PEERTYPE_JUNIOR); break;
+ case 1 : prop.putHTML("table_peertype", "senior/principal"); break;
+ case 2 : prop.putHTML("table_peertype", "senior/principal"); break;
+ case 3 : prop.putHTML("table_peertype", yacySeed.PEERTYPE_JUNIOR); break;
default: break;
}
}
- prop.put("table_rt", System.currentTimeMillis() - start);
- if (isXML) {
- // restore locale for formatter
- yFormatter.setLocale(sb.getConfig("locale.lang", "default"));
- }
+ prop.putNum("table_rt", System.currentTimeMillis() - start);
+
// return rewrite properties
return prop;
}
diff --git a/htroot/News.java b/htroot/News.java
index 223c445e0..bbf5b0b9d 100644
--- a/htroot/News.java
+++ b/htroot/News.java
@@ -109,15 +109,15 @@ public class News {
// generate properties for output
if (overview) {
// show overview
- prop.put("table", 0);
- prop.put("page", 0);
- prop.put("table_insize", yacyCore.newsPool.size(yacyNewsPool.INCOMING_DB));
- prop.put("table_prsize", yacyCore.newsPool.size(yacyNewsPool.PROCESSED_DB));
- prop.put("table_ousize", yacyCore.newsPool.size(yacyNewsPool.OUTGOING_DB));
- prop.put("table_pusize", yacyCore.newsPool.size(yacyNewsPool.PUBLISHED_DB));
+ prop.put("table", "0");
+ prop.put("page", "0");
+ prop.putNum("table_insize", yacyCore.newsPool.size(yacyNewsPool.INCOMING_DB));
+ prop.putNum("table_prsize", yacyCore.newsPool.size(yacyNewsPool.PROCESSED_DB));
+ prop.putNum("table_ousize", yacyCore.newsPool.size(yacyNewsPool.OUTGOING_DB));
+ prop.putNum("table_pusize", yacyCore.newsPool.size(yacyNewsPool.PUBLISHED_DB));
} else {
// generate table
- prop.put("table", 1);
+ prop.put("table", "1");
prop.put("page", tableID + 1);
prop.put("table_page", tableID + 1);
@@ -137,7 +137,7 @@ public class News {
if (seed == null) seed = yacyCore.seedDB.getDisconnected(record.originator());
String category = record.category();
prop.put("table_list_" + i + "_id", record.id());
- prop.put("table_list_" + i + "_ori", (seed == null) ? record.originator() : seed.getName());
+ prop.putHTML("table_list_" + i + "_ori", (seed == null) ? record.originator() : seed.getName());
prop.put("table_list_" + i + "_cre", serverDate.shortSecondTime(record.created()));
prop.put("table_list_" + i + "_crerfcdate", httpc.dateString(record.created()));
prop.put("table_list_" + i + "_cat", category);
@@ -145,7 +145,7 @@ public class News {
prop.put("table_list_" + i + "_dis", record.distributed());
Map attributeMap = record.attributes();
- prop.put("table_list_" + i + "_att", attributeMap.toString() );
+ prop.putHTML("table_list_" + i + "_att", attributeMap.toString());
int j = 0;
if (attributeMap.size() > 0) {
Iterator attributeKeys = attributeMap.keySet().iterator();
@@ -153,11 +153,11 @@ public class News {
String key = (String) attributeKeys.next();
String value = (String) attributeMap.get(key);
prop.put("table_list_" + i + "_attributes_" + j + "_name",key);
- prop.put("table_list_" + i + "_attributes_" + j + "_value",value);
+ prop.putHTML("table_list_" + i + "_attributes_" + j + "_value",value);
j++;
}
}
- prop.put("table_list_" + i + "_attributes",j);
+ prop.put("table_list_" + i + "_attributes", j);
// generating link / title / description (taken over from Surftips.java)
String link, title, description;
@@ -195,8 +195,8 @@ public class News {
description = "";
}
prop.put("table_list_" + i + "_link", link);
- prop.put("table_list_" + i + "_title", title);
- prop.put("table_list_" + i + "_description", description);
+ prop.putHTML("table_list_" + i + "_title", title);
+ prop.putHTML("table_list_" + i + "_description", description);
i++;
}
@@ -210,5 +210,4 @@ public class News {
// return rewrite properties
return prop;
}
-
}
diff --git a/htroot/PerformanceMemory_p.java b/htroot/PerformanceMemory_p.java
index 99e55e465..0ad731b02 100644
--- a/htroot/PerformanceMemory_p.java
+++ b/htroot/PerformanceMemory_p.java
@@ -72,18 +72,18 @@ public class PerformanceMemory_p {
if (defaultSettings == null) {
defaultSettings = serverFileUtils.loadHashMap(new File(env.getRootPath(), "yacy.init"));
}
- prop.put("gc", 0);
+ prop.put("gc", "0");
if (post != null) {
int xmx = 96; // default maximum heap size
if (post.containsKey("Xmx")) {
try { xmx = Integer.valueOf(post.get("Xmx", "64")).intValue(); } catch (NumberFormatException e){}
env.setConfig("javastart_Xmx", "Xmx" + xmx + "m");
env.setConfig("javastart_Xms", "Xms" + xmx + "m");
- prop.put("setStartupCommit", 1);
+ prop.put("setStartupCommit", "1");
}
if (post.containsKey("gc")) {
System.gc();
- prop.put("gc", 1);
+ prop.put("gc", "1");
}
}
@@ -97,23 +97,23 @@ public class PerformanceMemory_p {
long memoryTotalAfterStartup = Long.parseLong(env.getConfig("memoryTotalAfterStartup", "0"));
long memoryMax = serverMemory.max;
- prop.put("memoryMax", memoryMax / MB);
- prop.put("memoryAvailAfterStartup", (memoryMax - memoryTotalAfterStartup + memoryFreeAfterStartup) / MB);
- prop.put("memoryAvailAfterInitBGC", (memoryMax - memoryTotalAfterInitBGC + memoryFreeAfterInitBGC) / MB);
- prop.put("memoryAvailAfterInitAGC", (memoryMax - memoryTotalAfterInitAGC + memoryFreeAfterInitAGC) / MB);
- prop.put("memoryAvailNow", (memoryMax - memoryTotalNow + memoryFreeNow) / MB);
- prop.put("memoryTotalAfterStartup", memoryTotalAfterStartup / KB);
- prop.put("memoryTotalAfterInitBGC", memoryTotalAfterInitBGC / KB);
- prop.put("memoryTotalAfterInitAGC", memoryTotalAfterInitAGC / KB);
- prop.put("memoryTotalNow", memoryTotalNow / MB);
- prop.put("memoryFreeAfterStartup", memoryFreeAfterStartup / KB);
- prop.put("memoryFreeAfterInitBGC", memoryFreeAfterInitBGC / KB);
- prop.put("memoryFreeAfterInitAGC", memoryFreeAfterInitAGC / KB);
- prop.put("memoryFreeNow", memoryFreeNow / MB);
- prop.put("memoryUsedAfterStartup", (memoryTotalAfterStartup - memoryFreeAfterStartup) / KB);
- prop.put("memoryUsedAfterInitBGC", (memoryTotalAfterInitBGC - memoryFreeAfterInitBGC) / KB);
- prop.put("memoryUsedAfterInitAGC", (memoryTotalAfterInitAGC - memoryFreeAfterInitAGC) / KB);
- prop.put("memoryUsedNow", (memoryTotalNow - memoryFreeNow) / MB);
+ prop.putNum("memoryMax", memoryMax / MB);
+ prop.putNum("memoryAvailAfterStartup", (memoryMax - memoryTotalAfterStartup + memoryFreeAfterStartup) / MB);
+ prop.putNum("memoryAvailAfterInitBGC", (memoryMax - memoryTotalAfterInitBGC + memoryFreeAfterInitBGC) / MB);
+ prop.putNum("memoryAvailAfterInitAGC", (memoryMax - memoryTotalAfterInitAGC + memoryFreeAfterInitAGC) / MB);
+ prop.putNum("memoryAvailNow", (memoryMax - memoryTotalNow + memoryFreeNow) / MB);
+ prop.putNum("memoryTotalAfterStartup", memoryTotalAfterStartup / KB);
+ prop.putNum("memoryTotalAfterInitBGC", memoryTotalAfterInitBGC / KB);
+ prop.putNum("memoryTotalAfterInitAGC", memoryTotalAfterInitAGC / KB);
+ prop.putNum("memoryTotalNow", memoryTotalNow / MB);
+ prop.putNum("memoryFreeAfterStartup", memoryFreeAfterStartup / KB);
+ prop.putNum("memoryFreeAfterInitBGC", memoryFreeAfterInitBGC / KB);
+ prop.putNum("memoryFreeAfterInitAGC", memoryFreeAfterInitAGC / KB);
+ prop.putNum("memoryFreeNow", memoryFreeNow / MB);
+ prop.putNum("memoryUsedAfterStartup", (memoryTotalAfterStartup - memoryFreeAfterStartup) / KB);
+ prop.putNum("memoryUsedAfterInitBGC", (memoryTotalAfterInitBGC - memoryFreeAfterInitBGC) / KB);
+ prop.putNum("memoryUsedAfterInitAGC", (memoryTotalAfterInitAGC - memoryFreeAfterInitAGC) / KB);
+ prop.putNum("memoryUsedNow", (memoryTotalNow - memoryFreeNow) / MB);
// write table for FlexTable index sizes
Iterator i = kelondroFlexTable.filenames();
@@ -128,12 +128,12 @@ public class PerformanceMemory_p {
totalmem += mem;
prop.put("TableList_" + c + "_tableIndexPath", ((p = filename.indexOf("DATA")) < 0) ? filename : filename.substring(p));
prop.put("TableList_" + c + "_tableIndexChunkSize", map.get("tableIndexChunkSize"));
- prop.put("TableList_" + c + "_tableIndexCount", map.get("tableIndexCount"));
- prop.put("TableList_" + c + "_tableIndexMem", memstr(mem));
+ prop.putNum("TableList_" + c + "_tableIndexCount", (String)map.get("tableIndexCount"));
+ prop.put("TableList_" + c + "_tableIndexMem", serverMemory.bytesToString(mem));
c++;
}
prop.put("TableList", c);
- prop.put("TableIndexTotalMem", totalmem / (1024 * 1024));
+ prop.putNum("TableIndexTotalMem", totalmem / (1024 * 1024d));
// write node cache table
i = kelondroCachedRecords.filenames();
@@ -146,20 +146,20 @@ public class PerformanceMemory_p {
totalmem += mem;
prop.put("NodeList_" + c + "_nodeCachePath", ((p = filename.indexOf("DATA")) < 0) ? filename : filename.substring(p));
prop.put("NodeList_" + c + "_nodeChunkSize", map.get("nodeChunkSize"));
- prop.put("NodeList_" + c + "_nodeCacheCount", map.get("nodeCacheCount"));
- prop.put("NodeList_" + c + "_nodeCacheMem", memstr(mem));
- prop.put("NodeList_" + c + "_nodeCacheReadHit", map.get("nodeCacheReadHit"));
- prop.put("NodeList_" + c + "_nodeCacheReadMiss", map.get("nodeCacheReadMiss"));
- prop.put("NodeList_" + c + "_nodeCacheWriteUnique", map.get("nodeCacheWriteUnique"));
- prop.put("NodeList_" + c + "_nodeCacheWriteDouble", map.get("nodeCacheWriteDouble"));
- prop.put("NodeList_" + c + "_nodeCacheDeletes", map.get("nodeCacheDeletes"));
- prop.put("NodeList_" + c + "_nodeCacheFlushes", map.get("nodeCacheFlushes"));
+ prop.putNum("NodeList_" + c + "_nodeCacheCount", (String)map.get("nodeCacheCount"));
+ prop.put("NodeList_" + c + "_nodeCacheMem", serverMemory.bytesToString(mem));
+ prop.putNum("NodeList_" + c + "_nodeCacheReadHit", (String)map.get("nodeCacheReadHit"));
+ prop.putNum("NodeList_" + c + "_nodeCacheReadMiss", (String)map.get("nodeCacheReadMiss"));
+ prop.putNum("NodeList_" + c + "_nodeCacheWriteUnique", (String)map.get("nodeCacheWriteUnique"));
+ prop.putNum("NodeList_" + c + "_nodeCacheWriteDouble", (String)map.get("nodeCacheWriteDouble"));
+ prop.putNum("NodeList_" + c + "_nodeCacheDeletes", (String)map.get("nodeCacheDeletes"));
+ prop.putNum("NodeList_" + c + "_nodeCacheFlushes", (String)map.get("nodeCacheFlushes"));
c++;
}
prop.put("NodeList", c);
- prop.put("nodeCacheStopGrow", kelondroCachedRecords.getMemStopGrow() / (1024 * 1024));
- prop.put("nodeCacheStartShrink", kelondroCachedRecords.getMemStartShrink() / (1024 * 1024));
- prop.put("nodeCacheTotalMem", totalmem / (1024 * 1024));
+ prop.putNum("nodeCacheStopGrow", kelondroCachedRecords.getMemStopGrow() / (1024 * 1024d));
+ prop.putNum("nodeCacheStartShrink", kelondroCachedRecords.getMemStartShrink() / (1024 * 1024d));
+ prop.putNum("nodeCacheTotalMem", totalmem / (1024 * 1024d));
// write object cache table
i = kelondroCache.filenames();
@@ -174,35 +174,35 @@ public class PerformanceMemory_p {
hitmem = Long.parseLong((String) map.get("objectHitMem"));
totalhitmem += hitmem;
prop.put("ObjectList_" + c + "_objectHitChunkSize", map.get("objectHitChunkSize"));
- prop.put("ObjectList_" + c + "_objectHitCacheCount", map.get("objectHitCacheCount"));
- prop.put("ObjectList_" + c + "_objectHitCacheMem", memstr(hitmem));
- prop.put("ObjectList_" + c + "_objectHitCacheReadHit", map.get("objectHitCacheReadHit"));
- prop.put("ObjectList_" + c + "_objectHitCacheReadMiss", map.get("objectHitCacheReadMiss"));
- prop.put("ObjectList_" + c + "_objectHitCacheWriteUnique", map.get("objectHitCacheWriteUnique"));
- prop.put("ObjectList_" + c + "_objectHitCacheWriteDouble", map.get("objectHitCacheWriteDouble"));
- prop.put("ObjectList_" + c + "_objectHitCacheDeletes", map.get("objectHitCacheDeletes"));
- prop.put("ObjectList_" + c + "_objectHitCacheFlushes", map.get("objectHitCacheFlushes"));
+ prop.putNum("ObjectList_" + c + "_objectHitCacheCount", (String)map.get("objectHitCacheCount"));
+ prop.put("ObjectList_" + c + "_objectHitCacheMem", serverMemory.bytesToString(hitmem));
+ prop.putNum("ObjectList_" + c + "_objectHitCacheReadHit", (String)map.get("objectHitCacheReadHit"));
+ prop.putNum("ObjectList_" + c + "_objectHitCacheReadMiss", (String)map.get("objectHitCacheReadMiss"));
+ prop.putNum("ObjectList_" + c + "_objectHitCacheWriteUnique", (String)map.get("objectHitCacheWriteUnique"));
+ prop.putNum("ObjectList_" + c + "_objectHitCacheWriteDouble", (String)map.get("objectHitCacheWriteDouble"));
+ prop.putNum("ObjectList_" + c + "_objectHitCacheDeletes", (String)map.get("objectHitCacheDeletes"));
+ prop.putNum("ObjectList_" + c + "_objectHitCacheFlushes", (String)map.get("objectHitCacheFlushes"));
// miss cache
missmem = Long.parseLong((String) map.get("objectMissMem"));
totalmissmem += missmem;
prop.put("ObjectList_" + c + "_objectMissChunkSize", map.get("objectMissChunkSize"));
- prop.put("ObjectList_" + c + "_objectMissCacheCount", map.get("objectMissCacheCount"));
- prop.put("ObjectList_" + c + "_objectMissCacheMem", memstr(missmem));
- prop.put("ObjectList_" + c + "_objectMissCacheReadHit", map.get("objectMissCacheReadHit"));
- prop.put("ObjectList_" + c + "_objectMissCacheReadMiss", map.get("objectMissCacheReadMiss"));
- prop.put("ObjectList_" + c + "_objectMissCacheWriteUnique", map.get("objectMissCacheWriteUnique"));
- prop.put("ObjectList_" + c + "_objectMissCacheWriteDouble", map.get("objectMissCacheWriteDouble"));
- prop.put("ObjectList_" + c + "_objectMissCacheDeletes", map.get("objectMissCacheDeletes"));
+ prop.putNum("ObjectList_" + c + "_objectMissCacheCount", (String)map.get("objectMissCacheCount"));
+ prop.putHTML("ObjectList_" + c + "_objectMissCacheMem", serverMemory.bytesToString(missmem));
+ prop.putNum("ObjectList_" + c + "_objectMissCacheReadHit", (String)map.get("objectMissCacheReadHit"));
+ prop.putNum("ObjectList_" + c + "_objectMissCacheReadMiss", (String)map.get("objectMissCacheReadMiss"));
+ prop.putNum("ObjectList_" + c + "_objectMissCacheWriteUnique", (String)map.get("objectMissCacheWriteUnique"));
+ prop.putNum("ObjectList_" + c + "_objectMissCacheWriteDouble", (String)map.get("objectMissCacheWriteDouble"));
+ prop.putNum("ObjectList_" + c + "_objectMissCacheDeletes", (String)map.get("objectMissCacheDeletes"));
//prop.put("ObjectList_" + c + "_objectMissCacheFlushes", map.get("objectMissCacheFlushes"));
c++;
}
prop.put("ObjectList", c);
- prop.put("objectCacheStopGrow", kelondroCache.getMemStopGrow() / (1024 * 1024));
- prop.put("objectCacheStartShrink", kelondroCache.getMemStartShrink() / (1024 * 1024));
- prop.put("objectHitCacheTotalMem", totalhitmem / (1024 * 1024));
- prop.put("objectMissCacheTotalMem", totalmissmem / (1024 * 1024));
+ prop.putNum("objectCacheStopGrow", kelondroCache.getMemStopGrow() / (1024 * 1024d));
+ prop.putNum("objectCacheStartShrink", kelondroCache.getMemStartShrink() / (1024 * 1024d));
+ prop.putNum("objectHitCacheTotalMem", totalhitmem / (1024 * 1024d));
+ prop.putNum("objectMissCacheTotalMem", totalmissmem / (1024 * 1024d));
// parse initialization memory settings
String Xmx = env.getConfig("javastart_Xmx", "Xmx96m").substring(3);
@@ -212,16 +212,12 @@ public class PerformanceMemory_p {
// other caching structures
long amount = serverDomains.nameCacheHitSize();
- prop.put("namecache.hit",Long.toString(amount));
+ prop.putNum("namecache.hit", amount);
amount = serverDomains.nameCacheNoCachingListSize();
- prop.put("namecache.noCache",Long.toString(amount));
+ prop.putNum("namecache.noCache", amount);
amount = plasmaSwitchboard.urlBlacklist.blacklistCacheSize();
- prop.put("blacklistcache.size",Long.toString(amount));
+ prop.putNum("blacklistcache.size", amount);
// return rewrite values for templates
return prop;
}
-
- private static final String memstr(long mem) {
- return (mem == 0) ? "-" : ((mem < 1024*1024) ? ((mem / 1024) + " KB") : (mem / (1024 * 1024) + " MB"));
- }
}
diff --git a/htroot/PerformanceQueues_p.java b/htroot/PerformanceQueues_p.java
index 992352b7a..80813f74c 100644
--- a/htroot/PerformanceQueues_p.java
+++ b/htroot/PerformanceQueues_p.java
@@ -57,6 +57,7 @@ import de.anomic.server.serverFileUtils;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.serverThread;
+import de.anomic.tools.yFormatter;
public class PerformanceQueues_p {
@@ -66,11 +67,13 @@ public class PerformanceQueues_p {
serverObjects prop = new serverObjects();
File defaultSettingsFile = new File(switchboard.getRootPath(), "yacy.init");
Map defaultSettings = ((post == null) || (!(post.containsKey("submitdefault")))) ? null : serverFileUtils.loadHashMap(defaultSettingsFile);
-
Iterator threads = switchboard.threadNames();
String threadName;
serverThread thread;
+ boolean xml = ((String)header.get("PATH")).endsWith(".xml");
+ prop.setLocalized(!xml);
+
// calculate totals
long blocktime_total = 0, sleeptime_total = 0, exectime_total = 0;
while (threads.hasNext()) {
@@ -98,16 +101,16 @@ public class PerformanceQueues_p {
// set values to templates
prop.put("table_" + c + "_threadname", threadName);
- prop.put("table_" + c + "_hasurl_shortdescr", thread.getShortDescription());
+ prop.putHTML("table_" + c + "_hasurl_shortdescr", thread.getShortDescription(), xml);
if(thread.getMonitorURL() == null) {
- prop.put("table_"+c+"_hasurl", 0);
+ prop.put("table_"+c+"_hasurl", "0");
}else{
- prop.put("table_"+c+"_hasurl", 1);
+ prop.put("table_"+c+"_hasurl", "1");
prop.put("table_" + c + "_hasurl_url", thread.getMonitorURL());
}
- prop.put("table_" + c + "_longdescr", thread.getLongDescription());
+ prop.putHTML("table_" + c + "_longdescr", thread.getLongDescription(), xml);
queuesize = thread.getJobCount();
- prop.put("table_" + c + "_queuesize", (queuesize == Integer.MAX_VALUE) ? "unlimited" : Integer.toString(queuesize));
+ prop.put("table_" + c + "_queuesize", (queuesize == Integer.MAX_VALUE) ? "unknown" : yFormatter.number(queuesize, !xml));
blocktime = thread.getBlockTime();
sleeptime = thread.getSleepTime();
@@ -116,19 +119,19 @@ public class PerformanceQueues_p {
idleCycles = thread.getIdleCycles();
busyCycles = thread.getBusyCycles();
memshortageCycles = thread.getOutOfMemoryCycles();
- prop.put("table_" + c + "_blocktime", blocktime / 1000);
- prop.put("table_" + c + "_blockpercent", Long.toString(100 * blocktime / blocktime_total));
- prop.put("table_" + c + "_sleeptime", sleeptime / 1000);
- prop.put("table_" + c + "_sleeppercent", Long.toString(100 * sleeptime / sleeptime_total));
- prop.put("table_" + c + "_exectime", exectime / 1000);
- prop.put("table_" + c + "_execpercent", Long.toString(100 * exectime / exectime_total));
- prop.put("table_" + c + "_totalcycles", Long.toString(idleCycles + busyCycles + memshortageCycles));
- prop.put("table_" + c + "_idlecycles", Long.toString(idleCycles));
- prop.put("table_" + c + "_busycycles", Long.toString(busyCycles));
- prop.put("table_" + c + "_memscycles", Long.toString(memshortageCycles));
- prop.put("table_" + c + "_sleeppercycle", ((idleCycles + busyCycles) == 0) ? "-" : Long.toString(sleeptime / (idleCycles + busyCycles)));
- prop.put("table_" + c + "_execpercycle", (busyCycles == 0) ? "-" : Long.toString(exectime / busyCycles));
- prop.put("table_" + c + "_memusepercycle", (busyCycles == 0) ? "-" : Long.toString(memuse / busyCycles / 1024));
+ prop.putNum("table_" + c + "_blocktime", blocktime / 1000);
+ prop.putNum("table_" + c + "_blockpercent", 100 * blocktime / blocktime_total);
+ prop.putNum("table_" + c + "_sleeptime", sleeptime / 1000);
+ prop.putNum("table_" + c + "_sleeppercent", 100 * sleeptime / sleeptime_total);
+ prop.putNum("table_" + c + "_exectime", exectime / 1000);
+ prop.putNum("table_" + c + "_execpercent", 100 * exectime / exectime_total);
+ prop.putNum("table_" + c + "_totalcycles", idleCycles + busyCycles + memshortageCycles);
+ prop.putNum("table_" + c + "_idlecycles", idleCycles);
+ prop.putNum("table_" + c + "_busycycles", busyCycles);
+ prop.putNum("table_" + c + "_memscycles", memshortageCycles);
+ prop.putNum("table_" + c + "_sleeppercycle", ((idleCycles + busyCycles) == 0) ? -1 : sleeptime / (idleCycles + busyCycles));
+ prop.putNum("table_" + c + "_execpercycle", (busyCycles == 0) ? -1 : exectime / busyCycles);
+ prop.putNum("table_" + c + "_memusepercycle", (busyCycles == 0) ? -1 : memuse / busyCycles / 1024);
if ((post != null) && (post.containsKey("submitdelay"))) {
// load with new values
@@ -174,9 +177,9 @@ public class PerformanceQueues_p {
prop.put("table_" + c + "_busysleep", busysleep);
prop.put("table_" + c + "_memprereq", memprereq / 1024);
// disallow setting of memprereq for indexer to prevent db from throwing OOMs
- prop.put("table_" + c + "_disabled", /*(threadName.endsWith("_indexing")) ? 1 :*/ 0);
- prop.put("table_" + c + "_recommendation", (threadName.endsWith("_indexing")) ? 1 : 0);
- prop.put("table_" + c + "_recommendation_value", (threadName.endsWith("_indexing")) ? (switchboard.wordIndex.minMem() / 1024) : 0);
+ prop.put("table_" + c + "_disabled", /*(threadName.endsWith("_indexing")) ? 1 :*/ "0");
+ prop.put("table_" + c + "_recommendation", threadName.endsWith("_indexing") ? "1" : "0");
+ prop.putNum("table_" + c + "_recommendation_value", threadName.endsWith("_indexing") ? (switchboard.wordIndex.minMem() / 1024) : 0);
c++;
}
prop.put("table", c);
@@ -292,58 +295,58 @@ public class PerformanceQueues_p {
}
// table cache settings
- prop.put("urlCacheSize", switchboard.wordIndex.loadedURL.writeCacheSize());
- prop.put("wordCacheWSize", switchboard.wordIndex.dhtOutCacheSize());
- prop.put("wordCacheKSize", switchboard.wordIndex.dhtInCacheSize());
+ prop.putNum("urlCacheSize", switchboard.wordIndex.loadedURL.writeCacheSize());
+ prop.putNum("wordCacheWSize", switchboard.wordIndex.dhtOutCacheSize());
+ prop.putNum("wordCacheKSize", switchboard.wordIndex.dhtInCacheSize());
prop.putNum("wordCacheWSizeKBytes", switchboard.wordIndex.dhtCacheSizeBytes(false)/1024);
prop.putNum("wordCacheKSizeKBytes", switchboard.wordIndex.dhtCacheSizeBytes(true)/1024);
- prop.put("maxURLinWCache", "" + switchboard.wordIndex.maxURLinDHTOutCache());
- prop.put("maxURLinKCache", "" + switchboard.wordIndex.maxURLinDHTInCache());
- prop.put("maxAgeOfWCache", "" + (switchboard.wordIndex.maxAgeOfDHTOutCache() / 1000 / 60)); // minutes
- prop.put("maxAgeOfKCache", "" + (switchboard.wordIndex.maxAgeOfDHTInCache() / 1000 / 60)); // minutes
- prop.put("minAgeOfWCache", "" + (switchboard.wordIndex.minAgeOfDHTOutCache() / 1000 / 60)); // minutes
- prop.put("minAgeOfKCache", "" + (switchboard.wordIndex.minAgeOfDHTInCache() / 1000 / 60)); // minutes
- prop.put("maxWaitingWordFlush", switchboard.getConfig("maxWaitingWordFlush", "180"));
+ prop.putNum("maxURLinWCache", switchboard.wordIndex.maxURLinDHTOutCache());
+ prop.putNum("maxURLinKCache", switchboard.wordIndex.maxURLinDHTInCache());
+ prop.putNum("maxAgeOfWCache", switchboard.wordIndex.maxAgeOfDHTOutCache() / 1000 / 60); // minutes
+ prop.putNum("maxAgeOfKCache", switchboard.wordIndex.maxAgeOfDHTInCache() / 1000 / 60); // minutes
+ prop.putNum("minAgeOfWCache", switchboard.wordIndex.minAgeOfDHTOutCache() / 1000 / 60); // minutes
+ prop.putNum("minAgeOfKCache", switchboard.wordIndex.minAgeOfDHTInCache() / 1000 / 60); // minutes
+ prop.putNum("maxWaitingWordFlush", switchboard.getConfigLong("maxWaitingWordFlush", 180));
prop.put("wordCacheMaxCount", switchboard.getConfigLong(plasmaSwitchboard.WORDCACHE_MAX_COUNT, 20000));
prop.put("wordCacheInitCount", switchboard.getConfigLong(plasmaSwitchboard.WORDCACHE_INIT_COUNT, 30000));
prop.put("wordFlushSize", switchboard.getConfigLong("wordFlushSize", 2000));
- prop.put("onlineCautionDelay", switchboard.getConfig("onlineCautionDelay", "30000"));
- prop.put("onlineCautionDelayCurrent", System.currentTimeMillis() - switchboard.proxyLastAccess);
+ prop.put("onlineCautionDelay", switchboard.getConfigLong("onlineCautionDelay", 30000));
+ prop.putNum("onlineCautionDelayCurrent", System.currentTimeMillis() - switchboard.proxyLastAccess);
// table thread pool settings
GenericKeyedObjectPool.Config crawlerPoolConfig = switchboard.cacheLoader.getPoolConfig();
- prop.put("pool_0_name","Crawler Pool");
- prop.put("pool_0_maxActive",crawlerPoolConfig.maxActive);
- prop.put("pool_0_maxIdle",crawlerPoolConfig.maxIdle);
- prop.put("pool_0_minIdleConfigurable",0);
- prop.put("pool_0_minIdle","0");
- prop.put("pool_0_numActive",switchboard.cacheLoader.getNumActiveWorker());
- prop.put("pool_0_numIdle",switchboard.cacheLoader.getNumIdleWorker());
+ prop.put("pool_0_name", "Crawler Pool");
+ prop.put("pool_0_maxActive", crawlerPoolConfig.maxActive);
+ prop.put("pool_0_maxIdle", crawlerPoolConfig.maxIdle);
+ prop.put("pool_0_minIdleConfigurable", "0");
+ prop.put("pool_0_minIdle", "0");
+ prop.put("pool_0_numActive", switchboard.cacheLoader.getNumActiveWorker());
+ prop.put("pool_0_numIdle", switchboard.cacheLoader.getNumIdleWorker());
serverThread httpd = switchboard.getThread("10_httpd");
GenericObjectPool.Config httpdPoolConfig = ((serverCore)httpd).getPoolConfig();
- prop.put("pool_1_name","httpd Session Pool");
- prop.put("pool_1_maxActive",httpdPoolConfig.maxActive);
- prop.put("pool_1_maxIdle",httpdPoolConfig.maxIdle);
- prop.put("pool_1_minIdleConfigurable",1);
- prop.put("pool_1_minIdle",httpdPoolConfig.minIdle);
- prop.put("pool_1_numActive",((serverCore)httpd).getActiveSessionCount());
- prop.put("pool_1_numIdle",((serverCore)httpd).getIdleSessionCount());
+ prop.put("pool_1_name", "httpd Session Pool");
+ prop.put("pool_1_maxActive", httpdPoolConfig.maxActive);
+ prop.put("pool_1_maxIdle", httpdPoolConfig.maxIdle);
+ prop.put("pool_1_minIdleConfigurable", "1");
+ prop.put("pool_1_minIdle", httpdPoolConfig.minIdle);
+ prop.put("pool_1_numActive", ((serverCore)httpd).getActiveSessionCount());
+ prop.put("pool_1_numIdle", ((serverCore)httpd).getIdleSessionCount());
GenericObjectPool.Config stackerPoolConfig = switchboard.sbStackCrawlThread.getPoolConfig();
- prop.put("pool_2_name","CrawlStacker Session Pool");
- prop.put("pool_2_maxActive",stackerPoolConfig.maxActive);
- prop.put("pool_2_maxIdle",stackerPoolConfig.maxIdle);
- prop.put("pool_2_minIdleConfigurable",1);
- prop.put("pool_2_minIdle",stackerPoolConfig.minIdle);
- prop.put("pool_2_numActive",switchboard.sbStackCrawlThread.getNumActiveWorker());
- prop.put("pool_2_numIdle",switchboard.sbStackCrawlThread.getNumIdleWorker());
- prop.put("pool",3);
+ prop.putHTML("pool_2_name", "CrawlStacker Session Pool");
+ prop.put("pool_2_maxActive", stackerPoolConfig.maxActive);
+ prop.put("pool_2_maxIdle", stackerPoolConfig.maxIdle);
+ prop.put("pool_2_minIdleConfigurable", "1");
+ prop.put("pool_2_minIdle", stackerPoolConfig.minIdle);
+ prop.put("pool_2_numActive", switchboard.sbStackCrawlThread.getNumActiveWorker());
+ prop.put("pool_2_numIdle", switchboard.sbStackCrawlThread.getNumIdleWorker());
+ prop.put("pool", "3");
long curr_prio = switchboard.getConfigLong("javastart_priority",0);
- prop.put("priority_normal",(curr_prio==0)?1:0);
- prop.put("priority_below",(curr_prio==10)?1:0);
- prop.put("priority_low",(curr_prio==20)?1:0);
+ prop.put("priority_normal",(curr_prio==0) ? "1" : "0");
+ prop.put("priority_below",(curr_prio==10) ? "1" : "0");
+ prop.put("priority_low",(curr_prio==20) ? "1" : "0");
// return rewrite values for templates
return prop;
diff --git a/htroot/PerformanceSearch_p.java b/htroot/PerformanceSearch_p.java
index 8307a31db..349dc1888 100644
--- a/htroot/PerformanceSearch_p.java
+++ b/htroot/PerformanceSearch_p.java
@@ -41,7 +41,7 @@ public class PerformanceSearch_p {
plasmaSearchEvent se = plasmaSearchEvent.getEvent(plasmaSearchEvent.lastEventID);
if (se == null) {
- prop.put("table", 0);
+ prop.put("table", "0");
return prop;
}
@@ -51,8 +51,8 @@ public class PerformanceSearch_p {
while (events.hasNext()) {
event = (plasmaSearchProcessing.Entry) events.next();
prop.put("table_" + c + "_event", event.process);
- prop.put("table_" + c + "_count", event.count);
- prop.put("table_" + c + "_time", event.time);
+ prop.putNum("table_" + c + "_count", event.count);
+ prop.putNum("table_" + c + "_time", event.time);
c++;
}
prop.put("table", c);
diff --git a/htroot/ProxyIndexingMonitor_p.java b/htroot/ProxyIndexingMonitor_p.java
index 3332fb583..b62875da1 100644
--- a/htroot/ProxyIndexingMonitor_p.java
+++ b/htroot/ProxyIndexingMonitor_p.java
@@ -73,7 +73,7 @@ public class ProxyIndexingMonitor_p {
String oldProxyCachePath, newProxyCachePath;
String oldProxyCacheSize, newProxyCacheSize;
- prop.put("info", 0);
+ prop.put("info", "0");
prop.put("info_message", "");
if (post != null) {
@@ -114,7 +114,7 @@ public class ProxyIndexingMonitor_p {
// implant these settings also into the crawling profile for the proxy
if (sb.defaultProxyProfile == null) {
- prop.put("info", 1); //delete DATA/PLASMADB/crawlProfiles0.db
+ prop.put("info", "1"); //delete DATA/PLASMADB/crawlProfiles0.db
} else {
try {
sb.profilesActiveCrawls.changeEntry(sb.defaultProxyProfile, "generalDepth", Integer.toString(newProxyPrefetchDepth));
@@ -123,53 +123,52 @@ public class ProxyIndexingMonitor_p {
sb.profilesActiveCrawls.changeEntry(sb.defaultProxyProfile, "indexText",proxyIndexingLocalText ? "true":"false");
sb.profilesActiveCrawls.changeEntry(sb.defaultProxyProfile, "indexMedia",proxyIndexingLocalMedia ? "true":"false");
- prop.put("info", 2);//new proxyPrefetchdepth
+ prop.put("info", "2");//new proxyPrefetchdepth
prop.put("info_message", newProxyPrefetchDepth);
- prop.put("info_caching", (proxyStoreHTCache) ? 1 : 0);
- prop.put("info_indexingLocalText", (proxyIndexingLocalText) ? 1 : 0);
- prop.put("info_indexingLocalMedia", (proxyIndexingLocalMedia) ? 1 : 0);
- prop.put("info_indexingRemote", (proxyIndexingRemote) ? 1 : 0);
+ prop.put("info_caching", proxyStoreHTCache ? "1" : "0");
+ prop.put("info_indexingLocalText", proxyIndexingLocalText ? "1" : "0");
+ prop.put("info_indexingLocalMedia", proxyIndexingLocalMedia ? "1" : "0");
+ prop.put("info_indexingRemote", proxyIndexingRemote ? "1" : "0");
// proxyCache - only display on change
if (oldProxyCachePath.equals(newProxyCachePath)) {
- prop.put("info_path", 0);
+ prop.put("info_path", "0");
prop.put("info_path_return", oldProxyCachePath);
} else {
- prop.put("info_path", 1);
+ prop.put("info_path", "1");
prop.put("info_path_return", newProxyCachePath);
}
// proxyCacheSize - only display on change
if (oldProxyCacheSize.equals(newProxyCacheSize)) {
- prop.put("info_size", 0);
+ prop.put("info_size", "0");
prop.put("info_size_return", oldProxyCacheSize);
} else {
- prop.put("info_size", 1);
+ prop.put("info_size", "1");
prop.put("info_size_return", newProxyCacheSize);
}
// proxyCache, proxyCacheSize we need a restart
- prop.put("info_restart", 0);
- prop.put("info_restart_return", 0);
- if (!oldProxyCachePath.equals(newProxyCachePath)) prop.put("info_restart", 1);
-// if (!oldProxyCacheSize.equals(newProxyCacheSize)) prop.put("info_restart", 1);
+ prop.put("info_restart", "0");
+ prop.put("info_restart_return", "0");
+ if (!oldProxyCachePath.equals(newProxyCachePath)) prop.put("info_restart", "1");
} catch (IOException e) {
- prop.put("info", 3); //Error: errmsg
- prop.put("info_error", e.getMessage());
+ prop.put("info", "3"); //Error: errmsg
+ prop.putHTML("info_error", e.getMessage());
}
}
} catch (Exception e) {
- prop.put("info", 2); //Error: errmsg
- prop.put("info_error", e.getMessage());
+ prop.put("info", "2"); //Error: errmsg
+ prop.putHTML("info_error", e.getMessage());
serverLog.logSevere("SERVLET", "ProxyIndexingMonitor.case3", e);
}
}
prop.put("proxyPrefetchDepth", env.getConfig("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("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("proxyCache", "DATA/HTCACHE"));
prop.put("proxyCacheSize", env.getConfig("proxyCacheSize", "64"));
// return rewrite properties
diff --git a/htroot/QuickCrawlLink_p.java b/htroot/QuickCrawlLink_p.java
index a802fb419..421d98bcf 100644
--- a/htroot/QuickCrawlLink_p.java
+++ b/htroot/QuickCrawlLink_p.java
@@ -53,7 +53,6 @@ import java.net.MalformedURLException;
import java.net.URLDecoder;
import java.util.Date;
-import de.anomic.data.htmlTools;
import de.anomic.http.httpHeader;
import de.anomic.plasma.plasmaCrawlProfile;
import de.anomic.plasma.plasmaSwitchboard;
@@ -79,24 +78,24 @@ public class QuickCrawlLink_p {
if (post == null) {
// send back usage example
- prop.put("mode",0);
+ prop.put("mode", "0");
// getting the http host header
String hostSocket = (String) header.get(httpHeader.CONNECTION_PROP_HOST);
//String host = hostSocket;
- int port = 80, pos = hostSocket.indexOf(":");
+ int port = 80, pos = hostSocket.indexOf(":");
if (pos != -1) {
port = Integer.parseInt(hostSocket.substring(pos + 1));
//host = hostSocket.substring(0, pos);
}
prop.put("mode_host", "localhost");
- prop.put("mode_port", Integer.toString(port));
+ prop.put("mode_port", port);
return prop;
}
- prop.put("mode",1);
+ prop.put("mode", "1");
// getting the URL
String crawlingStart = post.get("url",null);
@@ -122,8 +121,8 @@ public class QuickCrawlLink_p {
boolean xdstopw = post.get("xdstopw", "").equals("on");
boolean xpstopw = post.get("xpstopw", "").equals("on");
- prop.put("mode_url", (crawlingStart == null) ? "unknown" : htmlTools.encodeUnicode2html(crawlingStart, false));
- prop.put("mode_title", (title == null) ? "unknown" : htmlTools.encodeUnicode2html(title, true));
+ prop.put("mode_url", (crawlingStart == null) ? "unknown" : crawlingStart);
+ prop.putHTML("mode_title", (title == null) ? "unknown" : title);
if (crawlingStart != null) {
crawlingStart = crawlingStart.trim();
@@ -134,7 +133,7 @@ public class QuickCrawlLink_p {
try {
crawlingStartURL = new yacyURL(crawlingStart, null);
} catch (MalformedURLException e) {
- prop.put("mode_status", 1);
+ prop.put("mode_status", "1");
prop.put("mode_code", "1");
return prop;
}
@@ -169,9 +168,9 @@ public class QuickCrawlLink_p {
);
} catch (Exception e) {
// mist
- prop.put("mode_status", 2);//Error with url
- prop.put("mode_code","2");
- prop.put("mode_status_error", e.getMessage());
+ prop.put("mode_status", "2");//Error with url
+ prop.put("mode_code", "2");
+ prop.putHTML("mode_status_error", e.getMessage());
return prop;
}
@@ -193,17 +192,15 @@ public class QuickCrawlLink_p {
// validate rejection reason
if (reasonString == null) {
- prop.put("mode_status", 0);//start msg
- prop.put("mode_code","0");
+ prop.put("mode_status", "0");//start msg
+ prop.put("mode_code", "0");
} else {
- prop.put("mode_status", 3);//start msg
+ prop.put("mode_status", "3");//start msg
prop.put("mode_code","3");
- prop.put("mode_status_error", reasonString);
+ prop.putHTML("mode_status_error", reasonString);
}
-
}
return prop;
}
-
}
diff --git a/htroot/Ranking_p.java b/htroot/Ranking_p.java
index eeaefd6a6..9f253cde2 100644
--- a/htroot/Ranking_p.java
+++ b/htroot/Ranking_p.java
@@ -76,20 +76,20 @@ public class Ranking_p {
private static serverObjects defaultValues() {
final serverObjects prop = new serverObjects();
prop.put("search", "");
- prop.put("num-results", 0);
- prop.put("excluded", 0);
- prop.put("combine", 0);
- prop.put("resultbottomline", 0);
- prop.put("localCount", 10);
- prop.put("localWDist", 999);
+ prop.put("num-results", "0");
+ prop.put("excluded", "0");
+ prop.put("combine", "0");
+ prop.put("resultbottomline", "0");
+ prop.put("localCount", "10");
+ prop.put("localWDist", "999");
//prop.put("globalChecked", "checked");
- prop.put("globalChecked", 0);
- prop.put("postsortChecked", 1);
- prop.put("localTime", 6);
+ prop.put("globalChecked", "0");
+ prop.put("postsortChecked", "1");
+ prop.put("localTime", "6");
prop.put("results", "");
- prop.put("urlmaskoptions", 0);
- prop.put("urlmaskoptions_urlmaskfilter", ".*");
- prop.put("jumpToCursor", 1);
+ prop.put("urlmaskoptions", "0");
+ prop.putHTML("urlmaskoptions_urlmaskfilter", ".*");
+ prop.put("jumpToCursor", "1");
return prop;
}
@@ -113,9 +113,9 @@ public class Ranking_p {
prop.put("attr" + attrExtension + "_" + j + "_select_" + i + "_value", i);
try {
prop.put("attr" + attrExtension + "_" + j + "_select_" + i + "_checked",
- (i == Integer.valueOf((String)map.get(key)).intValue()) ? 1 : 0);
+ (i == Integer.valueOf((String)map.get(key)).intValue()) ? "1" : "0");
} catch (NumberFormatException e) {
- prop.put("attr" + attrExtension + "_" + j + "_select_" + i + "_checked", 0);
+ prop.put("attr" + attrExtension + "_" + j + "_select_" + i + "_checked", "0");
}
}
prop.put("attr" + attrExtension + "_" + j + "_value",
diff --git a/htroot/SettingsAck_p.java b/htroot/SettingsAck_p.java
index 56eaaec81..bfdaef649 100644
--- a/htroot/SettingsAck_p.java
+++ b/htroot/SettingsAck_p.java
@@ -87,7 +87,7 @@ public class SettingsAck_p {
//if (post == null) System.out.println("POST: NULL"); else System.out.println("POST: " + post.toString());
if (post == null) {
- prop.put("info", 1);//no information submitted
+ prop.put("info", "1");//no information submitted
return prop;
}
@@ -99,22 +99,22 @@ public class SettingsAck_p {
String pw2 = (String) post.get("adminpw2");
// do checks
if ((user == null) || (pw1 == null) || (pw2 == null)) {
- prop.put("info", 1);//error with submitted information
+ prop.put("info", "1");//error with submitted information
return prop;
}
if (user.length() == 0) {
- prop.put("info", 2);//username must be given
+ prop.put("info", "2");//username must be given
return prop;
}
if (!(pw1.equals(pw2))) {
- prop.put("info", 3);//pw check failed
+ prop.put("info", "3");//pw check failed
return prop;
}
// check passed. set account:
env.setConfig(httpd.ADMIN_ACCOUNT_B64MD5, serverCodings.encodeMD5Hex(kelondroBase64Order.standardCoder.encodeString(user + ":" + pw1)));
env.setConfig("adminAccount", "");
- prop.put("info", 5);//admin account changed
- prop.put("info_user", user);
+ prop.put("info", "5");//admin account changed
+ prop.putHTML("info_user", user);
return prop;
}
@@ -125,26 +125,26 @@ public class SettingsAck_p {
* set new port
*/
String port = (String) post.get("port");
- prop.put("info_port", port);
+ prop.putHTML("info_port", port);
if (!env.getConfig("port", port).equals(port)) {
// validation port
serverCore theServerCore = (serverCore) env.getThread("10_httpd");
try {
InetSocketAddress theNewAddress = theServerCore.generateSocketAddress(port);
String hostName = theNewAddress.getHostName();
- prop.put("info_restart",1);
- prop.put("info_restart_ip",(hostName.equals("0.0.0.0"))?"localhost":hostName);
- prop.put("info_restart_port",Integer.toString(theNewAddress.getPort()));
+ prop.put("info_restart", "1");
+ prop.put("info_restart_ip",(hostName.equals("0.0.0.0"))? "localhost" : hostName);
+ prop.put("info_restart_port", theNewAddress.getPort());
env.setConfig("port", port);
theServerCore.reconnect();
} catch (SocketException e) {
- prop.put("info",26);
+ prop.put("info", "26");
return prop;
}
} else {
- prop.put("info_restart",0);
+ prop.put("info_restart", "0");
}
// read and process data
@@ -158,7 +158,7 @@ public class SettingsAck_p {
}
// do checks
if ((filter == null) || (use_proxyAccounts == null)) {
- prop.put("info", 1);//error with submitted information
+ prop.put("info", "1");//error with submitted information
return prop;
}
/*if (user.length() == 0) {
@@ -183,11 +183,11 @@ public class SettingsAck_p {
Pattern.compile(patternStr);
}
} catch (PatternSyntaxException e) {
- prop.put("info", 27);
- prop.put("info_filter", filter);
- prop.put("info_nr", Integer.toString(patternCount));
- prop.put("info_error", e.getMessage());
- prop.put("info_pattern", patternStr);
+ prop.put("info", "27");
+ prop.putHTML("info_filter", filter);
+ prop.put("info_nr", patternCount);
+ prop.putHTML("info_error", e.getMessage());
+ prop.putHTML("info_pattern", patternStr);
return prop;
}
}
@@ -196,12 +196,12 @@ public class SettingsAck_p {
env.setConfig("proxyClient", filter);
env.setConfig("use_proxyAccounts", use_proxyAccounts);//"true" or "false"
if (use_proxyAccounts.equals("false")){
- prop.put("info", 6);//proxy account has changed(no pw)
- prop.put("info_filter", filter);
+ prop.put("info", "6");//proxy account has changed(no pw)
+ prop.putHTML("info_filter", filter);
} else {
- prop.put("info", 7);//proxy account has changed
+ prop.put("info", "7");//proxy account has changed
//prop.put("info_user", user);
- prop.put("info_filter", filter);
+ prop.putHTML("info_filter", filter);
}
return prop;
}
@@ -212,7 +212,7 @@ public class SettingsAck_p {
// set transparent proxy flag
httpdProxyHandler.isTransparentProxy = post.containsKey("isTransparentProxy");
env.setConfig("isTransparentProxy", httpdProxyHandler.isTransparentProxy ? "true" : "false");
- prop.put("info_isTransparentProxy", httpdProxyHandler.isTransparentProxy ? "on" : "off");
+ prop.put("info_isTransparentProxy", httpdProxyHandler.isTransparentProxy ? "on" : "off");
// setting the keep alive property
httpd.keepAliveSupport = post.containsKey("connectionKeepAliveSupport");
@@ -227,7 +227,7 @@ public class SettingsAck_p {
env.setConfig("proxy.sendXForwardedForHeader", post.containsKey("proxy.sendXForwardedForHeader")?"true":"false");
prop.put("info_proxy.sendXForwardedForHeader", post.containsKey("proxy.sendXForwardedForHeader")? "on" : "off");
- prop.put("info", 20);
+ prop.put("info", "20");
return prop;
}
@@ -257,12 +257,12 @@ public class SettingsAck_p {
serverThread peerPing = env.getThread("30_peerping");
peerPing.notifyThread();
} catch (Exception e) {
- prop.put("info", 23);
- prop.put("info_errormsg",(e.getMessage() == null) ? "unknown" : e.getMessage().replaceAll("\n","<br>"));
+ prop.put("info", "23");
+ prop.putHTML("info_errormsg",(e.getMessage() == null) ? "unknown" : e.getMessage().replaceAll("\n","<br>"));
return prop;
}
- prop.put("info", 22);
+ prop.put("info", "22");
prop.put("info_portForwarding.Enabled", post.containsKey("portForwarding.Enabled")?"on":"off");
prop.put("info_portForwarding.Type", (String)post.get("portForwarding.Type"));
@@ -305,7 +305,7 @@ public class SettingsAck_p {
// do checks
if (filter == null) {
//if ((filter == null) || (user == null) || (pw1 == null) || (pw2 == null)) {
- prop.put("info", 1);//error with submitted information
+ prop.put("info", "1");//error with submitted information
return prop;
}
/* if (user.length() == 0) {
@@ -322,18 +322,18 @@ public class SettingsAck_p {
int patternCount = 0;
String patternStr = null;
try {
- StringTokenizer st = new StringTokenizer(filter,",");
+ StringTokenizer st = new StringTokenizer(filter,",");
while (st.hasMoreTokens()) {
patternCount++;
patternStr = st.nextToken();
Pattern.compile(patternStr);
}
} catch (PatternSyntaxException e) {
- prop.put("info", 27);
- prop.put("info_filter", filter);
- prop.put("info_nr", Integer.toString(patternCount));
- prop.put("info_error", e.getMessage());
- prop.put("info_pattern", patternStr);
+ prop.put("info", "27");
+ prop.putHTML("info_filter", filter);
+ prop.put("info_nr", patternCount);
+ prop.putHTML("info_error", e.getMessage());
+ prop.putHTML("info_pattern", patternStr);
return prop;
}
}
@@ -343,15 +343,15 @@ public class SettingsAck_p {
//env.setConfig("serverAccountBase64MD5", serverCodings.encodeMD5Hex(kelondroBase64Order.standardCoder.encodeString(user + ":" + pw1)));
env.setConfig("serverAccount", "");
- prop.put("info", 8);//server access filter updated
+ prop.put("info", "8");//server access filter updated
//prop.put("info_user", user);
- prop.put("info_filter", filter);
+ prop.putHTML("info_filter", filter);
return prop;
}
if (post.containsKey("pmode")) {
env.setConfig("onlineMode", "2");
- prop.put("info", 11);//permanent online mode
+ prop.put("info", "11");//permanent online mode
yacyCore.setOnlineMode(2);
yacyCore.triggerOnlineAction();
return prop;
@@ -359,14 +359,14 @@ public class SettingsAck_p {
if (post.containsKey("emode")) {
env.setConfig("onlineMode", "1");
- prop.put("info", 24);//event-based online mode
+ prop.put("info", "24");//event-based online mode
yacyCore.setOnlineMode(1);
return prop;
}
if (post.containsKey("cmode")) {
env.setConfig("onlineMode", "0");
- prop.put("info", 25);//cache mode
+ prop.put("info", "25");//cache mode
yacyCore.setOnlineMode(0);
return prop;
}
@@ -428,7 +428,7 @@ public class SettingsAck_p {
// env.setConfig("remoteProxyUse", (httpdProxyHandler.remoteProxyUse) ? "true" : "false");
- prop.put("info", 15); // The remote-proxy setting has been changed
+ prop.put("info", "15"); // The remote-proxy setting has been changed
return prop;
}
@@ -436,12 +436,12 @@ public class SettingsAck_p {
String error;
if ((error = ((plasmaSwitchboard)env).yc.saveSeedList(env)) == null) {
// trying to upload the seed-list file
- prop.put("info", 13);
- prop.put("info_success",1);
+ prop.put("info", "13");
+ prop.put("info_success", "1");
} else {
- prop.put("info",14);
- prop.put("info_errormsg",error.replaceAll("\n","<br>"));
- env.setConfig("seedUploadMethod","none");
+ prop.put("info", "14");
+ prop.putHTML("info_errormsg",error.replaceAll("\n","<br>"));
+ env.setConfig("seedUploadMethod","none");
}
return prop;
}
@@ -467,13 +467,13 @@ public class SettingsAck_p {
String error;
if ((error = ((plasmaSwitchboard)env).yc.saveSeedList(env)) == null) {
// we have successfully uploaded the seed-list file
- prop.put("info_seedUploadMethod",newSeedUploadMethod);
- prop.put("info_seedURL",newSeedURLStr);
- prop.put("info_success",(newSeedUploadMethod.equalsIgnoreCase("none")?0:1));
- prop.put("info", 19);
+ prop.put("info_seedUploadMethod", newSeedUploadMethod);
+ prop.putHTML("info_seedURL",newSeedURLStr);
+ prop.put("info_success", newSeedUploadMethod.equalsIgnoreCase("none") ? "0" : "1");
+ prop.put("info", "19");
} else {
- prop.put("info",14);
- prop.put("info_errormsg",error.replaceAll("\n","<br>"));
+ prop.put("info", "14");
+ prop.putHTML("info_errormsg", error.replaceAll("\n","<br>"));
env.setConfig("seedUploadMethod","none");
}
return prop;
@@ -514,21 +514,21 @@ public class SettingsAck_p {
if ((error = ((plasmaSwitchboard)env).yc.saveSeedList(env)) == null) {
// we have successfully uploaded the seed file
- prop.put("info", 13);
- prop.put("info_success",1);
+ prop.put("info", "13");
+ prop.put("info_success", "1");
} else {
// if uploading failed we print out an error message
- prop.put("info", 14);
- prop.put("info_errormsg",error.replaceAll("\n","<br>"));
+ prop.put("info", "14");
+ prop.putHTML("info_errormsg",error.replaceAll("\n","<br>"));
env.setConfig("seedUploadMethod","none");
}
} else {
- prop.put("info", 13);
- prop.put("info_success",0);
+ prop.put("info", "13");
+ prop.put("info_success", "0");
}
} else {
- prop.put("info", 13);
- prop.put("info_success",0);
+ prop.put("info", "13");
+ prop.put("info_success", "0");
}
return prop;
}
@@ -542,10 +542,10 @@ public class SettingsAck_p {
env.setConfig("msgForwardingCmd",(String) post.get("msgForwardingCmd"));
env.setConfig("msgForwardingTo",(String) post.get("msgForwardingTo"));
- prop.put("info", 21);
+ prop.put("info", "21");
prop.put("info_msgForwardingEnabled", post.containsKey("msgForwardingEnabled") ? "on" : "off");
prop.put("info_msgForwardingCmd", (String) post.get("msgForwardingCmd"));
- prop.put("info_msgForwardingTo", (String) post.get("msgForwardingTo"));
+ prop.putHTML("info_msgForwardingTo", (String) post.get("msgForwardingTo"));
return prop;
}
@@ -600,7 +600,7 @@ public class SettingsAck_p {
env.setConfig("parseableMimeTypes." + currParserMode,currEnabledMimesTxt.toString());
}
prop.put("info_parser",enabledMimesCount);
- prop.put("info", 18);
+ prop.put("info", "18");
return prop;
}
@@ -618,7 +618,7 @@ public class SettingsAck_p {
if (crawlerTimeout < 0) crawlerTimeout = 0;
env.setConfig("crawler.clientTimeout", Integer.toString(crawlerTimeout));
} catch (NumberFormatException e) {
- prop.put("info", 29);
+ prop.put("info", "29");
prop.put("info_crawler.clientTimeout",post.get("crawler.clientTimeout"));
return prop;
}
@@ -632,7 +632,7 @@ public class SettingsAck_p {
maxHttpSize = Integer.valueOf(maxSizeStr).intValue();
env.setConfig("crawler.http.maxFileSize", Long.toString(maxHttpSize));
} catch (NumberFormatException e) {
- prop.put("info", 30);
+ prop.put("info", "30");
prop.put("info_crawler.http.maxFileSize",post.get("crawler.http.maxFileSize"));
return prop;
}
@@ -646,22 +646,22 @@ public class SettingsAck_p {
maxFtpSize = Integer.valueOf(maxSizeStr).intValue();
env.setConfig("crawler.ftp.maxFileSize", Long.toString(maxFtpSize));
} catch (NumberFormatException e) {
- prop.put("info", 31);
+ prop.put("info", "31");
prop.put("info_crawler.ftp.maxFileSize",post.get("crawler.ftp.maxFileSize"));
return prop;
}
// everything is ok
- prop.put("info_crawler.clientTimeout",(crawlerTimeout==0) ?"0" :serverDate.intervalToString(crawlerTimeout));
- prop.put("info_crawler.http.maxFileSize",(maxHttpSize==-1)?"-1":serverMemory.bytesToString(maxHttpSize));
- prop.put("info_crawler.ftp.maxFileSize", (maxFtpSize==-1) ?"-1":serverMemory.bytesToString(maxFtpSize));
- prop.put("info", 28);
+ prop.put("info_crawler.clientTimeout",(crawlerTimeout==0) ? "0" :serverDate.intervalToString(crawlerTimeout));
+ prop.put("info_crawler.http.maxFileSize",(maxHttpSize==-1)? "-1":serverMemory.bytesToString(maxHttpSize));
+ prop.put("info_crawler.ftp.maxFileSize", (maxFtpSize==-1) ? "-1":serverMemory.bytesToString(maxFtpSize));
+ prop.put("info", "28");
return prop;
}
// nothing made
- prop.put("info", 1);//no information submitted
+ prop.put("info", "1");//no information submitted
return prop;
}
diff --git a/htroot/Settings_p.java b/htroot/Settings_p.java
index 948e74b74..ee81ef947 100644
--- a/htroot/Settings_p.java
+++ b/htroot/Settings_p.java
@@ -103,17 +103,17 @@ public final class Settings_p {
prop.put("port", env.getConfig("port", "8080"));
- prop.put("peerName", env.getConfig("peerName", "nameless"));
+ prop.putHTML("peerName", env.getConfig("peerName", "nameless"));
prop.put("staticIP", env.getConfig("staticIP", ""));
String peerLang = env.getConfig("locale.language", "default");
if (peerLang.equals("default")) peerLang = "en";
prop.put("peerLang", peerLang);
// http networking settings
- prop.put("isTransparentProxy", env.getConfig("isTransparentProxy", "false").equals("true") ? 1 : 0);
- prop.put("connectionKeepAliveSupport", env.getConfig("connectionKeepAliveSupport", "false").equals("true") ? 1 : 0);
- prop.put("proxy.sendViaHeader", env.getConfig("proxy.sendViaHeader", "false").equals("true") ? 1 : 0);
- prop.put("proxy.sendXForwardedForHeader", env.getConfig("proxy.sendXForwardedForHeader", "true").equals("true") ? 1 : 0);
+ prop.put("isTransparentProxy", env.getConfig("isTransparentProxy", "false").equals("true") ? "1" : "0");
+ prop.put("connectionKeepAliveSupport", env.getConfig("connectionKeepAliveSupport", "false").equals("true") ? "1" : "0");
+ prop.put("proxy.sendViaHeader", env.getConfig("proxy.sendViaHeader", "false").equals("true") ? "1" : "0");
+ prop.put("proxy.sendXForwardedForHeader", env.getConfig("proxy.sendXForwardedForHeader", "true").equals("true") ? "1" : "0");
// remote port forwarding settings
String[] forwardingMethods = new String[]{"sch","upnp"};
@@ -130,15 +130,15 @@ public final class Settings_p {
} catch (Exception e) {
} catch (Error e) {}
}
- prop.put("forwardingMethods",methodCount);
+ prop.put("forwardingMethods", methodCount);
if (methodCount > 0) portForwardingAvailable = true;
prop.put("portForwarding.Type",currentForwarder);
- prop.put("portForwarding.Available",portForwardingAvailable? 1:0);
- prop.put("portForwarding.Enabled",env.getConfig("portForwarding.Enabled","false").equals("true")? 1 : 0);
+ prop.put("portForwarding.Available",portForwardingAvailable? "1" : "0");
+ prop.put("portForwarding.Enabled",env.getConfig("portForwarding.Enabled","false").equals("true")? "1" : "0");
- prop.put("portForwarding.sch.UseProxy",env.getConfig("portForwarding.sch.UseProxy", "false").equals("true")? 1 : 0);
+ prop.put("portForwarding.sch.UseProxy",env.getConfig("portForwarding.sch.UseProxy", "false").equals("true") ? "1" : "0");
prop.put("portForwarding.sch.Port",env.getConfig("portForwarding.sch.Port", ""));
prop.put("portForwarding.sch.Host",env.getConfig("portForwarding.sch.Host", ""));
prop.put("portForwarding.sch.HostPort",env.getConfig("portForwarding.sch.HostPort", ""));
@@ -177,14 +177,14 @@ public final class Settings_p {
prop.put("remoteProxyNoProxy", env.getConfig("remoteProxyNoProxy", ""));
// proxy access filter
- prop.put("proxyfilter", env.getConfig("proxyClient", "*"));
+ prop.putHTML("proxyfilter", env.getConfig("proxyClient", "*"));
// proxy password
if ( env.getConfig("use_proxyAccounts", "false").equals("false") ) {
// no password has been specified
- prop.put("use_proxyAccounts", 0); //unchecked
+ prop.put("use_proxyAccounts", "0"); //unchecked
} else {
- prop.put("use_proxyAccounts", 1); //checked
+ prop.put("use_proxyAccounts", "1"); //checked
/*s = env.getConfig("proxyAccount", "proxy:void");
pos = s.indexOf(":");
if (pos < 0) {
@@ -195,7 +195,7 @@ public final class Settings_p {
}
// server access filter
- prop.put("serverfilter", env.getConfig("serverClient", "*"));
+ prop.putHTML("serverfilter", env.getConfig("serverClient", "*"));
// server password
if (env.getConfig("serverAccountBase64", "").length() == 0) {
@@ -212,7 +212,7 @@ public final class Settings_p {
}
// clientIP
- prop.put("clientIP", (String) header.get("CLIENTIP", "<unknown>")); // read an artificial header addendum
+ prop.putHTML("clientIP", (String) header.get("CLIENTIP", "<unknown>"), true); // read an artificial header addendum
/*
* seed upload settings
@@ -232,7 +232,7 @@ public final class Settings_p {
HashMap uploaders = yacyCore.getSeedUploadMethods();
prop.put("seedUploadMethods", uploaders.size() + 1);
prop.put("seedUploadMethods_0_name", "none");
- prop.put("seedUploadMethods_0_selected", enabledUploader.equals("none")?1:0);
+ prop.put("seedUploadMethods_0_selected", enabledUploader.equals("none") ? "1" : "0");
prop.put("seedUploadMethods_0_file", "");
int count = 0;
@@ -241,7 +241,7 @@ public final class Settings_p {
count++;
String uploaderName = (String) uploaderKeys.next();
prop.put("seedUploadMethods_" +count+ "_name", uploaderName);
- prop.put("seedUploadMethods_" +count+ "_selected", uploaderName.equals(enabledUploader)?1:0);
+ prop.put("seedUploadMethods_" +count+ "_selected", uploaderName.equals(enabledUploader) ? "1" : "0");
prop.put("seedUploadMethods_" +count+ "_file", "Settings_Seed_Upload" + uploaderName + ".inc");
yacySeedUploader theUploader = yacyCore.getSeedUploader(uploaderName);
@@ -260,7 +260,7 @@ public final class Settings_p {
/*
* Message forwarding configuration
*/
- prop.put("msgForwardingEnabled",env.getConfig("msgForwardingEnabled","false").equals("true")? 1 : 0);
+ prop.put("msgForwardingEnabled",env.getConfig("msgForwardingEnabled","false").equals("true") ? "1" : "0");
prop.put("msgForwardingCmd",env.getConfig("msgForwardingCmd", ""));
prop.put("msgForwardingTo",env.getConfig("msgForwardingTo", ""));
@@ -290,9 +290,9 @@ public final class Settings_p {
while (availableParserIter.hasNext()) {
ParserInfo parserInfo = (ParserInfo) availableParserIter.next();
prop.put("parser_" + parserIdx + "_name", parserInfo.parserName);
- prop.put("parser_" + parserIdx + "_version", parserInfo.parserVersionNr);
- prop.put("parser_" + parserIdx + "_usage", Integer.toString(parserInfo.usageCount));
- prop.put("parser_" + parserIdx + "_colspan",Integer.toString(configArray.length));
+ prop.putHTML("parser_" + parserIdx + "_version", parserInfo.parserVersionNr, true);
+ prop.put("parser_" + parserIdx + "_usage", parserInfo.usageCount);
+ prop.put("parser_" + parserIdx + "_colspan", configArray.length);
int mimeIdx = 0;
Enumeration mimeTypeIter = parserInfo.supportedMimeTypes.keys();
@@ -305,10 +305,10 @@ public final class Settings_p {
for (int i=0; i<configArray.length; i++) {
HashSet enabledParsers = configArray[i].getEnabledParserList();
prop.put("parser_" + parserIdx + "_mime_" + mimeIdx + "_parserMode_" + i + "_optionName", configArray[i].parserMode + "." + mimeType);
- prop.put("parser_" + parserIdx + "_mime_" + mimeIdx + "_parserMode_" + i + "_status", enabledParsers.contains(mimeType) ? 1:0);
+ prop.put("parser_" + parserIdx + "_mime_" + mimeIdx + "_parserMode_" + i + "_status", enabledParsers.contains(mimeType) ? "1" : "0");
allParsersEnabled[i] &= enabledParsers.contains(mimeType);
}
- prop.put("parser_" + parserIdx + "_mime_" + mimeIdx + "_parserMode",configArray.length);
+ prop.put("parser_" + parserIdx + "_mime_" + mimeIdx + "_parserMode", configArray.length);
mimeIdx++;
}
prop.put("parser_" + parserIdx + "_mime", mimeIdx);
@@ -318,11 +318,11 @@ public final class Settings_p {
for (int i=0; i<configArray.length; i++) {
prop.put("parserMode_" + i + "_name",configArray[i].parserMode);
- prop.put("parserMode_" + i + "_allParserEnabled",allParsersEnabled[i] ? 1:0);
+ prop.put("parserMode_" + i + "_allParserEnabled",allParsersEnabled[i] ? "1" : "0");
}
prop.put("parserMode",configArray.length);
prop.put("parser", parserIdx);
- prop.put("parser.colspan", Integer.toString(configArray.length+2));
+ prop.put("parser.colspan", configArray.length+2);
// Crawler settings
prop.put("crawler.clientTimeout",sb.getConfig("crawler.clientTimeout", "10000"));
diff --git a/htroot/Statistics.java b/htroot/Statistics.java
index 536dd0176..45c4bec18 100644
--- a/htroot/Statistics.java
+++ b/htroot/Statistics.java
@@ -59,15 +59,18 @@ public class Statistics {
// return variable that accumulates replacements
plasmaSwitchboard switchboard = (plasmaSwitchboard) sb;
serverObjects prop = new serverObjects();
- int page = (post == null) ? 0 : Integer.parseInt(post.get("page", "0"));
+ if (null == switchboard.facilityDB)
+ return prop;
+
+ int page = (post == null) ? 0 : post.getInt("page", 0);
prop.put("page", page);
switch (page) {
case 0:
if (switchboard.facilityDB.size("backlinks") == 0) {
- prop.put("page_backlinks", 0);
+ prop.put("page_backlinks", "0");
} else {
- prop.put("page_backlinks", 1);
+ prop.put("page_backlinks", "1");
Iterator it = switchboard.facilityDB.maps("backlinks", false, "date");
int count = 0;
int maxCount = 100;
@@ -81,7 +84,8 @@ public class Statistics {
urlString = (String) map.get("key");
try { url = new yacyURL(urlString, null); } catch (MalformedURLException e) { url = null; }
if ((url != null) && (!url.isLocal())) {
- prop.put("page_backlinks_list_" + count + "_dark", ((dark) ? 1 : 0)); dark =! dark;
+ prop.put("page_backlinks_list_" + count + "_dark", dark ? "1" : "0");
+ dark =! dark;
prop.put("page_backlinks_list_" + count + "_url", urlString);
prop.put("page_backlinks_list_" + count + "_date", map.get("date"));
prop.put("page_backlinks_list_" + count + "_clientip", map.get("clientip"));
@@ -89,14 +93,13 @@ public class Statistics {
count++;
}
}//while
- prop.put("page_backlinks_list", count);
- prop.put("page_backlinks_num", count);
- prop.put("page_backlinks_total", switchboard.facilityDB.size("backlinks"));
+ prop.putNum("page_backlinks_list", count);
+ prop.putNum("page_backlinks_num", count);
+ prop.putNum("page_backlinks_total", switchboard.facilityDB.size("backlinks"));
}
break;
}
// return rewrite properties
return prop;
}
-
}
diff --git a/htroot/Status.java b/htroot/Status.java
index dd9570ff5..ecb3cb0b7 100644
--- a/htroot/Status.java
+++ b/htroot/Status.java
@@ -139,19 +139,19 @@ public class Status {
boolean adminaccess = sb.adminAuthenticated(header) >= 2;
if (adminaccess) {
- prop.put("showPrivateTable",1);
+ prop.put("showPrivateTable", "1");
prop.put("privateStatusTable", "Status_p.inc");
} else {
- prop.put("showPrivateTable",0);
+ prop.put("showPrivateTable", "0");
prop.put("privateStatusTable", "");
}
// password protection
if (sb.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() == 0) {
- prop.put("protection", 0); // not protected
- prop.put("urgentSetPassword", 1);
+ prop.put("protection", "0"); // not protected
+ prop.put("urgentSetPassword", "1");
} else {
- prop.put("protection", 1); // protected
+ prop.put("protection", "1"); // protected
}
// version information
@@ -164,11 +164,11 @@ public class Status {
// place some more hints
if ((adminaccess) && (sb.getThread(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL).getJobCount() == 0) && (sb.getThread(plasmaSwitchboard.INDEXER).getJobCount() == 0)) {
- prop.put("hintCrawlStart", 1);
+ prop.put("hintCrawlStart", "1");
}
if ((adminaccess) && (sb.getThread(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL).getJobCount() > 500)) {
- prop.put("hintCrawlMonitor", 1);
+ prop.put("hintCrawlMonitor", "1");
}
// hostname and port
@@ -176,33 +176,33 @@ public class Status {
int pos = extendedPortString.indexOf(":");
prop.put("port",serverCore.getPortNr(extendedPortString));
if (pos!=-1) {
- prop.put("extPortFormat",1);
+ prop.put("extPortFormat", "1");
prop.put("extPortFormat_extPort",extendedPortString);
} else {
- prop.put("extPortFormat",0);
+ prop.put("extPortFormat", "0");
}
prop.put("host", serverDomains.myPublicLocalIP().getHostAddress());
// ssl support
- prop.put("sslSupport",sb.getConfig("keyStore", "").length() == 0 ? 0:1);
+ prop.put("sslSupport",sb.getConfig("keyStore", "").length() == 0 ? "0" : "1");
// port forwarding: hostname and port
if ((serverCore.portForwardingEnabled) && (serverCore.portForwarding != null)) {
- prop.put("portForwarding", 1);
+ prop.put("portForwarding", "1");
prop.put("portForwarding_host", serverCore.portForwarding.getHost());
prop.put("portForwarding_port", Integer.toString(serverCore.portForwarding.getPort()));
- prop.put("portForwarding_status", serverCore.portForwarding.isConnected() ? 1:0);
+ prop.put("portForwarding_status", serverCore.portForwarding.isConnected() ? "1" : "0");
} else {
- prop.put("portForwarding", 0);
+ prop.put("portForwarding", "0");
}
if (sb.getConfig("remoteProxyUse", "false").equals("true")) {
- prop.put("remoteProxy", 1);
- prop.put("remoteProxy_host", sb.getConfig("remoteProxyHost", "<unknown>"));
- prop.put("remoteProxy_port", sb.getConfig("remoteProxyPort", "<unknown>"));
- prop.put("remoteProxy_4Yacy", sb.getConfig("remoteProxyUse4Yacy", "true").equalsIgnoreCase("true")?0:1);
+ prop.put("remoteProxy", "1");
+ prop.putHTML("remoteProxy_host", sb.getConfig("remoteProxyHost", "<unknown>"), true);
+ prop.putHTML("remoteProxy_port", sb.getConfig("remoteProxyPort", "<unknown>"), true);
+ prop.put("remoteProxy_4Yacy", sb.getConfig("remoteProxyUse4Yacy", "true").equalsIgnoreCase("true") ? "0" : "1");
} else {
- prop.put("remoteProxy", 0); // not used
+ prop.put("remoteProxy", "0"); // not used
}
// peer information
@@ -210,48 +210,48 @@ public class Status {
final String thisName = sb.getConfig("peerName", "<nameless>");
if (yacyCore.seedDB.mySeed() == null) {
thisHash = "not assigned";
- prop.put("peerAddress", 0); // not assigned
- prop.put("peerStatistics", 0); // unknown
+ prop.put("peerAddress", "0"); // not assigned
+ prop.put("peerStatistics", "0"); // unknown
} else {
final long uptime = 60000 * Long.parseLong(yacyCore.seedDB.mySeed().get(yacySeed.UPTIME, "0"));
- prop.put("peerStatistics", 1);
+ prop.put("peerStatistics", "1");
prop.put("peerStatistics_uptime", serverDate.intervalToString(uptime));
- prop.put("peerStatistics_pagesperminute", yacyCore.seedDB.mySeed().get(yacySeed.ISPEED, "unknown"));
- prop.put("peerStatistics_queriesperhour", yFormatter.number(Math.round(6000d * yacyCore.seedDB.mySeed().getQPM()) / 100d));
- prop.put("peerStatistics_links", yFormatter.number(yacyCore.seedDB.mySeed().get(yacySeed.LCOUNT, "0")));
+ prop.putNum("peerStatistics_pagesperminute", yacyCore.seedDB.mySeed().getPPM());
+ prop.putNum("peerStatistics_queriesperhour", Math.round(6000d * yacyCore.seedDB.mySeed().getQPM()) / 100d);
+ prop.putNum("peerStatistics_links", yacyCore.seedDB.mySeed().getLinkCount());
prop.put("peerStatistics_words", yFormatter.number(yacyCore.seedDB.mySeed().get(yacySeed.ICOUNT, "0")));
- prop.put("peerStatistics_juniorConnects", yacyCore.peerActions.juniorConnects);
- prop.put("peerStatistics_seniorConnects", yacyCore.peerActions.seniorConnects);
- prop.put("peerStatistics_principalConnects", yacyCore.peerActions.principalConnects);
- prop.put("peerStatistics_disconnects", yacyCore.peerActions.disconnects);
+ prop.putNum("peerStatistics_juniorConnects", yacyCore.peerActions.juniorConnects);
+ prop.putNum("peerStatistics_seniorConnects", yacyCore.peerActions.seniorConnects);
+ prop.putNum("peerStatistics_principalConnects", yacyCore.peerActions.principalConnects);
+ prop.putNum("peerStatistics_disconnects", yacyCore.peerActions.disconnects);
prop.put("peerStatistics_connects", yFormatter.number(yacyCore.seedDB.mySeed().get(yacySeed.CCOUNT, "0")));
if (yacyCore.seedDB.mySeed().getPublicAddress() == null) {
thisHash = yacyCore.seedDB.mySeed().hash;
- prop.put("peerAddress", 0); // not assigned + instructions
- prop.put("warningGoOnline", 1);
+ prop.put("peerAddress", "0"); // not assigned + instructions
+ prop.put("warningGoOnline", "1");
} else {
thisHash = yacyCore.seedDB.mySeed().hash;
- prop.put("peerAddress", 1); // Address
+ prop.put("peerAddress", "1"); // Address
prop.put("peerAddress_address", yacyCore.seedDB.mySeed().getPublicAddress());
- prop.put("peerAddress_peername", sb.getConfig("peerName", "<nameless>").toLowerCase());
+ prop.putHTML("peerAddress_peername", sb.getConfig("peerName", "<nameless>").toLowerCase(), true);
}
}
final String peerStatus = ((yacyCore.seedDB.mySeed() == null) ? yacySeed.PEERTYPE_VIRGIN : yacyCore.seedDB.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN));
if (peerStatus.equals(yacySeed.PEERTYPE_VIRGIN)) {
- prop.put(PEERSTATUS, 0);
- prop.put("urgentStatusVirgin", 1);
+ prop.put(PEERSTATUS, "0");
+ prop.put("urgentStatusVirgin", "1");
} else if (peerStatus.equals(yacySeed.PEERTYPE_JUNIOR)) {
- prop.put(PEERSTATUS, 1);
- prop.put("warningStatusJunior", 1);
+ prop.put(PEERSTATUS, "1");
+ prop.put("warningStatusJunior", "1");
} else if (peerStatus.equals(yacySeed.PEERTYPE_SENIOR)) {
- prop.put(PEERSTATUS, 2);
- prop.put("hintStatusSenior", 1);
+ prop.put(PEERSTATUS, "2");
+ prop.put("hintStatusSenior", "1");
} else if (peerStatus.equals(yacySeed.PEERTYPE_PRINCIPAL)) {
- prop.put(PEERSTATUS, 3);
- prop.put("hintStatusPrincipal", 1);
+ prop.put(PEERSTATUS, "3");
+ prop.put("hintStatusPrincipal", "1");
prop.put("hintStatusPrincipal_seedURL", yacyCore.seedDB.mySeed().get("seedURL", "?"));
}
- prop.put("peerName", thisName);
+ prop.putHTML("peerName", thisName);
prop.put("hash", thisHash);
final String seedUploadMethod = sb.getConfig("seedUploadMethod", "");
@@ -268,121 +268,92 @@ public class Status {
}
if (seedUploadMethod.equalsIgnoreCase("ftp")) {
- prop.put(SEEDSERVER, 1); // enabled
+ prop.put(SEEDSERVER, "1"); // enabled
prop.put("seedServer_seedServer", sb.getConfig("seedFTPServer", ""));
} else if (seedUploadMethod.equalsIgnoreCase("scp")) {
- prop.put(SEEDSERVER, 1); // enabled
+ prop.put(SEEDSERVER, "1"); // enabled
prop.put("seedServer_seedServer", sb.getConfig("seedScpServer", ""));
} else if (seedUploadMethod.equalsIgnoreCase("file")) {
- prop.put(SEEDSERVER, 2); // enabled
+ prop.put(SEEDSERVER, "2"); // enabled
prop.put("seedServer_seedFile", sb.getConfig("seedFilePath", ""));
}
prop.put("seedServer_lastUpload",
serverDate.intervalToString(System.currentTimeMillis() - sb.yc.lastSeedUpload_timeStamp));
} else {
- prop.put(SEEDSERVER, 0); // disabled
+ prop.put(SEEDSERVER, "0"); // disabled
}
if (yacyCore.seedDB != null && yacyCore.seedDB.sizeConnected() > 0){
- prop.put("otherPeers", 1);
- prop.put("otherPeers_num", yFormatter.number(yacyCore.seedDB.sizeConnected()));
+ prop.put("otherPeers", "1");
+ prop.putNum("otherPeers_num", yacyCore.seedDB.sizeConnected());
}else{
- prop.put("otherPeers", 0); // not online
+ prop.put("otherPeers", "0"); // not online
}
if (sb.getConfig("browserPopUpTrigger", "false").equals("false")) {
- prop.put("popup", 0);
+ prop.put("popup", "0");
} else {
- prop.put("popup", 1);
+ prop.put("popup", "1");
}
if (sb.getConfig("onlineMode", "1").equals("0")) {
- prop.put("omode", 0);
+ prop.put("omode", "0");
} else if (sb.getConfig("onlineMode", "1").equals("1")) {
- prop.put("omode", 1);
+ prop.put("omode", "1");
} else {
- prop.put("omode", 2);
+ prop.put("omode", "2");
}
final Runtime rt = Runtime.getRuntime();
// memory usage and system attributes
- prop.put("freeMemory", bytesToString(rt.freeMemory()));
- prop.put("totalMemory", bytesToString(rt.totalMemory()));
- prop.put("maxMemory", bytesToString(serverMemory.max));
+ prop.put("freeMemory", serverMemory.bytesToString(rt.freeMemory()));
+ prop.put("totalMemory", serverMemory.bytesToString(rt.totalMemory()));
+ prop.put("maxMemory", serverMemory.bytesToString(serverMemory.max));
prop.put("processors", rt.availableProcessors());
// proxy traffic
//prop.put("trafficIn",bytesToString(httpdByteCountInputStream.getGlobalCount()));
- prop.put("trafficProxy",bytesToString(httpdByteCountOutputStream.getAccountCount("PROXY")));
- prop.put("trafficCrawler",bytesToString(httpdByteCountInputStream.getAccountCount("CRAWLER")));
+ prop.put("trafficProxy", serverMemory.bytesToString(httpdByteCountOutputStream.getAccountCount("PROXY")));
+ prop.put("trafficCrawler", serverMemory.bytesToString(httpdByteCountInputStream.getAccountCount("CRAWLER")));
// connection information
serverCore httpd = (serverCore) sb.getThread("10_httpd");
int activeSessionCount = httpd.getActiveSessionCount();
int idleSessionCount = httpd.getIdleSessionCount();
int maxSessionCount = httpd.getMaxSessionCount();
- prop.put("connectionsActive",Integer.toString(activeSessionCount));
- prop.put("connectionsMax",Integer.toString(maxSessionCount));
- prop.put("connectionsIdle",Integer.toString(idleSessionCount));
+ prop.putNum("connectionsActive", activeSessionCount);
+ prop.putNum("connectionsMax", maxSessionCount);
+ prop.putNum("connectionsIdle", idleSessionCount);
// Queue information
int indexingJobCount = sb.getThread("80_indexing").getJobCount()+sb.indexingTasksInProcess.size();
int indexingMaxCount = plasmaSwitchboard.indexingSlots;
int indexingPercent = (indexingMaxCount==0)?0:indexingJobCount*100/indexingMaxCount;
- prop.put("indexingQueueSize", Integer.toString(indexingJobCount));
- prop.put("indexingQueueMax", Integer.toString(indexingMaxCount));
- prop.put("indexingQueuePercent",(indexingPercent>100)?"100":Integer.toString(indexingPercent));
+ prop.putNum("indexingQueueSize", indexingJobCount);
+ prop.putNum("indexingQueueMax", indexingMaxCount);
+ prop.put("indexingQueuePercent",(indexingPercent>100) ? 100 : indexingPercent);
int loaderJobCount = sb.cacheLoader.size();
int loaderMaxCount = plasmaSwitchboard.crawlSlots;
int loaderPercent = (loaderMaxCount==0)?0:loaderJobCount*100/loaderMaxCount;
- prop.put("loaderQueueSize", Integer.toString(loaderJobCount));
- prop.put("loaderQueueMax", Integer.toString(loaderMaxCount));
- prop.put("loaderQueuePercent", (loaderPercent>100)?"100":Integer.toString(loaderPercent));
+ prop.putNum("loaderQueueSize", loaderJobCount);
+ prop.putNum("loaderQueueMax", loaderMaxCount);
+ prop.put("loaderQueuePercent", (loaderPercent>100) ? 100 : loaderPercent);
- prop.put("localCrawlQueueSize", yFormatter.number(sb.getThread(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL).getJobCount()));
- prop.put("localCrawlPaused",sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL)?1:0);
+ prop.putNum("localCrawlQueueSize", sb.getThread(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL).getJobCount());
+ prop.put("localCrawlPaused",sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL) ? "1" : "0");
- prop.put("remoteTriggeredCrawlQueueSize", yFormatter.number(sb.getThread(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL).getJobCount()));
- prop.put("remoteTriggeredCrawlPaused",sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL)?1:0);
+ prop.putNum("remoteTriggeredCrawlQueueSize", sb.getThread(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL).getJobCount());
+ prop.put("remoteTriggeredCrawlPaused",sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL) ? "1" : "0");
- prop.put("globalCrawlTriggerQueueSize", yFormatter.number(sb.getThread(plasmaSwitchboard.CRAWLJOB_GLOBAL_CRAWL_TRIGGER).getJobCount()));
- prop.put("globalCrawlTriggerPaused",sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_GLOBAL_CRAWL_TRIGGER)?1:0);
+ prop.putNum("globalCrawlTriggerQueueSize", sb.getThread(plasmaSwitchboard.CRAWLJOB_GLOBAL_CRAWL_TRIGGER).getJobCount());
+ prop.put("globalCrawlTriggerPaused",sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_GLOBAL_CRAWL_TRIGGER) ? "1" : "0");
- prop.put("stackCrawlQueueSize", yFormatter.number(sb.sbStackCrawlThread.size()));
+ prop.putNum("stackCrawlQueueSize", sb.sbStackCrawlThread.size());
// return rewrite properties
prop.put("date",(new Date()).toString());
return prop;
}
-
- public static String bytesToString(long byteCount) {
- try {
- final StringBuffer byteString = new StringBuffer();
-
- if (byteCount > 1073741824) {
- byteString.append(yFormatter.number(byteCount / 1073741824.0 ))
- .append(" GB");
- } else if (byteCount > 1048576) {
- byteString.append(yFormatter.number(byteCount / 1048576.0))
- .append(" MB");
- } else if (byteCount > 1024) {
- byteString.append(yFormatter.number(byteCount / 1024.0))
- .append(" KB");
- } else {
- byteString.append(yFormatter.number(byteCount))
- .append(" Bytes");
- }
-
- return byteString.toString();
- } catch (Exception e) {
- return "unknown";
- }
-
- }
-
-
- //TODO: groupDigits-functions (Status.java & Network.java) should
- // be referenced in a single class (now double-implemented)
}
diff --git a/htroot/Steering.java b/htroot/Steering.java
index c46c7021f..b4a15b9c7 100644
--- a/htroot/Steering.java
+++ b/htroot/Steering.java
@@ -61,7 +61,7 @@ public class Steering {
final plasmaSwitchboard sb = (plasmaSwitchboard) ss;
final serverObjects prop = new serverObjects();
- prop.put("info", 0); //no information submitted
+ prop.put("info", "0"); //no information submitted
if (prop == null) { return null; }
// handle access rights
@@ -72,13 +72,13 @@ public class Steering {
if (post.containsKey("shutdown")) {
sb.terminate(5000);
- prop.put("info", 3);
+ prop.put("info", "3");
return prop;
}
if (post.containsKey("restart")) {
yacyVersion.restart();
- prop.put("info", 4);
+ prop.put("info", "4");
return prop;
}
@@ -90,7 +90,7 @@ public class Steering {
if ((!devenvironment) && (releaseFile.length() > 0) && (releaseFile.exists())) {
yacyVersion.deployRelease(releaseFileName);
}
- prop.put("info", 5);
+ prop.put("info", "5");
prop.put("info_release", releaseFileName);
return prop;
diff --git a/htroot/Supporter.java b/htroot/Supporter.java
index a02c34753..1750659d5 100644
--- a/htroot/Supporter.java
+++ b/htroot/Supporter.java
@@ -133,31 +133,31 @@ public class Supporter {
refid = row.getColString(3, null);
voted = (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null) ||
(yacyCore.newsPool.getSpecific(yacyNewsPool.PUBLISHED_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null);
- prop.put("supporter_results_" + i + "_authorized", (authenticated) ? 1 : 0);
- prop.put("supporter_results_" + i + "_authorized_recommend", (voted) ? 0 : 1);
+ prop.put("supporter_results_" + i + "_authorized", authenticated ? "1" : "0");
+ prop.put("supporter_results_" + i + "_authorized_recommend", voted ? "0" : "1");
prop.put("supporter_results_" + i + "_authorized_recommend_urlhash", urlhash);
prop.put("supporter_results_" + i + "_authorized_recommend_refid", refid);
- prop.putASIS("supporter_results_" + i + "_authorized_recommend_url", crypt.simpleEncode(url, null, 'b'));
- prop.putASIS("supporter_results_" + i + "_authorized_recommend_title", crypt.simpleEncode(title, null, 'b'));
- prop.putASIS("supporter_results_" + i + "_authorized_recommend_description", crypt.simpleEncode(description, null, 'b'));
+ prop.put("supporter_results_" + i + "_authorized_recommend_url", crypt.simpleEncode(url, null, 'b'));
+ prop.putHTML("supporter_results_" + i + "_authorized_recommend_title", crypt.simpleEncode(title, null, 'b'));
+ prop.putHTML("supporter_results_" + i + "_authorized_recommend_description", crypt.simpleEncode(description, null, 'b'));
prop.put("supporter_results_" + i + "_authorized_recommend_display", display);
- prop.put("supporter_results_" + i + "_authorized_recommend_showScore", (showScore ? 1 : 0));
+ prop.put("supporter_results_" + i + "_authorized_recommend_showScore", showScore ? "1" : "0");
prop.put("supporter_results_" + i + "_authorized_urlhash", urlhash);
- prop.put("supporter_results_" + i + "_url", de.anomic.data.htmlTools.encodeUnicode2html(url, false));
+ prop.put("supporter_results_" + i + "_url", url);
prop.put("supporter_results_" + i + "_urlname", nxTools.shortenURLString(url, 60));
prop.put("supporter_results_" + i + "_urlhash", urlhash);
- prop.put("supporter_results_" + i + "_title", (showScore) ? ("(" + ranking.getScore(urlhash) + ") " + title) : title);
- prop.put("supporter_results_" + i + "_description", description);
+ prop.putHTML("supporter_results_" + i + "_title", (showScore) ? ("(" + ranking.getScore(urlhash) + ") " + title) : title);
+ prop.putHTML("supporter_results_" + i + "_description", description);
i++;
if (i >= 50) break;
}
prop.put("supporter_results", i);
- prop.put("supporter", 1);
+ prop.put("supporter", "1");
} else {
- prop.put("supporter", 0);
+ prop.put("supporter", "0");
}
return prop;
@@ -268,10 +268,6 @@ public class Supporter {
Supporter.put(urlhash, entry);
}
}
-
}
-
}
-
-
}
diff --git a/htroot/Surftips.java b/htroot/Surftips.java
index 00c47aeea..6a1b12509 100644
--- a/htroot/Surftips.java
+++ b/htroot/Surftips.java
@@ -142,31 +142,31 @@ public class Surftips {
refid = row.getColString(3, null);
voted = (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null) ||
(yacyCore.newsPool.getSpecific(yacyNewsPool.PUBLISHED_DB, yacyNewsPool.CATEGORY_SURFTIPP_VOTE_ADD, "refid", refid) != null);
- prop.put("surftips_results_" + i + "_authorized", (authenticated) ? 1 : 0);
- prop.put("surftips_results_" + i + "_authorized_recommend", (voted) ? 0 : 1);
+ prop.put("surftips_results_" + i + "_authorized", (authenticated) ? "1" : "0");
+ prop.put("surftips_results_" + i + "_authorized_recommend", (voted) ? "0" : "1");
prop.put("surftips_results_" + i + "_authorized_recommend_urlhash", urlhash);
prop.put("surftips_results_" + i + "_authorized_recommend_refid", refid);
- prop.putASIS("surftips_results_" + i + "_authorized_recommend_url", crypt.simpleEncode(url, null, 'b'));
- prop.putASIS("surftips_results_" + i + "_authorized_recommend_title", crypt.simpleEncode(title, null, 'b'));
- prop.putASIS("surftips_results_" + i + "_authorized_recommend_description", crypt.simpleEncode(description, null, 'b'));
+ prop.put("surftips_results_" + i + "_authorized_recommend_url", crypt.simpleEncode(url, null, 'b'));
+ prop.put("surftips_results_" + i + "_authorized_recommend_title", crypt.simpleEncode(title, null, 'b'));
+ prop.put("surftips_results_" + i + "_authorized_recommend_description", crypt.simpleEncode(description, null, 'b'));
prop.put("surftips_results_" + i + "_authorized_recommend_display", display);
- prop.put("surftips_results_" + i + "_authorized_recommend_showScore", (showScore ? 1 : 0));
+ prop.put("surftips_results_" + i + "_authorized_recommend_showScore", (showScore ? "1" : "0"));
prop.put("surftips_results_" + i + "_authorized_urlhash", urlhash);
- prop.put("surftips_results_" + i + "_url", de.anomic.data.htmlTools.encodeUnicode2html(url, false));
+ prop.put("surftips_results_" + i + "_url", url);
prop.put("surftips_results_" + i + "_urlname", nxTools.shortenURLString(url, 60));
prop.put("surftips_results_" + i + "_urlhash", urlhash);
- prop.put("surftips_results_" + i + "_title", (showScore) ? ("(" + ranking.getScore(urlhash) + ") " + title) : title);
- prop.put("surftips_results_" + i + "_description", description);
+ prop.putHTML("surftips_results_" + i + "_title", (showScore) ? ("(" + ranking.getScore(urlhash) + ") " + title) : title);
+ prop.putHTML("surftips_results_" + i + "_description", description);
i++;
if (i >= 50) break;
}
prop.put("surftips_results", i);
- prop.put("surftips", 1);
+ prop.put("surftips", "1");
} else {
- prop.put("surftips", 0);
+ prop.put("surftips", "0");
}
return prop;
@@ -330,10 +330,6 @@ public class Surftips {
surftips.put(urlhash, entry);
}
}
-
}
-
}
-
-
}
diff --git a/htroot/TestApplet.java b/htroot/TestApplet.java
index afa43fd91..d56babe3b 100644
--- a/htroot/TestApplet.java
+++ b/htroot/TestApplet.java
@@ -42,7 +42,7 @@ public class TestApplet {
for(int i=0;i<lines.length;i++){
pair=lines[i].split("=");
if(pair.length==2){
- args.put(pair[0], pair[1]);
+ args.putHTML(pair[0], pair[1]);
}
}
diff --git a/htroot/User.java b/htroot/User.java
index eb9af874a..e96b88dad 100644
--- a/htroot/User.java
+++ b/htroot/User.java
@@ -66,32 +66,32 @@ public class User{
userDB.Entry entry=null;
//default values
- prop.put("logged_in", 0);
- prop.put("logged-in_limit", 0);
- prop.put("status", 0);
+ prop.put("logged_in", "0");
+ prop.put("logged-in_limit", "0");
+ prop.put("status", "0");
//identified via HTTPPassword
entry=sb.userDB.proxyAuth(((String) header.get(httpHeader.AUTHORIZATION, "xxxxxx")));
if(entry != null){
- prop.put("logged-in_identified-by", 1);
+ prop.put("logged-in_identified-by", "1");
//try via cookie
}else{
entry=sb.userDB.cookieAuth(header.getHeaderCookies());
- prop.put("logged-in_identified-by", 2);
+ prop.put("logged-in_identified-by", "2");
//try via ip
if(entry == null){
entry=sb.userDB.ipAuth(((String)header.get("CLIENTIP", "xxxxxx")));
if(entry != null){
- prop.put("logged-in_identified-by", 0);
+ prop.put("logged-in_identified-by", "0");
}
}
}
//identified via userDB
if(entry != null){
- prop.put("logged-in", 1);
+ prop.put("logged-in", "1");
prop.put("logged-in_username", entry.getUserName());
if(entry.getTimeLimit() > 0){
- prop.put("logged-in_limit", 1);
+ prop.put("logged-in_limit", "1");
long limit=entry.getTimeLimit();
long used=entry.getTimeUsed();
prop.put("logged-in_limit_timelimit", limit);
@@ -104,7 +104,7 @@ public class User{
}
//logged in via static Password
}else if(sb.verifyAuthentication(header, true)){
- prop.put("logged-in", 2);
+ prop.put("logged-in", "2");
//identified via form-login
//TODO: this does not work for a static admin, yet.
}else if(post != null && post.containsKey("username") && post.containsKey("password")){
@@ -130,8 +130,8 @@ public class User{
outgoingHeader.setCookie("login", cookie);
prop.setOutgoingHeader(outgoingHeader);
- prop.put("logged-in", 1);
- prop.put("logged-in_identified-by", 1);
+ prop.put("logged-in", "1");
+ prop.put("logged-in_identified-by", "1");
prop.put("logged-in_username", username);
if(post.containsKey("returnto")){
prop.put("LOCATION", (String)post.get("returnto"));
@@ -141,27 +141,27 @@ public class User{
if(post!= null && entry != null){
if(post.containsKey("changepass")){
- prop.put("status", 1); //password
+ prop.put("status", "1"); //password
if(entry.getMD5EncodedUserPwd().equals(serverCodings.encodeMD5Hex(entry.getUserName()+":"+post.get("oldpass", "")))){
if(post.get("newpass").equals(post.get("newpass2"))){
if(!post.get("newpass", "").equals("")){
try {
entry.setProperty(userDB.Entry.MD5ENCODED_USERPWD_STRING, serverCodings.encodeMD5Hex(entry.getUserName()+":"+post.get("newpass", "")));
- prop.put("status_password", 0); //changes
+ prop.put("status_password", "0"); //changes
} catch (IOException e) {}
}else{
- prop.put("status_password", 3); //empty
+ prop.put("status_password", "3"); //empty
}
}else{
- prop.put("status_password", 2); //pws do not match
+ prop.put("status_password", "2"); //pws do not match
}
}else{
- prop.put("status_password", 1); //old pw wrong
+ prop.put("status_password", "1"); //old pw wrong
}
}
}
if(post!=null && post.containsKey("logout")){
- prop.put("logged-in",0);
+ prop.put("logged-in", "0");
if(entry != null){
entry.logout(((String)header.get("CLIENTIP", "xxxxxx")), userDB.getLoginToken(header.getHeaderCookies())); //todo: logout cookie
}else{
diff --git a/htroot/User_p.java b/htroot/User_p.java
index 0cf854146..d392ff148 100644
--- a/htroot/User_p.java
+++ b/htroot/User_p.java
@@ -78,54 +78,54 @@ public class User_p {
for(i=0;i<rights.length;i++){
prop.put("rights_"+i+"_name", rights[i]);
prop.put("rights_"+i+"_friendlyName", rightNames[i]);
- prop.put("rights_"+i+"_set", 0);
+ prop.put("rights_"+i+"_set", "0");
}
prop.put("rights", i);
- prop.put("users", 0);
+ prop.put("users", "0");
if(sb.userDB == null)
return prop;
if(post == null){
- //do nothing
-
- //user != current_user
- //user=from userlist
- //current_user = edited user
- } else if(post.containsKey("user") && !((String)post.get("user")).equals("newuser")){
- if(post.containsKey("change_user")){
- //defaults for newuser are set above
- entry=sb.userDB.getEntry((String)post.get("user"));
- // program crashes if a submit with emty username was made on previous mask and the user clicked on the
- // link: "If you want to manage more Users, return to the user page." (parameter "user" is empty)
+ //do nothing
+
+ //user != current_user
+ //user=from userlist
+ //current_user = edited user
+ } else if(post.containsKey("user") && !((String)post.get("user")).equals("newuser")){
+ if(post.containsKey("change_user")){
+ //defaults for newuser are set above
+ entry=sb.userDB.getEntry((String)post.get("user"));
+ // program crashes if a submit with emty username was made on previous mask and the user clicked on the
+ // link: "If you want to manage more Users, return to the user page." (parameter "user" is empty)
if (entry != null) {
- //TODO: set username read-only in html
+ //TODO: set username read-only in html
prop.put("current_user", post.get("user"));
- prop.put("username", post.get("user"));
- prop.put("firstname", entry.getFirstName());
- prop.put("lastname", entry.getLastName());
- prop.put("address", entry.getAddress());
- prop.put("timelimit", entry.getTimeLimit());
- prop.put("timeused", entry.getTimeUsed());
- for(i=0;i<rights.length;i++){
- prop.put("rights_"+i+"_set", (entry.hasRight(rights[i])?1:0));
- }
- prop.put("rights", i);
+ prop.put("username", post.get("user"));
+ prop.putHTML("firstname", entry.getFirstName());
+ prop.putHTML("lastname", entry.getLastName());
+ prop.putHTML("address", entry.getAddress());
+ prop.put("timelimit", entry.getTimeLimit());
+ prop.put("timeused", entry.getTimeUsed());
+ for(i=0;i<rights.length;i++){
+ prop.put("rights_"+i+"_set", entry.hasRight(rights[i]) ? "1" : "0");
+ }
+ prop.put("rights", i);
}
- }else if( post.containsKey("delete_user") && !((String)post.get("user")).equals("newuser") ){
- sb.userDB.removeEntry((String)post.get("user"));
- }
+ }else if( post.containsKey("delete_user") && !((String)post.get("user")).equals("newuser") ){
+ sb.userDB.removeEntry((String)post.get("user"));
+ }
} else if(post.containsKey("change")) { //New User / edit User
- prop.put("text", 0);
- prop.put("error", 0);
+ prop.put("text", "0");
+ prop.put("error", "0");
String username=(String)post.get("username");
String pw=(String)post.get("password");
String pw2=(String)post.get("password2");
if(! pw.equals(pw2)){
- prop.put("error", 2); //PW does not match
+ prop.put("error", "2"); //PW does not match
return prop;
}
String firstName=(String)post.get("firstname");
@@ -154,10 +154,10 @@ public class User_p {
try{
entry=sb.userDB.createEntry(username, mem);
sb.userDB.addEntry(entry);
- prop.put("text_username", username);
- prop.put("text", 1);
+ prop.putHTML("text_username", username);
+ prop.put("text", "1");
}catch(IllegalArgumentException e){
- prop.put("error", 3);
+ prop.put("error", "3");
}
@@ -179,12 +179,12 @@ public class User_p {
}catch (IOException e){
}
}else{
- prop.put("error", 1);
+ prop.put("error", "1");
}
- prop.put("text_username", username);
- prop.put("text", 2);
+ prop.putHTML("text_username", username);
+ prop.put("text", "2");
}//edit user
- prop.put("username", username);
+ prop.putHTML("username", username);
}
//Generate Userlist
@@ -192,7 +192,7 @@ public class User_p {
int numUsers=0;
while(it.hasNext()){
entry = (userDB.Entry)it.next();
- prop.put("users_"+numUsers+"_user", entry.getUserName());
+ prop.putHTML("users_"+numUsers+"_user", entry.getUserName());
numUsers++;
}
prop.put("users", numUsers);
diff --git a/htroot/ViewFile.html b/htroot/ViewFile.html
index 6db33bec0..76e30e53c 100644
--- a/htroot/ViewFile.html
+++ b/htroot/ViewFile.html
@@ -16,7 +16,7 @@
<dt>Hash:</dt> <dd>#[hash]#</dd>
<dt>Word Count:</dt> <dd>#[wordCount]#</dd>
<dt>Description:</dt><dd>#[desc]#</dd>
- <dt>Size:</dt> <dd>#[size]#</dd>#(mimeTypeAvailable)#::
+ <dt>Size:</dt> <dd>#[size]# Bytes</dd>#(mimeTypeAvailable)#::
<dt>MimeType:</dt> <dd>#[mimeType]#</dd>#(/mimeTypeAvailable)#
<dt><label for="viewMode">View as</label>:</dt>
<dd>
diff --git a/htroot/ViewFile.java b/htroot/ViewFile.java
index 9182df837..1f3c6a262 100644
--- a/htroot/ViewFile.java
+++ b/htroot/ViewFile.java
@@ -89,15 +89,15 @@ public class ViewFile {
plasmaSwitchboard sb = (plasmaSwitchboard)env;
if (post != null && post.containsKey("words"))
- prop.put("error_words", (String)post.get("words"));
+ prop.putHTML("error_words", (String)post.get("words"));
else {
- prop.put("error", 1);
- prop.put("viewmode", 0);
+ prop.put("error", "1");
+ prop.put("viewmode", "0");
return prop;
}
String viewMode = post.get("viewMode","sentences");
- prop.put("error_vMode-" + viewMode, 1);
+ prop.put("error_vMode-" + viewMode, "1");
yacyURL url = null;
String descr = "";
@@ -106,13 +106,13 @@ public class ViewFile {
boolean pre = false;
// getting the url hash from which the content should be loaded
- String urlHash = post.get("urlHash","");
+ String urlHash = post.get("urlHash","");
if (urlHash.length() > 0) {
// getting the urlEntry that belongs to the url hash
indexURLEntry urlEntry = null;
urlEntry = sb.wordIndex.loadedURL.load(urlHash, null);
if (urlEntry == null) {
- prop.put("error",2);
+ prop.put("error", "2");
prop.put("viewMode",VIEW_MODE_NO_TEXT);
return prop;
}
@@ -120,7 +120,7 @@ public class ViewFile {
// gettin the url that belongs to the entry
indexURLEntry.Components comp = urlEntry.comp();
if ((comp == null) || (comp.url() == null)) {
- prop.put("error", 3);
+ prop.put("error", "3");
prop.put("viewMode", VIEW_MODE_NO_TEXT);
return prop;
}
@@ -150,7 +150,7 @@ public class ViewFile {
if (url == null) {
- prop.put("error", 1);
+ prop.put("error", "1");
prop.put("viewMode", VIEW_MODE_NO_TEXT);
return prop;
}
@@ -171,8 +171,8 @@ public class ViewFile {
try {
entry = plasmaSnippetCache.loadResourceFromWeb(url, 5000, false, true);
} catch (plasmaCrawlerException e) {
- prop.put("error", 4);
- prop.put("error_errorText", e.getMessage());
+ prop.put("error", "4");
+ prop.putHTML("error_errorText", e.getMessage());
prop.put("viewMode", VIEW_MODE_NO_TEXT);
return prop;
}
@@ -184,7 +184,7 @@ public class ViewFile {
}
if (resource == null) {
- prop.put("error", 4);
+ prop.put("error", "4");
prop.put("error_errorText", "No resource available");
prop.put("viewMode", VIEW_MODE_NO_TEXT);
return prop;
@@ -205,14 +205,14 @@ public class ViewFile {
if (resInfo == null) {
String protocol = url.getProtocol();
if (!((protocol.equals("http") || protocol.equals("https")))) {
- prop.put("error", 6);
+ prop.put("error", "6");
prop.put("viewMode", VIEW_MODE_NO_TEXT);
return prop;
}
httpHeader responseHeader = httpc.whead(url, url.getHost(), 5000, null, null, sb.remoteProxyConfig);
if (responseHeader == null) {
- prop.put("error", 4);
+ prop.put("error", "4");
prop.put("error_errorText", "Unable to load resource metadata.");
prop.put("viewMode", VIEW_MODE_NO_TEXT);
return prop;
@@ -220,8 +220,8 @@ public class ViewFile {
try {
resInfo = plasmaHTCache.getResourceInfoFactory().buildResourceInfoObj(url, responseHeader);
} catch (Exception e) {
- prop.put("error", 4);
- prop.put("error_errorText", e.getMessage());
+ prop.put("error", "4");
+ prop.putHTML("error_errorText", e.getMessage());
prop.put("viewMode", VIEW_MODE_NO_TEXT);
return prop;
}
@@ -237,8 +237,8 @@ public class ViewFile {
} catch (Exception ex) {
/* ignore this */
}
- prop.put("error", 4);
- prop.put("error_errorText", e.getMessage());
+ prop.put("error", "4");
+ prop.putHTML("error_errorText", e.getMessage());
prop.put("viewMode", VIEW_MODE_NO_TEXT);
return prop;
}
@@ -250,8 +250,8 @@ public class ViewFile {
try {
content = new String(serverFileUtils.read(resource), "UTF-8");
} catch (Exception e) {
- prop.put("error", 4);
- prop.put("error_errorText", e.getMessage());
+ prop.put("error", "4");
+ prop.putHTML("error_errorText", e.getMessage());
prop.put("viewMode", VIEW_MODE_NO_TEXT);
return prop;
} finally {
@@ -265,9 +265,9 @@ public class ViewFile {
content = content.replaceAll("\n", "<br />").replaceAll("\t", "&nbsp;&nbsp;&nbsp;&nbsp;");
- prop.put("error", 0);
+ prop.put("error", "0");
prop.put("viewMode", VIEW_MODE_AS_PLAIN_TEXT);
- prop.put("viewMode_plainText", content);
+ prop.putHTML("viewMode_plainText", content);
} else if (viewMode.equals("iframe")) {
prop.put("viewMode", VIEW_MODE_AS_IFRAME);
@@ -279,14 +279,14 @@ public class ViewFile {
try {
document = plasmaSnippetCache.parseDocument(url, resourceLength, resource, resInfo);
if (document == null) {
- prop.put("error", 5);
+ prop.put("error", "5");
prop.put("error_errorText", "Unknown error");
prop.put("viewMode", VIEW_MODE_NO_TEXT);
return prop;
}
} catch (ParserException e) {
- prop.put("error", 5);
- prop.put("error_errorText", e.getMessage());
+ prop.put("error", "5");
+ prop.putHTML("error_errorText", e.getMessage());
prop.put("viewMode", VIEW_MODE_NO_TEXT);
return prop;
} finally {
@@ -307,7 +307,7 @@ public class ViewFile {
content = content.replaceAll("\n", "<br />").replaceAll("\t", "&nbsp;&nbsp;&nbsp;&nbsp;");
prop.put("viewMode", VIEW_MODE_AS_PARSED_TEXT);
- prop.putASIS("viewMode_parsedText", markup(wordArray, content));
+ prop.put("viewMode_parsedText", markup(wordArray, content));
} else if (viewMode.equals("sentences")) {
prop.put("viewMode", VIEW_MODE_AS_PARSED_SENTENCES);
@@ -322,9 +322,9 @@ public class ViewFile {
while (sentences.hasNext()) {
sentence = ((StringBuffer) sentences.next()).toString();
if (sentence.trim().length() > 0) {
- prop.put("viewMode_sentences_" + i + "_nr", Integer.toString(i + 1));
- prop.putASIS("viewMode_sentences_" + i + "_text", markup(wordArray, sentence));
- prop.put("viewMode_sentences_" + i + "_dark", ((dark) ? 1 : 0));
+ prop.put("viewMode_sentences_" + i + "_nr", i + 1);
+ prop.put("viewMode_sentences_" + i + "_text", markup(wordArray, sentence));
+ prop.put("viewMode_sentences_" + i + "_dark", dark ? "1" : "0");
dark = !dark;
i++;
}
@@ -346,13 +346,13 @@ public class ViewFile {
while (tsi.hasNext()) {
entry = (htmlFilterImageEntry) tsi.next();
prop.put("viewMode_links_" + i + "_nr", i);
- prop.put("viewMode_links_" + i + "_dark", ((dark) ? 1 : 0));
+ prop.put("viewMode_links_" + i + "_dark", dark ? "1" : "0");
prop.put("viewMode_links_" + i + "_type", "image");
- prop.putASIS("viewMode_links_" + i + "_text", markup(wordArray, entry.alt()));
+ prop.put("viewMode_links_" + i + "_text", markup(wordArray, entry.alt()));
prop.put("viewMode_links_" + i + "_url", entry.url().toNormalform(false, true));
- prop.putASIS("viewMode_links_" + i + "_link", markup(wordArray, entry.url().toNormalform(false, true)));
+ prop.put("viewMode_links_" + i + "_link", markup(wordArray, entry.url().toNormalform(false, true)));
if (entry.width() > 0 && entry.height() > 0)
- prop.putASIS("viewMode_links_" + i + "_attr", entry.width() + "x" + entry.height() + " Pixel");
+ prop.put("viewMode_links_" + i + "_attr", entry.width() + "x" + entry.height() + " Pixel");
else
prop.put("viewMode_links_" + i + "_attr", "unknown");
dark = !dark;
@@ -365,13 +365,13 @@ public class ViewFile {
}
if (document != null) document.close();
}
- prop.put("error", 0);
+ prop.put("error", "0");
prop.put("error_url", url.toNormalform(false, true));
prop.put("error_hash", urlHash);
- prop.put("error_wordCount", Integer.toString(wordCount));
- prop.put("error_desc", descr);
- prop.put("error_size", size);
- prop.put("error_mimeTypeAvailable", (resMime == null) ? 0 : 1);
+ prop.put("error_wordCount", wordCount);
+ prop.putHTML("error_desc", descr);
+ prop.putNum("error_size", size);
+ prop.put("error_mimeTypeAvailable", (resMime == null) ? "0" : "1");
prop.put("error_mimeTypeAvailable_mimeType", resMime);
return prop;
}
@@ -408,11 +408,11 @@ public class ViewFile {
entry = (Map.Entry) mi.next();
prop.put("viewMode_links_" + c + "_nr", c);
prop.put("viewMode_links_" + c + "_dark", ((dark) ? 1 : 0));
- prop.put("viewMode_links_" + c + "_type", name);
- prop.putASIS("viewMode_links_" + c + "_text", markup(wordArray, (String) entry.getValue()));
- prop.putASIS("viewMode_links_" + c + "_link", markup(wordArray, (String) entry.getKey()));
+ prop.putHTML("viewMode_links_" + c + "_type", name);
+ prop.put("viewMode_links_" + c + "_text", markup(wordArray, (String) entry.getValue()));
+ prop.put("viewMode_links_" + c + "_link", markup(wordArray, (String) entry.getKey()));
prop.put("viewMode_links_" + c + "_url", entry.getKey());
- prop.put("viewMode_links_" + c + "_attr", "");
+ prop.putHTML("viewMode_links_" + c + "_attr", "");
dark = !dark;
c++;
i++;
diff --git a/htroot/ViewImage.java b/htroot/ViewImage.java
index c898ee77f..d3cc0aab8 100644
--- a/htroot/ViewImage.java
+++ b/htroot/ViewImage.java
@@ -64,7 +64,7 @@ public class ViewImage {
public static Image respond(httpHeader header, serverObjects post, serverSwitch env) {
- plasmaSwitchboard sb = (plasmaSwitchboard)env;
+ plasmaSwitchboard sb = (plasmaSwitchboard)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
diff --git a/htroot/ViewLog_p.java b/htroot/ViewLog_p.java
index 7da3632e0..5d32ecfd0 100644
--- a/htroot/ViewLog_p.java
+++ b/htroot/ViewLog_p.java
@@ -93,8 +93,8 @@ public class ViewLog_p {
}
}
- prop.put("submenu", (displaySubmenu) ? 1 : 0);
- prop.put("reverseChecked", reversed ? 1 : 0);
+ prop.put("submenu", displaySubmenu ? "1" : "0");
+ prop.put("reverseChecked", reversed ? "1" : "0");
prop.put("lines", lines);
prop.put("maxlines",maxlines);
prop.put("filter", filter);
@@ -125,14 +125,13 @@ public class ViewLog_p {
else if (nextLogLine.startsWith("I ")) level = 1;
else if (nextLogLine.startsWith("D ")) level = 0;
- prop.put("log_" + lc + "_level",level);
- prop.put("log_" + lc + "_line", nextLogLine);
+ prop.put("log_" + lc + "_level", level);
+ prop.putHTML("log_" + lc + "_line", nextLogLine);
lc++;
}
- prop.put("log",lc);
+ prop.put("log", lc);
// return rewrite properties
return prop;
}
-
}
diff --git a/htroot/ViewProfile.java b/htroot/ViewProfile.java
index dbcf6d023..ce78a56e1 100644
--- a/htroot/ViewProfile.java
+++ b/htroot/ViewProfile.java
@@ -68,8 +68,8 @@ import de.anomic.yacy.yacySeed;
public class ViewProfile {
- public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
- // listManager.switchboard = (plasmaSwitchboard) env;
+ public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
+ // listManager.switchboard = (plasmaSwitchboard) env;
serverObjects prop = new serverObjects();
plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
boolean authenticated = switchboard.adminAuthenticated(header) >= 2;
@@ -79,10 +79,10 @@ public class ViewProfile {
if ((hash == null) || (yacyCore.seedDB == null)) {
// wrong access
- prop.put("success","0");
+ prop.put("success", "0");
return prop;
}
- prop.put("hash",hash);
+ prop.put("hash", hash);
// get the profile
HashMap profile = null;
@@ -100,8 +100,8 @@ public class ViewProfile {
profile = new HashMap();
profile.putAll(p);
prop.put("success", "3"); // everything ok
- prop.put("localremotepeer", 0);
- prop.put("success_peername", yacyCore.seedDB.mySeed().getName());
+ prop.put("localremotepeer", "0");
+ prop.putHTML("success_peername", yacyCore.seedDB.mySeed().getName());
prop.put("success_peerhash", yacyCore.seedDB.mySeed().hash);
address = yacyCore.seedDB.mySeed().getPublicAddress();
} else {
@@ -128,11 +128,11 @@ public class ViewProfile {
yacyCore.log.logInfo("fetched profile:" + profile);
prop.put("success", "3"); // everything ok
}
- prop.put("success_peername", seed.getName());
+ prop.putHTML("success_peername", seed.getName());
prop.put("success_peerhash", seed.hash);
address = seed.getPublicAddress();
}
- prop.put("localremotepeer", 1);
+ prop.put("localremotepeer", "1");
}
Iterator i;
if (profile != null) {
@@ -157,7 +157,7 @@ public class ViewProfile {
//empty values
Iterator it = knownKeys.iterator();
while (it.hasNext()) {
- prop.put("success_" + (String) it.next(), 0);
+ prop.put("success_" + (String) it.next(), "0");
}
//number of not explicitly recognized but displayed items
@@ -168,38 +168,38 @@ public class ViewProfile {
String value = new String();
// this prevents broken links ending in <br>
- value=((String) entry.getValue()).replaceAll("\r", "").replaceAll("\\\\n", "\n");
+ value=((String) entry.getValue()).replaceAll("\r", "").replaceAll("\\\\n", "\n");
//all known Keys which should be set as they are
if (knownKeys.contains(key)) {
- if (value.length() > 0) {
- prop.put("success_" + key, 1);
- // only comments get "wikified"
- if(key.equals("comment")){
- prop.putWiki(
- "success_" + key + "_value",
- ((String) entry.getValue()).replaceAll("\r", "").replaceAll("\\\\n", "\n"),
- address
- );
- prop.putASIS("success_" + key + "_b64value",kelondroBase64Order.standardCoder.encodeString((String) entry.getValue()));
- }else{
- prop.put("success_" + key + "_value", value); //put replaces HTML Chars by entities.
- }
- }
- //special handling, hide flower if no icq uin is set
+ if (value.length() > 0) {
+ prop.put("success_" + key, "1");
+ // only comments get "wikified"
+ if(key.equals("comment")){
+ prop.putWiki(
+ "success_" + key + "_value",
+ ((String) entry.getValue()).replaceAll("\r", "").replaceAll("\\\\n", "\n"),
+ address
+ );
+ prop.put("success_" + key + "_b64value",kelondroBase64Order.standardCoder.encodeString((String) entry.getValue()));
+ }else{
+ prop.putHTML("success_" + key + "_value", value); //put replaces HTML Chars by entities.
+ }
+ }
+ //special handling, hide flower if no icq uin is set
} else if (key.equals("homepage")) {
- if (value.length() > 0) {
- if (!(value.startsWith("http"))) {
- value = "http://" + value;
- }
- prop.put("success_" + key, 1);
- prop.put("success_" + key + "_value", value);
- }
+ if (value.length() > 0) {
+ if (!(value.startsWith("http"))) {
+ value = "http://" + value;
+ }
+ prop.put("success_" + key, "1");
+ prop.putHTML("success_" + key + "_value", value);
+ }
//This will display unknown items(of newer versions) as plaintext
} else {
//unknown
prop.put("success_other_" + numUnknown + "_key", key);
- prop.put("success_other_" + numUnknown + "_value", value);
+ prop.putHTML("success_other_" + numUnknown + "_value", value);
numUnknown++;
}
}
@@ -207,5 +207,4 @@ public class ViewProfile {
return prop;
}
-
}
diff --git a/htroot/WatchCrawler_p.java b/htroot/WatchCrawler_p.java
index 3fc7043b5..b186b3535 100644
--- a/htroot/WatchCrawler_p.java
+++ b/htroot/WatchCrawler_p.java
@@ -63,16 +63,16 @@ public class WatchCrawler_p {
// return variable that accumulates replacements
plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
serverObjects prop = new serverObjects();
- prop.put("forwardToCrawlStart", 0);
+ prop.put("forwardToCrawlStart", "0");
if (post == null) {
// not a crawl start, only monitoring
- prop.put("info", 0);
+ prop.put("info", "0");
} else {
- prop.put("info", 0);
+ prop.put("info", "0");
if ((post.containsKey("autoforward")) && (switchboard.coreCrawlJobSize() == 0)) {
- prop.put("forwardToCrawlStart", 1);
+ prop.put("forwardToCrawlStart", "1");
}
if (post.containsKey("continue")) {
@@ -98,7 +98,7 @@ public class WatchCrawler_p {
if (post.containsKey("crawlingstart")) {
// init crawl
if (yacyCore.seedDB == null) {
- prop.put("info", 3);
+ prop.put("info", "3");
} else {
// set new properties
boolean fullDomain = post.get("range", "wide").equals("domain"); // special property in simple crawl start
@@ -170,9 +170,9 @@ public class WatchCrawler_p {
// check if pattern matches
if ((crawlingStart == null) /* || (!(crawlingStart.matches(newcrawlingfilter))) */) {
// print error message
- prop.put("info", 4); //crawlfilter does not match url
- prop.put("info_newcrawlingfilter", newcrawlingfilter);
- prop.put("info_crawlingStart", crawlingStart);
+ prop.put("info", "4"); //crawlfilter does not match url
+ prop.putHTML("info_newcrawlingfilter", newcrawlingfilter);
+ prop.putHTML("info_crawlingStart", crawlingStart);
} else try {
// check if the crawl filter works correctly
@@ -198,8 +198,8 @@ public class WatchCrawler_p {
if (reasonString == null) {
// liftoff!
- prop.put("info", 8);//start msg
- prop.put("info_crawlingURL", ((String) post.get("crawlingURL")));
+ prop.put("info", "8");//start msg
+ prop.putHTML("info_crawlingURL", ((String) post.get("crawlingURL")));
// generate a YaCyNews if the global flag was set
if (crawlOrder) {
@@ -220,33 +220,33 @@ public class WatchCrawler_p {
}
} else {
- prop.put("info", 5); //Crawling failed
- prop.put("info_crawlingURL", ((String) post.get("crawlingURL")));
- prop.put("info_reasonString", reasonString);
+ prop.put("info", "5"); //Crawling failed
+ prop.putHTML("info_crawlingURL", ((String) post.get("crawlingURL")));
+ prop.putHTML("info_reasonString", reasonString);
plasmaCrawlZURL.Entry ee = switchboard.errorURL.newEntry(crawlingStartURL, reasonString);
ee.store();
switchboard.errorURL.stackPushEntry(ee);
}
} catch (PatternSyntaxException e) {
- prop.put("info", 4); //crawlfilter does not match url
- prop.put("info_newcrawlingfilter", newcrawlingfilter);
- prop.put("info_error", e.getMessage());
+ prop.put("info", "4"); //crawlfilter does not match url
+ prop.putHTML("info_newcrawlingfilter", newcrawlingfilter);
+ prop.putHTML("info_error", e.getMessage());
} catch (Exception e) {
// mist
- prop.put("info", 6);//Error with url
- prop.put("info_crawlingStart", crawlingStart);
- prop.put("info_error", e.getMessage());
+ prop.put("info", "6");//Error with url
+ prop.putHTML("info_crawlingStart", crawlingStart);
+ prop.putHTML("info_error", e.getMessage());
e.printStackTrace();
- }
+ }
- } else if (crawlingMode.equals(CRAWLING_MODE_FILE)) {
+ } else if (crawlingMode.equals(CRAWLING_MODE_FILE)) {
if (post.containsKey("crawlingFile")) {
// getting the name of the uploaded file
String fileName = (String) post.get("crawlingFile");
- try {
+ try {
// check if the crawl filter works correctly
- Pattern.compile(newcrawlingfilter);
+ Pattern.compile(newcrawlingfilter);
// loading the file content
File file = new File(fileName);
@@ -285,7 +285,7 @@ public class WatchCrawler_p {
nexturlstring = nexturlstring.trim();
// normalizing URL
- nexturlstring = new yacyURL(nexturlstring, null).toNormalform(true, true);
+ nexturlstring = new yacyURL(nexturlstring, null).toNormalform(true, true);
// generating an url object
yacyURL nexturlURL = null;
@@ -294,7 +294,7 @@ public class WatchCrawler_p {
} catch (MalformedURLException ex) {
nexturlURL = null;
continue;
- }
+ }
// enqueuing the url for crawling
switchboard.sbStackCrawlThread.enqueue(
@@ -306,19 +306,19 @@ public class WatchCrawler_p {
0,
profile,
true);
- }
+ }
} catch (PatternSyntaxException e) {
// print error message
- prop.put("info", 4); //crawlfilter does not match url
- prop.put("info_newcrawlingfilter", newcrawlingfilter);
- prop.put("info_error", e.getMessage());
+ prop.put("info", "4"); //crawlfilter does not match url
+ prop.putHTML("info_newcrawlingfilter", newcrawlingfilter);
+ prop.putHTML("info_error", e.getMessage());
} catch (Exception e) {
// mist
- prop.put("info", 7);//Error with file
- prop.put("info_crawlingStart", fileName);
- prop.put("info_error", e.getMessage());
- e.printStackTrace();
+ prop.put("info", "7");//Error with file
+ prop.putHTML("info_crawlingStart", fileName);
+ prop.putHTML("info_error", e.getMessage());
+ e.printStackTrace();
}
switchboard.continueCrawlJob(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL);
}
@@ -338,7 +338,7 @@ public class WatchCrawler_p {
indexText, indexMedia,
storeHTCache, true, crawlOrder, xsstopw, xdstopw, xpstopw);
- // create a new sitemap importer
+ // create a new sitemap importer
dbImporter importerThread = switchboard.dbImportManager.getNewImporter("sitemap");
if (importerThread != null) {
HashMap initParams = new HashMap();
@@ -346,14 +346,14 @@ public class WatchCrawler_p {
initParams.put("crawlingProfile",pe.handle());
importerThread.init(initParams);
- importerThread.startIt();
- }
+ importerThread.startIt();
+ }
} catch (Exception e) {
// mist
- prop.put("info", 6);//Error with url
- prop.put("info_crawlingStart", sitemapURLStr);
- prop.put("info_error", e.getMessage());
- e.printStackTrace();
+ prop.put("info", "6");//Error with url
+ prop.putHTML("info_crawlingStart", sitemapURLStr);
+ prop.putHTML("info_error", e.getMessage());
+ e.printStackTrace();
}
}
}
@@ -367,9 +367,9 @@ public class WatchCrawler_p {
// performance settings
long LCbusySleep = Integer.parseInt(env.getConfig(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL_BUSYSLEEP, "100"));
int LCppm = (int) (60000L / Math.max(1,LCbusySleep));
- prop.put("crawlingSpeedMaxChecked", (LCppm >= 1000) ? 1 : 0);
- prop.put("crawlingSpeedCustChecked", ((LCppm > 10) && (LCppm < 1000)) ? 1 : 0);
- prop.put("crawlingSpeedMinChecked", (LCppm <= 10) ? 1 : 0);
+ prop.put("crawlingSpeedMaxChecked", (LCppm >= 1000) ? "1" : "0");
+ prop.put("crawlingSpeedCustChecked", ((LCppm > 10) && (LCppm < 1000)) ? "1" : "0");
+ prop.put("crawlingSpeedMinChecked", (LCppm <= 10) ? "1" : "0");
prop.put("customPPMdefault", ((LCppm > 10) && (LCppm < 1000)) ? Integer.toString(LCppm) : "");
// return rewrite properties
diff --git a/htroot/Wiki.java b/htroot/Wiki.java
index e75601a0c..f28058028 100644
--- a/htroot/Wiki.java
+++ b/htroot/Wiki.java
@@ -109,8 +109,8 @@ public class Wiki {
access = post.get("access", "admin");
switchboard.setConfig("WikiAccess", access);
}
- if (access.equals("admin")) prop.put("mode_access", 0);
- if (access.equals("all")) prop.put("mode_access", 1);
+ if (access.equals("admin")) prop.put("mode_access", "0");
+ if (access.equals("all")) prop.put("mode_access", "1");
wikiBoard.entry page = switchboard.wikiDB.read(pagename);
@@ -150,28 +150,28 @@ public class Wiki {
// edit the page
try {
- prop.put("mode", 1); //edit
- prop.put("mode_author", author);
- prop.put("mode_page-code", new String(page.page(), "UTF-8"));
- prop.put("mode_pagename", pagename);
+ prop.put("mode", "1"); //edit
+ prop.putHTML("mode_author", author);
+ prop.putHTML("mode_page-code", new String(page.page(), "UTF-8"));
+ prop.putHTML("mode_pagename", pagename);
} catch (UnsupportedEncodingException e) {}
}
//contributed by [MN]
else if (post.containsKey("preview")) {
// preview the page
- prop.put("mode", 2);//preview
- prop.put("mode_pagename", pagename);
- prop.put("mode_author", author);
+ prop.put("mode", "2");//preview
+ prop.putHTML("mode_pagename", pagename);
+ prop.putHTML("mode_author", author);
prop.put("mode_date", dateString(new Date()));
prop.putWiki("mode_page", post.get("content", ""));
- prop.put("mode_page-code", post.get("content", ""));
+ prop.putHTML("mode_page-code", post.get("content", ""));
}
//end contrib of [MN]
else if (post.containsKey("index")) {
// view an index
- prop.put("mode", 3); //Index
+ prop.put("mode", "3"); //Index
String subject;
try {
Iterator i = switchboard.wikiDB.keys(true);
@@ -180,25 +180,25 @@ public class Wiki {
while (i.hasNext()) {
subject = (String) i.next();
entry = switchboard.wikiDB.read(subject);
- prop.put("mode_pages_"+count+"_name",wikiBoard.webalize(subject));
- prop.put("mode_pages_"+count+"_subject", subject);
+ prop.putHTML("mode_pages_"+count+"_name",wikiBoard.webalize(subject));
+ prop.putHTML("mode_pages_"+count+"_subject", subject);
prop.put("mode_pages_"+count+"_date", dateString(entry.date()));
- prop.put("mode_pages_"+count+"_author", entry.author());
+ prop.putHTML("mode_pages_"+count+"_author", entry.author());
count++;
}
prop.put("mode_pages", count);
} catch (IOException e) {
- prop.put("mode_error", 1); //IO Error reading Wiki
- prop.put("mode_error_message", e.getMessage());
+ prop.put("mode_error", "1"); //IO Error reading Wiki
+ prop.putHTML("mode_error_message", e.getMessage());
}
- prop.put("mode_pagename", pagename);
+ prop.putHTML("mode_pagename", pagename);
}
else if (post.containsKey("diff")) {
// Diff
- prop.put("mode", 4);
- prop.put("mode_page", pagename);
- prop.put("mode_error_page", pagename);
+ prop.put("mode", "4");
+ prop.putHTML("mode_page", pagename);
+ prop.putHTML("mode_error_page", pagename);
try {
Iterator it = switchboard.wikiDB.keysBkp(true);
@@ -212,11 +212,11 @@ public class Wiki {
prop.put("mode_error_versions_" + count + "_date", wikiBoard.dateString(entry.date()));
prop.put("mode_error_versions_" + count + "_fdate", dateString(entry.date()));
if (wikiBoard.dateString(entry.date()).equals(post.get("old", null))) {
- prop.put("mode_error_versions_" + count + "_oldselected", 1);
+ prop.put("mode_error_versions_" + count + "_oldselected", "1");
oentry = entry;
oldselected = true;
} else if (wikiBoard.dateString(entry.date()).equals(post.get("new", null))) {
- prop.put("mode_error_versions_" + count + "_newselected", 1);
+ prop.put("mode_error_versions_" + count + "_newselected", "1");
nentry = entry;
newselected = true;
}
@@ -225,12 +225,12 @@ public class Wiki {
count--; // don't show current version
if (!oldselected) // select latest old entry
- prop.put("mode_error_versions_" + (count - 1) + "_oldselected", 1);
+ prop.put("mode_error_versions_" + (count - 1) + "_oldselected", "1");
if (!newselected) // select latest new entry (== current)
- prop.put("mode_error_curselected", 1);
+ prop.put("mode_error_curselected", "1");
if (count == 0) {
- prop.put("mode_error", 2); // no entries found
+ prop.put("mode_error", "2"); // no entries found
} else {
prop.put("mode_error_versions", count);
}
@@ -247,37 +247,35 @@ public class Wiki {
diff diff = new diff(
new String(oentry.page(), "UTF-8"),
new String(nentry.page(), "UTF-8"), 3);
- prop.putASIS("mode_versioning_diff", de.anomic.data.diff.toHTML(new diff[] { diff }));
- prop.put("mode_versioning", 1);
+ prop.put("mode_versioning_diff", de.anomic.data.diff.toHTML(new diff[] { diff }));
+ prop.put("mode_versioning", "1");
} else if (post.containsKey("viewold") && oentry != null) {
- prop.put("mode_versioning", 2);
- prop.put("mode_versioning_pagename", pagename);
- prop.put("mode_versioning_author", oentry.author());
+ prop.put("mode_versioning", "2");
+ prop.putHTML("mode_versioning_pagename", pagename);
+ prop.putHTML("mode_versioning_author", oentry.author());
prop.put("mode_versioning_date", dateString(oentry.date()));
prop.putWiki("mode_versioning_page", oentry.page());
- prop.put("mode_versioning_page-code", new String(oentry.page(), "UTF-8"));
+ prop.putHTML("mode_versioning_page-code", new String(oentry.page(), "UTF-8"));
}
} catch (IOException e) {
- prop.put("mode_error", 1); //IO Error reading Wiki
- prop.put("mode_error_message", e.getMessage());
+ prop.put("mode_error", "1"); //IO Error reading Wiki
+ prop.putHTML("mode_error_message", e.getMessage());
}
}
else {
// show page
- prop.put("mode", 0); //viewing
- prop.put("mode_pagename", pagename);
- prop.put("mode_author", page.author());
+ prop.put("mode", "0"); //viewing
+ prop.putHTML("mode_pagename", pagename);
+ prop.putHTML("mode_author", page.author());
prop.put("mode_date", dateString(page.date()));
prop.putWiki("mode_page", page.page());
- prop.put("controls", 0);
- prop.put("controls_pagename", pagename);
+ prop.put("controls", "0");
+ prop.putHTML("controls_pagename", pagename);
}
// return rewrite properties
return prop;
}
-
-
}
diff --git a/htroot/YaCySearchPluginFF.java b/htroot/YaCySearchPluginFF.java
index fac25827d..4564d132e 100644
--- a/htroot/YaCySearchPluginFF.java
+++ b/htroot/YaCySearchPluginFF.java
@@ -71,8 +71,8 @@ public class YaCySearchPluginFF {
}
prop.put("host", host);
- prop.put("port", Integer.toString(port));
- prop.put("name", yacyCore.seedDB.mySeed().getName());
+ prop.put("port", port);
+ prop.putHTML("name", yacyCore.seedDB.mySeed().getName());
return prop;
}
diff --git a/htroot/autoconfig.java b/htroot/autoconfig.java
index f5f645c3e..a5a07eb40 100644
--- a/htroot/autoconfig.java
+++ b/htroot/autoconfig.java
@@ -72,7 +72,7 @@ public class autoconfig {
}
prop.put("host", host);
- prop.put("port", Integer.toString(port));
+ prop.put("port", port);
return prop;
}
diff --git a/htroot/htdocsdefault/dir.java b/htroot/htdocsdefault/dir.java
index 200cd4a18..f334d8e97 100644
--- a/htroot/htdocsdefault/dir.java
+++ b/htroot/htdocsdefault/dir.java
@@ -104,9 +104,9 @@ public class dir {
final File dir = new File(htroot, path);
// general settings
- prop.put("peername", env.getConfig("peerName", "<nameless>"));
- prop.put("peerdomain", env.getConfig("peerName", "<nameless>").toLowerCase());
- prop.put("peeraddress", yacyCore.seedDB.mySeed().getPublicAddress());
+ prop.putHTML("peername", env.getConfig("peerName", "<nameless>"));
+ prop.putHTML("peerdomain", env.getConfig("peerName", "<nameless>").toLowerCase());
+ prop.putHTML("peeraddress", yacyCore.seedDB.mySeed().getPublicAddress());
prop.put("hostname", serverDomains.myPublicIP());
try{
prop.put("hostip", InetAddress.getByName(serverDomains.myPublicIP()));
@@ -239,7 +239,7 @@ public class dir {
// tree += "<span class=\"tt\">path&nbsp;=&nbsp;" + path + "</span><br><br>";
if (list != null) {
int filecount = 0, fileIdx = 0;
- prop.put("path", path);
+ prop.putHTML("path", path);
boolean dark = false;
for (int i = 0; i < list.length; i++) {
@@ -249,7 +249,7 @@ public class dir {
String fileName = f.getName();
// changing table row color
- prop.put("dirlist_" + fileIdx + "_dark" , dark?1:0);
+ prop.put("dirlist_" + fileIdx + "_dark" , dark ? "1" : "0");
dark = !dark;
@@ -284,74 +284,74 @@ public class dir {
prop.put("dirlist_" + fileIdx + "_dir_rfc822date" , httpc.dateString(new Date(f.lastModified())));
prop.put("dirlist_" + fileIdx + "_dir_timestamp" , Long.toString(f.lastModified()));
// the entry name
- prop.put("dirlist_" + fileIdx + "_dir_name" , fileName);
+ prop.putHTML("dirlist_" + fileIdx + "_dir_name" , fileName);
if (f.isDirectory()) {
// the entry is a directory
- prop.put("dirlist_" + fileIdx + "_dir" , 1);
- prop.put("dirlist_" + fileIdx + "_dir_URL","http://" + yacyCore.seedDB.mySeed().getPublicAddress() + path + fileName + "/");
+ prop.put("dirlist_" + fileIdx + "_dir" , "1");
+ prop.putHTML("dirlist_" + fileIdx + "_dir_URL","http://" + yacyCore.seedDB.mySeed().getPublicAddress() + path + fileName + "/");
} else {
// determine if we should display the description string or a preview image
boolean showImage = /* (description.length() == 0) && */ (fileName.endsWith(".jpg") || fileName.endsWith(".gif") || fileName.endsWith(".png") || fileName.endsWith(".ico") || fileName.endsWith(".bmp"));
// the entry is a file
- prop.put("dirlist_" + fileIdx + "_dir" , 0);
+ prop.put("dirlist_" + fileIdx + "_dir" , "0");
// the file size
prop.put("dirlist_" + fileIdx + "_dir_size" , serverMemory.bytesToString(f.length()));
- prop.put("dirlist_" + fileIdx + "_dir_sizeBytes" , Long.toString(f.length()));
+ prop.put("dirlist_" + fileIdx + "_dir_sizeBytes" , f.length());
// the unique url
- prop.put("dirlist_" + fileIdx + "_dir_yacyhURL",yacyhURL(yacyCore.seedDB.mySeed(), fileName, md5s));
- prop.put("dirlist_" + fileIdx + "_dir_URL","http://" + yacyCore.seedDB.mySeed().getPublicAddress() + path + fileName);
+ prop.putHTML("dirlist_" + fileIdx + "_dir_yacyhURL",yacyhURL(yacyCore.seedDB.mySeed(), fileName, md5s));
+ prop.putHTML("dirlist_" + fileIdx + "_dir_URL","http://" + yacyCore.seedDB.mySeed().getPublicAddress() + path + fileName);
// the md5 sum of the file
prop.put("dirlist_" + fileIdx + "_dir_md5s",md5s);
// description mode: 0...image preview, 1...description text
prop.put("dirlist_" + fileIdx + "_dir_descriptionMode",showImage?0:1);
if (showImage) {
- prop.put("dirlist_" + fileIdx + "_dir_descriptionMode_image",fileName);
+ prop.putHTML("dirlist_" + fileIdx + "_dir_descriptionMode_image",fileName);
}
// always set the description tag (needed by rss and xml)
- prop.put("dirlist_" + fileIdx + "_dir_descriptionMode_text",description);
+ prop.putHTML("dirlist_" + fileIdx + "_dir_descriptionMode_text",description);
}
- prop.put("dirlist_" + fileIdx + "_adminAuthorization",adminAuthorization?1:0);
- prop.put("dirlist_" + fileIdx + "_adminAuthorization_name",fileName);
+ prop.put("dirlist_" + fileIdx + "_adminAuthorization",adminAuthorization ? "1" : "0");
+ prop.putHTML("dirlist_" + fileIdx + "_adminAuthorization_name",fileName);
fileIdx++;
}
prop.put("dirlist",filecount);
- prop.put("emptydir", filecount == 0 ? 1:0);
+ prop.put("emptydir", filecount == 0 ? "1" : "0");
}
- prop.put("authenticated",1);
+ prop.put("authenticated", "1");
} else {
- prop.put("authenticated",0);
+ prop.put("authenticated", "0");
}
if (adminAuthorization) {
- prop.put("ident", 0);
- prop.put("logout", 0);
- prop.put("account", 0);
- prop.put("service",0);
- prop.put("info", 0);
+ prop.put("ident", "0");
+ prop.put("logout", "0");
+ prop.put("account", "0");
+ prop.put("service", "0");
+ prop.put("info", "0");
} else if (uploadAuthorization) {
- prop.put("ident", 1);
- prop.put("logout", 1);
- prop.put("account", 1);
- prop.put("service",0);
- prop.put("info", 1);
+ prop.put("ident", "1");
+ prop.put("logout", "1");
+ prop.put("account", "1");
+ prop.put("service", "0");
+ prop.put("info", "1");
} else if (downloadAuthorization) {
- prop.put("ident", 2);
- prop.put("logout", 2);
- prop.put("account", 2);
- prop.put("service",1);
- prop.put("info", 2);
+ prop.put("ident", "2");
+ prop.put("logout", "2");
+ prop.put("account", "2");
+ prop.put("service", "1");
+ prop.put("info", "2");
} else {
- prop.put("ident", 3);
- prop.put("logout", 3);
- prop.put("account",3);
- prop.put("service", 2);
- prop.put("info", 3);
+ prop.put("ident", "3");
+ prop.put("logout", "3");
+ prop.put("account", "3");
+ prop.put("service", "2");
+ prop.put("info", "3");
}
// return rewrite properties
diff --git a/htroot/index.java b/htroot/index.java
index 3d58de9ba..6425a19d8 100644
--- a/htroot/index.java
+++ b/htroot/index.java
@@ -39,7 +39,6 @@ import de.anomic.server.serverDate;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyCore;
-import de.anomic.yacy.yacySeed;
import de.anomic.yacy.yacyURL;
public class index {
@@ -106,40 +105,41 @@ public class index {
//long mylinks = 0;
try {
- prop.put("links", groupDigits(/*mylinks = */Long.parseLong(yacyCore.seedDB.mySeed().get(yacySeed.LCOUNT, "0"))));
- } catch (NumberFormatException e) { prop.put("links", "0"); }
+ prop.putNum("links", yacyCore.seedDB.mySeed().getLinkCount());
+ } catch (NumberFormatException e) { prop.putHTML("links", "0"); }
//prop.put("total-links", groupDigits(mylinks + yacyCore.seedDB.countActiveURL())); // extremely time-intensive!
// we create empty entries for template strings
String promoteSearchPageGreeting = env.getConfig("promoteSearchPageGreeting", "");
if (env.getConfigBool("promoteSearchPageGreeting.useNetworkName", false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
if (promoteSearchPageGreeting.length() == 0) promoteSearchPageGreeting = "P2P WEB SEARCH";
- prop.putASIS("promoteSearchPageGreeting", promoteSearchPageGreeting);
- prop.put("former", former);
- prop.put("num-results", 0);
- prop.put("excluded", 0);
- prop.put("combine", 0);
- prop.put("resultbottomline", 0);
+ prop.putHTML("promoteSearchPageGreeting", promoteSearchPageGreeting);
+ prop.putHTML("former", former);
+ prop.put("num-results", "0");
+ prop.put("excluded", "0");
+ prop.put("combine", "0");
+ prop.put("resultbottomline", "0");
prop.put("searchoptions", searchoptions);
- prop.put("searchoptions_count-10", (count == 10) ? 1 : 0);
- prop.put("searchoptions_count-50", (count == 50) ? 1 : 0);
- prop.put("searchoptions_count-100", (count == 100) ? 1 : 0);
- prop.put("searchoptions_resource-global", ((global) ? 1 : 0));
- prop.put("searchoptions_resource-global-disabled", (indexReceiveGranted && indexDistributeGranted) ? 0 : 1);
- prop.put("searchoptions_resource-global-disabled_reason", (indexReceiveGranted) ? 0 : (indexDistributeGranted) ? 1 : 2);
- prop.put("searchoptions_resource-local", ((global) ? 0 : 1));
- prop.put("searchoptions_time-1", (time == 1) ? 1 : 0);
- prop.put("searchoptions_time-2", (time == 2) ? 1 : 0);
- prop.put("searchoptions_time-4", (time == 4) ? 1 : 0);
- prop.put("searchoptions_time-6", (time == 6) ? 1 : 0);
- prop.put("searchoptions_time-8", (time == 8) ? 1 : 0);
- prop.put("searchoptions_time-10", (time == 10) ? 1 : 0);
- prop.put("searchoptions_urlmaskoptions", 0);
- prop.put("searchoptions_urlmaskoptions_urlmaskfilter", urlmaskfilter);
- prop.put("searchoptions_prefermaskoptions", 0);
- prop.put("searchoptions_prefermaskoptions_prefermaskfilter", prefermaskfilter);
+ prop.put("searchoptions_count-10", (count == 10) ? "1" : "0");
+ prop.put("searchoptions_count-50", (count == 50) ? "1" : "0");
+ prop.put("searchoptions_count-100", (count == 100) ? "1" : "0");
+ prop.put("searchoptions_resource-global", global ? "1" : "0");
+ prop.put("searchoptions_resource-global-disabled", (indexReceiveGranted && indexDistributeGranted) ? "0" : "1");
+ prop.put("searchoptions_resource-global-disabled_reason",
+ (indexReceiveGranted) ? "0" : (indexDistributeGranted ? "1" : "2"));
+ prop.put("searchoptions_resource-local", global ? "0" : "1");
+ prop.put("searchoptions_time-1", (time == 1) ? "1" : "0");
+ prop.put("searchoptions_time-2", (time == 2) ? "1" : "0");
+ prop.put("searchoptions_time-4", (time == 4) ? "1" : "0");
+ prop.put("searchoptions_time-6", (time == 6) ? "1" : "0");
+ prop.put("searchoptions_time-8", (time == 8) ? "1" : "0");
+ prop.put("searchoptions_time-10", (time == 10) ? "1" : "0");
+ prop.put("searchoptions_urlmaskoptions", "0");
+ prop.putHTML("searchoptions_urlmaskoptions_urlmaskfilter", urlmaskfilter);
+ prop.put("searchoptions_prefermaskoptions", "0");
+ prop.putHTML("searchoptions_prefermaskoptions_prefermaskfilter", prefermaskfilter);
prop.put("searchoptions_indexofChecked", "");
- prop.put("searchoptions_publicSearchpage", (publicPage == true) ? 0 : 1);
+ prop.put("searchoptions_publicSearchpage", (publicPage == true) ? "0" : "1");
prop.put("results", "");
prop.put("cat", cat);
prop.put("type", type);
@@ -147,19 +147,12 @@ public class index {
prop.put("display", display);
prop.put("constraint", constraint);
prop.put("searchoptions_display", display);
- prop.put("contentdomCheckText", (contentdom == plasmaSearchQuery.CONTENTDOM_TEXT) ? 1 : 0);
- prop.put("contentdomCheckAudio", (contentdom == plasmaSearchQuery.CONTENTDOM_AUDIO) ? 1 : 0);
- prop.put("contentdomCheckVideo", (contentdom == plasmaSearchQuery.CONTENTDOM_VIDEO) ? 1 : 0);
- prop.put("contentdomCheckImage", (contentdom == plasmaSearchQuery.CONTENTDOM_IMAGE) ? 1 : 0);
- prop.put("contentdomCheckApp", (contentdom == plasmaSearchQuery.CONTENTDOM_APP) ? 1 : 0);
+ prop.put("contentdomCheckText", (contentdom == plasmaSearchQuery.CONTENTDOM_TEXT) ? "1" : "0");
+ prop.put("contentdomCheckAudio", (contentdom == plasmaSearchQuery.CONTENTDOM_AUDIO) ? "1" : "0");
+ prop.put("contentdomCheckVideo", (contentdom == plasmaSearchQuery.CONTENTDOM_VIDEO) ? "1" : "0");
+ prop.put("contentdomCheckImage", (contentdom == plasmaSearchQuery.CONTENTDOM_IMAGE) ? "1" : "0");
+ prop.put("contentdomCheckApp", (contentdom == plasmaSearchQuery.CONTENTDOM_APP) ? "1" : "0");
return prop;
}
-
- private static String groupDigits(long Number) {
- final String s = Long.toString(Number);
- String t = "";
- for (int i = 0; i < s.length(); i++) t = s.charAt(s.length() - i - 1) + (((i % 3) == 0) ? "." : "") + t;
- return t.substring(0, t.length() - 1);
- }
}
diff --git a/htroot/js/WatchCrawler.js b/htroot/js/WatchCrawler.js
index 3ae065ed3..0bc7002d0 100644
--- a/htroot/js/WatchCrawler.js
+++ b/htroot/js/WatchCrawler.js
@@ -45,13 +45,13 @@ function refresh(){
function requestStatus(){
statusRPC=createRequestObject();
- statusRPC.open('get', '/xml/status_p.xml');
+ statusRPC.open('get', '/xml/status_p.xml?html=');
statusRPC.onreadystatechange = handleStatus;
statusRPC.send(null);
}
function requestQueues(){
queuesRPC=createRequestObject();
- queuesRPC.open('get', '/xml/queues_p.xml');
+ queuesRPC.open('get', '/xml/queues_p.xml?html=');
queuesRPC.onreadystatechange = handleQueues;
queuesRPC.send(null);
@@ -85,12 +85,14 @@ function handleStatus(){
removeAllChildren(trafCrawlerSpan);
trafCrawlerSpan.appendChild(document.createTextNode(Math.round((trafficCrawler) / 1024 / 10.24) / 100));
- var wordCache=getValue(getFirstChild(statusTag, "wordCacheWSize"));
+ var wordCache=getValue(getFirstChild(statusTag, "wordCacheWCount"));
+ var wordCacheSize=getValue(getFirstChild(statusTag, "wordCacheWSize"));
var wordCacheMax=getValue(getFirstChild(statusTag, "wordCacheMaxCount"));
+ var wordCacheMaxSize=getValue(getFirstChild(statusTag, "wordCacheMaxSize"));
wordCacheNum=document.getElementById("wordcacheNum");
removeAllChildren(wordCacheNum);
- wordCacheNum.appendChild(document.createTextNode(wordCache+"/"+wordCacheMax));
+ wordCacheNum.appendChild(document.createTextNode(wordCacheSize+"/"+wordCacheMaxSize));
wordCacheSpan=document.getElementById("wordcacheSpan");
removeAllChildren(wordCacheSpan);
diff --git a/htroot/opensearchdescription.java b/htroot/opensearchdescription.java
index df4112231..269a4d817 100644
--- a/htroot/opensearchdescription.java
+++ b/htroot/opensearchdescription.java
@@ -43,9 +43,9 @@ public class opensearchdescription {
if (thisaddress.indexOf(":") == -1) thisaddress += ":" + serverCore.getPortNr(env.getConfig("port", "8080"));
final serverObjects prop = new serverObjects();
- prop.put("thisaddress", thisaddress);
- prop.put("SearchPageGreeting", promoteSearchPageGreeting);
- prop.put("clientname", yacyCore.seedDB.mySeed().getName());
+ prop.putHTML("thisaddress", thisaddress, true);
+ prop.putHTML("SearchPageGreeting", promoteSearchPageGreeting, true);
+ prop.putHTML("clientname", yacyCore.seedDB.mySeed().getName(), true);
// return rewrite properties
return prop;
diff --git a/htroot/robots.java b/htroot/robots.java
index 10cfa6bd4..4e7f1f70e 100644
--- a/htroot/robots.java
+++ b/htroot/robots.java
@@ -19,16 +19,16 @@ public class robots {
if (rbc.isAllDisallowed()) {
prop.put(httpdRobotsTxtConfig.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(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.isLockedDisallowed() || rbc.isDirsDisallowed()) {
final ArrayList[] p = getFiles(env.getConfig(plasmaSwitchboard.HTROOT_PATH, plasmaSwitchboard.HTROOT_PATH_DEFAULT));
diff --git a/htroot/sharedBlacklist_p.java b/htroot/sharedBlacklist_p.java
index 90688f8c4..0205a9b6b 100644
--- a/htroot/sharedBlacklist_p.java
+++ b/htroot/sharedBlacklist_p.java
@@ -111,16 +111,16 @@ public class sharedBlacklist_p {
String IP = seed.get(yacySeed.IP, "127.0.0.1");
String Port = seed.get(yacySeed.PORT, "8080");
String peerName = seed.get(yacySeed.NAME, "<" + IP + ":" + Port + ">");
- prop.put("page_source", peerName);
+ prop.putHTML("page_source", peerName);
downloadURL = "http://" + IP + ":" + Port + "/yacy/list.html?col=black";
} else {
prop.put("status", STATUS_PEER_UNKNOWN);//YaCy-Peer not found
- prop.put("page", 1);
+ prop.put("page", "1");
}
} else {
prop.put("status", STATUS_PEER_UNKNOWN);//YaCy-Peer not found
- prop.put("page", 1);
+ prop.put("page", "1");
}
if (downloadURL != null) {
@@ -135,46 +135,46 @@ public class sharedBlacklist_p {
otherBlacklist = nxTools.strings(httpc.wget(u, u.getHost(), 12000, null, null, switchboard.remoteProxyConfig,reqHeader, null), "UTF-8");
} catch (Exception e) {
prop.put("status", STATUS_PEER_UNKNOWN);
- prop.put("page", 1);
- }
+ prop.put("page", "1");
+ }
}
} else if (post.containsKey("url")) {
/* ======================================================
* Download the blacklist from URL
- * ====================================================== */
+ * ====================================================== */
- String downloadURL = (String)post.get("url");
- prop.put("page_source", downloadURL);
+ String downloadURL = (String)post.get("url");
+ prop.putHTML("page_source", downloadURL);
try {
yacyURL u = new yacyURL(downloadURL, null);
otherBlacklist = nxTools.strings(httpc.wget(u, u.getHost(), 6000, null, null, switchboard.remoteProxyConfig, null, null), "UTF-8"); //get List
} catch (Exception e) {
prop.put("status", STATUS_URL_PROBLEM);
- prop.put("status_address",downloadURL);
- prop.put("page", 1);
+ prop.putHTML("status_address",downloadURL);
+ prop.put("page", "1");
}
} else if (post.containsKey("file")) {
/* ======================================================
* Import the blacklist from file
- * ====================================================== */
+ * ====================================================== */
String sourceFileName = (String)post.get("file");
prop.put("page_source", sourceFileName);
File sourceFile = new File(listManager.listsPath, sourceFileName);
if (!sourceFile.exists() || !sourceFile.canRead() || !sourceFile.isFile()) {
prop.put("status", STATUS_FILE_ERROR);
- prop.put("page", 1);
- } else {
+ prop.put("page", "1");
+ } else {
otherBlacklist = listManager.getListArray(sourceFile);
}
} else if (post.containsKey("add")) {
/* ======================================================
* Add loaded items into blacklist file
- * ====================================================== */
+ * ====================================================== */
- prop.put("page", 1); //result page
+ prop.put("page", "1"); //result page
prop.put("status", STATUS_ENTRIES_ADDED); //list of added Entries
int count = 0;//couter of added entries
@@ -213,20 +213,20 @@ public class sharedBlacklist_p {
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));
- }
- }
+ }
+ }
}
}
}
} catch (Exception e) {
- prop.put("status",1);
- prop.put("status_error", e.getLocalizedMessage());
+ prop.put("status", "1");
+ prop.putHTML("status_error", e.getLocalizedMessage());
} finally {
if (pw != null) try { pw.close(); } catch (Exception e){ /* */}
}
prop.put("LOCATION","Blacklist_p.html?selectedListName=" + selectedBlacklistName + "&selectList=");
- return prop;
+ return prop;
}
// generate the html list
@@ -236,30 +236,29 @@ public class sharedBlacklist_p {
// sort the loaded blacklist
String[] sortedlist = (String[])otherBlacklist.toArray(new String[otherBlacklist.size()]);
- Arrays.sort(sortedlist);
+ Arrays.sort(sortedlist);
int count = 0;
for(int i = 0; i < sortedlist.length; i++){
String tmp = sortedlist[i];
if( !Blacklist.contains(tmp) && (!tmp.equals("")) ){
//newBlacklist.add(tmp);
- prop.put("page_urllist_" + count + "_dark", count % 2 == 0 ? 0:1);
+ prop.put("page_urllist_" + count + "_dark", count % 2 == 0 ? "0" : "1");
prop.put("page_urllist_" + count + "_url", tmp);
prop.put("page_urllist_" + count + "_count", count);
count++;
}
}
- prop.put("page_urllist", (count));
- prop.put("num", String.valueOf(count));
- prop.put("page", 0);
+ prop.put("page_urllist", (count));
+ prop.put("num", count);
+ prop.put("page", "0");
}
} else {
- prop.put("page", 1);
- prop.put("status", 5);//Wrong Invokation
+ prop.put("page", "1");
+ prop.put("status", "5");//Wrong Invokation
}
return prop;
}
-
}
diff --git a/htroot/www/welcome.java b/htroot/www/welcome.java
index 65d44ed33..6f778790f 100644
--- a/htroot/www/welcome.java
+++ b/htroot/www/welcome.java
@@ -67,9 +67,9 @@ public class welcome {
// update seed info
yacyCore.peerActions.updateMySeed();
- prop.put("peername", env.getConfig("peerName", "<nameless>"));
- prop.put("peerdomain", env.getConfig("peerName", "<nameless>").toLowerCase());
- prop.put("peeraddress", yacyCore.seedDB.mySeed().getPublicAddress());
+ prop.putHTML("peername", env.getConfig("peerName", "<nameless>"));
+ prop.putHTML("peerdomain", env.getConfig("peerName", "<nameless>").toLowerCase());
+ prop.putHTML("peeraddress", yacyCore.seedDB.mySeed().getPublicAddress());
prop.put("hostname", serverDomains.myPublicIP());
try{
prop.put("hostip", InetAddress.getByName(serverDomains.myPublicIP()).getHostAddress());
@@ -82,8 +82,8 @@ public class welcome {
final String peertype = (yacyCore.seedDB.mySeed() == null) ? yacySeed.PEERTYPE_JUNIOR : yacyCore.seedDB.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN);
final boolean senior = (peertype.equals(yacySeed.PEERTYPE_SENIOR)) || (peertype.equals(yacySeed.PEERTYPE_PRINCIPAL));
if (senior) { prop.put("couldcan", "can"); } else { prop.put("couldcan", "could"); }
- if (senior) { prop.put("seniorinfo", "This peer runs in senior mode which means that your peer can be accessed using the addresses shown above."); } else { prop.put("seniorinfo", "<b>Nobody can access your peer from the outside of your intranet. You must open your firewall and/or set a 'virtual server' in the settings of your router to enable access to the addresses as shown below.</b>"); }
- prop.put("wwwpath", "<application_root_path>/" + env.getConfig("htDocsPath", "DATA/HTDOCS"));
+ if (senior) { prop.put("seniorinfo", "This peer runs in senior mode which means that your peer can be accessed using the addresses shown above."); } else { prop.putHTML("seniorinfo", "<b>Nobody can access your peer from the outside of your intranet. You must open your firewall and/or set a 'virtual server' in the settings of your router to enable access to the addresses as shown below.</b>"); }
+ prop.putHTML("wwwpath", "<application_root_path>/" + env.getConfig("htDocsPath", "DATA/HTDOCS"));
// return rewrite properties
return prop;
diff --git a/htroot/xml/blacklists_p.java b/htroot/xml/blacklists_p.java
index 26411a3c3..01fdf1f8c 100644
--- a/htroot/xml/blacklists_p.java
+++ b/htroot/xml/blacklists_p.java
@@ -42,12 +42,12 @@ public class blacklists_p {
int count;
if (dirlist != null) {
for (int i = 0; i <= dirlist.length - 1; i++) {
- prop.put("lists_" + blacklistCount + "_name", dirlist[i]);
+ prop.putHTML("lists_" + blacklistCount + "_name", dirlist[i]);
if (listManager.listSetContains("BlackLists.Shared", dirlist[i])) {
- prop.put("lists_" + blacklistCount + "_shared", 1);
+ prop.put("lists_" + blacklistCount + "_shared", "1");
} else {
- prop.put("lists_" + blacklistCount + "_shared", 0);
+ prop.put("lists_" + blacklistCount + "_shared", "0");
}
String[] types = abstractURLPattern.BLACKLIST_TYPES_STRING.split(",");
@@ -67,7 +67,7 @@ public class blacklists_p {
if (nextEntry.length() == 0) continue;
if (nextEntry.startsWith("#")) continue;
- prop.put("lists_" + blacklistCount + "_items_" + count + "_item", nextEntry);
+ prop.putHTML("lists_" + blacklistCount + "_items_" + count + "_item", nextEntry);
count++;
}
prop.put("lists_" + blacklistCount + "_items", count);
@@ -82,6 +82,3 @@ public class blacklists_p {
}
}
-
-
-
diff --git a/htroot/xml/bookmarks/posts/all.java b/htroot/xml/bookmarks/posts/all.java
index 540ed3dcd..68e32ecc3 100644
--- a/htroot/xml/bookmarks/posts/all.java
+++ b/htroot/xml/bookmarks/posts/all.java
@@ -79,15 +79,15 @@ public class all {
while(it.hasNext()){
bookmark=switchboard.bookmarksDB.getBookmark((String) it.next());
prop.put("posts_"+count+"_url", bookmark.getUrl());
- prop.put("posts_"+count+"_title", bookmark.getTitle());
- prop.put("posts_"+count+"_description", bookmark.getDescription());
+ prop.putHTML("posts_"+count+"_title", bookmark.getTitle());
+ prop.putHTML("posts_"+count+"_description", bookmark.getDescription());
prop.put("posts_"+count+"_md5", serverCodings.encodeMD5Hex(bookmark.getUrl()));
date=new Date(bookmark.getTimeStamp());
prop.put("posts_"+count+"_time", serverDate.dateToiso8601(date));
- prop.put("posts_"+count+"_tags", bookmark.getTagsString().replaceAll(","," "));
+ prop.putHTML("posts_"+count+"_tags", bookmark.getTagsString().replaceAll(","," "));
// additional XML tags
- prop.put("posts_"+count+"_isExtended",extendedXML ? 1:0);
+ prop.put("posts_"+count+"_isExtended",extendedXML ? "1" : "0");
if (extendedXML) {
prop.put("posts_"+count+"_isExtended_private", Boolean.toString(!bookmark.getPublic()));
}
@@ -100,6 +100,3 @@ public class all {
}
}
-
-
-
diff --git a/htroot/xml/bookmarks/posts/delete_p.java b/htroot/xml/bookmarks/posts/delete_p.java
index ce214aed4..25969eb5b 100644
--- a/htroot/xml/bookmarks/posts/delete_p.java
+++ b/htroot/xml/bookmarks/posts/delete_p.java
@@ -58,17 +58,17 @@ public class delete_p {
if(post!= null){
try {
if( post.containsKey("url") && switchboard.bookmarksDB.removeBookmark((new yacyURL(post.get("url", "nourl"), null)).hash())) {
- prop.put("result", 1);
+ prop.put("result", "1");
}else if(post.containsKey("urlhash") && switchboard.bookmarksDB.removeBookmark(post.get("urlhash", "nohash"))){
- prop.put("result", 1);
+ prop.put("result", "1");
}else{
- prop.put("result",0);
+ prop.put("result", "0");
}
} catch (MalformedURLException e) {
- prop.put("result",0);
+ prop.put("result", "0");
}
}else{
- prop.put("result",0);
+ prop.put("result", "0");
}
// return rewrite properties
return prop;
diff --git a/htroot/xml/bookmarks/posts/get.java b/htroot/xml/bookmarks/posts/get.java
index f9a59300d..2ed0adf75 100644
--- a/htroot/xml/bookmarks/posts/get.java
+++ b/htroot/xml/bookmarks/posts/get.java
@@ -72,16 +72,16 @@ public class get {
tag==null || bookmark.getTags().contains(tag) &&
isAdmin || bookmark.getPublic()){
prop.put("posts_"+count+"_url", bookmark.getUrl());
- prop.put("posts_"+count+"_title", bookmark.getTitle());
- prop.put("posts_"+count+"_description", bookmark.getDescription());
- prop.putASIS("posts_"+count+"_md5", serverCodings.encodeMD5Hex(bookmark.getUrl()));
+ prop.putHTML("posts_"+count+"_title", bookmark.getTitle());
+ prop.putHTML("posts_"+count+"_description", bookmark.getDescription());
+ prop.put("posts_"+count+"_md5", serverCodings.encodeMD5Hex(bookmark.getUrl()));
prop.put("posts_"+count+"_time", date);
- prop.put("posts_"+count+"_tags", bookmark.getTagsString().replaceAll(","," "));
+ prop.putHTML("posts_"+count+"_tags", bookmark.getTagsString().replaceAll(","," "));
// additional XML tags
- prop.put("posts_"+count+"_isExtended",extendedXML ? 1:0);
+ prop.put("posts_"+count+"_isExtended",extendedXML ? "1" : "0");
if (extendedXML) {
- prop.putASIS("posts_"+count+"_isExtended_private", Boolean.toString(!bookmark.getPublic()));
+ prop.put("posts_"+count+"_isExtended_private", Boolean.toString(!bookmark.getPublic()));
}
count++;
}
diff --git a/htroot/xml/bookmarks/tags/get.java b/htroot/xml/bookmarks/tags/get.java
index f1203f30b..f38068413 100644
--- a/htroot/xml/bookmarks/tags/get.java
+++ b/htroot/xml/bookmarks/tags/get.java
@@ -67,7 +67,7 @@ public class get {
bookmarksDB.Tag tag;
while(it.hasNext()){
tag=(bookmarksDB.Tag)it.next();
- prop.put("tags_"+count+"_name", tag.getTagName());
+ prop.putHTML("tags_"+count+"_name", tag.getTagName());
prop.put("tags_"+count+"_count", tag.size());
count++;
}
@@ -78,6 +78,3 @@ public class get {
}
}
-
-
-
diff --git a/htroot/xml/bookmarks/tags/rename_p.java b/htroot/xml/bookmarks/tags/rename_p.java
index 3e3e36c97..acb83b8d9 100644
--- a/htroot/xml/bookmarks/tags/rename_p.java
+++ b/htroot/xml/bookmarks/tags/rename_p.java
@@ -56,17 +56,14 @@ public class rename_p {
// return variable that accumulates replacements
plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
serverObjects prop = new serverObjects();
- prop.put("result",0);//error
+ prop.put("result", "0");//error
//rename tags
if(post != null && post.containsKey("old") && post.containsKey("new")){
if(switchboard.bookmarksDB.renameTag((String)post.get("old"), (String)post.get("new")))
- prop.put("result", 1);//success
+ prop.put("result", "1");//success
}
// return rewrite properties
return prop;
}
}
-
-
-
diff --git a/htroot/xml/config_p.java b/htroot/xml/config_p.java
index d5b296cf8..c6b22c552 100644
--- a/htroot/xml/config_p.java
+++ b/htroot/xml/config_p.java
@@ -27,7 +27,6 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import de.anomic.data.htmlTools;
import de.anomic.http.httpHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -62,8 +61,8 @@ public class config_p {
int count=0;
while(keys.hasNext()){
key = (String) keys.next();
- prop.put("options_"+count+"_key", htmlTools.encodeUnicode2html(key, true));
- prop.put("options_"+count+"_value", htmlTools.encodeUnicode2html(env.getConfig(key, "ERROR"), true));
+ prop.putHTML("options_"+count+"_key", key);
+ prop.putHTML("options_"+count+"_value", env.getConfig(key, "ERROR"));
count++;
}
prop.put("options", count);
diff --git a/htroot/xml/queues_p.java b/htroot/xml/queues_p.java
index 78cc327c4..0473dc96a 100644
--- a/htroot/xml/queues_p.java
+++ b/htroot/xml/queues_p.java
@@ -53,7 +53,6 @@ import java.util.Date;
import java.util.Iterator;
import java.util.Locale;
-import de.anomic.data.htmlTools;
import de.anomic.http.httpHeader;
import de.anomic.plasma.plasmaCrawlEntry;
import de.anomic.plasma.plasmaCrawlLoaderMessage;
@@ -82,18 +81,20 @@ public class queues_p {
plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
//wikiCode wikiTransformer = new wikiCode(switchboard);
serverObjects prop = new serverObjects();
- prop.put("rejected", 0);
+ if (post == null || !post.containsKey("html"))
+ prop.setLocalized(false);
+ prop.put("rejected", "0");
//int showRejectedCount = 10;
yacySeed initiator;
//indexing queue
- prop.put("indexingSize", switchboard.getThread(plasmaSwitchboard.INDEXER).getJobCount()+switchboard.indexingTasksInProcess.size());
- prop.put("indexingMax", plasmaSwitchboard.indexingSlots);
- prop.put("urlpublictextSize", switchboard.wordIndex.loadedURL.size());
- prop.put("rwipublictextSize", switchboard.wordIndex.size());
+ prop.putNum("indexingSize", switchboard.getThread(plasmaSwitchboard.INDEXER).getJobCount()+switchboard.indexingTasksInProcess.size());
+ prop.putNum("indexingMax", plasmaSwitchboard.indexingSlots);
+ prop.putNum("urlpublictextSize", switchboard.wordIndex.loadedURL.size());
+ prop.putNum("rwipublictextSize", switchboard.wordIndex.size());
if ((switchboard.sbQueue.size() == 0) && (switchboard.indexingTasksInProcess.size() == 0)) {
- prop.put("list", 0); //is empty
+ prop.put("list", "0"); //is empty
} else {
plasmaSwitchboardQueue.Entry pcentry;
int inProcessCount = 0;
@@ -125,13 +126,13 @@ public class queues_p {
totalSize += entrySize;
initiator = yacyCore.seedDB.getConnected(pcentry.initiator());
prop.put("list-indexing_"+i+"_profile", (pcentry.profile() != null) ? pcentry.profile().name() : "deleted");
- prop.put("list-indexing_"+i+"_initiator", ((initiator == null) ? "proxy" : htmlTools.encodeUnicode2html(initiator.getName(), true)));
+ prop.put("list-indexing_"+i+"_initiator", ((initiator == null) ? "proxy" : initiator.getName()));
prop.put("list-indexing_"+i+"_depth", pcentry.depth());
prop.put("list-indexing_"+i+"_modified", pcentry.getModificationDate());
- prop.put("list-indexing_"+i+"_anchor", (pcentry.anchorName()==null)?"":htmlTools.encodeUnicode2html(pcentry.anchorName(), true));
+ prop.putHTML("list-indexing_"+i+"_anchor", (pcentry.anchorName()==null) ? "" : pcentry.anchorName(), true);
prop.put("list-indexing_"+i+"_url", pcentry.url().toNormalform(false, true));
- prop.put("list-indexing_"+i+"_size", entrySize);
- prop.put("list-indexing_"+i+"_inProcess", (inProcess)?1:0);
+ prop.putNum("list-indexing_"+i+"_size", entrySize);
+ prop.put("list-indexing_"+i+"_inProcess", (inProcess) ? "1" : "0");
prop.put("list-indexing_"+i+"_hash", pcentry.urlHash());
ok++;
}
@@ -140,12 +141,12 @@ public class queues_p {
}
//loader queue
- prop.put("loaderSize", Integer.toString(switchboard.cacheLoader.size()));
- prop.put("loaderMax", Integer.toString(plasmaSwitchboard.crawlSlots));
+ prop.put("loaderSize", switchboard.cacheLoader.size());
+ prop.put("loaderMax", plasmaSwitchboard.crawlSlots);
if (switchboard.cacheLoader.size() == 0) {
- prop.put("list-loader", 0);
+ prop.put("list-loader", "0");
} else {
- ThreadGroup loaderThreads = switchboard.cacheLoader.threadStatus();
+ ThreadGroup loaderThreads = switchboard.cacheLoader.threadStatus();
Thread[] threadList = new Thread[loaderThreads.activeCount()*2];
int size = loaderThreads.enumerate(threadList);
@@ -165,17 +166,17 @@ public class queues_p {
}
//local crawl queue
- prop.put("localCrawlSize", Integer.toString(switchboard.getThread(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL).getJobCount()));
+ prop.putNum("localCrawlSize", switchboard.getThread(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL).getJobCount());
prop.put("localCrawlState", switchboard.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL) ? STATE_PAUSED : STATE_RUNNING);
int stackSize = switchboard.noticeURL.stackSize(plasmaCrawlNURL.STACK_TYPE_CORE);
addNTable(prop, "list-local", switchboard.noticeURL.top(plasmaCrawlNURL.STACK_TYPE_CORE, Math.min(10, stackSize)));
//global crawl queue
- prop.put("remoteCrawlSize", Integer.toString(switchboard.getThread(plasmaSwitchboard.CRAWLJOB_GLOBAL_CRAWL_TRIGGER).getJobCount()));
+ prop.putNum("remoteCrawlSize", switchboard.getThread(plasmaSwitchboard.CRAWLJOB_GLOBAL_CRAWL_TRIGGER).getJobCount());
prop.put("remoteCrawlState", switchboard.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_GLOBAL_CRAWL_TRIGGER) ? STATE_PAUSED : STATE_RUNNING);
stackSize = switchboard.noticeURL.stackSize(plasmaCrawlNURL.STACK_TYPE_LIMIT);
if (stackSize == 0) {
- prop.put("list-remote", 0);
+ prop.put("list-remote", "0");
} else {
addNTable(prop, "list-remote", switchboard.noticeURL.top(plasmaCrawlNURL.STACK_TYPE_LIMIT, Math.min(10, stackSize)));
}
@@ -198,8 +199,8 @@ public class queues_p {
prop.put(tableName + "_" + showNum + "_initiator", ((initiator == null) ? "proxy" : initiator.getName()));
prop.put(tableName + "_" + showNum + "_depth", urle.depth());
prop.put(tableName + "_" + showNum + "_modified", daydate(urle.loaddate()));
- prop.put(tableName + "_" + showNum + "_anchor", urle.name());
- prop.put(tableName + "_" + showNum + "_url", urle.url().toNormalform(false, true));
+ prop.putHTML(tableName + "_" + showNum + "_anchor", urle.name(), true);
+ prop.putHTML(tableName + "_" + showNum + "_url", urle.url().toNormalform(false, true), true);
prop.put(tableName + "_" + showNum + "_hash", urle.url().hash());
showNum++;
}
@@ -208,6 +209,3 @@ public class queues_p {
}
}
-
-
-
diff --git a/htroot/xml/status_p.java b/htroot/xml/status_p.java
index 089bf6b3e..cb89f1b99 100644
--- a/htroot/xml/status_p.java
+++ b/htroot/xml/status_p.java
@@ -45,7 +45,6 @@ import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.serverMemory;
import de.anomic.yacy.yacyCore;
-import de.anomic.yacy.yacySeed;
import de.anomic.http.httpdByteCountInputStream;
import de.anomic.http.httpdByteCountOutputStream;
@@ -56,22 +55,28 @@ public class status_p {
// return variable that accumulates replacements
plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
serverObjects prop = new serverObjects();
- prop.put("rejected", 0);
+ if (post == null || !post.containsKey("html"))
+ prop.setLocalized(false);
+ prop.put("rejected", "0");
yacyCore.peerActions.updateMySeed();
- prop.put("ppm", yacyCore.seedDB.mySeed().get(yacySeed.ISPEED, "unknown"));
- prop.put("qpm", yacyCore.seedDB.mySeed().get(yacySeed.RSPEED, "unknown"));
- prop.put("wordCacheSize", switchboard.wordIndex.dhtOutCacheSize() + switchboard.wordIndex.dhtInCacheSize());
- prop.put("wordCacheWSize", switchboard.wordIndex.dhtOutCacheSize());
- prop.put("wordCacheKSize", switchboard.wordIndex.dhtInCacheSize());
- prop.put("wordCacheMaxCount", switchboard.getConfig(plasmaSwitchboard.WORDCACHE_MAX_COUNT, "10000"));
+ final int cacheOutSize = switchboard.wordIndex.dhtOutCacheSize();
+ final long cacheMaxSize = switchboard.getConfigLong(plasmaSwitchboard.WORDCACHE_MAX_COUNT, 10000);
+ prop.putNum("ppm", yacyCore.seedDB.mySeed().getPPM());
+ prop.putNum("qpm", yacyCore.seedDB.mySeed().getQPM());
+ prop.putNum("wordCacheSize", switchboard.wordIndex.dhtOutCacheSize() + switchboard.wordIndex.dhtInCacheSize());
+ prop.putNum("wordCacheWSize", cacheOutSize);
+ prop.putNum("wordCacheKSize", switchboard.wordIndex.dhtInCacheSize());
+ prop.putNum("wordCacheMaxSize", cacheMaxSize);
+ prop.put("wordCacheWCount", cacheOutSize);
+ prop.put("wordCacheMaxCount", cacheMaxSize);
//
// memory usage and system attributes
final Runtime rt = Runtime.getRuntime();
- prop.put("freeMemory", rt.freeMemory());
- prop.put("totalMemory", rt.totalMemory());
- prop.put("maxMemory", serverMemory.max);
- prop.put("processors", rt.availableProcessors());
+ prop.putNum("freeMemory", rt.freeMemory());
+ prop.putNum("totalMemory", rt.totalMemory());
+ prop.putNum("maxMemory", serverMemory.max);
+ prop.putNum("processors", rt.availableProcessors());
// proxy traffic
prop.put("trafficIn", httpdByteCountInputStream.getGlobalCount());
@@ -83,6 +88,3 @@ public class status_p {
}
}
-
-
-
diff --git a/htroot/xml/status_p.xml b/htroot/xml/status_p.xml
index 8eb7f9503..7dced800b 100644
--- a/htroot/xml/status_p.xml
+++ b/htroot/xml/status_p.xml
@@ -3,7 +3,9 @@
<ppm>#[ppm]#</ppm>
<wordCacheSize>#[wordCacheSize]#</wordCacheSize>
<wordCacheWSize>#[wordCacheWSize]#</wordCacheWSize>
+ <wordCacheWCount>#[wordCacheWCount]#</wordCacheWCount>
<wordCacheKSize>#[wordCacheKSize]#</wordCacheKSize>
+ <wordCacheMaxSize>#[wordCacheMaxSize]#</wordCacheMaxSize>
<wordCacheMaxCount>#[wordCacheMaxCount]#</wordCacheMaxCount>
<memory>
diff --git a/htroot/xml/util/getpageinfo_p.java b/htroot/xml/util/getpageinfo_p.java
index fd53919b3..7da620b0e 100644
--- a/htroot/xml/util/getpageinfo_p.java
+++ b/htroot/xml/util/getpageinfo_p.java
@@ -67,15 +67,15 @@ public class getpageinfo_p {
prop.put("sitemap", "");
prop.put("title", "");
prop.put("favicon","");
- prop.put("robots-allowed", 3); //unknown
+ prop.put("robots-allowed", "3"); //unknown
String actions="title";
if(post!=null && post.containsKey("url")){
if(post.containsKey("actions"))
actions=(String)post.get("actions");
String url=(String) post.get("url");
if(url.toLowerCase().startsWith("ftp://")){
- prop.put("robots-allowed", 1);
- prop.put("title", "FTP: "+url);
+ prop.put("robots-allowed", "1");
+ prop.putHTML("title", "FTP: "+url);
return prop;
} else if (!(url.toLowerCase().startsWith("http://") || url.toLowerCase().startsWith("https://"))) {
url = "http://" + url;
@@ -92,15 +92,15 @@ public class getpageinfo_p {
writer.close();
// put the document title
- prop.put("title", scraper.getTitle());
+ prop.putHTML("title", scraper.getTitle());
// put the favicon that belongs to the document
- prop.put("favicon", (scraper.getFavicon()==null)?"":scraper.getFavicon().toString());
+ prop.put("favicon", (scraper.getFavicon()==null) ? "" : scraper.getFavicon().toString());
// put keywords
String list[]=scraper.getKeywords();
for(int i=0;i<list.length;i++){
- prop.put("tags_"+i+"_tag", list[i]);
+ prop.putHTML("tags_"+i+"_tag", list[i]);
}
prop.put("tags", list.length);
@@ -113,11 +113,11 @@ public class getpageinfo_p {
yacyURL theURL = new yacyURL(url, null);
// determine if crawling of the current URL is allowed
- prop.put("robots-allowed", robotsParser.isDisallowed(theURL) ? 0:1);
+ prop.put("robots-allowed", robotsParser.isDisallowed(theURL) ? "0" : "1");
// get the sitemap URL of the domain
yacyURL sitemapURL = robotsParser.getSitemapURL(theURL);
- prop.put("sitemap", (sitemapURL==null)?"":sitemapURL.toString());
+ prop.putHTML("sitemap", (sitemapURL==null)?"":sitemapURL.toString());
} catch (MalformedURLException e) {}
}
@@ -127,6 +127,3 @@ public class getpageinfo_p {
}
}
-
-
-
diff --git a/htroot/yacy/crawlOrder.java b/htroot/yacy/crawlOrder.java
index 23a39d2dd..2170403aa 100644
--- a/htroot/yacy/crawlOrder.java
+++ b/htroot/yacy/crawlOrder.java
@@ -212,8 +212,8 @@ public final class crawlOrder {
stackresult = stack(switchboard, (String) urlv.get(i), (String) refv.get(i), iam, youare);
response = (String) stackresult[0];
- prop.putASIS("list_" + i + "_job", (String) stackresult[0] + "," + (String) stackresult[1]);
- prop.putASIS("list_" + i + "_lurl", (String) stackresult[2]);
+ prop.put("list_" + i + "_job", (String) stackresult[0] + "," + (String) stackresult[1]);
+ prop.put("list_" + i + "_lurl", (String) stackresult[2]);
prop.put("list_" + i + "_count", i);
}
prop.put("list", count);
@@ -230,13 +230,13 @@ public final class crawlOrder {
delay = "600";
}
- prop.putASIS("response", response);
- prop.putASIS("reason", reason);
- prop.putASIS("delay", delay);
+ prop.put("response", response);
+ prop.put("reason", reason);
+ prop.put("delay", delay);
prop.put("depth", acceptDepth);
- prop.putASIS("lurl", lurl);
- prop.putASIS("forward", "");
- prop.putASIS("key", key);
+ prop.put("lurl", lurl);
+ prop.put("forward", "");
+ prop.put("key", key);
// return rewrite properties
return prop;
diff --git a/htroot/yacy/crawlReceipt.java b/htroot/yacy/crawlReceipt.java
index 1da8f74f0..4f0bbe1ac 100644
--- a/htroot/yacy/crawlReceipt.java
+++ b/htroot/yacy/crawlReceipt.java
@@ -116,40 +116,40 @@ public final class crawlReceipt {
if ((yacyCore.seedDB.mySeed() == null) || (!(yacyCore.seedDB.mySeed().hash.equals(youare)))) {
// no yacy connection / unknown peers
- prop.putASIS("delay", "3600");
+ prop.put("delay", "3600");
return prop;
}
if (propStr == null) {
// error with url / wrong key
- prop.putASIS("delay", "3600");
+ prop.put("delay", "3600");
return prop;
}
if ((switchboard.isRobinsonMode()) && (!switchboard.isInMyCluster(otherPeer))) {
// we reject urls that are from outside our cluster
- prop.putASIS("delay", "9999");
+ prop.put("delay", "9999");
}
// generating a new loaded URL entry
indexURLEntry entry = switchboard.wordIndex.loadedURL.newEntry(propStr);
if (entry == null) {
log.logWarning("crawlReceipt: RECEIVED wrong RECEIPT (entry null) from peer " + iam + "\n\tURL properties: "+ propStr);
- prop.putASIS("delay", "3600");
+ prop.put("delay", "3600");
return prop;
}
indexURLEntry.Components comp = entry.comp();
if (comp.url() == null) {
log.logWarning("crawlReceipt: RECEIVED wrong RECEIPT (url null) for hash " + entry.hash() + " from peer " + iam + "\n\tURL properties: "+ propStr);
- prop.putASIS("delay", "3600");
+ prop.put("delay", "3600");
return prop;
}
// check if the entry is in our network domain
if (!switchboard.acceptURL(comp.url())) {
log.logWarning("crawlReceipt: RECEIVED wrong RECEIPT (url outside of our domain) for hash " + entry.hash() + " from peer " + iam + "\n\tURL properties: "+ propStr);
- prop.putASIS("delay", "9999");
+ prop.put("delay", "9999");
return prop;
}
@@ -161,11 +161,11 @@ public final class crawlReceipt {
log.logInfo("crawlReceipt: RECEIVED RECEIPT from " + otherPeerName + " for URL " + entry.hash() + ":" + comp.url().toNormalform(false, true));
// ready for more
- prop.putASIS("delay", "10");
+ prop.put("delay", "10");
return prop;
} catch (IOException e) {
e.printStackTrace();
- prop.putASIS("delay", "3600");
+ prop.put("delay", "3600");
return prop;
}
@@ -174,7 +174,7 @@ public final class crawlReceipt {
ee.store();
switchboard.errorURL.stackPushEntry(ee);
//switchboard.noticeURL.remove(receivedUrlhash);
- prop.putASIS("delay", "3600");
+ prop.put("delay", "3600");
return prop;
// return rewrite properties
diff --git a/htroot/yacy/hello.java b/htroot/yacy/hello.java
index 7fba9f85b..aec959bda 100644
--- a/htroot/yacy/hello.java
+++ b/htroot/yacy/hello.java
@@ -130,11 +130,11 @@ public final class hello {
serverCore.checkInterruption();
// try first the reportedip, since this may be a connect from a port-forwarding host
- prop.putASIS("yourip", reportedip);
+ prop.put("yourip", reportedip);
remoteSeed.put(yacySeed.IP, reportedip);
urls = yacyClient.queryUrlCount(remoteSeed);
} else {
- prop.putASIS("yourip", "unknown");
+ prop.put("yourip", "unknown");
}
// if the previous attempt (using the reported ip address) was not successful, try the ip where
@@ -149,7 +149,7 @@ public final class hello {
if (isNotLocal) {
serverCore.checkInterruption();
- prop.putASIS("yourip", clientip);
+ prop.put("yourip", clientip);
remoteSeed.put(yacySeed.IP, clientip);
urls = yacyClient.queryUrlCount(remoteSeed);
}
@@ -162,18 +162,18 @@ public final class hello {
// assign status
if (urls >= 0) {
if (remoteSeed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) == null) {
- prop.putASIS(yacySeed.YOURTYPE, yacySeed.PEERTYPE_SENIOR);
+ prop.put(yacySeed.YOURTYPE, yacySeed.PEERTYPE_SENIOR);
remoteSeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR);
} else if (remoteSeed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_PRINCIPAL).equals(yacySeed.PEERTYPE_PRINCIPAL)) {
- prop.putASIS(yacySeed.YOURTYPE, yacySeed.PEERTYPE_PRINCIPAL);
+ prop.put(yacySeed.YOURTYPE, yacySeed.PEERTYPE_PRINCIPAL);
} else {
- prop.putASIS(yacySeed.YOURTYPE, yacySeed.PEERTYPE_SENIOR);
+ prop.put(yacySeed.YOURTYPE, yacySeed.PEERTYPE_SENIOR);
remoteSeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR);
}
// connect the seed
yacyCore.peerActions.peerArrival(remoteSeed, true);
} else {
- prop.putASIS(yacySeed.YOURTYPE, yacySeed.PEERTYPE_JUNIOR);
+ prop.put(yacySeed.YOURTYPE, yacySeed.PEERTYPE_JUNIOR);
yacyCore.peerActions.juniorConnects++; // update statistics
remoteSeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR);
yacyCore.log.logInfo("hello: responded remote junior peer '" + remoteSeed.getName() + "' from " + reportedip);
@@ -222,7 +222,7 @@ public final class hello {
seeds.append("seed0=").append(yacyCore.seedDB.mySeed().genSeedStr(key)).append(serverCore.crlfString);
}
- prop.putASIS("seedlist", seeds.toString());
+ prop.put("seedlist", seeds.toString());
// return rewrite properties
prop.put("message", "ok " + seed.length());
return prop;
diff --git a/htroot/yacy/list.java b/htroot/yacy/list.java
index 581bbf927..b95d0241c 100644
--- a/htroot/yacy/list.java
+++ b/htroot/yacy/list.java
@@ -108,7 +108,7 @@ public final class list {
}
} // if filenamesarray.length > 0
- prop.put("list",out);
+ prop.put("list",out.toString());
}
// start contrib by [FB]
else if (col.length() == 0 && post.get("list", "").equals("queueUrls")) {
@@ -128,7 +128,7 @@ public final class list {
b.append(htmlTools.decodeHtml2Unicode(url.toNormalform(false, true))).append("\n");
cnt++;
}
- prop.put("list", b);
+ prop.put("list", b.toString());
CrawlURLFetchStack_p.fetchMap.put(
otherPeerName,
new Integer(((CrawlURLFetchStack_p.fetchMap.get(otherPeerName) == null)
@@ -144,7 +144,7 @@ public final class list {
}
// end contrib by [FB]
} else {
- prop.putASIS("list","");
+ prop.put("list","");
}
return prop;
diff --git a/htroot/yacy/message.java b/htroot/yacy/message.java
index d6b731fcd..bb6258e89 100644
--- a/htroot/yacy/message.java
+++ b/htroot/yacy/message.java
@@ -87,14 +87,14 @@ public final class message {
int messagesize = 10240;
int attachmentsize = 0;
- prop.putASIS("messagesize", "0");
- prop.putASIS("attachmentsize", "0");
+ prop.put("messagesize", "0");
+ prop.put("attachmentsize", "0");
String youare = post.get("youare", ""); // seed hash of the target peer, needed for network stability
// check if we are the right target and requester has correct information about this peer
if ((yacyCore.seedDB.mySeed() == null) || (!(yacyCore.seedDB.mySeed().hash.equals(youare)))) {
// this request has a wrong target
- prop.putASIS("response", "-1"); // request rejected
+ prop.put("response", "-1"); // request rejected
return prop;
}
@@ -102,17 +102,17 @@ public final class message {
(!((sb.isPublicRobinson()) ||
(sb.isInMyCluster((String)header.get(httpHeader.CONNECTION_PROP_CLIENTIP)))))) {
// if we are a robinson cluster, answer only if this client is known by our network definition
- prop.putASIS("response", "-1"); // request rejected
+ prop.put("response", "-1"); // request rejected
return prop;
}
- prop.putASIS("messagesize", Integer.toString(messagesize));
- prop.putASIS("attachmentsize", Integer.toString(attachmentsize));
+ prop.put("messagesize", Integer.toString(messagesize));
+ prop.put("attachmentsize", Integer.toString(attachmentsize));
if (process.equals("permission")) {
// permission: respond with acceptable message and attachment size
// String iam = (String) post.get("iam", ""); // seed hash of requester
- prop.putASIS("response", "Welcome to my peer!");
+ prop.put("response", "Welcome to my peer!");
// that's it!
}
@@ -120,7 +120,7 @@ public final class message {
// post: post message to message board
String otherSeedString = post.get("myseed", "");
if (otherSeedString.length() == 0) {
- prop.putASIS("response", "-1"); // request rejected
+ prop.put("response", "-1"); // request rejected
return prop;
}
//Date remoteTime = yacyCore.parseUniversalDate((String) post.get(yacySeed.MYTIME)); // read remote time
@@ -129,17 +129,17 @@ public final class message {
String subject = crypt.simpleDecode(post.get("subject", ""), key); // message's subject
String message = crypt.simpleDecode(post.get("message", ""), key); // message body
if (subject == null || message == null) {
- prop.putASIS("response", "-1"); // don't accept empty messages
+ prop.put("response", "-1"); // don't accept empty messages
return prop;
}
message = message.trim();
subject = subject.trim();
if (subject.length() == 0 || message.length() == 0) {
- prop.putASIS("response", "-1"); // don't accept empty messages
+ prop.put("response", "-1"); // don't accept empty messages
return prop;
}
- prop.putASIS("response", "Thank you!");
+ prop.put("response", "Thank you!");
// save message
messageBoard.entry msgEntry = null;
diff --git a/htroot/yacy/profile.java b/htroot/yacy/profile.java
index 4af2135b8..737bb22a8 100644
--- a/htroot/yacy/profile.java
+++ b/htroot/yacy/profile.java
@@ -74,7 +74,7 @@ public final class profile {
(!sb.isPublicRobinson()) &&
(!sb.isInMyCluster((String)header.get(httpHeader.CONNECTION_PROP_CLIENTIP)))) {
// if we are a robinson cluster, answer only if this client is known by our network definition
- prop.put("list", 0);
+ prop.put("list", "0");
return prop;
}
@@ -97,8 +97,8 @@ public final class profile {
key=(String)it.next();
value=profile.getProperty(key, "").replaceAll("\r","").replaceAll("\n","\\\\n");
if( !(key.equals("")) && !(value.equals("")) ){
- prop.putASIS("list_"+count+"_key", key);
- prop.putASIS("list_"+count+"_value", value);
+ prop.put("list_"+count+"_key", key);
+ prop.put("list_"+count+"_value", value);
count++;
}
}
diff --git a/htroot/yacy/query.java b/htroot/yacy/query.java
index 96444ab34..6c0499d75 100644
--- a/htroot/yacy/query.java
+++ b/htroot/yacy/query.java
@@ -73,7 +73,7 @@ public final class query {
// 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,
// what would mean that our peer ping does not work
- prop.putASIS("response", "-1"); // request rejected
+ prop.put("response", "-1"); // request rejected
return prop;
}
@@ -85,12 +85,12 @@ public final class query {
final String obj = post.get("object", ""); // keyword for query subject
final String env = post.get("env", ""); // argument to query
- prop.putASIS("mytime", serverDate.shortSecondTime());
+ prop.put("mytime", serverDate.shortSecondTime());
// check if we are the right target and requester has correct information about this peer
if (yacyCore.seedDB.mySeed() == null || !yacyCore.seedDB.mySeed().hash.equals(youare)) {
// this request has a wrong target
- prop.putASIS("response", "-1"); // request rejected
+ prop.put("response", "-1"); // request rejected
return prop;
}
@@ -117,30 +117,30 @@ public final class query {
// requests about requirements
if (obj.equals("wantedlurls")) {
- prop.putASIS("response", "0"); // dummy response
+ prop.put("response", "0"); // dummy response
return prop;
}
if (obj.equals("wantedpurls")) {
- prop.putASIS("response", "0"); // dummy response
+ prop.put("response", "0"); // dummy response
return prop;
}
if (obj.equals("wantedword")) {
// response returns a list of wanted word hashes
- prop.putASIS("response", "0"); // dummy response
+ prop.put("response", "0"); // dummy response
return prop;
}
if (obj.equals("wantedrwi")) {
// <env> shall contain a word hash, the number of wanted lurls for this hash is returned
- prop.putASIS("response", "0"); // dummy response
+ prop.put("response", "0"); // dummy response
return prop;
}
if (obj.equals("wantedseeds")) {
// return a number of wanted seed
- prop.putASIS("response", "0"); // dummy response
+ prop.put("response", "0"); // dummy response
return prop;
}
diff --git a/htroot/yacy/search.java b/htroot/yacy/search.java
index 6e05d1029..6b0d17965 100644
--- a/htroot/yacy/search.java
+++ b/htroot/yacy/search.java
@@ -100,9 +100,9 @@ public final class search {
(!((sb.isPublicRobinson()) ||
(sb.isInMyCluster((String)header.get(httpHeader.CONNECTION_PROP_CLIENTIP)))))) {
// if we are a robinson cluster, answer only if this client is known by our network definition
- prop.putASIS("links", "");
- prop.putASIS("linkcount", "0");
- prop.putASIS("references", "");
+ prop.put("links", "");
+ prop.put("linkcount", "0");
+ prop.put("references", "");
return prop;
}
@@ -155,9 +155,9 @@ public final class search {
}
}
- prop.putASIS("indexcount", "");
- prop.put("joincount", 0);
- prop.putASIS("references", "");
+ prop.put("indexcount", "");
+ prop.put("joincount", "0");
+ prop.put("references", "");
} else {
@@ -175,8 +175,8 @@ public final class search {
// set statistic details of search result and find best result index set
if (theSearch.getLocalCount() == 0) {
- prop.putASIS("indexcount", "");
- prop.putASIS("joincount", "0");
+ prop.put("indexcount", "");
+ prop.put("joincount", "0");
} else {
// attach information about index abstracts
StringBuffer indexcount = new StringBuffer();
@@ -196,14 +196,14 @@ public final class search {
indexabstract.append("indexabstract." + wordhash + "=").append((String) theSearch.IAResults.get(wordhash)).append(serverCore.crlfString);
}
}
- prop.putASIS("indexcount", new String(indexcount));
+ prop.put("indexcount", indexcount.toString());
if (theSearch.getLocalCount() == 0) {
joincount = 0;
- prop.put("joincount", 0);
+ prop.put("joincount", "0");
} else {
joincount = theSearch.getLocalCount();
- prop.putASIS("joincount", Integer.toString(joincount));
+ prop.put("joincount", Integer.toString(joincount));
accu = theSearch.completeResults(duetime);
}
@@ -211,7 +211,7 @@ public final class search {
// this is not needed if the search is restricted to specific
// urls, because it is a re-search
if ((theSearch.IAmaxcounthash == null) || (urls.length() != 0) || (queryhashes.size() <= 1) || (abstracts.length() == 0)) {
- prop.putASIS("indexabstract", "");
+ prop.put("indexabstract", "");
} else if (abstracts.equals("auto")) {
// automatically attach the index abstract for the index that has the most references. This should be our target dht position
indexabstractContainercount += ((Integer) theSearch.IACount.get(theSearch.IAmaxcounthash)).intValue();
@@ -236,18 +236,18 @@ public final class search {
while (j.hasNext()) {
refstr.append(",").append((String) j.next());
}
- prop.putASIS("references", (refstr.length() > 0) ? refstr.substring(1) : new String(refstr));
+ prop.put("references", (refstr.length() > 0) ? refstr.substring(1) : refstr.toString());
localProcess.yield("reference collection", ws.size());
}
- prop.putASIS("indexabstract", new String(indexabstract));
+ prop.put("indexabstract", indexabstract.toString());
// prepare result
if ((joincount == 0) || (accu == null)) {
// no results
- prop.putASIS("links", "");
- prop.putASIS("linkcount", "0");
- prop.putASIS("references", "");
+ prop.put("links", "");
+ prop.put("linkcount", "0");
+ prop.put("references", "");
} else {
// result is a List of urlEntry elements
@@ -262,15 +262,15 @@ public final class search {
links.append("resource").append(i).append('=').append(resource).append(serverCore.crlfString);
}
}
- prop.putASIS("links", new String(links));
+ prop.put("links", links.toString());
prop.put("linkcount", accu.size());
localProcess.yield("result list preparation", accu.size());
}
// add information about forward peers
- prop.putASIS("fwhop", ""); // hops (depth) of forwards that had been performed to construct this result
- prop.putASIS("fwsrc", ""); // peers that helped to construct this result
- prop.putASIS("fwrec", ""); // peers that would have helped to construct this result (recommendations)
+ prop.put("fwhop", ""); // hops (depth) of forwards that had been performed to construct this result
+ prop.put("fwsrc", ""); // peers that helped to construct this result
+ prop.put("fwrec", ""); // peers that would have helped to construct this result (recommendations)
// prepare search statistics
Long trackerHandle = new Long(System.currentTimeMillis());
@@ -293,7 +293,7 @@ public final class search {
indexabstractContainercount + " index abstracts, " +
(System.currentTimeMillis() - timestamp) + " milliseconds");
- prop.putASIS("searchtime", Long.toString(System.currentTimeMillis() - timestamp));
+ prop.put("searchtime", System.currentTimeMillis() - timestamp);
final int links = Integer.parseInt(prop.get("linkcount","0"));
yacyCore.seedDB.mySeed().incSI(links);
diff --git a/htroot/yacy/transfer.java b/htroot/yacy/transfer.java
index 8a8614751..b93a71ad2 100644
--- a/htroot/yacy/transfer.java
+++ b/htroot/yacy/transfer.java
@@ -73,13 +73,13 @@ public final class transfer {
String filename = post.get("filename", ""); // a name of a file without path
//long filesize = Long.parseLong((String) post.get("filesize", "")); // the size of the file
- prop.put("process", 0);
- prop.putASIS("response", "denied"); // reject is default and is overwritten if ok
- prop.putASIS("process_access", "");
- prop.putASIS("process_address", "");
- prop.putASIS("process_protocol", "");
- prop.putASIS("process_path", "");
- prop.putASIS("process_maxsize", "0");
+ prop.put("process", "0");
+ prop.put("response", "denied"); // reject is default and is overwritten if ok
+ prop.put("process_access", "");
+ prop.put("process_address", "");
+ prop.put("process_protocol", "");
+ prop.put("process_path", "");
+ prop.put("process_maxsize", "0");
if (sb.isRobinsonMode() || !sb.rankingOn) {
// in a robinson environment, do not answer. We do not do any transfer in a robinson cluster.
@@ -98,18 +98,18 @@ public final class transfer {
String otherpeerName = otherseed.hash + ":" + otherseed.getName();
if (process.equals("permission")) {
- prop.put("process", 0);
+ prop.put("process", "0");
if (((purpose.equals("crcon")) && (filename.startsWith("CRG")) && (filename.endsWith(".cr.gz"))) || ((filename.startsWith("domlist")) && (filename.endsWith(".txt.gz") || filename.endsWith(".zip")))) {
// consolidation of cr files
//System.out.println("yacy/transfer:post=" + post.toString());
//String cansendprotocol = (String) post.get("can-send-protocol", "http");
String access = kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw(otherpeer + ":" + filename)) + ":" + kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw("" + System.currentTimeMillis()));
- prop.putASIS("response", "ok");
- prop.putASIS("process_access", access);
- prop.putASIS("process_address", yacyCore.seedDB.mySeed().getPublicAddress());
- prop.putASIS("process_protocol", "http");
- prop.putASIS("process_path", ""); // currently empty; the store process will find a path
- prop.putASIS("process_maxsize", "-1"); // if response is too big we return the size of the file
+ prop.put("response", "ok");
+ prop.put("process_access", access);
+ prop.put("process_address", yacyCore.seedDB.mySeed().getPublicAddress());
+ prop.put("process_protocol", "http");
+ prop.put("process_path", ""); // currently empty; the store process will find a path
+ prop.put("process_maxsize", "-1"); // if response is too big we return the size of the file
sb.rankingPermissions.put(serverCodings.encodeMD5Hex(kelondroBase64Order.standardCoder.encodeString(access)), filename);
sb.getLog().logFine("RankingTransmission: granted peer " + otherpeerName + " to send CR file " + filename);
}
@@ -117,7 +117,7 @@ public final class transfer {
}
if (process.equals("store")) {
- prop.put("process", 1);
+ prop.put("process", "1");
if (purpose.equals("crcon")) {
byte[] filebytes = (byte[]) post.get("filename$file");
String accesscode = post.get("access", ""); // one-time authentication
@@ -125,10 +125,10 @@ public final class transfer {
//java.util.HashMap perm = sb.rankingPermissions;
//System.out.println("PERMISSIONDEBUG: accesscode=" + accesscode + ", permissions=" + perm.toString());
String grantedFile = (String) sb.rankingPermissions.get(accesscode);
- prop.putASIS("process_tt", "");
+ prop.put("process_tt", "");
if ((grantedFile == null) || (!(grantedFile.equals(filename)))) {
// fraud-access of this interface
- prop.putASIS("response", "denied");
+ prop.put("response", "denied");
sb.getLog().logFine("RankingTransmission: denied " + otherpeerName + " to send CR file " + filename + ": wrong access code");
} else {
sb.rankingPermissions.remove(accesscode); // not needed any more
@@ -140,19 +140,19 @@ public final class transfer {
serverFileUtils.write(filebytes, file);
String md5t = serverCodings.encodeMD5Hex(file);
if (md5t.equals(md5)) {
- prop.putASIS("response", "ok");
+ prop.put("response", "ok");
sb.getLog().logFine("RankingTransmission: received from peer " + otherpeerName + " CR file " + filename);
} else {
- prop.putASIS("response", "transfer failure");
+ prop.put("response", "transfer failure");
sb.getLog().logFine("RankingTransmission: transfer failure from peer " + otherpeerName + " for CR file " + filename);
}
}else{
//exploit?
- prop.putASIS("response", "io error");
+ prop.put("response", "io error");
return prop;
}
} catch (IOException e) {
- prop.putASIS("response", "io error");
+ prop.put("response", "io error");
}
}
}
diff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.java
index 7ff658500..e25f172d6 100644
--- a/htroot/yacy/transferRWI.java
+++ b/htroot/yacy/transferRWI.java
@@ -205,9 +205,9 @@ public final class transferRWI {
}
}
- prop.putASIS("unknownURL", new String(unknownURLs));
- prop.putASIS("result", result);
- prop.putASIS("pause", Integer.toString(pause));
+ prop.put("unknownURL", unknownURLs.toString());
+ prop.put("result", result);
+ prop.put("pause", pause);
// return rewrite properties
return prop;
diff --git a/htroot/yacy/transferURL.java b/htroot/yacy/transferURL.java
index 398073dff..e401ae8de 100644
--- a/htroot/yacy/transferURL.java
+++ b/htroot/yacy/transferURL.java
@@ -174,8 +174,8 @@ public final class transferURL {
result = "ok";
}
- prop.putASIS("double", doublevalues);
- prop.putASIS("result", result);
+ prop.put("double", doublevalues);
+ prop.put("result", result);
return prop;
}
}
diff --git a/htroot/yacy/urls.java b/htroot/yacy/urls.java
index aeef9377e..4229e5818 100644
--- a/htroot/yacy/urls.java
+++ b/htroot/yacy/urls.java
@@ -44,12 +44,12 @@ public class urls {
serverObjects prop = new serverObjects();
// insert default values
- prop.putASIS("iam", yacyCore.seedDB.mySeed().hash);
- prop.putASIS("response", "rejected - insufficient call parameters");
- prop.putASIS("channel_title", "");
- prop.putASIS("channel_description", "");
- prop.putASIS("channel_pubDate", "");
- prop.put("item", 0);
+ prop.put("iam", yacyCore.seedDB.mySeed().hash);
+ prop.put("response", "rejected - insufficient call parameters");
+ prop.put("channel_title", "");
+ prop.put("channel_description", "");
+ prop.put("channel_pubDate", "");
+ prop.put("item", "0");
if (post == null) return prop;
@@ -68,8 +68,8 @@ public class urls {
}
if (entry == null) break;
prop.put("item_" + c + "_title", "");
- prop.put("item_" + c + "_link", entry.url().toNormalform(true, false));
- prop.put("item_" + c + "_description", entry.name());
+ prop.putHTML("item_" + c + "_link", entry.url().toNormalform(true, false));
+ prop.putHTML("item_" + c + "_description", entry.name());
prop.put("item_" + c + "_author", "");
prop.put("item_" + c + "_pubDate", serverDate.shortSecondTime(entry.appdate()));
prop.put("item_" + c + "_guid", entry.url().hash());
@@ -77,7 +77,7 @@ public class urls {
count--;
}
prop.put("item", c);
- prop.put("response", "ok");
+ prop.putHTML("response", "ok");
}
// return rewrite properties
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index 745517e18..b157076b9 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -51,7 +51,6 @@ import java.net.MalformedURLException;
import java.util.HashMap;
import java.util.TreeSet;
-import de.anomic.data.htmlTools;
import de.anomic.http.httpHeader;
import de.anomic.index.indexURLEntry;
import de.anomic.kelondro.kelondroBitfield;
@@ -70,6 +69,7 @@ import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.logging.serverLog;
import de.anomic.tools.crypt;
+import de.anomic.tools.yFormatter;
import de.anomic.yacy.yacyCore;
import de.anomic.yacy.yacyNewsPool;
import de.anomic.yacy.yacyNewsRecord;
@@ -93,6 +93,7 @@ public class yacysearch {
// case if no values are requested
final String referer = (String) header.get("Referer");
String querystring = (post == null) ? "" : post.get("search", "").trim();
+ boolean rss = post.get("rss", "false").equals("true");
if ((post == null) || (env == null) || (querystring.length() == 0) || (!searchAllowed)) {
@@ -113,18 +114,18 @@ public class yacysearch {
// we create empty entries for template strings
final serverObjects prop = new serverObjects();
- prop.put("searchagain", 0);
+ prop.put("searchagain", "0");
prop.put("input", input);
prop.put("display", display);
prop.put("input_input", input);
prop.put("input_display", display);
- prop.putASIS("input_promoteSearchPageGreeting", promoteSearchPageGreeting);
+ prop.put("input_promoteSearchPageGreeting", promoteSearchPageGreeting);
prop.put("input_former", "");
prop.put("former", "");
- prop.put("input_count", 10);
- prop.put("input_offset", 0);
+ prop.put("input_count", "10");
+ prop.put("input_offset", "0");
prop.put("input_resource", "global");
- prop.put("input_time", 6);
+ prop.put("input_time", "6");
prop.put("input_urlmaskfilter", ".*");
prop.put("input_prefermaskfilter", "");
prop.put("input_indexof", "off");
@@ -132,15 +133,15 @@ public class yacysearch {
prop.put("input_cat", "href");
prop.put("input_depth", "0");
prop.put("input_contentdom", "text");
- prop.put("input_contentdomCheckText", 1);
- prop.put("input_contentdomCheckAudio", 0);
- prop.put("input_contentdomCheckVideo", 0);
- prop.put("input_contentdomCheckImage", 0);
- prop.put("input_contentdomCheckApp", 0);
- prop.put("excluded", 0);
+ prop.put("input_contentdomCheckText", "1");
+ prop.put("input_contentdomCheckAudio", "0");
+ prop.put("input_contentdomCheckVideo", "0");
+ prop.put("input_contentdomCheckImage", "0");
+ prop.put("input_contentdomCheckApp", "0");
+ prop.put("excluded", "0");
prop.put("results", "");
- prop.put("resultTable", 0);
- prop.put("num-results", (searchAllowed) ? 0 : 4);
+ prop.put("resultTable", "0");
+ prop.put("num-results", searchAllowed ? "0" : "4");
return prop;
}
@@ -318,11 +319,11 @@ public class yacysearch {
sb.localSearchTracker.put(client, handles);
prop = new serverObjects();
- prop.put("num-results_totalcount", theSearch.getLocalCount() + theSearch.getGlobalCount());
- prop.put("num-results_globalresults", 1);
- prop.put("num-results_globalresults_globalcount", theSearch.getGlobalCount());
+ prop.put("num-results_totalcount", yFormatter.number(theSearch.getLocalCount() + theSearch.getGlobalCount(), !rss));
+ prop.put("num-results_globalresults", "1");
+ prop.put("num-results_globalresults_globalcount", yFormatter.number(theSearch.getGlobalCount(), !rss));
prop.put("num-results_offset", offset);
- prop.put("num-results_linkcount", 0);
+ prop.put("num-results_linkcount", "0");
prop.put("num-results_itemsPerPage", itemsPerPage);
// compose page navigation
@@ -348,7 +349,7 @@ public class yacysearch {
resnav.append(navurla(thispage + 1, display, theQuery));
resnav.append("<strong>&gt;</strong></a>");
}
- prop.putASIS("num-results_resnav", resnav.toString());
+ prop.put("num-results_resnav", resnav.toString());
// generate the search result lines; they will be produced by another servlet
for (int i = 0; i < theQuery.displayResults(); i++) {
@@ -356,25 +357,25 @@ public class yacysearch {
prop.put("results_" + i + "_eventID", theQuery.id());
}
prop.put("results", theQuery.displayResults());
- prop.put("resultTable", (contentdomCode <= 1) ? 0 : 1);
+ prop.put("resultTable", (contentdomCode <= 1) ? "0" : "1");
prop.put("eventID", theQuery.id()); // for bottomline
// process result of search
if (filtered.size() > 0) {
- prop.put("excluded", 1);
- prop.put("excluded_stopwords", filtered.toString());
+ prop.put("excluded", "1");
+ prop.putHTML("excluded_stopwords", filtered.toString());
} else {
- prop.put("excluded", 0);
+ prop.put("excluded", "0");
}
if (prop == null || prop.size() == 0) {
if (post.get("search", "").length() < 3) {
- prop.put("num-results", 2); // no results - at least 3 chars
+ prop.put("num-results", "2"); // no results - at least 3 chars
} else {
- prop.put("num-results", 1); // no results
+ prop.put("num-results", "1"); // no results
}
} else {
- prop.put("num-results", 3);
+ prop.put("num-results", "3");
}
prop.put("input_cat", "href");
@@ -383,37 +384,36 @@ public class yacysearch {
// adding some additional properties needed for the rss feed
String hostName = (String) header.get("Host", "localhost");
if (hostName.indexOf(":") == -1) hostName += ":" + serverCore.getPortNr(env.getConfig("port", "8080"));
- prop.putASIS("searchBaseURL", "http://" + hostName + "/yacysearch.html");
- prop.putASIS("rssYacyImageURL", "http://" + hostName + "/env/grafics/yacy.gif");
+ prop.put("searchBaseURL", "http://" + hostName + "/yacysearch.html");
+ prop.put("rssYacyImageURL", "http://" + hostName + "/env/grafics/yacy.gif");
}
- prop.put("searchagain", (global) ? 1 : 0);
+ prop.put("searchagain", global ? "1" : "0");
prop.put("input", input);
prop.put("display", display);
prop.put("input_input", input);
prop.put("input_display", display);
- prop.putASIS("input_promoteSearchPageGreeting", promoteSearchPageGreeting);
- prop.put("input_former", querystring);
- prop.put("former", post.get("search", ""));
+ prop.put("input_promoteSearchPageGreeting", promoteSearchPageGreeting);
+ prop.putHTML("input_former", querystring);
+ //prop.put("former", post.get("search", ""));
prop.put("input_count", itemsPerPage);
prop.put("input_offset", offset);
- prop.put("input_resource", (global) ? "global" : "local");
+ prop.put("input_resource", global ? "global" : "local");
prop.put("input_time", searchtime / 1000);
- prop.put("input_urlmaskfilter", urlmask);
- prop.put("input_prefermaskfilter", prefermask);
+ prop.putHTML("input_urlmaskfilter", urlmask);
+ prop.putHTML("input_prefermaskfilter", prefermask);
prop.put("input_indexof", (indexof) ? "on" : "off");
prop.put("input_constraint", constraint.exportB64());
prop.put("input_contentdom", post.get("contentdom", "text"));
- prop.put("input_contentdomCheckText", (contentdomCode == plasmaSearchQuery.CONTENTDOM_TEXT) ? 1 : 0);
- prop.put("input_contentdomCheckAudio", (contentdomCode == plasmaSearchQuery.CONTENTDOM_AUDIO) ? 1 : 0);
- prop.put("input_contentdomCheckVideo", (contentdomCode == plasmaSearchQuery.CONTENTDOM_VIDEO) ? 1 : 0);
- prop.put("input_contentdomCheckImage", (contentdomCode == plasmaSearchQuery.CONTENTDOM_IMAGE) ? 1 : 0);
- prop.put("input_contentdomCheckApp", (contentdomCode == plasmaSearchQuery.CONTENTDOM_APP) ? 1 : 0);
+ prop.put("input_contentdomCheckText", (contentdomCode == plasmaSearchQuery.CONTENTDOM_TEXT) ? "1" : "0");
+ prop.put("input_contentdomCheckAudio", (contentdomCode == plasmaSearchQuery.CONTENTDOM_AUDIO) ? "1" : "0");
+ prop.put("input_contentdomCheckVideo", (contentdomCode == plasmaSearchQuery.CONTENTDOM_VIDEO) ? "1" : "0");
+ prop.put("input_contentdomCheckImage", (contentdomCode == plasmaSearchQuery.CONTENTDOM_IMAGE) ? "1" : "0");
+ prop.put("input_contentdomCheckApp", (contentdomCode == plasmaSearchQuery.CONTENTDOM_APP) ? "1" : "0");
// for RSS: don't HTML encode some elements
- String q = htmlTools.encodeUnicode2xml(post.get("search", ""));
- prop.putASIS("rss_query", q);
- prop.putASIS("rss_queryenc", yacyURL.escape(q.replace(' ', '+')));
+ prop.putHTML("rss_query", querystring, true);
+ prop.put("rss_queryenc", yacyURL.escape(querystring.replace(' ', '+')));
// return rewrite properties
return prop;
diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java
index ade2c2d4b..cb664456d 100644
--- a/htroot/yacysearchitem.java
+++ b/htroot/yacysearchitem.java
@@ -32,7 +32,6 @@ import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
-import de.anomic.data.htmlTools;
import de.anomic.http.httpHeader;
import de.anomic.kelondro.kelondroMSetTools;
import de.anomic.kelondro.kelondroNaturalOrder;
@@ -70,11 +69,11 @@ public class yacysearchitem {
int item = post.getInt("item", -1);
// default settings for blank item
- prop.put("content", 0);
- prop.put("rss", 0);
- prop.put("references", 0);
- prop.put("rssreferences", 0);
- prop.put("dynamic", 0);
+ prop.put("content", "0");
+ prop.put("rss", "0");
+ prop.put("references", "0");
+ prop.put("rssreferences", "0");
+ prop.put("dynamic", "0");
// find search event
plasmaSearchEvent theSearch = plasmaSearchEvent.getEvent(eventID);
@@ -91,7 +90,7 @@ public class yacysearchitem {
prop.put("dynamic_global", theSearch.getGlobalCount());
prop.put("dynamic_total", theSearch.getGlobalCount() + theSearch.getLocalCount());
prop.put("dynamic_items", (item < 0) ? theQuery.neededResults() : item + 1);
- prop.put("dynamic", 1);
+ prop.put("dynamic", "1");
}
if (bottomline) {
@@ -129,14 +128,14 @@ public class yacysearchitem {
while (iter.hasNext()) {
word = (String) iter.next();
if (word != null) {
- prop.put("rssreferences_words_" + hintcount + "_word", word);
+ prop.putHTML("rssreferences_words_" + hintcount + "_word", word);
}
prop.put("rssreferences_words", hintcount);
if (hintcount++ > MAX_TOPWORDS) {
break;
}
}
- prop.put("rssreferences", 1);
+ prop.put("rssreferences", "1");
} else {
String word;
int hintcount = 0;
@@ -144,10 +143,10 @@ public class yacysearchitem {
while (iter.hasNext()) {
word = (String) iter.next();
if (word != null) {
- prop.put("references_words_" + hintcount + "_word", word);
- prop.put("references_words_" + hintcount + "_newsearch", theQuery.queryString.replace(' ', '+') + "+" + word);
+ prop.putHTML("references_words_" + hintcount + "_word", word);
+ prop.putHTML("references_words_" + hintcount + "_newsearch", theQuery.queryString.replace(' ', '+') + "+" + word);
prop.put("references_words_" + hintcount + "_count", theQuery.displayResults());
- prop.put("references_words_" + hintcount + "_offset", 0);
+ prop.put("references_words_" + hintcount + "_offset", "0");
prop.put("references_words_" + hintcount + "_contentdom", theQuery.contentdom());
prop.put("references_words_" + hintcount + "_resource", theQuery.searchdom());
prop.put("references_words_" + hintcount + "_time", (theQuery.maximumTime / 1000));
@@ -157,7 +156,7 @@ public class yacysearchitem {
break;
}
}
- prop.put("references", 1);
+ prop.put("references", "1");
}
}
@@ -174,26 +173,26 @@ public class yacysearchitem {
if (rss) {
// text search for rss output
- prop.put("rss", 1); // switch on specific content
- prop.putASIS("rss_title", htmlTools.encodeUnicode2xml(result.title()));
- prop.putASIS("rss_description", htmlTools.encodeUnicode2xml(result.textSnippet().getLineRaw()));
- prop.put("rss_link", result.urlstring());
+ prop.put("rss", "1"); // switch on specific content
+ prop.putHTML("rss_title", result.title(), true);
+ prop.putHTML("rss_description", result.textSnippet().getLineRaw(), true);
+ prop.putHTML("rss_link", result.urlstring(), true);
prop.put("rss_urlhash", result.hash());
prop.put("rss_date", plasmaSwitchboard.dateString822(result.modified()));
return prop;
}
- prop.put("rss", 0);
+ prop.put("rss", "0");
if (theQuery.contentdom == plasmaSearchQuery.CONTENTDOM_TEXT) {
// text search
prop.put("content", theQuery.contentdom + 1); // switch on specific content
- prop.put("content_authorized", (authenticated) ? 1 : 0);
- prop.put("content_authorized_recommend", (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_ADD, "url", result.urlstring()) == null) ? 1 : 0);
+ prop.put("content_authorized", authenticated ? "1" : "0");
+ prop.put("content_authorized_recommend", (yacyCore.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_ADD, "url", result.urlstring()) == null) ? "1" : "0");
prop.put("content_authorized_recommend_deletelink", "/yacysearch.html?search=" + theQuery.queryString + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(ranking.toExternalString()) + "&resource=local&time=3&deleteref=" + result.hash() + "&urlmaskfilter=.*");
prop.put("content_authorized_recommend_recommendlink", "/yacysearch.html?search=" + theQuery.queryString + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(ranking.toExternalString()) + "&resource=local&time=3&recommendref=" + result.hash() + "&urlmaskfilter=.*");
prop.put("content_authorized_urlhash", result.hash());
- prop.put("content_description", result.title());
+ prop.putHTML("content_description", result.title());
prop.put("content_url", result.urlstring());
int port=result.url().getPort();
@@ -204,25 +203,25 @@ public class yacysearchitem {
faviconURL = null;
}
- prop.put("content_faviconCode", sb.licensedURLs.aquireLicense(faviconURL)); // aquire license for favicon url loading
+ prop.putHTML("content_faviconCode", sb.licensedURLs.aquireLicense(faviconURL)); // aquire license for favicon url loading
prop.put("content_urlhash", result.hash());
prop.put("content_urlhexhash", yacySeed.b64Hash2hexHash(result.hash()));
- prop.put("content_urlname", nxTools.shortenURLString(result.urlname(), urllength));
+ prop.putHTML("content_urlname", nxTools.shortenURLString(result.urlname(), urllength));
prop.put("content_date", plasmaSwitchboard.dateString(result.modified()));
prop.put("content_ybr", plasmaSearchPreOrder.ybr(result.hash()));
- prop.put("content_size", Long.toString(result.filesize()));
+ prop.putNum("content_size", result.filesize());
TreeSet[] query = theQuery.queryWords();
yacyURL wordURL = null;
try {
- prop.put("content_words", URLEncoder.encode(query[0].toString(),"UTF-8"));
+ prop.putHTML("content_words", URLEncoder.encode(query[0].toString(),"UTF-8"));
} catch (UnsupportedEncodingException e) {}
- prop.put("content_former", theQuery.queryString);
+ prop.putHTML("content_former", theQuery.queryString);
prop.put("content_rankingprops", result.word().toPropertyForm() + ", domLengthEstimated=" + yacyURL.domLengthEstimation(result.hash()) +
- ((yacyURL.probablyRootURL(result.hash())) ? ", probablyRootURL" : "") +
- (((wordURL = yacyURL.probablyWordURL(result.hash(), query[0])) != null) ? ", probablyWordURL=" + wordURL.toNormalform(false, true) : ""));
+ ((yacyURL.probablyRootURL(result.hash())) ? ", probablyRootURL" : "") +
+ (((wordURL = yacyURL.probablyWordURL(result.hash(), query[0])) != null) ? ", probablyWordURL=" + wordURL.toNormalform(false, true) : ""));
- prop.putASIS("content_snippet", result.textSnippet().getLineMarked(theQuery.queryHashes));
+ prop.put("content_snippet", result.textSnippet().getLineMarked(theQuery.queryHashes));
return prop;
}
@@ -238,15 +237,15 @@ public class yacysearchitem {
for (int i = 0; i < images.size(); i++) {
ms = (plasmaSnippetCache.MediaSnippet) images.get(i);
try {url = new yacyURL(ms.href, null);} catch (MalformedURLException e) {continue;}
- prop.put("content_items_" + i + "_href", ms.href);
+ prop.putHTML("content_items_" + i + "_href", ms.href);
prop.put("content_items_" + i + "_code", sb.licensedURLs.aquireLicense(url));
- prop.put("content_items_" + i + "_name", shorten(ms.name, namelength));
+ prop.putHTML("content_items_" + i + "_name", shorten(ms.name, namelength));
prop.put("content_items_" + i + "_attr", ms.attr); // attributes, here: original size of image
c++;
}
prop.put("content_items", c);
} else {
- prop.put("content_items", 0);
+ prop.put("content_items", "0");
}
return prop;
}
@@ -263,16 +262,16 @@ public class yacysearchitem {
int c = 0;
for (int i = 0; i < media.size(); i++) {
ms = (plasmaSnippetCache.MediaSnippet) media.get(i);
- prop.put("content_items_" + i + "_href", ms.href);
- prop.put("content_items_" + i + "_hrefshort", nxTools.shortenURLString(ms.href, urllength));
- prop.put("content_items_" + i + "_name", shorten(ms.name, namelength));
- prop.put("content_items_" + i + "_col", (col) ? 0 : 1);
+ prop.putHTML("content_items_" + i + "_href", ms.href);
+ prop.putHTML("content_items_" + i + "_hrefshort", nxTools.shortenURLString(ms.href, urllength));
+ prop.putHTML("content_items_" + i + "_name", shorten(ms.name, namelength));
+ prop.put("content_items_" + i + "_col", (col) ? "0" : "1");
c++;
col = !col;
}
prop.put("content_items", c);
} else {
- prop.put("content_items", 0);
+ prop.put("content_items", "0");
}
return prop;
}
diff --git a/source/de/anomic/data/htmlTools.java b/source/de/anomic/data/htmlTools.java
index f994d6621..0cced9e3c 100644
--- a/source/de/anomic/data/htmlTools.java
+++ b/source/de/anomic/data/htmlTools.java
@@ -1,3 +1,46 @@
+// htmlTools.java
+// -----------------------
+// (C) by Michael Peter Christen; [email protected],
+// (C) by Jan Sandbrink (NN), Franz Brausse (FB, karlchenofhell),
+// (C) by Bjoern 'fuchs' Krombholz (fuchsi)
+// first published on http://www.yacy.net
+//
+// $LastChangedDate: $
+// $LastChangedRevision: $
+// $LastChangedBy: $
+//
+// 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
+//
+// Using this software in any meaning (reading, learning, copying, compiling,
+// running) means that you agree that the Author(s) is (are) not responsible
+// for cost, loss of data or any harm that may be caused directly or indirectly
+// 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.
+//
+// Any changes to this file according to the GPL as documented in the file
+// gpl.txt aside this file in the shipment you received can be done to the
+// lines that follows this copyright notice here, but changes must not be
+// done inside the copyright notive above. A re-distribution must contain
+// the intact and unchanged copyright notice.
+// Contributions and changes to the program code must be marked as such.
package de.anomic.data;
public class htmlTools {
@@ -5,30 +48,42 @@ public class htmlTools {
/** Replaces characters in a string with other entities according to HTML standards.
* @param text a string that possibly contains special characters
* @param includingAmpersand if <code>false</code> ampersands are not encoded
+ * @param forXML if <code>true</code> then only &amp;, &quot;, &lt; and &gt; will
+ * be transcoded.
* @return the string with all characters replaced by the corresponding character from array
*/
- //[FB], changes by [MN], re-implemented by [MC]
- public static String encodeUnicode2html(String text, boolean includingAmpersand) {
- if (text == null) return null;
+ public static String encodeUnicode2html(String text, boolean includingAmpersand, boolean forXML) {
+ if (text == null)
+ return null;
+
int spos = (includingAmpersand ? 0 : 2);
- int epos = mapping.length;
+ // if (forXML), then only encode ampersand, quotation mark, less than and
+ // greather than which are the first 4 pairs in default mapping table
+ int epos = (forXML ? 8 : mapping.length);
return encode(text, mapping, spos, epos);
}
+
+ /**
+ * Like {@link #encodeUnicode2html(String, boolean, boolean)} with <code>forXML = false</code>
+ */
+ public static String encodeUnicode2html(String text, boolean includingAmpersand) {
+ return encodeUnicode2html(text, includingAmpersand, false);
+ }
+
/**
* Replaces special entities ampersand, quotation marks, and less than/graiter than
* by the escaping entities allowed in XML documents.
*
+ * Like {@link #encodeUnicode2html(String, boolean, boolean)} with
+ * <code>includingAmpersand = true</code> and <code>foxXML = true</code>.
+ *
* @param text the original String
* @return the encoded String
*/
public static String encodeUnicode2xml(String text) {
- if (text == null) return null;
- int spos = 0;
- int epos = 8;
-
- return encode(text, mapping, spos, epos);
+ return encodeUnicode2html(text, true, true);
}
/**
diff --git a/source/de/anomic/http/httpd.java b/source/de/anomic/http/httpd.java
index 8230391e8..855e401f7 100644
--- a/source/de/anomic/http/httpd.java
+++ b/source/de/anomic/http/httpd.java
@@ -757,7 +757,7 @@ public final class httpd implements serverHandler {
sep = argsString.indexOf("&");
if ((eqp <= 0) || (sep <= 0)) break;
// resulting equations are inserted into the property args with leading '&'
- args.putASIS(parseArg(argsString.substring(0, eqp)), parseArg(argsString.substring(eqp + 1, sep)));
+ args.put(parseArg(argsString.substring(0, eqp)), parseArg(argsString.substring(eqp + 1, sep)));
argsString = argsString.substring(sep + 1);
argc++;
}
@@ -965,12 +965,12 @@ public final class httpd implements serverHandler {
java.lang.System.arraycopy(buffer, pos, line, 0, q - pos);
// in the 'line' variable we have now either a normal value or an uploadef file
if (filename == null) {
- args.putASIS(new String(name, "UTF-8"), new String(line, "UTF-8"));
+ args.put(new String(name, "UTF-8"), new String(line, "UTF-8"));
} else {
// we store the file in a hashtable.
// we use the same key to address the file in the hashtable as we
// use to address the filename in the properties, but without leading '&'
- args.putASIS(new String(name, "UTF-8"), new String(filename, "UTF-8"));
+ args.put(new String(name, "UTF-8"), new String(filename, "UTF-8"));
files.put(new String(name, "UTF-8"), line);
}
argc++;
@@ -1172,7 +1172,7 @@ public final class httpd implements serverHandler {
switch (errorcase) {
case ERRORCASE_MESSAGE:
- tp.putASIS("errorMessageType_detailedErrorMsg", (detailedErrorMsgText == null) ? "" : detailedErrorMsgText.replaceAll("\n", "<br />"));
+ tp.put("errorMessageType_detailedErrorMsg", (detailedErrorMsgText == null) ? "" : detailedErrorMsgText.replaceAll("\n", "<br />"));
break;
case ERRORCASE_FILE:
tp.put("errorMessageType_file", (detailedErrorMsgFile == null) ? "" : detailedErrorMsgFile);
diff --git a/source/de/anomic/server/serverMemory.java b/source/de/anomic/server/serverMemory.java
index c4d7f1744..6db843e23 100644
--- a/source/de/anomic/server/serverMemory.java
+++ b/source/de/anomic/server/serverMemory.java
@@ -26,9 +26,8 @@
package de.anomic.server;
-import java.text.DecimalFormat;
-
import de.anomic.server.logging.serverLog;
+import de.anomic.tools.yFormatter;
public class serverMemory {
@@ -150,15 +149,14 @@ public class serverMemory {
try {
final StringBuffer byteString = new StringBuffer();
- final DecimalFormat df = new DecimalFormat( "0.00" );
if (byteCount > 1073741824) {
- byteString.append(df.format((double)byteCount / (double)1073741824 ))
+ byteString.append(yFormatter.number((double)byteCount / (double)1073741824 ))
.append(" GB");
} else if (byteCount > 1048576) {
- byteString.append(df.format((double)byteCount / (double)1048576))
+ byteString.append(yFormatter.number((double)byteCount / (double)1048576))
.append(" MB");
} else if (byteCount > 1024) {
- byteString.append(df.format((double)byteCount / (double)1024))
+ byteString.append(yFormatter.number((double)byteCount / (double)1024))
.append(" KB");
} else {
byteString.append(Long.toString(byteCount))
diff --git a/source/de/anomic/server/serverObjects.java b/source/de/anomic/server/serverObjects.java
index 68acaa273..9cdb4f8aa 100644
--- a/source/de/anomic/server/serverObjects.java
+++ b/source/de/anomic/server/serverObjects.java
@@ -1,299 +1,335 @@
-//serverObjects.java
-//-----------------------
-//(C) by Michael Peter Christen; [email protected]
-//first published on http://www.anomic.de
-//Frankfurt, Germany, 2004
-//last major change: 05.06.2004
-
-//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
-
-//Using this software in any meaning (reading, learning, copying, compiling,
-//running) means that you agree that the Author(s) is (are) not responsible
-//for cost, loss of data or any harm that may be caused directly or indirectly
-//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.
-
-//Any changes to this file according to the GPL as documented in the file
-//gpl.txt aside this file in the shipment you received can be done to the
-//lines that follows this copyright notice here, but changes must not be
-//done inside the copyright notive above. A re-distribution must contain
-//the intact and unchanged copyright notice.
-//Contributions and changes to the program code must be marked as such.
-
-/*
- Why do we need this Class?
- The purpose of this class is to provide a hashtable object to the server
- and implementing interfaces. Values to and from cgi pages are encapsulated in
- this object. The server shall be executable in a Java 1.0 environment,
- so the following other options did not comply:
-
- Properties - setProperty would be needed, but only available in 1.2
- HashMap, TreeMap - only in 1.2
- Hashtable - available in 1.0, but 'put' does not accept null values
-
- So this class was created as a convenience.
- It will also contain special methods that read data from internet-resources
- in the background, while data can already be read out of the object.
- This shall speed up usage when a slow internet connection is used (dial-up)
- */
-
-package de.anomic.server;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Map;
-
-import de.anomic.data.htmlTools;
-import de.anomic.plasma.plasmaSwitchboard;
-import de.anomic.tools.yFormatter;
-
-public class serverObjects extends Hashtable implements Cloneable {
-
- private static final long serialVersionUID = 1L;
-
- public serverObjects() {
- super();
- }
-
- public serverObjects(int initialCapacity) {
- super(initialCapacity);
- }
-
- public serverObjects(Map input) {
- super(input);
- }
-
- // new put takes also null values
- public Object put(Object key, Object value) {
- if (key == null) {
- // this does nothing
- return null;
- } else if (value == null) {
- // assigning the null value creates the same effect like removing the element
- return super.remove(key);
- } else {
- return super.put(key, value);
- }
- }
-
- /**
- * Add byte array to the map, value is kept as it is.
- * @param key key name as String.
- * @param value mapped value as a byte array.
- * @return the added value.
- */
- public byte[] put(String key, byte[] value) {
- return (byte[]) this.put((Object) key, (Object) value); //TODO: use wikiCode.replaceXMLEntities?!
- }
-
-
- /**
- * Add a String to the map. The content of the String is escaped to be usable in HTML output.
- * @param key key name as String.
- * @param value a String that will be reencoded for HTML output.
- * @return the modified String that was added to the map.
- * @see htmlTools#encodeUnicode2html(String, boolean)
- */
- public String put(String key, String value) {
- return (String) put((Object) key, (Object) htmlTools.encodeUnicode2html(value, true));
- }
-
- /**
- * Add an unformatted String representation of a double/float value
- * to the map.
- * @param key key name as String.
- * @param value value as double/float.
- * @return value as it was added to the map or <code>NaN</code> if an error occured.
- */
- public double put(String key, double value) {
- String ret = this.put(key, Double.toString(value));
- if (ret == null) {
- return Double.NaN;
- } else try {
- return Double.parseDouble(ret);
- } catch (NumberFormatException e) {
- return Double.NaN;
- }
- }
-
- /**
- * same as {@link #put(String, double)} but for integer types
- * @return Returns 0 for the error case.
- */
- public long put(String key, long value) {
- String result = this.put(key, Long.toString(value));
- if (result == null) {
- return 0;
- } else try {
- return Long.parseLong(result);
- } catch (NumberFormatException e) {
- return 0;
- }
- }
-
- /**
- * Add a byte/long/integer to the map. The number will be encoded into a String using
- * a localized format specified by {@link yFormatter}.
- * @param key key name as String.
- * @param value integer type value to be added to the map in its formatted String
- * representation.
- * @return the String value added to the map.
- */
- public String putNum(String key, long value) {
- return (String) this.put((Object) key, (Object) yFormatter.number(value));
- }
- /**
- * Variant for double/float types.
- * @see #putNum(String, long)
- */
- public String putNum(String key, double value) {
- return (String) this.put((Object) key, (Object) yFormatter.number(value));
- }
-
- // ASIS methods don't reencode the values before adding them to the map
- public byte[] putASIS(String key, byte[] value) {
- return (byte[]) this.put((Object) key, (Object) value);
- }
- public String putASIS(String key, String value) {
- return (String) this.put((Object) key, (Object) value);
- }
-
- public String putWiki(String key, String wikiCode){
- return this.putASIS(key, plasmaSwitchboard.wikiParser.transform(wikiCode));
- }
- public String putWiki(String key, byte[] wikiCode) {
- try {
- return this.putASIS(key, plasmaSwitchboard.wikiParser.transform(wikiCode));
- } catch (UnsupportedEncodingException e) {
- return this.putASIS(key, "Internal error pasting wiki-code: " + e.getMessage());
- }
- }
- public String putWiki(String key, String wikiCode, String publicAddress) {
- return this.putASIS(key, plasmaSwitchboard.wikiParser.transform(wikiCode, publicAddress));
- }
- public String putWiki(String key, byte[] wikiCode, String publicAddress) {
- try {
- return this.putASIS(key, plasmaSwitchboard.wikiParser.transform(wikiCode, "UTF-8", publicAddress));
- } catch (UnsupportedEncodingException e) {
- return this.putASIS(key, "Internal error pasting wiki-code: " + e.getMessage());
- }
- }
-
- // inc variant: for counters
- public long inc(String key) {
- String c = (String) super.get(key);
- if (c == null) c = "0";
- long l = Long.parseLong(c) + 1;
- super.put(key, Long.toString(l));
- return l;
- }
-
- // new get with default objects
- public Object get(String key, Object dflt) {
- Object result = super.get(key);
- if (result == null) return dflt; else return result;
- }
-
- // string variant
- public String get(String key, String dflt) {
- return (String) this.get(key, (Object) dflt);
- }
-
- public int getInt(String key, int dflt) {
- String s = (String) super.get(key);
- if (s == null) return dflt;
- try {
- return Integer.parseInt(s);
- } catch (NumberFormatException e) {
- return dflt;
- }
- }
-
- public long getLong(String key, long dflt) {
- String s = (String) super.get(key);
- if (s == null) return dflt;
- try {
- return Long.parseLong(s);
- } catch (NumberFormatException e) {
- return dflt;
- }
- }
-
- // returns a set of all values where their key mappes the keyMapper
- public String[] getAll(String keyMapper) {
- // the keyMapper may contain regular expressions as defined in String.matches
- // this method is particulary useful when parsing the result of checkbox forms
- ArrayList v = new ArrayList();
- Enumeration e = keys();
- String key;
- while (e.hasMoreElements()) {
- key = (String) e.nextElement();
- if (key.matches(keyMapper)) v.add(get(key));
- }
- // make a String[]
- String[] result = new String[v.size()];
- for (int i = 0; i < v.size(); i++) result[i] = (String) v.get(i);
- return result;
- }
-
- // put all elements of another hastable into the own table
- public void putAll(serverObjects add) {
- Enumeration e = add.keys();
- Object k;
- while (e.hasMoreElements()) {
- k = e.nextElement();
- put(k, add.get(k));
- }
- }
-
- // convenience methods for storing and loading to a file system
- public void store(File f) throws IOException {
- BufferedOutputStream fos = null;
- try {
- fos = new BufferedOutputStream(new FileOutputStream(f));
- Enumeration e = keys();
- String key, value;
- while (e.hasMoreElements()) {
- key = (String) e.nextElement();
- value = ((String) get(key)).replaceAll("\n", "\\\\n");
- fos.write((key + "=" + value + "\r\n").getBytes());
- }
- } finally {
- if (fos != null) {
- try {
- fos.flush();
- fos.close();
- } catch (Exception e){}
- }
- }
- }
-
- public Object clone() {
- return super.clone();
- }
-
-}
+//serverObjects.java
+//-----------------------
+//(C) by Michael Peter Christen; [email protected]
+//first published on http://www.anomic.de
+//Frankfurt, Germany, 2004
+//(C) changes by Bjoern 'fuchs' Krombholz
+//
+// $LastChangedDate: $
+// $LastChangedRevision: $
+// $LastChangedBy: $
+//
+//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
+
+//Using this software in any meaning (reading, learning, copying, compiling,
+//running) means that you agree that the Author(s) is (are) not responsible
+//for cost, loss of data or any harm that may be caused directly or indirectly
+//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.
+
+//Any changes to this file according to the GPL as documented in the file
+//gpl.txt aside this file in the shipment you received can be done to the
+//lines that follows this copyright notice here, but changes must not be
+//done inside the copyright notive above. A re-distribution must contain
+//the intact and unchanged copyright notice.
+//Contributions and changes to the program code must be marked as such.
+
+/*
+ Why do we need this Class?
+ The purpose of this class is to provide a hashtable object to the server
+ and implementing interfaces. Values to and from cgi pages are encapsulated in
+ this object. The server shall be executable in a Java 1.0 environment,
+ so the following other options did not comply:
+
+ Properties - setProperty would be needed, but only available in 1.2
+ HashMap, TreeMap - only in 1.2
+ Hashtable - available in 1.0, but 'put' does not accept null values
+
+ So this class was created as a convenience.
+ It will also contain special methods that read data from internet-resources
+ in the background, while data can already be read out of the object.
+ This shall speed up usage when a slow internet connection is used (dial-up)
+ */
+
+package de.anomic.server;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Map;
+
+import de.anomic.data.htmlTools;
+import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.tools.yFormatter;
+
+public class serverObjects extends Hashtable implements Cloneable {
+
+ private static final long serialVersionUID = 1L;
+ private boolean localized = true;
+
+ public serverObjects() {
+ super();
+ }
+
+ public serverObjects(int initialCapacity) {
+ super(initialCapacity);
+ }
+
+ public serverObjects(Map input) {
+ super(input);
+ }
+
+ /**
+ * Add a key-value pair of Objects to the map.
+ * @param key This method will do nothing if the key is <code>null</code>.
+ * @param value The value that should be mapped to the key.
+ * If value is <code>null</code>, then the element at <code>key</code>
+ * is removed from the map.
+ * @return The value that was added to the map.
+ * @see java.util.Hashtable#put(K, V)
+ */
+ public Object put(Object key, Object value) {
+ if (key == null) {
+ // this does nothing
+ return null;
+ } else if (value == null) {
+ // assigning the null value creates the same effect like removing the element
+ return super.remove(key);
+ } else {
+ return super.put(key, value);
+ }
+ }
+
+ /**
+ * This method just calls {@link #put(Object, Object)}.
+ */
+ public String put(String key, String value) {
+ return (String) this.put((Object) key, value);
+ }
+
+ /**
+ * Add byte array to the map, value is kept as it is.
+ * @param key key name as String.
+ * @param value mapped value as a byte array.
+ * @return the added value.
+ */
+ public byte[] put(String key, byte[] value) {
+ return (byte[]) this.put((Object) key, (Object) value); //TODO: do we need an encoding method for byte[]?
+ }
+
+ /**
+ * Add an unformatted String representation of a double/float value
+ * to the map.
+ * @param key key name as String.
+ * @param value value as double/float.
+ * @return value as it was added to the map or <code>NaN</code> if an error occured.
+ */
+ public double put(String key, double value) {
+ if (null == this.put(key, Double.toString(value))) {
+ return Double.NaN;
+ } else {
+ return value;
+ }
+ }
+
+ /**
+ * same as {@link #put(String, double)} but for integer types
+ * @return Returns 0 for the error case.
+ */
+ public long put(String key, long value) {
+ if (null == this.put(key, Long.toString(value))) {
+ return 0;
+ } else {
+ return value;
+ }
+ }
+
+ /**
+ * Add a String to the map. The content of the String is escaped to be usable in HTML output.
+ * @param key key name as String.
+ * @param value a String that will be reencoded for HTML output.
+ * @return the modified String that was added to the map.
+ * @see htmlTools#encodeUnicode2html(String, boolean)
+ */
+ public String putHTML(String key, String value) {
+ return putHTML(key, value, false);
+ }
+
+ /**
+ * Like {@link #putHTML(String, String)} but takes an extra argument defining, if the returned
+ * String should be used in normal HTML: <code>false</code>.
+ * If forXML is <code>true</code>, then only the characters <b>&amp; &quot; &lt; &gt;</b> will be
+ * replaced in the returned String.
+ */
+ public String putHTML(String key, String value, boolean forXML) {
+ return (String) put((Object) key, htmlTools.encodeUnicode2html(value, true, forXML));
+ }
+
+ /**
+ * Add a byte/long/integer to the map. The number will be encoded into a String using
+ * a localized format specified by {@link yFormatter} and {@link #setLocalized(boolean)}.
+ * @param key key name as String.
+ * @param value integer type value to be added to the map in its formatted String
+ * representation.
+ * @return the String value added to the map.
+ */
+ public String putNum(String key, long value) {
+ return (String) this.put((Object) key, yFormatter.number(value, this.localized));
+ }
+
+ /**
+ * Variant for double/float types.
+ * @see #putNum(String, long)
+ */
+ public String putNum(String key, double value) {
+ return (String) this.put((Object) key, yFormatter.number(value, this.localized));
+ }
+
+ /**
+ * Variant for string encoded numbers.
+ * @see #putNum(String, long)
+ */
+ public String putNum(String key, String value) {
+ return (String) this.put((Object) key, yFormatter.number(value));
+ }
+
+
+ public String putWiki(String key, String wikiCode){
+ return this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode));
+ }
+ public String putWiki(String key, byte[] wikiCode) {
+ try {
+ return this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode));
+ } catch (UnsupportedEncodingException e) {
+ return this.put(key, "Internal error pasting wiki-code: " + e.getMessage());
+ }
+ }
+ public String putWiki(String key, String wikiCode, String publicAddress) {
+ return this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode, publicAddress));
+ }
+ public String putWiki(String key, byte[] wikiCode, String publicAddress) {
+ try {
+ return this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode, "UTF-8", publicAddress));
+ } catch (UnsupportedEncodingException e) {
+ return this.put(key, "Internal error pasting wiki-code: " + e.getMessage());
+ }
+ }
+
+ // inc variant: for counters
+ public long inc(String key) {
+ String c = (String) super.get(key);
+ if (c == null) c = "0";
+ long l = Long.parseLong(c) + 1;
+ super.put(key, Long.toString(l));
+ return l;
+ }
+
+ // new get with default objects
+ public Object get(String key, Object dflt) {
+ Object result = super.get(key);
+ if (result == null) return dflt; else return result;
+ }
+
+ // string variant
+ public String get(String key, String dflt) {
+ return (String) this.get(key, (Object) dflt);
+ }
+
+ public int getInt(String key, int dflt) {
+ String s = (String) super.get(key);
+ if (s == null) return dflt;
+ try {
+ return Integer.parseInt(s);
+ } catch (NumberFormatException e) {
+ return dflt;
+ }
+ }
+
+ public long getLong(String key, long dflt) {
+ String s = (String) super.get(key);
+ if (s == null) return dflt;
+ try {
+ return Long.parseLong(s);
+ } catch (NumberFormatException e) {
+ return dflt;
+ }
+ }
+
+ // returns a set of all values where their key mappes the keyMapper
+ public String[] getAll(String keyMapper) {
+ // the keyMapper may contain regular expressions as defined in String.matches
+ // this method is particulary useful when parsing the result of checkbox forms
+ ArrayList v = new ArrayList();
+ Enumeration e = keys();
+ String key;
+ while (e.hasMoreElements()) {
+ key = (String) e.nextElement();
+ if (key.matches(keyMapper)) v.add(get(key));
+ }
+ // make a String[]
+ String[] result = new String[v.size()];
+ for (int i = 0; i < v.size(); i++) result[i] = (String) v.get(i);
+ return result;
+ }
+
+ // put all elements of another hastable into the own table
+ public void putAll(serverObjects add) {
+ Enumeration e = add.keys();
+ Object k;
+ while (e.hasMoreElements()) {
+ k = e.nextElement();
+ put(k, add.get(k));
+ }
+ }
+
+ // convenience methods for storing and loading to a file system
+ public void store(File f) throws IOException {
+ BufferedOutputStream fos = null;
+ try {
+ fos = new BufferedOutputStream(new FileOutputStream(f));
+ Enumeration e = keys();
+ String key, value;
+ while (e.hasMoreElements()) {
+ key = (String) e.nextElement();
+ value = ((String) get(key)).replaceAll("\n", "\\\\n");
+ fos.write((key + "=" + value + "\r\n").getBytes());
+ }
+ } finally {
+ if (fos != null) {
+ try {
+ fos.flush();
+ fos.close();
+ } catch (Exception e){}
+ }
+ }
+ }
+
+ /**
+ * Defines the localization state of this object.
+ * Currently it is used for numbers added with the putNum() methods only.
+ * @param loc if <code>true</code> store numbers in a localized format, otherwise
+ * use a default english locale without grouping.
+ * @see yFormatter#setLocale(String)
+ */
+ public void setLocalized(boolean loc) {
+ this.localized = loc;
+ }
+
+ public Object clone() {
+ return super.clone();
+ }
+
+}
diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.java
index aebeddadd..1ee0814cf 100644
--- a/source/de/anomic/yacy/yacyClient.java
+++ b/source/de/anomic/yacy/yacyClient.java
@@ -99,8 +99,8 @@ public final class yacyClient {
final serverObjects post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), null);
for (int retry = 0; retry < 3; retry++) try {
// generate request
- post.putASIS("count", "20");
- post.putASIS("seed", yacyCore.seedDB.mySeed().genSeedStr(post.get("key", "")));
+ post.put("count", "20");
+ post.put("seed", yacyCore.seedDB.mySeed().genSeedStr(post.get("key", "")));
yacyCore.log.logFine("yacyClient.publishMySeed thread '" + Thread.currentThread().getName() + "' contacting peer at " + address);
// send request
result = nxTools.table(
@@ -239,8 +239,8 @@ public final class yacyClient {
public static yacySeed querySeed(yacySeed target, String seedHash) {
// prepare request
final serverObjects post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), target.hash);
- post.putASIS("object", "seed");
- post.putASIS("env", seedHash);
+ post.put("object", "seed");
+ post.put("env", seedHash);
// send request
try {
@@ -268,9 +268,9 @@ public final class yacyClient {
public static int queryRWICount(yacySeed target, String wordHash) {
// prepare request
final serverObjects post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), target.hash);
- post.putASIS("object", "rwicount");
- post.putASIS("ttl", "0");
- post.putASIS("env", wordHash);
+ post.put("object", "rwicount");
+ post.put("ttl", "0");
+ post.put("env", wordHash);
// send request
try {
@@ -300,9 +300,9 @@ public final class yacyClient {
// prepare request
final serverObjects post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), target.hash);
- post.putASIS("object", "lurlcount");
- post.putASIS("ttl", "0");
- post.putASIS("env", "");
+ post.put("object", "lurlcount");
+ post.put("ttl", "0");
+ post.put("env", "");
// send request
try {
@@ -369,20 +369,20 @@ public final class yacyClient {
// prepare request
final serverObjects post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), target.hash);
- post.putASIS("myseed", yacyCore.seedDB.mySeed().genSeedStr(post.get("key", "")));
+ post.put("myseed", yacyCore.seedDB.mySeed().genSeedStr(post.get("key", "")));
post.put("count", Math.max(10, count));
- post.putASIS("resource", ((global) ? "global" : "local"));
+ post.put("resource", ((global) ? "global" : "local"));
post.put("partitions", partitions);
- post.putASIS("query", wordhashes);
- post.putASIS("exclude", excludehashes);
- post.putASIS("urls", urlhashes);
- post.putASIS("prefer", prefer);
- post.putASIS("filter", filter);
- post.putASIS("ttl", "0");
+ post.put("query", wordhashes);
+ post.put("exclude", excludehashes);
+ post.put("urls", urlhashes);
+ post.put("prefer", prefer);
+ post.put("filter", filter);
+ post.put("ttl", "0");
post.put("maxdist", maxDistance);
- post.putASIS("profile", crypt.simpleEncode(rankingProfile.toExternalString()));
- post.putASIS("constraint", constraint.exportB64());
- if (abstractCache != null) post.putASIS("abstracts", "auto");
+ post.put("profile", crypt.simpleEncode(rankingProfile.toExternalString()));
+ post.put("constraint", constraint.exportB64());
+ if (abstractCache != null) post.put("abstracts", "auto");
final long timestamp = System.currentTimeMillis();
// send request
@@ -588,7 +588,7 @@ public final class yacyClient {
// prepare request
final serverObjects post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), targetHash);
- post.putASIS("process", "permission");
+ post.put("process", "permission");
// send request
try {
@@ -616,13 +616,13 @@ public final class yacyClient {
// prepare request
final serverObjects post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), targetHash);
- post.putASIS("process", "post");
- post.putASIS("myseed", yacyCore.seedDB.mySeed().genSeedStr(post.get("key", "")));
- post.putASIS("subject", subject);
+ post.put("process", "post");
+ post.put("myseed", yacyCore.seedDB.mySeed().genSeedStr(post.get("key", "")));
+ post.put("subject", subject);
try {
- post.putASIS("message", new String(message, "UTF-8"));
+ post.put("message", new String(message, "UTF-8"));
} catch (UnsupportedEncodingException e) {
- post.putASIS("message", new String(message));
+ post.put("message", new String(message));
}
// send request
@@ -663,11 +663,11 @@ public final class yacyClient {
// prepare request
final serverObjects post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), null);
- post.putASIS("process", "permission");
- post.putASIS("purpose", "crcon");
- post.putASIS("filename", filename);
- post.putASIS("filesize", Long.toString(filesize));
- post.putASIS("can-send-protocol", "http");
+ post.put("process", "permission");
+ post.put("purpose", "crcon");
+ post.put("filename", filename);
+ post.put("filesize", Long.toString(filesize));
+ post.put("can-send-protocol", "http");
// send request
try {
@@ -695,12 +695,12 @@ public final class yacyClient {
// prepare request
final serverObjects post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), null);
- post.putASIS("process", "store");
- post.putASIS("purpose", "crcon");
- post.putASIS("filename", filename);
+ post.put("process", "store");
+ post.put("purpose", "crcon");
+ post.put("filename", filename);
post.put("filesize", Long.toString(file.length));
- post.putASIS("md5", serverCodings.encodeMD5Hex(file));
- post.putASIS("access", access);
+ post.put("md5", serverCodings.encodeMD5Hex(file));
+ post.put("access", access);
HashMap files = new HashMap();
files.put("filename", file);
@@ -761,18 +761,18 @@ public final class yacyClient {
// prepare request
final serverObjects post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), target.hash);
- post.putASIS("process", "crawl");
+ post.put("process", "crawl");
if (url.length == 1) {
- post.putASIS("url", crypt.simpleEncode(url[0].toNormalform(true, true)));
- post.putASIS("referrer", crypt.simpleEncode((referrer[0] == null) ? "" : referrer[0].toNormalform(true, true)));
+ post.put("url", crypt.simpleEncode(url[0].toNormalform(true, true)));
+ post.put("referrer", crypt.simpleEncode((referrer[0] == null) ? "" : referrer[0].toNormalform(true, true)));
} else {
for (int i=0; i< url.length; i++) {
- post.putASIS("url" + i, crypt.simpleEncode(url[i].toNormalform(true, true)));
- post.putASIS("ref" + i, crypt.simpleEncode((referrer[i] == null) ? "" : referrer[i].toNormalform(true, true)));
+ post.put("url" + i, crypt.simpleEncode(url[i].toNormalform(true, true)));
+ post.put("ref" + i, crypt.simpleEncode((referrer[i] == null) ? "" : referrer[i].toNormalform(true, true)));
}
}
- post.putASIS("depth", "0");
- post.putASIS("ttl", "0");
+ post.put("depth", "0");
+ post.put("ttl", "0");
// determining target address
final String address = target.getClusterAddress();
@@ -833,12 +833,12 @@ public final class yacyClient {
// prepare request
final serverObjects post = yacyNetwork.basicRequestPost(plasmaSwitchboard.getSwitchboard(), target.hash);
- post.putASIS("process", process);
- post.putASIS("urlhash", ((entry == null) ? "" : entry.hash()));
- post.putASIS("result", result);
- post.putASIS("reason", reason);
- post.putASIS("wordh", wordhashes);
- post.putASIS("lurlEntry", ((entry == null) ? "" : crypt.simpleEncode(entry.toString(), post.get("key", ""))));
+ post.put("process", process);
+ post.put("urlhash", ((entry == null) ? "" : entry.hash()));
+ post.put("result", result);
+ post.put("reason", reason);
+ post.put("wordh", wordhashes);
+ post.put("lurlEntry", ((entry == null) ? "" : crypt.simpleEncode(entry.toString(), post.get("key", ""))));
// determining target address
final String address = target.getClusterAddress();
@@ -963,7 +963,7 @@ public final class yacyClient {
// enabling gzip compression for post request body
if ((gzipBody) && (targetSeed.getVersion() >= yacyVersion.YACY_SUPPORTS_GZIP_POST_REQUESTS)) {
- post.putASIS(httpc.GZIP_POST_BODY,"true");
+ post.put(httpc.GZIP_POST_BODY,"true");
}
post.put("wordc", Integer.toString(indexes.length));
@@ -991,7 +991,7 @@ public final class yacyClient {
}
post.put("entryc", indexcount);
- post.putASIS("indexes", entrypost.toString());
+ post.put("indexes", entrypost.toString());
try {
final ArrayList v = nxTools.strings(
httpc.wput(
@@ -1029,7 +1029,7 @@ public final class yacyClient {
// enabling gzip compression for post request body
if ((gzipBody) && (targetSeed.getVersion() >= yacyVersion.YACY_SUPPORTS_GZIP_POST_REQUESTS)) {
- post.putASIS(httpc.GZIP_POST_BODY,"true");
+ post.put(httpc.GZIP_POST_BODY,"true");
}
String resource = "";
@@ -1039,7 +1039,7 @@ public final class yacyClient {
if (urls[i] != null) {
resource = urls[i].toString();
if (resource != null) {
- post.putASIS("url" + urlc, resource);
+ post.put("url" + urlc, resource);
urlPayloadSize += resource.length();
urlc++;
}