fix for default boolean post values: the default value MUST NOT be TRUE,

because it's normal that a boolean value is missing in the post argument
if a checkbox is not selected.
Added also some style enhancements to IndexFederated, removed the Solr
attachment manual and replaced it with a link to the wiki which explains
this in more detail.
pull/1/head
Michael Peter Christen 11 years ago
parent 252c525709
commit 76afcccaaf

@ -65,7 +65,7 @@ public class AccessPicture_p {
color_grid = post.get("colorgrid", color_grid);
color_dot = post.get("colordot", color_dot);
color_line = post.get("colorline", color_line);
corona = !post.containsKey("corona") || post.getBoolean("corona", false);
corona = !post.containsKey("corona") || post.getBoolean("corona");
coronaangle = (corona) ? post.getInt("coronaangle", 0) : -1;
}
if (coronaangle < 0) corona = false;

@ -97,7 +97,7 @@ public class ConfigBasic {
boolean ssl;
if (post != null && post.getInt("port", 0) > 1023) {
port = post.getLong("port", 8090);
ssl = post.getBoolean("withssl", false);
ssl = post.getBoolean("withssl");
} else {
port = env.getConfigLong("port", 8090); //this allows a low port, but it will only get one, if the user edits the config himself.
ssl = env.getConfigBool("server.https", false);

@ -83,15 +83,15 @@ public class ConfigPortal {
sb.setConfig(SwitchboardConstants.SEARCH_ITEMS, post.getInt("maximumRecords", 10));
sb.setConfig(SwitchboardConstants.INDEX_FORWARD, post.get(SwitchboardConstants.INDEX_FORWARD, ""));
HTTPDFileHandler.indexForward = post.get(SwitchboardConstants.INDEX_FORWARD, "");
sb.setConfig("publicTopmenu", !post.containsKey("publicTopmenu") || post.getBoolean("publicTopmenu", true));
sb.setConfig("publicSearchpage", !post.containsKey("publicSearchpage") || post.getBoolean("publicSearchpage", true));
sb.setConfig("search.options", post.getBoolean("search.options", false));
sb.setConfig("publicTopmenu", !post.containsKey("publicTopmenu") || post.getBoolean("publicTopmenu"));
sb.setConfig("publicSearchpage", !post.containsKey("publicSearchpage") || post.getBoolean("publicSearchpage"));
sb.setConfig("search.options", post.getBoolean("search.options"));
sb.setConfig("interaction.userlogon.enabled", post.getBoolean("interaction.userlogon", false));
sb.setConfig(SwitchboardConstants.GREEDYLEARNING_ACTIVE, post.getBoolean(SwitchboardConstants.GREEDYLEARNING_ACTIVE, true));
sb.setConfig("interaction.userlogon.enabled", post.getBoolean("interaction.userlogon"));
sb.setConfig(SwitchboardConstants.GREEDYLEARNING_ACTIVE, post.getBoolean(SwitchboardConstants.GREEDYLEARNING_ACTIVE));
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY, post.get("search.verify", "ifexist"));
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY_DELETE, post.getBoolean("search.verify.delete", false));
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY_DELETE, post.getBoolean("search.verify.delete"));
sb.setConfig("about.headline", post.get("about.headline", ""));
sb.setConfig("about.body", post.get("about.body", ""));

