mirror of https://github.com/apache/lucene.git
SOLR-1255 An attempt to visit the replication admin page when its not a defined handler should display an approp message
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@792861 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
da8dd622e3
commit
6457b52936
|
@ -74,6 +74,13 @@ final class RequestHandlers {
|
||||||
return handlers.get(normalize(handlerName));
|
return handlers.get(normalize(handlerName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SolrRequestHandler get(Class clazz) {
|
||||||
|
for (SolrRequestHandler requestHandler : handlers.values()) {
|
||||||
|
if(requestHandler.getClass() == clazz) return requestHandler;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handlers must be initialized before calling this function. As soon as this is
|
* Handlers must be initialized before calling this function. As soon as this is
|
||||||
* called, the handler can immediately accept requests.
|
* called, the handler can immediately accept requests.
|
||||||
|
|
|
@ -768,6 +768,10 @@ public final class SolrCore implements SolrInfoMBean {
|
||||||
return reqHandlers.get(handlerName);
|
return reqHandlers.get(handlerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SolrRequestHandler getRequestHandler(Class clazz) {
|
||||||
|
return reqHandlers.get(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an unmodifieable Map containing the registered handlers
|
* Returns an unmodifieable Map containing the registered handlers
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,11 +24,12 @@
|
||||||
<%@ page import="java.util.List" %>
|
<%@ page import="java.util.List" %>
|
||||||
<%@ page import="java.util.Collection" %>
|
<%@ page import="java.util.Collection" %>
|
||||||
<%@ page import="org.apache.solr.request.SolrRequestHandler"%>
|
<%@ page import="org.apache.solr.request.SolrRequestHandler"%>
|
||||||
|
<%@ page import="org.apache.solr.handler.ReplicationHandler" %>
|
||||||
|
|
||||||
<%-- jsp:include page="header.jsp"/ --%>
|
<%-- jsp:include page="header.jsp"/ --%>
|
||||||
<%-- do a verbatim include so we can use the local vars --%>
|
<%-- do a verbatim include so we can use the local vars --%>
|
||||||
<%@include file="header.jsp" %>
|
<%@include file="header.jsp" %>
|
||||||
<%SolrRequestHandler replicationhandler = core.getRequestHandler("/replication");%>
|
<%SolrRequestHandler replicationhandler = core.getRequestHandler(ReplicationHandler.class);%>
|
||||||
<br clear="all">
|
<br clear="all">
|
||||||
<table>
|
<table>
|
||||||
|
|
||||||
|
|
|
@ -21,14 +21,14 @@
|
||||||
org.apache.solr.request.LocalSolrQueryRequest,
|
org.apache.solr.request.LocalSolrQueryRequest,
|
||||||
org.apache.solr.request.SolrQueryResponse,
|
org.apache.solr.request.SolrQueryResponse,
|
||||||
org.apache.solr.request.SolrRequestHandler"%>
|
org.apache.solr.request.SolrRequestHandler"%>
|
||||||
|
<%@ page import="org.apache.solr.handler.ReplicationHandler" %>
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
|
|
||||||
<%
|
<%
|
||||||
request.setCharacterEncoding("UTF-8");
|
request.setCharacterEncoding("UTF-8");
|
||||||
%>
|
%>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
|
||||||
<%@include file="../_info.jsp" %>
|
<%@include file="../_info.jsp" %>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -55,7 +55,11 @@ public NamedList executeCommand(String command, SolrCore core, SolrRequestHandle
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<%
|
<%
|
||||||
final SolrRequestHandler rh = core.getRequestHandler("/replication");
|
final SolrRequestHandler rh = core.getRequestHandler(ReplicationHandler.class);
|
||||||
|
if(rh == null){
|
||||||
|
response.sendError( 404, "No ReplicationHandler registered" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
NamedList namedlist = executeCommand("details",core,rh);
|
NamedList namedlist = executeCommand("details",core,rh);
|
||||||
NamedList detailsMap = (NamedList)namedlist.get("details");
|
NamedList detailsMap = (NamedList)namedlist.get("details");
|
||||||
if(detailsMap != null)
|
if(detailsMap != null)
|
||||||
|
|
Loading…
Reference in New Issue