Apache Solr open-source search software
SOLR-350 -- dropping 'default' core usage and requiring the core name in the URL. Also fixes broken admin links (SOLR-441)
Ryan McKinley0841e7ea3343
diff --git a/client/java/solrj/src/org/apache/solr/client/solrj/SolrServer.java b/client/java/solrj/src/org/apache/solr/client/solrj/SolrServer.javaindex b3fe11e9525..3e7ca01ac4a 100644--- a/client/java/solrj/src/org/apache/solr/client/solrj/SolrServer.java+++ b/client/java/solrj/src/org/apache/solr/client/solrj/SolrServer.java@@ -37,6 +37,9 @@ public interface SolrServer// A general method to allow various methodsNamedList<Object> request( final SolrRequest request ) throws SolrServerException, IOException;+ void setDefaultCore( String core );+ String getDefaultCore();+// Standard methodsUpdateResponse add( SolrInputDocument doc ) throws SolrServerException, IOException;UpdateResponse add( Collection<SolrInputDocument> docs ) throws SolrServerException, IOException;diff --git a/client/java/solrj/src/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java b/client/java/solrj/src/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.javaindex 3dcf5117cd7..4ad3ee9de04 100644--- a/client/java/solrj/src/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java+++ b/client/java/solrj/src/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java@@ -96,19 +96,29 @@ public class EmbeddedSolrServer extends BaseSolrServerSolrCore core = this.core;MultiCore multicore = MultiCore.getRegistry();if( useMultiCore ) {+ String c = getDefaultCore();if( request.getCore() != null ) {+ c = request.getCore();+ }+ if( c != null ) {if( !multicore.isEnabled() ) {throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"multicore access is not enabled" );}- core = multicore.getCore( request.getCore() );+ if( c.length() > 0 ) {+ core = multicore.getCore( c );+ }+ else {+ core = multicore.getDefaultCore();+ }if( core == null ) {throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,- "Unknown core: "+request.getCore() );+ "Unknown core: "+c );}}else {- core = multicore.getDefaultCore();+ throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,+ "missing core" );}}diff --git a/client/java/solrj/src/org/apache/solr/client/solrj/impl/BaseSolrServer.java b/client/java/solrj/src/org/apache/solr/client/solrj/impl/BaseSolrServer.javaindex f65162a32dc..79edfe59371 100644--- a/client/java/solrj/src/org/apache/solr/client/solrj/impl/BaseSolrServer.java+++ b/client/java/solrj/src/org/apache/solr/client/solrj/impl/BaseSolrServer.java@@ -37,7 +37,9 @@ import org.apache.solr.common.params.SolrParams;* @version $Id$* @since solr 1.3*/-public abstract class BaseSolrServer implements SolrServer {+public abstract class BaseSolrServer implements SolrServer+{+ protected String defaultCore = null;public UpdateResponse add(Collection<SolrInputDocument> docs, boolean overwrite ) throws SolrServerException, IOException {UpdateRequest req = new UpdateRequest();@@ -98,4 +100,12 @@ public abstract class BaseSolrServer implements SolrServer {public QueryResponse query(SolrParams params) throws SolrServerException {return new QueryRequest( params ).process( this );}++ public String getDefaultCore() {+ return defaultCore;+ }++ public void setDefaultCore(String defaultCore) {+ this.defaultCore = defaultCore;+ }}diff --git a/client/java/solrj/src/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java b/client/java/solrj/src/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.javaindex 82f632c3641..3712c2e4f47 100644--- a/client/java/solrj/src/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java+++ b/client/java/solrj/src/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java@@ -121,8 +121,12 @@ public class CommonsHttpSolrServer extends BaseSolrServer}// modify the path for multicore access+ String core = getDefaultCore();if( request.getCore() != null ) {- path = "/@"+request.getCore()+path;+ core= request.getCore();+ }+ if( core != null && core.length() > 0 ) {+ path = "/"+core+path;}if( params == null ) {diff --git a/client/java/solrj/src/org/apache/solr/client/solrj/request/MultiCoreRequest.java b/client/java/solrj/src/org/apache/solr/client/solrj/request/MultiCoreRequest.javaindex f265b388b41..411a2daabaf 100644--- a/client/java/solrj/src/org/apache/solr/client/solrj/request/MultiCoreRequest.java+++ b/client/java/solrj/src/org/apache/solr/client/solrj/request/MultiCoreRequest.java@@ -49,11 +49,21 @@ public class MultiCoreRequest extends RequestBasesuper( METHOD.GET, path );}+ public final void setCoreParam( String v )+ {+ this.core = v;+ }+@Overridepublic final void setCore( String v ){- this.core = v;- // this does not change the path!+ throw new UnsupportedOperationException( "MultiCoreRequest does not use a core.");+ }++ @Override+ public final String getCore()+ {+ return ""; // force it to invalid core}//---------------------------------------------------------------------------------------@@ -100,18 +110,10 @@ public class MultiCoreRequest extends RequestBase////---------------------------------------------------------------------------------------- public static MultiCoreResponse setDefault( String name, SolrServer server ) throws SolrServerException, IOException- {- MultiCoreRequest req = new MultiCoreRequest();- req.setCore( name );- req.setAction( MultiCoreAction.SETASDEFAULT );- return req.process( server );- }-public static MultiCoreResponse reloadCore( String name, SolrServer server ) throws SolrServerException, IOException{MultiCoreRequest req = new MultiCoreRequest();- req.setCore( name );+ req.setCoreParam( name );req.setAction( MultiCoreAction.RELOAD );return req.process( server );}@@ -119,8 +121,8 @@ public class MultiCoreRequest extends RequestBasepublic static MultiCoreResponse getStatus( String name, SolrServer server ) throws SolrServerException, IOException{MultiCoreRequest req = new MultiCoreRequest();+ req.setCoreParam( name );req.setAction( MultiCoreAction.STATUS );- req.setCore( name );return req.process( server );}}diff --git a/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java b/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.javaindex 489aadd3819..1807a4bc719 100644--- a/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java+++ b/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java@@ -17,16 +17,12 @@package org.apache.solr.client.solrj;-import org.apache.solr.client.solrj.request.LukeRequest;import org.apache.solr.client.solrj.request.MultiCoreRequest;import org.apache.solr.client.solrj.request.QueryRequest;import org.apache.solr.client.solrj.request.UpdateRequest;import org.apache.solr.client.solrj.request.UpdateRequest.ACTION;-import org.apache.solr.client.solrj.response.LukeResponse;import org.apache.solr.client.solrj.response.MultiCoreResponse;import org.apache.solr.common.SolrInputDocument;-import org.apache.solr.common.params.SolrParams;-import org.apache.solr.common.util.NamedList;/**@@ -44,9 +40,6 @@ public abstract class MultiCoreExampleTestBase extends SolrExampleTestBasepublic void testMultiCore() throws Exception{SolrServer solr = getSolrServer();-- MultiCoreRequest.setDefault( "core1", solr );- MultiCoreRequest.setDefault( "core0", solr );UpdateRequest up = new UpdateRequest();up.setAction( ACTION.COMMIT, true, true );@@ -101,9 +94,11 @@ public abstract class MultiCoreExampleTestBase extends SolrExampleTestBaseassertEquals( 0, r.process( solr ).getResults().size() );// Now test Changing the default core+ solr.setDefaultCore( "core0" );assertEquals( 1, solr.query( new SolrQuery( "id:AAA" ) ).getResults().size() );assertEquals( 0, solr.query( new SolrQuery( "id:BBB" ) ).getResults().size() );- MultiCoreRequest.setDefault( "core1", solr );++ solr.setDefaultCore( "core1" );assertEquals( 0, solr.query( new SolrQuery( "id:AAA" ) ).getResults().size() );assertEquals( 1, solr.query( new SolrQuery( "id:BBB" ) ).getResults().size() );diff --git a/example/multicore/multicore.xml b/example/multicore/multicore.xmlindex 362ab042e6c..0a516e782a7 100644--- a/example/multicore/multicore.xml+++ b/example/multicore/multicore.xml@@ -27,6 +27,6 @@sharedLib: path to a lib files that will be shared across all cores--><multicore adminPath="/admin/multicore" persistent="true" >- <core name="core0" instanceDir="core0" default="true"/>- <core name="core1" instanceDir="core1" />+ <core name="core0" instanceDir="core0" default="true"/>+ <core name="core1" instanceDir="core1" /></multicore>diff --git a/src/java/org/apache/solr/common/params/MultiCoreParams.java b/src/java/org/apache/solr/common/params/MultiCoreParams.javaindex c6c96cafc8b..a6f91da1348 100644--- a/src/java/org/apache/solr/common/params/MultiCoreParams.java+++ b/src/java/org/apache/solr/common/params/MultiCoreParams.java@@ -28,6 +28,9 @@ public interface MultiCoreParams/** Persistent -- should it save the multicore state? **/public final static String PERSISTENT = "persistent";++ /** The name of the the core to swap names with **/+ public final static String WITH = "with";/** What action **/public final static String ACTION = "action";@@ -37,7 +40,7 @@ public interface MultiCoreParamsLOAD,UNLOAD,RELOAD,- SETASDEFAULT;+ SWAP;public static MultiCoreAction get( String p ){diff --git a/src/java/org/apache/solr/core/MultiCore.java b/src/java/org/apache/solr/core/MultiCore.javaindex d60e46d3e46..b5226c862ce 100644--- a/src/java/org/apache/solr/core/MultiCore.java+++ b/src/java/org/apache/solr/core/MultiCore.java@@ -20,7 +20,6 @@ package org.apache.solr.core;import java.io.File;import java.io.FileInputStream;import java.io.IOException;-import java.util.ArrayList;import java.util.Collection;import java.util.Collections;import java.util.HashMap;@@ -125,7 +124,7 @@ public class MultiCore"multicore.xml defines multiple default cores. "+getDefaultCore().getName() + " and " + core.getName() );}- this.setDefaultCore( core );+ defaultCore = core;hasDefault = true;}}@@ -171,9 +170,13 @@ public class MultiCorethrow new RuntimeException( "Can not register a null core." );}String name = core.getName();- if( name == null || name.length() == 0 ) {- throw new RuntimeException( "Invalid core name." );+ if( name == null ||+ name.length() < 1 ||+ name.indexOf( '/' ) >= 0 ||+ name.indexOf( '\\' ) >= 0 ){+ throw new RuntimeException( "Invalid core name: "+name );}+SolrCore old = cores.put(name, core);if( old == null ) {log.info( "registering core: "+name );@@ -183,6 +186,21 @@ public class MultiCorereturn old;}+ public void swap(SolrCore c0, SolrCore c1) {+ if( c0 == null || c1 == null ) {+ throw new RuntimeException( "Can not swap a null core." );+ }+ synchronized( cores ) {+ String n0 = c0.getName();+ String n1 = c1.getName();+ cores.put(n0, c1);+ cores.put(n1, c0);+ c0.setName( n1 );+ c1.setName( n0 );+ }+ log.info( "swaped: "+c0.getName() + " with " + c1.getName() );+ }+/*** While the new core is loading, requests will continue to be dispatched to* and processed by the old core@@ -194,28 +212,21 @@ public class MultiCore*/public void reload(SolrCore core) throws ParserConfigurationException, IOException, SAXException{- boolean wasDefault = (core==defaultCore);-SolrResourceLoader loader = new SolrResourceLoader( core.getResourceLoader().getInstanceDir() );SolrConfig config = new SolrConfig( loader, core.getConfigFile(), null );IndexSchema schema = new IndexSchema( config, core.getSchemaFile() );SolrCore loaded = new SolrCore( core.getName(), core.getDataDir(), config, schema );this.register( loaded );- if( wasDefault ) {- this.setDefaultCore( loaded );- }// TODO? -- add some kind of hook to close the core after all references are// gone... is finalize() enough?}-- public void setDefaultCore( SolrCore core )++ public void remove( String name ){- defaultCore = core;- cores.put( null, core );- cores.put( "", core );+ cores.remove( name );}-+public SolrCore getDefaultCore() {return defaultCore;}@@ -224,13 +235,7 @@ public class MultiCore* @return a Collection of registered SolrCores*/public Collection<SolrCore> getCores() {- ArrayList<SolrCore> c = new ArrayList<SolrCore>(cores.size());- for( Map.Entry<String, SolrCore> entry : cores.entrySet() ) {- if( entry.getKey() != null && entry.getKey().length() > 0 ) {- c.add( entry.getValue() );- }- }- return c;+ return cores.values();}public SolrCore getCore(String name) {@@ -268,5 +273,4 @@ public class MultiCorepublic File getConfigFile() {return configFile;}-}diff --git a/src/java/org/apache/solr/core/SolrCore.java b/src/java/org/apache/solr/core/SolrCore.javaindex 73323a377f6..0dbfaf3f952 100644--- a/src/java/org/apache/solr/core/SolrCore.java+++ b/src/java/org/apache/solr/core/SolrCore.java@@ -83,7 +83,7 @@ public final class SolrCore {public static Logger log = Logger.getLogger(SolrCore.class.getName());- private final String name;+ private String name;private final SolrConfig solrConfig;private final IndexSchema schema;private final String dataDir;@@ -136,6 +136,10 @@ public final class SolrCore {public String getName() {return name;}++ public void setName(String v) {+ this.name = v;+ }/*** @since solr 1.3diff --git a/src/java/org/apache/solr/handler/admin/MultiCoreHandler.java b/src/java/org/apache/solr/handler/admin/MultiCoreHandler.javaindex e1a92b2e018..75189fdaf63 100644--- a/src/java/org/apache/solr/handler/admin/MultiCoreHandler.java+++ b/src/java/org/apache/solr/handler/admin/MultiCoreHandler.java@@ -67,6 +67,7 @@ public class MultiCoreHandler extends RequestHandlerBase// Pick the actionSolrParams params = req.getParams();+ SolrParams required = params.required();MultiCoreAction action = MultiCoreAction.STATUS;String a = params.get( MultiCoreParams.ACTION );if( a != null ) {@@ -109,15 +110,22 @@ public class MultiCoreHandler extends RequestHandlerBase}else {switch( action ) {- case SETASDEFAULT:- manager.setDefaultCore( core );- rsp.add( "default", core.getName() );- break;-+case RELOAD: {manager.reload( core );break;}++ case SWAP: {+ String name = required.get( MultiCoreParams.WITH );+ SolrCore swap = manager.getCore( name );+ if( swap == null ) {+ throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,+ "Unknown core: "+name );+ }+ manager.swap( core, swap );+ break;+ }default:throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,diff --git a/src/webapp/resources/admin/_info.jsp b/src/webapp/resources/admin/_info.jspindex 3b60f8eccbe..58362e2a3c0 100644--- a/src/webapp/resources/admin/_info.jsp+++ b/src/webapp/resources/admin/_info.jsp@@ -28,10 +28,6 @@<%//SolrCore core = (SolrCore) request.getAttribute("org.apache.solr.SolrCore");- if (core == null) {- String coreParam = request.getParameter("core");- core = coreParam != null? org.apache.solr.core.MultiCore.getRegistry().getCore(coreParam) : null;- }if (core == null)core = SolrCore.getSolrCore();diff --git a/src/webapp/resources/admin/action.jsp b/src/webapp/resources/admin/action.jspindex 056e26b5f3f..978c5303a2e 100644--- a/src/webapp/resources/admin/action.jsp+++ b/src/webapp/resources/admin/action.jsp@@ -111,6 +111,6 @@</tr></table><br><br>- <a href=".?core=<%=core.getName()%>">Return to Admin Page</a>+ <a href=".">Return to Admin Page</a></body></html>diff --git a/src/webapp/resources/admin/analysis.jsp b/src/webapp/resources/admin/analysis.jspindex 77d2208febf..a1536efbb70 100644--- a/src/webapp/resources/admin/analysis.jsp+++ b/src/webapp/resources/admin/analysis.jsp@@ -60,7 +60,6 @@<h2>Field Analysis</h2><form method="GET" action="analysis.jsp">-<input type='hidden' name='core' value='<%=core.getName()%>'><table><tr><td>diff --git a/src/webapp/resources/admin/distributiondump.jsp b/src/webapp/resources/admin/distributiondump.jspindex 4d205a323f8..71cb41680e0 100644--- a/src/webapp/resources/admin/distributiondump.jsp+++ b/src/webapp/resources/admin/distributiondump.jsp@@ -153,6 +153,6 @@<%= buffer %></table><br><br>- <a href=".?<%=core.getName()%>">Return to Admin Page</a>+ <a href=".">Return to Admin Page</a></body></html>diff --git a/src/webapp/resources/admin/form.jsp b/src/webapp/resources/admin/form.jspindex e34e1c7d655..88877f7c9e0 100644--- a/src/webapp/resources/admin/form.jsp+++ b/src/webapp/resources/admin/form.jsp@@ -19,7 +19,6 @@<br clear="all"><form name="queryForm" method="GET" action="../select">-<input name='core' type='hidden' value='<%=core.getName()%>'><!-- these are good defaults to have if people bookmark the resultingURLs, but they should not show up in the form since they are veryoutput type specific.diff --git a/src/webapp/resources/admin/header.jsp b/src/webapp/resources/admin/header.jspindex 9110d443bae..6b615477451 100644--- a/src/webapp/resources/admin/header.jsp+++ b/src/webapp/resources/admin/header.jsp@@ -29,7 +29,7 @@ var host_name="<%= hostname %>"</head><body>-<a href="?core=<%=core.getName()%>"><img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="Solr"></a>+<a href="."><img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="Solr"></a><h1>Solr Admin (<%= collectionName %>)<%= enabledStatus==null ? "" : (isEnabled ? " - Enabled" : " - Disabled") %> </h1>diff --git a/src/webapp/resources/admin/index.jsp b/src/webapp/resources/admin/index.jspindex 982c1c5edf6..e8012991926 100644--- a/src/webapp/resources/admin/index.jsp+++ b/src/webapp/resources/admin/index.jsp@@ -34,15 +34,15 @@<h3>Solr</h3></td><td>- [<a href="get-file.jsp?core=<%=core.getName()%>&file=<%=core.getSchemaFile()%>">Schema</a>]- [<a href="get-file.jsp?core=<%=core.getName()%>&file=<%=core.getConfigFile()%>">Config</a>]- [<a href="analysis.jsp?core=<%=core.getName()%>&highlight=on">Analysis</a>]+ [<a href="get-file.jsp?file=<%=core.getSchemaFile()%>">Schema</a>]+ [<a href="get-file.jsp?file=<%=core.getConfigFile()%>">Config</a>]+ [<a href="analysis.jsp?highlight=on">Analysis</a>]<br>- [<a href="stats.jsp?core=<%=core.getName()%>">Statistics</a>]- [<a href="registry.jsp?core=<%=core.getName()%>">Info</a>]- [<a href="distributiondump.jsp?core=<%=core.getName()%>">Distribution</a>]- [<a href="ping?core=<%=core.getName()%>">Ping</a>]- [<a href="logging.jsp?core=<%=core.getName()%>">Logging</a>]+ [<a href="stats.jsp">Statistics</a>]+ [<a href="registry.jsp">Info</a>]+ [<a href="distributiondump.jsp">Distribution</a>]+ [<a href="ping">Ping</a>]+ [<a href="logging.jsp">Logging</a>]</td></tr>@@ -53,7 +53,7 @@ if (cores.size() > 1) {%><tr><td><strong>Cores:</strong><br></td><td><%while (icore.hasNext()) {SolrCore acore = icore.next();if (acore == core) continue;- %>[<a href=".?core=<%=acore.getName()%>"><%=acore.getName()%></a>]<%+ %>[<a href="../../<%=acore.getName()%>/admin/"><%=acore.getName()%></a>]<%}%></td></tr><%}%>@@ -62,17 +62,17 @@ if (cores.size() > 1) {%><tr><td><strong>Cores:</strong><br></td><td><%<strong>App server:</strong><br></td><td>- [<a href="get-properties.jsp?core=<%=core.getName()%>">Java Properties</a>]- [<a href="threaddump.jsp?core=<%=core.getName()%>">Thread Dump</a>]+ [<a href="get-properties.jsp">Java Properties</a>]+ [<a href="threaddump.jsp">Thread Dump</a>]<%if (enabledFile!=null)if (isEnabled) {%>- [<a href="action.jsp?core=<%=core.getName()%>&action=Disable">Disable</a>]+ [<a href="action.jsp?action=Disable">Disable</a>]<%} else {%>- [<a href="action.jsp?core=<%=core.getName()%>&action=Enable">Enable</a>]+ [<a href="action.jsp?action=Enable">Enable</a>]<%}%>@@ -80,7 +80,7 @@ if (cores.size() > 1) {%><tr><td><strong>Cores:</strong><br></td><td><%</tr>-<jsp:include page="get-file.jsp?core=<%=core.getName()%>&file=admin-extra.html&optional=y" flush="true"/>+<jsp:include page="get-file.jsp?file=admin-extra.html&optional=y" flush="true"/></table><P>@@ -91,7 +91,7 @@ if (cores.size() > 1) {%><tr><td><strong>Cores:</strong><br></td><td><%<h3>Make a Query</h3></td><td>-[<a href="form.jsp?core=<%=core.getName()%>">Full Interface</a>]+[<a href="form.jsp">Full Interface</a>]</td></tr>@@ -102,7 +102,6 @@ if (cores.size() > 1) {%><tr><td><strong>Cores:</strong><br></td><td><%<td colspan=2><form name=queryForm method="GET" action="../select/"><textarea class="std" rows="4" cols="40" name="q"><%= defaultSearch %></textarea>- <input name="core" type="hidden" value="<%=core.getName()%>"><input name="version" type="hidden" value="2.2"><input name="start" type="hidden" value="0"><input name="rows" type="hidden" value="10">diff --git a/src/webapp/resources/admin/logging.xsl b/src/webapp/resources/admin/logging.xslindex d436cc9195f..3678ea5b83e 100644--- a/src/webapp/resources/admin/logging.xsl+++ b/src/webapp/resources/admin/logging.xsl@@ -1,119 +1,89 @@-<?xml version="1.0" encoding="utf-8"?>-<!--- Licensed to the Apache Software Foundation (ASF) under one or more- contributor license agreements. See the NOTICE file distributed with- this work for additional information regarding copyright ownership.- The ASF licenses this file to You under the Apache License, Version 2.0- (the "License"); you may not use this file except in compliance with- the License. You may obtain a copy of the License at-- http://www.apache.org/licenses/LICENSE-2.0-- Unless required by applicable law or agreed to in writing, software- distributed under the License is distributed on an "AS IS" BASIS,- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- See the License for the specific language governing permissions and- limitations under the License.--->-<!-- $Id$ -->-<!-- $URL$ -->--<xsl:stylesheet- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"- version="1.0">-- <xsl:output- method="html"- indent="yes"- doctype-public="-//W3C//DTD HTML 4.01//EN"- doctype-system="http://www.w3.org/TR/html4/strict.dtd" />-- <xsl:template match="/">- <html>- <head>- <link rel="stylesheet" type="text/css" href="solr-admin.css"></link>- <link rel="icon" href="/favicon.ico" type="image/ico"></link>- <link rel="shortcut icon" href="/favicon.ico" type="image/ico"></link>- <title>Solr Admin: Logging</title>- </head>- <body>- <a href="">- <img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="SOLR">- </img>- </a>- <h1>Solr Admin (<xsl:value-of select="solr/meta/collection" />)</h1>- <div style="margin-top: 1em;">- <xsl:apply-templates/>- <div>- </div>- <xsl:element name='a'>- <xsl:attribute name='href'>.?core=<xsl:value-of select="//solr/core"/></xsl:attribute>- <xsl:text>Return to Admin Page</xsl:text>- </xsl:element>- </div>- </body>- </html>- </xsl:template>-- <xsl:include href="meta.xsl"/>-- <xsl:template match="solr/logging">--<br clear="all"/>-<h2>Solr Logging</h2>-<table>- <tr>- <td>- <H3>Log Level:</H3>- </td>- <td>-<xsl:value-of select="logLevel" />- </td>- </tr>- <tr>- <td>- Set Level- </td>- <td>- [<xsl:element name='a'>- <xsl:attribute name='href'>action.jsp?log=ALL&core=<xsl:value-of select="//solr/core"/></xsl:attribute>- <xsl:text>ALL</xsl:text>- </xsl:element>]- [<xsl:element name='a'>- <xsl:attribute name='href'>action.jsp?log=CONFIG&core=<xsl:value-of select="//solr/core"/></xsl:attribute>- <xsl:text>CONFIG</xsl:text>- </xsl:element>]- [<xsl:element name='a'>- <xsl:attribute name='href'>action.jsp?log=FINE&core=<xsl:value-of select="//solr/core"/></xsl:attribute>- <xsl:text>FINE</xsl:text>- </xsl:element>]- [<xsl:element name='a'>- <xsl:attribute name='href'>action.jsp?log=FINER&core=<xsl:value-of select="//solr/core"/></xsl:attribute>- <xsl:text>FINER</xsl:text>- </xsl:element>]- [<xsl:element name='a'>- <xsl:attribute name='href'>action.jsp?log=FINEST&core=<xsl:value-of select="//solr/core"/></xsl:attribute>- <xsl:text>FINEST</xsl:text>- </xsl:element>]- [<xsl:element name='a'>- <xsl:attribute name='href'>action.jsp?log=INFO&core=<xsl:value-of select="//solr/core"/></xsl:attribute>- <xsl:text>INFO</xsl:text>- </xsl:element>]- [<xsl:element name='a'>- <xsl:attribute name='href'>action.jsp?log=OFF&core=<xsl:value-of select="//solr/core"/></xsl:attribute>- <xsl:text>OFF</xsl:text>- </xsl:element>]- [<xsl:element name='a'>- <xsl:attribute name='href'>action.jsp?log=SEVERE&core=<xsl:value-of select="//solr/core"/></xsl:attribute>- <xsl:text>SEVERE</xsl:text>- </xsl:element>]- [<xsl:element name='a'>- <xsl:attribute name='href'>action.jsp?log=WARNING&core=<xsl:value-of select="//solr/core"/></xsl:attribute>- <xsl:text>WARNING</xsl:text>- </xsl:element>]- </td>- </tr>-</table>-- </xsl:template>-</xsl:stylesheet>+<?xml version="1.0" encoding="utf-8"?>+<!--+ Licensed to the Apache Software Foundation (ASF) under one or more+ contributor license agreements. See the NOTICE file distributed with+ this work for additional information regarding copyright ownership.+ The ASF licenses this file to You under the Apache License, Version 2.0+ (the "License"); you may not use this file except in compliance with+ the License. You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.+-->+<!-- $Id$ -->+<!-- $URL$ -->++<xsl:stylesheet+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"+ version="1.0">++ <xsl:output+ method="html"+ indent="yes"+ doctype-public="-//W3C//DTD HTML 4.01//EN"+ doctype-system="http://www.w3.org/TR/html4/strict.dtd" />++ <xsl:template match="/">+ <html>+ <head>+ <link rel="stylesheet" type="text/css" href="solr-admin.css"></link>+ <link rel="icon" href="/favicon.ico" type="image/ico"></link>+ <link rel="shortcut icon" href="/favicon.ico" type="image/ico"></link>+ <title>Solr Admin: Logging</title>+ </head>+ <body>+ <a href="">+ <img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="SOLR">+ </img>+ </a>+ <h1>Solr Admin (<xsl:value-of select="solr/meta/collection" />)</h1>+ <div style="margin-top: 1em;">+ <xsl:apply-templates/>+ <div>+ </div>+ <a href=".">Return to Admin Page</a>+ </div>+ </body>+ </html>+ </xsl:template>++ <xsl:include href="meta.xsl"/>++ <xsl:template match="solr/logging">++<br clear="all"/>+<h2>Solr Logging</h2>+<table>+ <tr>+ <td>+ <H3>Log Level:</H3>+ </td>+ <td>+<xsl:value-of select="logLevel" />+ </td>+ </tr>+ <tr>+ <td>+ Set Level+ </td>+ <td>+ [<a href="action.jsp?log=ALL">ALL</a>]+ [<a href="action.jsp?log=CONFIG">CONFIG</a>]+ [<a href="action.jsp?log=FINE">FINE</a>]+ [<a href="action.jsp?log=FINER">FINER</a>]+ [<a href="action.jsp?log=FINEST">FINEST</a>]+ [<a href="action.jsp?log=INFO">INFO</a>]+ [<a href="action.jsp?log=OFF">OFF</a>]+ [<a href="action.jsp?log=SEVERE">SEVERE</a>]+ [<a href="action.jsp?log=WARNING">WARNING</a>]+ </td>+ </tr>+</table>++ </xsl:template>+</xsl:stylesheet>diff --git a/src/webapp/resources/admin/ping.xsl b/src/webapp/resources/admin/ping.xslindex ec5672acf5e..364577bc69c 100644--- a/src/webapp/resources/admin/ping.xsl+++ b/src/webapp/resources/admin/ping.xsl@@ -1,72 +1,69 @@-<?xml version="1.0" encoding="utf-8"?>-<!--- Licensed to the Apache Software Foundation (ASF) under one or more- contributor license agreements. See the NOTICE file distributed with- this work for additional information regarding copyright ownership.- The ASF licenses this file to You under the Apache License, Version 2.0- (the "License"); you may not use this file except in compliance with- the License. You may obtain a copy of the License at-- http://www.apache.org/licenses/LICENSE-2.0-- Unless required by applicable law or agreed to in writing, software- distributed under the License is distributed on an "AS IS" BASIS,- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- See the License for the specific language governing permissions and- limitations under the License.--->-<!-- $Id$ -->-<!-- $URL$ -->--<xsl:stylesheet- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"- version="1.0">-- <xsl:output- method="html"- indent="yes"- doctype-public="-//W3C//DTD HTML 4.01//EN"- doctype-system="http://www.w3.org/TR/html4/strict.dtd" />-- <xsl:template match="/">- <html>- <head>- <link rel="stylesheet" type="text/css" href="solr-admin.css"></link>- <link rel="icon" href="/favicon.ico" type="image/ico"></link>- <link rel="shortcut icon" href="/favicon.ico" type="image/ico"></link>- <title>Solr Admin: Ping</title>- </head>- <body>- <a href="">- <img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="SOLR">- </img>- </a>- <h1>Solr Admin (<xsl:value-of select="solr/meta/collection" />)</h1>- <div style="margin-top: 1em;">- <xsl:apply-templates/>- <div>- </div>- <xsl:element name='a'>- <xsl:attribute name='href'>.?core=<xsl:value-of select="//solr/core"/></xsl:attribute>- <xsl:text>Return to Admin Page (ping)</xsl:text>- </xsl:element>- </div>- </body>- </html>- </xsl:template>-- <xsl:include href="meta.xsl"/>-- <xsl:template match="solr/ping">- <table>- <tr>- <td>- <H3>Ping</H3>- </td>- <td>- <xsl:value-of select="error" />- </td>- </tr>- </table>- </xsl:template>-</xsl:stylesheet>+<?xml version="1.0" encoding="utf-8"?>+<!--+ Licensed to the Apache Software Foundation (ASF) under one or more+ contributor license agreements. See the NOTICE file distributed with+ this work for additional information regarding copyright ownership.+ The ASF licenses this file to You under the Apache License, Version 2.0+ (the "License"); you may not use this file except in compliance with+ the License. You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.+-->+<!-- $Id$ -->+<!-- $URL$ -->++<xsl:stylesheet+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"+ version="1.0">++ <xsl:output+ method="html"+ indent="yes"+ doctype-public="-//W3C//DTD HTML 4.01//EN"+ doctype-system="http://www.w3.org/TR/html4/strict.dtd" />++ <xsl:template match="/">+ <html>+ <head>+ <link rel="stylesheet" type="text/css" href="solr-admin.css"></link>+ <link rel="icon" href="/favicon.ico" type="image/ico"></link>+ <link rel="shortcut icon" href="/favicon.ico" type="image/ico"></link>+ <title>Solr Admin: Ping</title>+ </head>+ <body>+ <a href="">+ <img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="SOLR">+ </img>+ </a>+ <h1>Solr Admin (<xsl:value-of select="solr/meta/collection" />)</h1>+ <div style="margin-top: 1em;">+ <xsl:apply-templates/>+ <div>+ </div>+ <a href=".">Return to Admin Page</a>+ </div>+ </body>+ </html>+ </xsl:template>++ <xsl:include href="meta.xsl"/>++ <xsl:template match="solr/ping">+ <table>+ <tr>+ <td>+ <H3>Ping</H3>+ </td>+ <td>+ <xsl:value-of select="error" />+ </td>+ </tr>+ </table>+ </xsl:template>+</xsl:stylesheet>diff --git a/src/webapp/resources/admin/registry.xsl b/src/webapp/resources/admin/registry.xslindex f375e2568a4..53ff775cc3b 100644--- a/src/webapp/resources/admin/registry.xsl+++ b/src/webapp/resources/admin/registry.xsl@@ -48,10 +48,7 @@<br clear="all" /><xsl:apply-templates/><br /><br />- <xsl:element name='a'>- <xsl:attribute name='href'>.?core=<xsl:value-of select="//solr/core"/></xsl:attribute>- <xsl:text>Return to Admin Page</xsl:text>- </xsl:element>+ <a href="">Return to Admin Page</a></body></html></xsl:template>diff --git a/src/webapp/resources/admin/stats.xsl b/src/webapp/resources/admin/stats.xslindex 40bbdc99d78..80ccc913e41 100644--- a/src/webapp/resources/admin/stats.xsl+++ b/src/webapp/resources/admin/stats.xsl@@ -48,10 +48,7 @@<br clear="all" /><xsl:apply-templates/><br /><br />- <xsl:element name='a'>- <xsl:attribute name='href'>.?core=<xsl:value-of select="//solr/core"/></xsl:attribute>- <xsl:text>Return to Admin Page</xsl:text>- </xsl:element>+ <a href=".">Return to Admin Page</a></body></html></xsl:template>diff --git a/src/webapp/resources/admin/threaddump.xsl b/src/webapp/resources/admin/threaddump.xslindex a51787acc67..999b05d009b 100644--- a/src/webapp/resources/admin/threaddump.xsl+++ b/src/webapp/resources/admin/threaddump.xsl@@ -1,104 +1,101 @@-<?xml version="1.0" encoding="utf-8"?>-<!--- Licensed to the Apache Software Foundation (ASF) under one or more- contributor license agreements. See the NOTICE file distributed with- this work for additional information regarding copyright ownership.- The ASF licenses this file to You under the Apache License, Version 2.0- (the "License"); you may not use this file except in compliance with- the License. You may obtain a copy of the License at-- http://www.apache.org/licenses/LICENSE-2.0-- Unless required by applicable law or agreed to in writing, software- distributed under the License is distributed on an "AS IS" BASIS,- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- See the License for the specific language governing permissions and- limitations under the License.--->-<!-- $Id$ -->-<!-- $URL$ -->--<xsl:stylesheet- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"- version="1.0">-- <xsl:output- method="html"- indent="yes"- doctype-public="-//W3C//DTD HTML 4.01//EN"- doctype-system="http://www.w3.org/TR/html4/strict.dtd" />-- <xsl:template match="/">- <html>- <head>- <link rel="stylesheet" type="text/css" href="solr-admin.css"></link>- <link rel="icon" href="/favicon.ico" type="image/ico"></link>- <link rel="shortcut icon" href="/favicon.ico" type="image/ico"></link>- <title>SOLR Info</title>- </head>- <body>- <a href="">- <img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="SOLR"/>- </a>- <h1>Solr Admin (<xsl:value-of select="solr/meta/collection" />)</h1>- <h2>Thread Dump</h2>- <div style="margin-top: 1em;">- <table>- <xsl:apply-templates/>- </table>- <xsl:element name='a'>- <xsl:attribute name='href'>.?core=<xsl:value-of select="//solr/core"/></xsl:attribute>- <xsl:text>Return to Admin Page</xsl:text>- </xsl:element>- </div>- </body>- </html>- </xsl:template>-- <xsl:include href="meta.xsl"/>-- <xsl:template match="solr/system/jvm">- <tr>- <td><xsl:value-of select="name"/> <xsl:value-of select="version"/></td>- </tr>- </xsl:template>-- <xsl:template match="solr/system/threadCount">- <tr>- <td>- Thread Count:- current=<xsl:value-of select="current"/>,- peak=<xsl:value-of select="peak"/>,- daemon=<xsl:value-of select="daemon"/></td>- </tr>- </xsl:template>-- <xsl:template match="solr/system/threadDump">- <div>Full Thread Dump:</div>- <xsl:for-each select="thread">- <!-- OG: TODO: add suspended/native conditionals -->- <tr>- <td style="margin-left: 1em; font-weight: bold;">- '<xsl:value-of select="name"/>'- Id=<xsl:value-of select="id"/>,- <xsl:value-of select="state"/>- on lock=<xsl:value-of select="lock"/>,- total cpu time=<xsl:value-of select="cpuTime"/>- user time=<xsl:value-of select="userTime"/>- </td>- </tr>- <xsl:apply-templates select="stackTrace"/>- </xsl:for-each>- </xsl:template>-- <xsl:template match="stackTrace">- <tr>- <td style="margin-left: 1em;">- <xsl:for-each select="line">- <xsl:value-of select="."/><br/>- </xsl:for-each>- </td>- </tr>- </xsl:template>--</xsl:stylesheet>+<?xml version="1.0" encoding="utf-8"?>+<!--+ Licensed to the Apache Software Foundation (ASF) under one or more+ contributor license agreements. See the NOTICE file distributed with+ this work for additional information regarding copyright ownership.+ The ASF licenses this file to You under the Apache License, Version 2.0+ (the "License"); you may not use this file except in compliance with+ the License. You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.+-->+<!-- $Id$ -->+<!-- $URL$ -->++<xsl:stylesheet+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"+ version="1.0">++ <xsl:output+ method="html"+ indent="yes"+ doctype-public="-//W3C//DTD HTML 4.01//EN"+ doctype-system="http://www.w3.org/TR/html4/strict.dtd" />++ <xsl:template match="/">+ <html>+ <head>+ <link rel="stylesheet" type="text/css" href="solr-admin.css"></link>+ <link rel="icon" href="/favicon.ico" type="image/ico"></link>+ <link rel="shortcut icon" href="/favicon.ico" type="image/ico"></link>+ <title>SOLR Info</title>+ </head>+ <body>+ <a href="">+ <img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="SOLR"/>+ </a>+ <h1>Solr Admin (<xsl:value-of select="solr/meta/collection" />)</h1>+ <h2>Thread Dump</h2>+ <div style="margin-top: 1em;">+ <table>+ <xsl:apply-templates/>+ </table>+ <a href=".">Return to Admin Page</a>+ </div>+ </body>+ </html>+ </xsl:template>++ <xsl:include href="meta.xsl"/>++ <xsl:template match="solr/system/jvm">+ <tr>+ <td><xsl:value-of select="name"/> <xsl:value-of select="version"/></td>+ </tr>+ </xsl:template>++ <xsl:template match="solr/system/threadCount">+ <tr>+ <td>+ Thread Count:+ current=<xsl:value-of select="current"/>,+ peak=<xsl:value-of select="peak"/>,+ daemon=<xsl:value-of select="daemon"/></td>+ </tr>+ </xsl:template>++ <xsl:template match="solr/system/threadDump">+ <div>Full Thread Dump:</div>+ <xsl:for-each select="thread">+ <!-- OG: TODO: add suspended/native conditionals -->+ <tr>+ <td style="margin-left: 1em; font-weight: bold;">+ '<xsl:value-of select="name"/>'+ Id=<xsl:value-of select="id"/>,+ <xsl:value-of select="state"/>+ on lock=<xsl:value-of select="lock"/>,+ total cpu time=<xsl:value-of select="cpuTime"/>+ user time=<xsl:value-of select="userTime"/>+ </td>+ </tr>+ <xsl:apply-templates select="stackTrace"/>+ </xsl:for-each>+ </xsl:template>++ <xsl:template match="stackTrace">+ <tr>+ <td style="margin-left: 1em;">+ <xsl:for-each select="line">+ <xsl:value-of select="."/><br/>+ </xsl:for-each>+ </td>+ </tr>+ </xsl:template>++</xsl:stylesheet>diff --git a/src/webapp/resources/index.html b/src/webapp/resources/index.jspsimilarity index 79%rename from src/webapp/resources/index.htmlrename to src/webapp/resources/index.jspindex f4a11e7fa97..f4b125ae6ab 100644--- a/src/webapp/resources/index.html+++ b/src/webapp/resources/index.jsp@@ -1,4 +1,4 @@-<!--+<%--Licensed to the Apache Software Foundation (ASF) under one or morecontributor license agreements. See the NOTICE file distributed withthis work for additional information regarding copyright ownership.@@ -13,7 +13,8 @@WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.--->+--%>+<html><head><link rel="stylesheet" type="text/css" href="solr-admin.css">@@ -25,6 +26,15 @@<body><h1>Welcome to Solr!</h1><a href="."><img border="0" align="right" height="61" width="142" src="admin/solr-head.gif" alt="Solr"/></a>++<%+ org.apache.solr.core.MultiCore multicore = org.apache.solr.core.MultiCore.getRegistry();+ if( multicore.isEnabled() ) {+ for( org.apache.solr.core.SolrCore core : multicore.getCores() ) {%>+<a href="<%= core.getName() %>/admin/">Admin <%= core.getName() %> </a><br/>+<% }} else { %><a href="admin/">Solr Admin</a>+<% } %>+</body></html>diff --git a/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java b/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.javaindex 668ee32c202..b977da1b001 100644--- a/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java+++ b/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java@@ -76,13 +76,9 @@ public class SolrDispatchFilter implements Filterlog.info( "looking for multicore.xml: "+multiconfig.getAbsolutePath() );if( multiconfig.exists() ) {multicore.load( instanceDir, multiconfig );+ core = multicore.getDefaultCore();}if( multicore.isEnabled() ) {- core = multicore.getDefaultCore();- if( core == null ) {- throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,- "Multicore configuration does not include a default" );- }singlecore = null;}else {@@ -93,22 +89,22 @@ public class SolrDispatchFilter implements Filterlog.info("user.dir=" + System.getProperty("user.dir"));// Read global configuration- // Only the first registerd core configures the following attributes- Config solrConfig = core.getSolrConfig();+ // Only the first registered core configures the following attributes+ Config globalConfig = core.getSolrConfig();- long uploadLimitKB = solrConfig.getInt(+ long uploadLimitKB = globalConfig.getInt("requestDispatcher/requestParsers/@multipartUploadLimitInKB", 2000 ); // 2MB default- boolean enableRemoteStreams = solrConfig.getBool(+ boolean enableRemoteStreams = globalConfig.getBool("requestDispatcher/requestParsers/@enableRemoteStreaming", false );parsers = new SolrRequestParsers( enableRemoteStreams, uploadLimitKB );// Let this filter take care of /select?xxx format- this.handleSelect = solrConfig.getBool( "requestDispatcher/@handleSelect", false );+ this.handleSelect = globalConfig.getBool( "requestDispatcher/@handleSelect", false );// should it keep going if we hit an error?- abortOnConfigurationError = solrConfig.getBool("abortOnConfigurationError",true);+ abortOnConfigurationError = globalConfig.getBool("abortOnConfigurationError",true);}catch( Throwable t ) {// catch this so our filter still works@@ -125,7 +121,12 @@ public class SolrDispatchFilter implements Filterout.println( "Check your log files for more detailed information on what may be wrong.\n" );out.println( "If you want solr to continue after configuration errors, change: \n");out.println( " <abortOnConfigurationError>false</abortOnConfigurationError>\n" );- out.println( "in solrconfig.xml\n" );+ if( multicore.isEnabled() ) {+ out.println( "in multicore.xml\n" );+ }+ else {+ out.println( "in solrconfig.xml\n" );+ }for( Throwable t : SolrConfig.severeErrors ) {out.println( "-------------------------------------------------------------" );@@ -179,54 +180,51 @@ public class SolrDispatchFilter implements Filter}// By default use the single core. If multicore is enabled, look for one.+ SolrRequestHandler handler = null;SolrCore core = singlecore;if( core == null ) {- // try to get the corename as a request parameter first- String corename = null;- if( path.startsWith( "/@" ) ) { // multicore- idx = path.indexOf( '/', 2 );- if( idx < 1 ) {- throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,- "MultiCore path must contain a '/'. For example: /@corename/handlerpath" );- }- corename = path.substring( 2, idx );- path = path.substring( idx );-- core = multicore.getCore( corename );- if( core == null ) {- throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,- "Can not find core: '"+corename+"'" );- }+ // Perhaps this is a muli-core admin page?+ if( path.equals( multicore.getAdminPath() ) ) {+ handler = multicore.getMultiCoreHandler();}else {- core = multicore.getDefaultCore();+ idx = path.indexOf( "/", 1 );+ if( idx > 1 ) {+ // try to get the corename as a request parameter first+ String corename = path.substring( 1, idx );+ path = path.substring( idx );+ core = multicore.getCore( corename );+ // invalid core name is ok. It could fall through to some other request+ }}}- SolrRequestHandler handler = null;- if( path.length() > 1 ) { // don't match "" or "/" as valid path- handler = core.getRequestHandler( path );- }- if( handler == null && handleSelect ) {- if( "/select".equals( path ) || "/select/".equals( path ) ) {- solrReq = parsers.parse( core, path, req );- String qt = solrReq.getParams().get( CommonParams.QT );- if( qt != null && qt.startsWith( "/" ) ) {- throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Invalid query type. Do not use /select to access: "+qt);- }- handler = core.getRequestHandler( qt );- if( handler == null ) {- throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "unknown handler: "+qt);+ if( core != null ) {+ // Only try to parse the handler *if* a valid core exists+ // when multi-core is enabled, the path can lead to a null core.+ if( handler == null && path.length() > 1 ) { // don't match "" or "/" as valid path+ handler = core.getRequestHandler( path );+ }+ if( handler == null && handleSelect ) {+ if( "/select".equals( path ) || "/select/".equals( path ) ) {+ solrReq = parsers.parse( core, path, req );+ String qt = solrReq.getParams().get( CommonParams.QT );+ if( qt != null && qt.startsWith( "/" ) ) {+ throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Invalid query type. Do not use /select to access: "+qt);+ }+ handler = core.getRequestHandler( qt );+ if( handler == null ) {+ throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "unknown handler: "+qt);+ }}}}-- // Perhaps this is a muli-core admin page?- if( handler == null && path.equals( multicore.getAdminPath() ) ) {- handler = multicore.getMultiCoreHandler();- }if( handler != null ) {+ if( core == null ) {+ core = multicore.getDefaultCore();+ }+if( solrReq == null ) {solrReq = parsers.parse( core, path, req );}@@ -245,21 +243,15 @@ public class SolrDispatchFilter implements Filterreturn;}// otherwise, let's ensure the core is in the SolrCore request attribute so- // the servlet can retrieve it+ // the servlet/jsp can retrieve itelse {- // TEMP -- to support /admin multicore grab the core from the request- // TODO -- for muticore /admin support, strip the corename from the path- // and forward to the /admin jsp file- // req.getRequestDispatcher( path ).forward( request, response );- String corename = request.getParameter("core");- if( corename != null ) {- core = multicore.getCore( corename );- if( core == null ) {- throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,- "Can not find core: '"+corename+"'" );- }- }req.setAttribute("org.apache.solr.SolrCore", core);++ // Modify the request so each core gets its own /admin+ if( singlecore == null && path.startsWith( "/admin" ) ) {+ req.getRequestDispatcher( path ).forward( request, response );+ return;+ }}}catch( Throwable ex ) {