You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.5 KiB
55 lines
1.5 KiB
18 years ago
|
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.Collections;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.List;
|
||
|
|
||
16 years ago
|
import de.anomic.http.httpRequestHeader;
|
||
18 years ago
|
import de.anomic.server.serverObjects;
|
||
|
import de.anomic.server.serverSwitch;
|
||
|
|
||
|
public class config_p {
|
||
|
|
||
|
|
||
16 years ago
|
public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch<?> env) {
|
||
18 years ago
|
// return variable that accumulates replacements
|
||
|
//plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
|
||
17 years ago
|
final serverObjects prop = new serverObjects();
|
||
18 years ago
|
String key;
|
||
|
|
||
|
//change a Key
|
||
|
if(post != null && post.containsKey("key") && post.containsKey("value")){
|
||
17 years ago
|
key=post.get("key");
|
||
|
final String value=post.get("value");
|
||
18 years ago
|
if(!key.equals("")){
|
||
|
env.setConfig(key, value);
|
||
|
}
|
||
|
}
|
||
|
|
||
17 years ago
|
Iterator<String> keys = env.configKeys();
|
||
18 years ago
|
|
||
17 years ago
|
final List<String> list = new ArrayList<String>(250);
|
||
18 years ago
|
while(keys.hasNext()){
|
||
|
list.add(keys.next());
|
||
|
}
|
||
|
Collections.sort(list);
|
||
|
keys = list.iterator();
|
||
|
|
||
|
int count=0;
|
||
|
while(keys.hasNext()){
|
||
17 years ago
|
key = keys.next();
|
||
17 years ago
|
prop.putHTML("options_"+count+"_key", key);
|
||
|
prop.putHTML("options_"+count+"_value", env.getConfig(key, "ERROR"));
|
||
18 years ago
|
count++;
|
||
|
}
|
||
|
prop.put("options", count);
|
||
|
|
||
|
// return rewrite properties
|
||
|
return prop;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|