mirror of https://github.com/apache/lucene.git
SOLR-6533 implicit requesthandlers were not exposed
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1650000 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
88eb9719fa
commit
b7ddac884e
|
@ -40,6 +40,7 @@ import org.apache.solr.common.util.ContentStream;
|
||||||
import org.apache.solr.common.util.StrUtils;
|
import org.apache.solr.common.util.StrUtils;
|
||||||
import org.apache.solr.core.ConfigOverlay;
|
import org.apache.solr.core.ConfigOverlay;
|
||||||
import org.apache.solr.core.PluginInfo;
|
import org.apache.solr.core.PluginInfo;
|
||||||
|
import org.apache.solr.core.PluginsRegistry;
|
||||||
import org.apache.solr.core.RequestParams;
|
import org.apache.solr.core.RequestParams;
|
||||||
import org.apache.solr.core.SolrConfig;
|
import org.apache.solr.core.SolrConfig;
|
||||||
import org.apache.solr.core.SolrResourceLoader;
|
import org.apache.solr.core.SolrResourceLoader;
|
||||||
|
@ -99,7 +100,7 @@ public class SolrConfigHandler extends RequestHandlerBase {
|
||||||
|
|
||||||
private void handleGET() {
|
private void handleGET() {
|
||||||
if(parts.size() == 1) {
|
if(parts.size() == 1) {
|
||||||
resp.add("config", req.getCore().getSolrConfig().toMap());
|
resp.add("config", getConfigDetails());
|
||||||
} else {
|
} else {
|
||||||
if(ConfigOverlay.NAME.equals(parts.get(1))){
|
if(ConfigOverlay.NAME.equals(parts.get(1))){
|
||||||
resp.add(ConfigOverlay.NAME, req.getCore().getSolrConfig().getOverlay().toMap());
|
resp.add(ConfigOverlay.NAME, req.getCore().getSolrConfig().getOverlay().toMap());
|
||||||
|
@ -118,12 +119,27 @@ public class SolrConfigHandler extends RequestHandlerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Map<String, Object> m = req.getCore().getSolrConfig().toMap();
|
Map<String, Object> m = getConfigDetails();
|
||||||
resp.add("config", ZkNodeProps.makeMap(parts.get(1),m.get(parts.get(1))));
|
resp.add("config", ZkNodeProps.makeMap(parts.get(1),m.get(parts.get(1))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Map<String, Object> getConfigDetails() {
|
||||||
|
Map<String, Object> map = req.getCore().getSolrConfig().toMap();
|
||||||
|
Map reqHandlers = (Map) map.get(SolrRequestHandler.TYPE);
|
||||||
|
if(reqHandlers == null) map.put(SolrRequestHandler.TYPE, reqHandlers = new LinkedHashMap<>());
|
||||||
|
List<PluginInfo> plugins = PluginsRegistry.getHandlers(req.getCore());
|
||||||
|
for (PluginInfo plugin : plugins) {
|
||||||
|
if(SolrRequestHandler.TYPE.equals( plugin.type)){
|
||||||
|
if(!reqHandlers.containsKey(plugin.name)){
|
||||||
|
reqHandlers.put(plugin.name,plugin.toMap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void handlePOST() throws IOException {
|
private void handlePOST() throws IOException {
|
||||||
Iterable<ContentStream> streams = req.getContentStreams();
|
Iterable<ContentStream> streams = req.getContentStreams();
|
||||||
|
|
|
@ -96,6 +96,17 @@ public class TestSolrConfigHandler extends RestTestBase {
|
||||||
|
|
||||||
public void testProperty() throws Exception{
|
public void testProperty() throws Exception{
|
||||||
RestTestHarness harness = restTestHarness;
|
RestTestHarness harness = restTestHarness;
|
||||||
|
Map confMap = getRespMap("/config?wt=json" ,harness);
|
||||||
|
assertNotNull( getObjectByPath(confMap,false,Arrays.asList("config","requestHandler","/admin/luke")));
|
||||||
|
assertNotNull( getObjectByPath(confMap,false,Arrays.asList("config","requestHandler","/admin/system")));
|
||||||
|
assertNotNull( getObjectByPath(confMap,false,Arrays.asList("config","requestHandler","/admin/mbeans")));
|
||||||
|
assertNotNull( getObjectByPath(confMap,false,Arrays.asList("config","requestHandler","/admin/plugins")));
|
||||||
|
assertNotNull( getObjectByPath(confMap,false,Arrays.asList("config","requestHandler","/admin/threads")));
|
||||||
|
assertNotNull( getObjectByPath(confMap,false,Arrays.asList("config","requestHandler","/admin/properties")));
|
||||||
|
assertNotNull( getObjectByPath(confMap,false,Arrays.asList("config","requestHandler","/admin/logging")));
|
||||||
|
assertNotNull( getObjectByPath(confMap,false,Arrays.asList("config","requestHandler","/admin/file")));
|
||||||
|
assertNotNull( getObjectByPath(confMap,false,Arrays.asList("config","requestHandler","/admin/ping")));
|
||||||
|
|
||||||
String payload= "{\n" +
|
String payload= "{\n" +
|
||||||
" 'set-property' : { 'updateHandler.autoCommit.maxDocs':100, 'updateHandler.autoCommit.maxTime':10 } \n" +
|
" 'set-property' : { 'updateHandler.autoCommit.maxDocs':100, 'updateHandler.autoCommit.maxTime':10 } \n" +
|
||||||
" }";
|
" }";
|
||||||
|
|
Loading…
Reference in New Issue