Skip to content

Apache Lucene open-source search software

Clarify path-prefix in web.xml comments and javadocs

Erik Hatcher01b702921865
diff --git a/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java b/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
index 2a3f53d6443..75fb924ac93 100644
--- a/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
+++ b/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
@@ -358,8 +358,9 @@ public class SolrDispatchFilter implements Filter
//---------------------------------------------------------------------
/**
- * set the prefix for all paths. This is useful if you want to apply the
- * filter to something other then *.
+ * Set the prefix for all paths. This is useful if you want to apply the
+ * filter to something other then /*, perhaps because you are merging this
+ * filter into a larger web application.
*
* For example, if web.xml specifies:
*
@@ -369,7 +370,7 @@ public class SolrDispatchFilter implements Filter
* </filter-mapping>
*
* Make sure to set the PathPrefix to "/xxx" either with this function
- * or in web.xml
+ * or in web.xml.
*
* <init-param>
* <param-name>path-prefix</param-name>
diff --git a/src/webapp/web/WEB-INF/web.xml b/src/webapp/web/WEB-INF/web.xml
index 13669b3eae9..3b1859e150a 100644
--- a/src/webapp/web/WEB-INF/web.xml
+++ b/src/webapp/web/WEB-INF/web.xml
@@ -34,14 +34,30 @@
<filter>
<filter-name>SolrRequestFilter</filter-name>
<filter-class>org.apache.solr.servlet.SolrDispatchFilter</filter-class>
- <!--
+ <!-- If you are wiring Solr into a larger web application which controls
+ the web context root, you will probably want to mount Solr under
+ a path prefix (app.war with /app/solr mounted into it, for example).
+ You will need to put this prefix in front of the SolrDispatchFilter
+ url-pattern mapping too (/solr/*), and also on any paths for
+ legacy Solr servlet mappings you may be using.
<init-param>
<param-name>path-prefix</param-name>
<param-value>/xxx</param-value>
</init-param>
-->
</filter>
+
<filter-mapping>
+ <!--
+ NOTE: When using multicore, /admin JSP URLs with a core specified
+ such as /solr/coreName/admin/stats.jsp get forwarded by a
+ RequestDispatcher to /solr/admin/stats.jsp with the specified core
+ put into request scope keyed as "org.apache.solr.SolrCore".
+
+ It is unnecessary, and potentially problematic, to have the SolrDispatchFilter
+ configured to also filter on forwards. Do not configure
+ this dispatcher as <dispatcher>FORWARD</dispatcher>.
+ -->
<filter-name>SolrRequestFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>