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
|
@ -66,7 +66,7 @@ final class RequestHandlers {
|
|||
public RequestHandlers(SolrCore core) {
|
||||
this.core = core;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the RequestHandler registered at the given name
|
||||
*/
|
||||
|
@ -74,6 +74,13 @@ final class RequestHandlers {
|
|||
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
|
||||
* called, the handler can immediately accept requests.
|
||||
|
|
|
@ -767,6 +767,10 @@ public final class SolrCore implements SolrInfoMBean {
|
|||
public SolrRequestHandler getRequestHandler(String handlerName) {
|
||||
return reqHandlers.get(handlerName);
|
||||
}
|
||||
|
||||
public SolrRequestHandler getRequestHandler(Class clazz) {
|
||||
return reqHandlers.get(clazz);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an unmodifieable Map containing the registered handlers
|
||||
|
|
|
@ -24,11 +24,12 @@
|
|||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.Collection" %>
|
||||
<%@ page import="org.apache.solr.request.SolrRequestHandler"%>
|
||||
<%@ page import="org.apache.solr.handler.ReplicationHandler" %>
|
||||
|
||||
<%-- jsp:include page="header.jsp"/ --%>
|
||||
<%-- do a verbatim include so we can use the local vars --%>
|
||||
<%@include file="header.jsp" %>
|
||||
<%SolrRequestHandler replicationhandler = core.getRequestHandler("/replication");%>
|
||||
<%SolrRequestHandler replicationhandler = core.getRequestHandler(ReplicationHandler.class);%>
|
||||
<br clear="all">
|
||||
<table>
|
||||
|
||||
|
|
|
@ -21,14 +21,14 @@
|
|||
org.apache.solr.request.LocalSolrQueryRequest,
|
||||
org.apache.solr.request.SolrQueryResponse,
|
||||
org.apache.solr.request.SolrRequestHandler"%>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<%@ page import="org.apache.solr.handler.ReplicationHandler" %>
|
||||
<%
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
%>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<%@include file="../_info.jsp" %>
|
||||
|
||||
<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 detailsMap = (NamedList)namedlist.get("details");
|
||||
if(detailsMap != null)
|
||||
|
|
Loading…
Reference in New Issue