yacy_search_server/htroot/api/config_p.java
orbiter 3197ca42ed preparations to move the HTCache into cora:
- move the header framework classes to cora
- move the ARC caching classes to cora
- refactoring of code to call these classes from cora

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7068 6c8d7289-2bf4-0310-a012-ef5d649a1542
2010-08-23 12:32:02 +00:00

56 lines
1.5 KiB
Java

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import net.yacy.cora.protocol.RequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class config_p {
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
//plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
final serverObjects prop = new serverObjects();
String key;
//change a Key
if(post != null && post.containsKey("key") && post.containsKey("value")){
key=post.get("key");
final String value=post.get("value");
if(!key.equals("")){
env.setConfig(key, value);
}
}
Iterator<String> keys = env.configKeys();
final List<String> list = new ArrayList<String>(250);
while(keys.hasNext()){
list.add(keys.next());
}
Collections.sort(list);
keys = list.iterator();
int count=0;
while(keys.hasNext()){
key = keys.next();
prop.putHTML("options_"+count+"_key", key);
prop.putHTML("options_"+count+"_value", env.getConfig(key, "ERROR"));
count++;
}
prop.put("options", count);
// return rewrite properties
return prop;
}
}