lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ans...@apache.org
Subject svn commit: r1703445 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/core/ solr/core/src/java/org/apache/solr/client/solrj/embedded/ solr/core/src/java/org/apache/solr/servlet/ solr/core/src/test/org/apache/solr/cloud/ solr/webapp/ solr/webapp/web/W...
Date Wed, 16 Sep 2015 19:00:05 GMT
Author: anshum
Date: Wed Sep 16 19:00:03 2015
New Revision: 1703445

URL: http://svn.apache.org/r1703445
Log:
SOLR-8058: Fix the exclusion filter so that collections that start with js, css, img, tpl
can be accessed.(merge from trunk)

Added:
    lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/TestExclusionRuleCollectionAccess.java
      - copied unchanged from r1703441, lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/TestExclusionRuleCollectionAccess.java
Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/solr/core/   (props changed)
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
    lucene/dev/branches/branch_5x/solr/webapp/   (props changed)
    lucene/dev/branches/branch_5x/solr/webapp/web/WEB-INF/web.xml

Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1703445&r1=1703444&r2=1703445&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Wed Sep 16 19:00:03 2015
@@ -110,6 +110,8 @@ Bug Fixes
   when parallelUpdates is enabled (default) and multiple docs are sent as a single update.
   (kevin, hossman, shalin)
 
+* SOLR-8058: Fix the exclusion filter so that collections that start with js, css, img, tpl
+  can be accessed. (Upayavira, Steve Rowe, Anshum Gupta) 
 
 Optimizations
 ----------------------

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java?rev=1703445&r1=1703444&r2=1703445&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java
Wed Sep 16 19:00:03 2015
@@ -28,6 +28,7 @@ import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.ServerConnector;
 import org.eclipse.jetty.server.SslConnectionFactory;
 import org.eclipse.jetty.server.session.HashSessionIdManager;
+import org.eclipse.jetty.servlet.BaseHolder;
 import org.eclipse.jetty.servlet.FilterHolder;
 import org.eclipse.jetty.servlet.ServletContextHandler;
 import org.eclipse.jetty.servlet.ServletHolder;
@@ -85,6 +86,8 @@ public class JettySolrRunner {
   private volatile boolean startedBefore = false;
 
   private LinkedList<FilterHolder> extraFilters;
+
+  private static final String excludePatterns = "/css/.+,/js/.+,/img/.+,/tpl/.+";
   
   private int proxyPort = -1;
 
@@ -333,9 +336,10 @@ public class JettySolrRunner {
           String pathSpec = config.extraServlets.get(servletHolder);
           root.addServlet(servletHolder, pathSpec);
         }
-
-        dispatchFilter = root.addFilter(SolrDispatchFilter.class, "*", EnumSet.of(DispatcherType.REQUEST)
);
-
+        dispatchFilter = root.getServletHandler().newFilterHolder(BaseHolder.Source.EMBEDDED);
+        dispatchFilter.setHeldClass(SolrDispatchFilter.class);
+        dispatchFilter.setInitParameter("excludePatterns", excludePatterns);
+        root.addFilter(dispatchFilter, "*", EnumSet.of(DispatcherType.REQUEST));
       }
 
       @Override

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java?rev=1703445&r1=1703444&r2=1703445&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
Wed Sep 16 19:00:03 2015
@@ -195,9 +195,13 @@ public class SolrDispatchFilter extends
 
     // No need to even create the HttpSolrCall object if this path is excluded.
     if(excludePatterns != null) {
-      String servletPath = ((HttpServletRequest) request).getServletPath();
+      String requestPath = ((HttpServletRequest) request).getServletPath();
+      String extraPath = ((HttpServletRequest)request).getPathInfo();
+      if (extraPath != null) { // In embedded mode, servlet path is empty - include all post-context
path here for testing 
+        requestPath += extraPath;
+      }
       for (Pattern p : excludePatterns) {
-        Matcher matcher = p.matcher(servletPath);
+        Matcher matcher = p.matcher(requestPath);
         if (matcher.lookingAt()) {
           chain.doFilter(request, response);
           return;

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/WEB-INF/web.xml?rev=1703445&r1=1703444&r2=1703445&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/WEB-INF/web.xml (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/WEB-INF/web.xml Wed Sep 16 19:00:03 2015
@@ -56,7 +56,7 @@
     -->
     <init-param>
       <param-name>excludePatterns</param-name>
-      <param-value>/css/*,/js/*,/img/*,/tpl/*</param-value>
+      <param-value>/css/.+,/js/.+,/img/.+,/tpl/.+</param-value>
     </init-param>
   </filter>
 



Mime
View raw message