Further on this via the servlet-spec.... RequestDispatcher#forward may or may not re-run the filter chain, depending on web.xml configuration. <dispatcher>FORWARD</dispatcher> on the filter- mapping is required which I don't have configured. Iff that were the case, then yeah I guess it could be recursive, huh? So perhaps we put a note by the filter-mapping in our web.xml that says "don't do that"?

        Erik

On Mar 24, 2008, at 5:41 PM, Erik Hatcher wrote:

On Mar 24, 2008, at 4:54 PM, Chris Hostetter wrote:
: Log:
: Incorporate the prefixPath, if configured, on the forwards

this doesn't really seem like the correct usage of prefixPath .. it's
suppose to be set to whatever the SolrDispatchFIlter is configured to
intercept, not a generic webapp name ... with this change, won't
SolrDispatchFilter constantly forward to itself?

Gimme a firinstance here.

For my use case, I'm basically building a web application that "embeds" Solr in that a standard Java web application with /solr mapped in like this:

  <filter>
    <filter-name>SolrRequestFilter</filter-name>
<filter-class>org.apache.solr.servlet.SolrDispatchFilter</ filter-class>
    <init-param>
      <param-name>path-prefix</param-name>
      <param-value>/solr</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>SolrRequestFilter</filter-name>
    <url-pattern>/solr/*</url-pattern>
  </filter-mapping>

The code change affects only a multicore configuration of /admin requests:

            if( singlecore == null && path.startsWith( "/admin" ) ) {
req.getRequestDispatcher( pathPrefix == null ? path : pathPrefix + path ).forward( request, response );
              return;
             }

Going to /solr/admin/stats.jsp, it was intercepting and forwarding to /admin/stats.jsp which is a 404. _info.jsp can leverage a default core in a multicore configuration and let the old (non-core prefixed) paths work fine, but the forwarding wasn't taking into account /solr being mapped via web.xml rather than a webapps/ solr.war application root context.

Cool?   If there is a loophole I'm missing I'll happily fix it up.

        Erik




: Modified: lucene/solr/trunk/src/webapp/src/org/apache/solr/ servlet/SolrDispatchFilter.java : URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/ src/org/apache/solr/servlet/SolrDispatchFilter.java? rev=640449&r1=640448&r2=640449&view=diff : ===================================================================== ========= : --- lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/ SolrDispatchFilter.java (original) : +++ lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/ SolrDispatchFilter.java Mon Mar 24 08:53:46 2008
: @@ -304,7 +304,7 @@
:              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 ); : + req.getRequestDispatcher( pathPrefix == null ? path : pathPrefix + path ).forward( request, response );
:                return;
:              }
:            }
:
:



-Hoss

Reply via email to