Properties are maps, so they don't need special handling

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@533809 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2007-04-30 17:18:02 +00:00
parent 974b655b2c
commit 88a33e7427
1 changed files with 5 additions and 15 deletions

View File

@ -36,29 +36,19 @@ public class PropertiesRequestHandler extends RequestHandlerBase
@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws IOException
{
NamedList<String> props = null;
Object props = null;
String name = req.getParams().get( "name" );
if( name != null ) {
props = new SimpleOrderedMap<String>();
props.add( name, System.getProperty(name) );
NamedList<String> p = new SimpleOrderedMap<String>();
p.add( name, System.getProperty(name) );
props = p;
}
else {
props = toNamedList( System.getProperties() );
props = System.getProperties();
}
rsp.add( "system.properties", props );
}
public static NamedList<String> toNamedList( Properties p )
{
NamedList<String> props = new SimpleOrderedMap<String>();
java.util.Enumeration e = p.propertyNames();
while(e.hasMoreElements()) {
String prop = (String)e.nextElement();
props.add( prop, p.getProperty(prop) );
}
return props;
}
//////////////////////// SolrInfoMBeans methods //////////////////////
@Override