Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

Fix a couple of multicore related issues in both index.jsp pages

Erik Hatcherd273c9a727bc
diff --git a/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java b/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
index 74fc7ba0398..4beecad549c 100644
--- a/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
+++ b/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
@@ -191,6 +191,8 @@ public class SolrDispatchFilter implements Filter
// By default use the single core. If multicore is enabled, look for one.
final SolrCore core;
if (multicore != null && multicore.isEnabled()) {
+ req.setAttribute("org.apache.solr.MultiCore", multicore);
+
// if this is the multi-core admin page, it will handle it
if( path.equals( multicore.getAdminPath() ) ) {
handler = multicore.getMultiCoreHandler();
@@ -296,8 +298,7 @@ public class SolrDispatchFilter implements Filter
// a servlet/jsp can retrieve it
else {
req.setAttribute("org.apache.solr.SolrCore", core);
- req.setAttribute("org.apache.solr.MultiCore", multicore);
- // Modify the request so each core gets its own /admin
+ // Modify the request so each core gets its own /admin
if( singlecore == null && path.startsWith( "/admin" ) ) {
req.getRequestDispatcher( pathPrefix == null ? path : pathPrefix + path ).forward( request, response );
return;
diff --git a/src/webapp/web/admin/index.jsp b/src/webapp/web/admin/index.jsp
index 8b88482aa8a..768fd148265 100644
--- a/src/webapp/web/admin/index.jsp
+++ b/src/webapp/web/admin/index.jsp
@@ -49,6 +49,7 @@
<%-- List the cores (that arent this one) so we can switch --%>
<% org.apache.solr.core.MultiCore multicore = (org.apache.solr.core.MultiCore)request.getAttribute("org.apache.solr.MultiCore");
+ if (multicore!=null) {
java.util.Collection<SolrCore> cores = multicore.getCores();
if (cores.size() > 1) {%><tr><td><strong>Cores:</strong><br></td><td><%
java.util.Iterator<SolrCore> icore = cores.iterator();
@@ -57,7 +58,7 @@ if (cores.size() > 1) {%><tr><td><strong>Cores:</strong><br></td><td><%
if (acore == core) continue;
%>[<a href="../../<%=acore.getName()%>/admin/"><%=acore.getName()%></a>]<%
}%></td></tr><%
-}%>
+}}%>
<tr>
<td>
diff --git a/src/webapp/web/index.jsp b/src/webapp/web/index.jsp
index a229c6d260d..502f8051c1b 100644
--- a/src/webapp/web/index.jsp
+++ b/src/webapp/web/index.jsp
@@ -29,9 +29,9 @@
<%
org.apache.solr.core.MultiCore multicore = (org.apache.solr.core.MultiCore)request.getAttribute("org.apache.solr.MultiCore");
- if( multicore.isEnabled() ) {
+ if(multicore != null && multicore.isEnabled() ) {
for( org.apache.solr.core.SolrCore core : multicore.getCores() ) {%>
-<a href="<%= core.getName() %>/admin/">Admin <%= core.getName() %> </a><br/>
+<a href="<%= core.getName() %>/admin/">Admin <%= core.getName() %></a><br/>
<% }} else { %>
<a href="admin/">Solr Admin</a>
<% } %>