@ -59,34 +59,34 @@ public class ConfigSearchPage_p {
// store this call as api call
sb.tables.recordAPICall(post, "ConfigPortal.html", WorkTables.TABLE_API_TYPE_CONFIGURATION, "new portal design. greeting: " + newGreeting);
sb.setConfig("publicTopmenu", post.getBoolean("publicTopmenu", false));
sb.setConfig("search.options", post.getBoolean("search.options", false));
sb.setConfig("search.text", post.getBoolean("search.text", false));
sb.setConfig("search.image", post.getBoolean("search.image", false));
sb.setConfig("search.audio", post.getBoolean("search.audio", false));
sb.setConfig("search.video", post.getBoolean("search.video", false));
sb.setConfig("search.app", post.getBoolean("search.app", false));
sb.setConfig("search.result.show.date", post.getBoolean("search.result.show.date", false));
sb.setConfig("search.result.show.size", post.getBoolean("search.result.show.size", false));
sb.setConfig("search.result.show.metadata", post.getBoolean("search.result.show.metadata", false));
sb.setConfig("search.result.show.parser", post.getBoolean("search.result.show.parser", false));
sb.setConfig("search.result.show.citation", post.getBoolean("search.result.show.citation", false));
sb.setConfig("search.result.show.pictures", post.getBoolean("search.result.show.pictures", false));
sb.setConfig("search.result.show.cache", post.getBoolean("search.result.show.cache", false));
sb.setConfig("search.result.show.proxy", post.getBoolean("search.result.show.proxy", false));
sb.setConfig("search.result.show.hostbrowser", post.getBoolean("search.result.show.hostbrowser", false));
sb.setConfig("search.result.show.tags", post.getBoolean("search.result.show.tags", false));
sb.setConfig("publicTopmenu", post.getBoolean("publicTopmenu"));
sb.setConfig("search.options", post.getBoolean("search.options"));
sb.setConfig("search.text", post.getBoolean("search.text"));
sb.setConfig("search.image", post.getBoolean("search.image"));
sb.setConfig("search.audio", post.getBoolean("search.audio"));
sb.setConfig("search.video", post.getBoolean("search.video"));
sb.setConfig("search.app", post.getBoolean("search.app"));
sb.setConfig("search.result.show.date", post.getBoolean("search.result.show.date"));
sb.setConfig("search.result.show.size", post.getBoolean("search.result.show.size"));
sb.setConfig("search.result.show.metadata", post.getBoolean("search.result.show.metadata"));
sb.setConfig("search.result.show.parser", post.getBoolean("search.result.show.parser"));
sb.setConfig("search.result.show.citation", post.getBoolean("search.result.show.citation"));
sb.setConfig("search.result.show.pictures", post.getBoolean("search.result.show.pictures"));
sb.setConfig("search.result.show.cache", post.getBoolean("search.result.show.cache"));
sb.setConfig("search.result.show.proxy", post.getBoolean("search.result.show.proxy"));
sb.setConfig("search.result.show.hostbrowser", post.getBoolean("search.result.show.hostbrowser"));
sb.setConfig("search.result.show.tags", post.getBoolean("search.result.show.tags"));
// construct navigation String
String nav = "";
if (post.getBoolean("search.navigation.filetype", false)) nav += "filetype,";
if (post.getBoolean("search.navigation.protocol", false)) nav += "protocol,";
if (post.getBoolean("search.navigation.hosts", false)) nav += "hosts,";
if (post.getBoolean("search.navigation.authors", false)) nav += "authors,";
if (post.getBoolean("search.navigation.namespace", false)) nav += "namespace,";
if (post.getBoolean("search.navigation.topics", false)) nav += "topics,";
if (post.getBoolean("search.navigation.filetype")) nav += "filetype,";
if (post.getBoolean("search.navigation.protocol")) nav += "protocol,";
if (post.getBoolean("search.navigation.hosts")) nav += "hosts,";
if (post.getBoolean("search.navigation.authors")) nav += "authors,";
if (post.getBoolean("search.navigation.namespace")) nav += "namespace,";
if (post.getBoolean("search.navigation.topics")) nav += "topics,";
if (nav.endsWith(",")) nav = nav.substring(0, nav.length() - 1);
sb.setConfig("search.navigation", nav);
}

@ -157,7 +157,7 @@ public class ConfigUpdate_p {
sb.setConfig("update.cycle", Math.max(12, post.getLong("cycle", 168)));
sb.setConfig("update.blacklist", post.get("blacklist", ""));
sb.setConfig("update.concept", ("any".equals(post.get("releaseType", "any"))) ? "any" : "main");
sb.setConfig("update.onlySignedFiles", (post.getBoolean("onlySignedFiles", true)) ? "1" : "0");
sb.setConfig("update.onlySignedFiles", (post.getBoolean("onlySignedFiles")) ? "1" : "0");
}
}

