lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject svn commit: r792861 - in /lucene/solr/trunk/src: java/org/apache/solr/core/RequestHandlers.java java/org/apache/solr/core/SolrCore.java webapp/web/admin/index.jsp webapp/web/admin/replication/header.jsp
Date Fri, 10 Jul 2009 10:04:29 GMT
Author: noble
Date: Fri Jul 10 10:04:29 2009
New Revision: 792861

URL: http://svn.apache.org/viewvc?rev=792861&view=rev
Log:
SOLR-1255 An attempt to visit the replication admin page when its not a defined handler should
display an approp message

Modified:
    lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandlers.java
    lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java
    lucene/solr/trunk/src/webapp/web/admin/index.jsp
    lucene/solr/trunk/src/webapp/web/admin/replication/header.jsp

Modified: lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandlers.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandlers.java?rev=792861&r1=792860&r2=792861&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandlers.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandlers.java Fri Jul 10 10:04:29
2009
@@ -66,7 +66,7 @@
   public RequestHandlers(SolrCore core) {
       this.core = core;
   }
-  
+
   /**
    * @return the RequestHandler registered at the given name 
    */
@@ -74,6 +74,13 @@
     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.

Modified: lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java?rev=792861&r1=792860&r2=792861&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java Fri Jul 10 10:04:29 2009
@@ -767,6 +767,10 @@
   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

Modified: lucene/solr/trunk/src/webapp/web/admin/index.jsp
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/admin/index.jsp?rev=792861&r1=792860&r2=792861&view=diff
==============================================================================
--- lucene/solr/trunk/src/webapp/web/admin/index.jsp (original)
+++ lucene/solr/trunk/src/webapp/web/admin/index.jsp Fri Jul 10 10:04:29 2009
@@ -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>
 

Modified: lucene/solr/trunk/src/webapp/web/admin/replication/header.jsp
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/admin/replication/header.jsp?rev=792861&r1=792860&r2=792861&view=diff
==============================================================================
--- lucene/solr/trunk/src/webapp/web/admin/replication/header.jsp (original)
+++ lucene/solr/trunk/src/webapp/web/admin/replication/header.jsp Fri Jul 10 10:04:29 2009
@@ -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 @@
 %>
 
 <%
-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)



Mime
View raw message