Class SolrDispatchFilter

  • All Implemented Interfaces:
    javax.servlet.Filter

    public class SolrDispatchFilter
    extends Object
    This filter looks at the incoming URL maps them to handlers defined in solrconfig.xml
    Since:
    solr 1.2
    • Constructor Detail

      • SolrDispatchFilter

        public SolrDispatchFilter()
    • Method Detail

      • init

        public void init​(javax.servlet.FilterConfig config)
                  throws javax.servlet.ServletException
        Throws:
        javax.servlet.ServletException
      • createCoreContainer

        protected CoreContainer createCoreContainer​(Path solrHome,
                                                    Properties extraProperties)
        Override this to change CoreContainer initialization
        Returns:
        a CoreContainer to hold this server's cores
      • loadNodeConfig

        public static NodeConfig loadNodeConfig​(Path solrHome,
                                                Properties nodeProperties)
        Get the NodeConfig whether stored on disk, in ZooKeeper, etc. This may also be used by custom filters to load relevant configuration.
        Returns:
        the NodeConfig
      • destroy

        public void destroy()
      • close

        public void close()
      • doFilter

        public void doFilter​(javax.servlet.ServletRequest request,
                             javax.servlet.ServletResponse response,
                             javax.servlet.FilterChain chain)
                      throws IOException,
                             javax.servlet.ServletException
        Throws:
        IOException
        javax.servlet.ServletException
      • doFilter

        public void doFilter​(javax.servlet.ServletRequest _request,
                             javax.servlet.ServletResponse _response,
                             javax.servlet.FilterChain chain,
                             boolean retry)
                      throws IOException,
                             javax.servlet.ServletException
        Throws:
        IOException
        javax.servlet.ServletException
      • getHttpSolrCall

        protected HttpSolrCall getHttpSolrCall​(javax.servlet.http.HttpServletRequest request,
                                               javax.servlet.http.HttpServletResponse response,
                                               boolean retry)
        Allow a subclass to modify the HttpSolrCall. In particular, subclasses may want to add attributes to the request and send errors differently
      • closeShield

        public static javax.servlet.http.HttpServletRequest closeShield​(javax.servlet.http.HttpServletRequest request,
                                                                        boolean retry)
        Wrap the request's input stream with a close shield. If this is a retry, we will assume that the stream has already been wrapped and do nothing. Only the container should ever actually close the servlet output stream.
        Parameters:
        request - The request to wrap.
        retry - If this is an original request or a retry.
        Returns:
        A request object with an InputStream that will ignore calls to close.
      • closeShield

        public static javax.servlet.http.HttpServletResponse closeShield​(javax.servlet.http.HttpServletResponse response,
                                                                         boolean retry)
        Wrap the response's output stream with a close shield. If this is a retry, we will assume that the stream has already been wrapped and do nothing. Only the container should ever actually close the servlet request stream.
        Parameters:
        response - The response to wrap.
        retry - If this response corresponds to an original request or a retry.
        Returns:
        A response object with an OutputStream that will ignore calls to close.
      • closeOnDestroy

        public void closeOnDestroy​(boolean closeOnDestroy)