@ -61,7 +61,7 @@ public final class Connections_p {
// determines if name lookup should be done or not
final boolean doNameLookup;
if (post != null) {
doNameLookup = post.getBoolean("nameLookup", false);
doNameLookup = post.getBoolean("nameLookup");
if (post.containsKey("closeServerSession")) {
final String sessionName = post.get("closeServerSession", null);
sb.closeSessions(sessionName);

@ -171,7 +171,7 @@ public class Crawler_p {
long t = timeParser(true, post.getInt("deleteIfOlderNumber", -1), post.get("deleteIfOlderUnit","year")); // year, month, day, hour
if (t > 0) deleteageDate = new Date(t);
}
final boolean deleteold = (deleteage && deleteageDate != null) || (restrictedcrawl && post.getBoolean("deleteold", false));
final boolean deleteold = (deleteage && deleteageDate != null) || (restrictedcrawl && post.getBoolean("deleteold"));
String crawlingStart0 = post.get("crawlingURL","").trim(); // the crawljob start url
String[] rootURLs0 = crawlingStart0.indexOf('\n') > 0 || crawlingStart0.indexOf('\r') > 0 ? crawlingStart0.split("[\\r\\n]+") : crawlingStart0.split(Pattern.quote("|"));
@ -207,7 +207,7 @@ public class Crawler_p {
String ipMustMatch = post.get("ipMustmatch", CrawlProfile.MATCH_ALL_STRING);
final String ipMustNotMatch = post.get("ipMustnotmatch", CrawlProfile.MATCH_NEVER_STRING);
if (ipMustMatch.length() < 2) ipMustMatch = CrawlProfile.MATCH_ALL_STRING;
final String countryMustMatch = post.getBoolean("countryMustMatchSwitch", false) ? post.get("countryMustMatchList", "") : "";
final String countryMustMatch = post.getBoolean("countryMustMatchSwitch") ? post.get("countryMustMatchList", "") : "";
sb.setConfig("crawlingIPMustMatch", ipMustMatch);
sb.setConfig("crawlingIPMustNotMatch", ipMustNotMatch);
if (countryMustMatch.length() > 0) sb.setConfig("crawlingCountryMustMatch", countryMustMatch);

@ -228,7 +228,7 @@ public class HostBrowser {
delete = true;
}
int facetcount=post.getInt("facetcount", 0);
boolean complete = post.getBoolean("complete", false);
boolean complete = post.getBoolean("complete");
if (complete) { // we want only root paths for complete lists
p = path.indexOf('/', 10);
if (p > 0) path = path.substring(0, p + 1);

@ -21,12 +21,12 @@
Solr stores the main search index. It is the home of two cores, the default 'collection1' core for documents and the 'webgraph' core for a web structure graph. Detailed information about the used Solr fields can be edited in the <a href="/IndexSchema_p.html">Schema Editor</a>.
<dl>
<dt class="TableCellDark"><input type="checkbox" name="solr.indexing.lazy" id="solr.indexing.lazy" #(solr.indexing.lazy.checked)#:: checked="checked"#(/solr.indexing.lazy.checked)# /></dt>
<dd>Lazy Value Initialization. If checked, only non-zero values and non-empty strings are written to Solr fields.</dd>
<dt class="TableCellDark">Lazy Value Initialization&nbsp;<input type="checkbox" name="solr.indexing.lazy" id="solr.indexing.lazy" #(solr.indexing.lazy.checked)#:: checked="checked"#(/solr.indexing.lazy.checked)# /></dt>
<dd>If checked, only non-zero values and non-empty strings are written to Solr fields.</dd>
<dt>&nbsp;</dt><dd>&nbsp;</dd>
<dt>Use deep-embedded local Solr</dt>
<dd><input type="checkbox" name="core.service.fulltext" id="core_service_fulltext" #(core.service.fulltext.checked)#:: checked="checked"#(/core.service.fulltext.checked)# onclick="if(!document.getElementById('config').core_service_fulltext.checked) {document.getElementById('config').solr_indexing_solrremote.checked = true;}"/><br/>
<dt>Use deep-embedded local Solr&nbsp;<input type="checkbox" name="core.service.fulltext" id="core_service_fulltext" #(core.service.fulltext.checked)#:: checked="checked"#(/core.service.fulltext.checked)# onclick="if(!document.getElementById('config').core_service_fulltext.checked) {document.getElementById('config').solr_indexing_solrremote.checked = true;}"/></dt>
<dd>
This will write the YaCy-embedded Solr index which stored within the YaCy DATA directory.<br/>
The Solr native search interface is accessible at<br/>
<a href="/solr/select?q=*:*&start=0&rows=3&core=collection1">/solr/select?q=*:*&start=0&rows=3&core=collection1</a>
@ -34,12 +34,10 @@
<a href="/solr/select?q=*:*&start=0&rows=3&core=webgraph">/solr/select?q=*:*&start=0&rows=3&core=webgraph</a> for the webgraph core.<br/>
If you switch off this index, a remote Solr must be activated.</dd>
<dt><input type="submit" name="set" value="Set" /></dt><dd></dd>
<dt>Use remote Solr server(s)</dt>
<dd><input type="checkbox" name="solr.indexing.solrremote" id="solr_indexing_solrremote" #(solr.indexing.solrremote.checked)#:: checked="checked"#(/solr.indexing.solrremote.checked)# onclick="if(!document.getElementById('config').solr_indexing_solrremote.checked) {document.getElementById('config').core_service_fulltext.checked = true;}"/><br/>
Here you can define a single or a set of remote solr servers. If both, an internal and an external Solr is used, then both are mirrored.
That means, every write request goes to internal and external Solr, but a read request goes only to the internal index.
Only if the internal index does not give any result on a search request, also the remote is requested.</dd>
<dt>Use remote Solr server(s)&nbsp;<input type="checkbox" name="solr.indexing.solrremote" id="solr_indexing_solrremote" #(solr.indexing.solrremote.checked)#:: checked="checked"#(/solr.indexing.solrremote.checked)# onclick="if(!document.getElementById('config').solr_indexing_solrremote.checked) {document.getElementById('config').core_service_fulltext.checked = true;}"/></dt>
<dd>It's easy to <a href="http://www.yacy-websearch.net/wiki/index.php/Dev:Solr" target="_blank">attach an external Solr to YaCy</a>.
This external Solr can be used instead the internal Solr. It can also be used additionally to the internal Solr, then both Solr indexes are mirrored.
</dd>
#(table)#::
<dt class="TableCellDark">&nbsp;</dt>
@ -70,34 +68,14 @@
<dt class="TableCellDark"></dt>
<dd>Sharding Method<br/><input type="text" size="50" maxlength="50" value="#[solr.indexing.sharding]#" name="solr.indexing.sharding" id="solr.indexing.sharding" disabled="disabled"/></dd>
<dt><input type="submit" name="set" value="Set" /></dt><dd></dd>
<dt></dt><dd>
An <strong>external Solr installation</strong> is easily done following these steps (by example for Solr 4.1.0):
<ul>
<li>Download solr-4.1.0.tgz from http://lucene.apache.org/solr/</li>
<li>Decompress solr-4.1.0.tgz (with 'tar xfz solr-4.1.0.tgz') and put solr-4.1.0 into ~/</li>
<li>Consider that YaCy is already running and stored in ~/yacy/</li>
<li>To configure the multi-core configuration of YaCy, execute:<br>
<pre>mkdir ~/solr-4.1.0/example/solr/webgraph
cp -R ~/solr-4.1.0/example/solr/collection1/conf ~/solr-4.1.0/example/solr/webgraph/conf
~/yacy/bin/apicat.sh /api/schema.xml?core=collection1 > ~/solr-4.1.0/example/solr/collection1/conf/schema.xml
~/yacy/bin/apicat.sh /api/schema.xml?core=webgraph > ~/solr-4.1.0/example/solr/webgraph/conf/schema.xml</pre></li>
<li>edit ~/solr-4.1.0/example/solr/solr.xml and put in the following content:<br/>
<pre>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
&lt;solr persistent="true"&gt;
&lt;cores adminPath="/admin/cores" defaultCoreName="collection1"&gt;
&lt;core name="collection1" instanceDir="collection1" /&gt;
&lt;core name="webgraph" instanceDir="webgraph" /&gt;
&lt;/cores&gt;
&lt;/solr&gt;</pre></li>
<li>Finally, start the external Solr with:<br>
<pre>cd ~/solr-4.1.0/example/ && java -jar start.jar</pre></li>
<li>open <a href="http://localhost:8983/solr/">http://localhost:8983/solr/</a> to visit Solr's administration console.</li>
</ul>
<dt><input type="submit" name="setsolr" value="Set" /></dt><dd></dd>
</dd>
</dl>
</fieldset>
</form>
<form id="config" action="IndexFederated_p.html" method="get" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset>
<legend>
Web Structure Index
@ -111,11 +89,13 @@ cp -R ~/solr-4.1.0/example/solr/collection1/conf ~/solr-4.1.0/example/solr/webgr
<dt><input type="checkbox" name="core.service.webgraph.tmp" id="core_service_webgraph" #(core.service.webgraph.tmp.checked)#:: checked="checked"#(/core.service.webgraph.tmp.checked)# /></dt>
<dd>use webgraph search index (rich information in second Solr core)</dd>
<dt><input type="submit" name="set" value="Set" /></dt><dd></dd>
<dt><input type="submit" name="setcitation" value="Set" /></dt><dd></dd>
</dl>
</fieldset>
</form>
<!--
<form id="config" action="IndexFederated_p.html" method="get" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset>
<legend>
Content Semantics
@ -126,11 +106,13 @@ cp -R ~/solr-4.1.0/example/solr/collection1/conf ~/solr-4.1.0/example/solr/webgr
<dt><input type="checkbox" name="core.service.jena.tmp" id="core_service_jena" #(core.service.jena.tmp.checked)#:: checked="checked"#(/core.service.jena.tmp.checked)# /></dt>
<dd>write document metadata to the Jena index.</dd>
<dt><input type="submit" name="set" value="Set" /></dt><dd></dd>
<dt><input type="submit" name="setjena" value="Set" /></dt><dd></dd>
</dl>
</fieldset>
</form>
-->
<form id="config" action="IndexFederated_p.html" method="get" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset>
<legend>
Peer-to-Peer Operation
@ -141,7 +123,7 @@ cp -R ~/solr-4.1.0/example/solr/collection1/conf ~/solr-4.1.0/example/solr/webgr
<dt><input type="checkbox" name="core.service.rwi.tmp" id="core_service_rwi" #(core.service.rwi.tmp.checked)#:: checked="checked"#(/core.service.rwi.tmp.checked)# /></dt>
<dd>support peer-to-peer index transmission (DHT RWI index)</dd>
<dt><input type="submit" name="set" value="Set" /></dt><dd></dd>
<dt><input type="submit" name="setrwi" value="Set" /></dt><dd></dd>
</dl>
</fieldset>
</form>

@ -46,9 +46,9 @@ public class IndexFederated_p {
final serverObjects prop = new serverObjects();
final Switchboard sb = (Switchboard) env;
if (post != null && post.containsKey("set")) {
if (post != null && post.containsKey("setrwi")) {
//yacy
boolean post_core_rwi = post.getBoolean(SwitchboardConstants.CORE_SERVICE_RWI, false);
boolean post_core_rwi = post.getBoolean(SwitchboardConstants.CORE_SERVICE_RWI);
final boolean previous_core_rwi = sb.index.connectedRWI() && env.getConfigBool(SwitchboardConstants.CORE_SERVICE_RWI, false);
env.setConfig(SwitchboardConstants.CORE_SERVICE_RWI, post_core_rwi);
if (previous_core_rwi && !post_core_rwi) sb.index.disconnectRWI(); // switch off
@ -57,8 +57,10 @@ public class IndexFederated_p {
final long fileSizeMax = (OS.isWindows) ? sb.getConfigLong("filesize.max.win", Integer.MAX_VALUE) : sb.getConfigLong( "filesize.max.other", Integer.MAX_VALUE);
sb.index.connectRWI(wordCacheMaxCount, fileSizeMax);
} catch (final IOException e) { ConcurrentLog.logException(e); } // switch on
}
boolean post_core_citation = post.getBoolean(SwitchboardConstants.CORE_SERVICE_CITATION, false);
if (post != null && post.containsKey("setcitation")) {
boolean post_core_citation = post.getBoolean(SwitchboardConstants.CORE_SERVICE_CITATION);
final boolean previous_core_citation = sb.index.connectedCitation() && env.getConfigBool(SwitchboardConstants.CORE_SERVICE_CITATION, false);
env.setConfig(SwitchboardConstants.CORE_SERVICE_CITATION, post_core_citation);
if (previous_core_citation && !post_core_citation) sb.index.disconnectCitation(); // switch off
@ -67,8 +69,18 @@ public class IndexFederated_p {
final long fileSizeMax = (OS.isWindows) ? sb.getConfigLong("filesize.max.win", Integer.MAX_VALUE) : sb.getConfigLong( "filesize.max.other", Integer.MAX_VALUE);
sb.index.connectCitation(wordCacheMaxCount, fileSizeMax);
} catch (final IOException e) { ConcurrentLog.logException(e); } // switch on
boolean webgraph = post.getBoolean(SwitchboardConstants.CORE_SERVICE_WEBGRAPH);
sb.index.fulltext().writeWebgraph(webgraph);
env.setConfig(SwitchboardConstants.CORE_SERVICE_WEBGRAPH, webgraph);
}
if (post != null && post.containsKey("setjena")) {
boolean jena = post.getBoolean(SwitchboardConstants.CORE_SERVICE_JENA);
env.setConfig(SwitchboardConstants.CORE_SERVICE_JENA, jena);
}
boolean post_core_fulltext = post.getBoolean(SwitchboardConstants.CORE_SERVICE_FULLTEXT, true);
if (post != null && post.containsKey("setsolr")) {
boolean post_core_fulltext = post.getBoolean(SwitchboardConstants.CORE_SERVICE_FULLTEXT);
final boolean previous_core_fulltext = sb.index.fulltext().connectedLocalSolr() && env.getConfigBool(SwitchboardConstants.CORE_SERVICE_FULLTEXT, false);
env.setConfig(SwitchboardConstants.CORE_SERVICE_FULLTEXT, post_core_fulltext);
@ -83,17 +95,10 @@ public class IndexFederated_p {
try { sb.index.fulltext().connectLocalSolr(); } catch (final IOException e) { ConcurrentLog.logException(e); }
}
boolean webgraph = post.getBoolean(SwitchboardConstants.CORE_SERVICE_WEBGRAPH, false);
sb.index.fulltext().writeWebgraph(webgraph);
env.setConfig(SwitchboardConstants.CORE_SERVICE_WEBGRAPH, webgraph);
boolean jena = post.getBoolean(SwitchboardConstants.CORE_SERVICE_JENA, false);
env.setConfig(SwitchboardConstants.CORE_SERVICE_JENA, jena);
// solr
final boolean solrRemoteWasOn = sb.index.fulltext().connectedRemoteSolr() && env.getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED, true);
String solrurls = post.get("solr.indexing.url", env.getConfig(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_URL, "http://127.0.0.1:8983/solr"));
final boolean solrRemoteIsOnAfterwards = post.getBoolean("solr.indexing.solrremote", false) & solrurls.length() > 0;
final boolean solrRemoteIsOnAfterwards = post.getBoolean("solr.indexing.solrremote") & solrurls.length() > 0;
env.setConfig(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED, solrRemoteIsOnAfterwards);
final BufferedReader r = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(UTF8.getBytes(solrurls))));
final StringBuilder s = new StringBuilder();
@ -148,7 +153,7 @@ public class IndexFederated_p {
ConcurrentLog.severe("IndexFederated_p", "change of solr connection failed", e);
}
boolean lazy = post.getBoolean("solr.indexing.lazy", true);
boolean lazy = post.getBoolean("solr.indexing.lazy");
env.setConfig(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_LAZY, lazy);
}

@ -90,7 +90,7 @@ public class NetworkPicture
passiveLimit = post.getInt("pal", passiveLimit);
potentialLimit = post.getInt("pol", potentialLimit);
maxCount = post.getInt("max", maxCount);
corona = post.getBoolean("corona", true);
corona = post.getBoolean("corona");
coronaangle = (corona) ? post.getInt("coronaangle", 0) : -1;
communicationTimeout = post.getLong("ct", -1);
bgcolor = post.get("bgcolor", bgcolor);

@ -22,7 +22,7 @@ public class PeerLoadPicture {
if (post != null) {
width = post.getInt("width", 800);
height = post.getInt("height", 600);
showidle = post.getBoolean("showidle", false);
showidle = post.getBoolean("showidle");
}
final CircleThreadPiece idle = new CircleThreadPiece("Idle", new Color(170, 255, 170));

@ -102,11 +102,11 @@ public class Status
ByteCount.resetCount();
redirect = true;
} else if ( post.containsKey("popup") ) {
final boolean trigger_enabled = post.getBoolean("popup", false);
final boolean trigger_enabled = post.getBoolean("popup");
sb.setConfig("browserPopUpTrigger", trigger_enabled);
redirect = true;
} else if ( post.containsKey("tray") ) {
final boolean trigger_enabled = post.getBoolean("tray", false);
final boolean trigger_enabled = post.getBoolean("tray");
sb.setConfig("trayIcon", trigger_enabled);
redirect = true;
}

@ -65,7 +65,7 @@ public class Table_API_p {
startRecord = 0;
maximumRecords = 1000;
}
final boolean inline = (post != null && post.getBoolean("inline", false));
final boolean inline = (post != null && post.getBoolean("inline"));
prop.put("inline", (inline) ? 1 : 0);

@ -49,7 +49,7 @@ public class Threaddump_p {
final StringBuilder buffer = new StringBuilder(1000);
final boolean plain = post != null && post.getBoolean("plain", false);
final boolean plain = post != null && post.getBoolean("plain");
final int sleep = (post == null) ? 0 : post.getInt("sleep", 0); // a sleep before creation of a thread dump can be used for profiling
if (sleep > 0) try {Thread.sleep(sleep);} catch (final InterruptedException e) {}
prop.put("dump", "1");

@ -129,7 +129,7 @@ public class ViewFile {
// define an url by post parameter
url = new DigestURI(MultiProtocolURI.unescape(urlString));
urlHash = ASCII.String(url.hash());
pre = post.getBoolean("pre", false);
pre = post.getBoolean("pre");
} catch (final MalformedURLException e) {}
URIMetadataNode urlEntry = null;

@ -62,7 +62,7 @@ public class import_ymark {
boolean merge = false;
boolean empty = false;
final String indexing = post.get("indexing", "off");
final boolean medialink = post.getBoolean("medialink", false);
final boolean medialink = post.getBoolean("medialink");
if(post.containsKey("autotag") && !post.get("autotag", "off").equals("off")) {
autotag = true;

@ -44,7 +44,7 @@ public class opensearchdescription {
if (thisaddress.indexOf(':',0) == -1) thisaddress += ":" + serverCore.getPortNr(env.getConfig("port", "8090"));
int compareyacy = 0;
if (post != null && post.getBoolean("compare_yacy", false)) compareyacy = 1;
if (post != null && post.getBoolean("compare_yacy")) compareyacy = 1;
final serverObjects prop = new serverObjects();
prop.put("compareyacy", compareyacy);

@ -445,9 +445,18 @@ public class serverObjects implements Serializable, Cloneable {
}
}
public boolean getBoolean(final String key, final boolean dflt) {
/**
* get the boolean value of a post field
* DO NOT INTRODUCE A DEFAULT FIELD HERE,
* this is an application for html checkboxes which do not appear
* in the post if they are not selected.
* Therefore the default value MUST be always FALSE.
* @param key
* @return the boolean value of a field or false, if the field does not appear.
*/
public boolean getBoolean(final String key) {
String s = removeByteOrderMark(get(key));
if (s == null) return dflt;
if (s == null) return false;
s = s.toLowerCase();
return s.equals("true") || s.equals("on") || s.equals("1");
}

Loading…
Cancel
Save