Package org.apache.solr.servlet
Class SolrDispatchFilter
- java.lang.Object
-
- org.apache.solr.servlet.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SolrDispatchFilter.Action
Enum to define action that needs to be processed.static class
SolrDispatchFilter.ClosedServletInputStream
static class
SolrDispatchFilter.ClosedServletOutputStream
-
Field Summary
Fields Modifier and Type Field Description protected String
abortErrorMessage
protected CoreContainer
cores
protected org.apache.http.client.HttpClient
httpClient
protected CountDownLatch
init
static String
PROPERTIES_ATTRIBUTE
static String
SOLR_DEFAULT_CONFDIR_ATTRIBUTE
static String
SOLR_INSTALL_DIR_ATTRIBUTE
static String
SOLR_LOG_LEVEL
static String
SOLR_LOG_MUTECONSOLE
static String
SOLRHOME_ATTRIBUTE
-
Constructor Summary
Constructors Constructor Description SolrDispatchFilter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
closeOnDestroy(boolean closeOnDestroy)
static javax.servlet.http.HttpServletRequest
closeShield(javax.servlet.http.HttpServletRequest request, boolean retry)
Wrap the request's input stream with a close shield.static javax.servlet.http.HttpServletResponse
closeShield(javax.servlet.http.HttpServletResponse response, boolean retry)
Wrap the response's output stream with a close shield.protected CoreContainer
createCoreContainer(Path solrHome, Properties extraProperties)
Override this to change CoreContainer initializationvoid
destroy()
void
doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
void
doFilter(javax.servlet.ServletRequest _request, javax.servlet.ServletResponse _response, javax.servlet.FilterChain chain, boolean retry)
CoreContainer
getCores()
protected HttpSolrCall
getHttpSolrCall(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean retry)
Allow a subclass to modify the HttpSolrCall.void
init(javax.servlet.FilterConfig config)
static NodeConfig
loadNodeConfig(Path solrHome, Properties nodeProperties)
Get the NodeConfig whether stored on disk, in ZooKeeper, etc.
-
-
-
Field Detail
-
cores
protected volatile CoreContainer cores
-
init
protected final CountDownLatch init
-
abortErrorMessage
protected String abortErrorMessage
-
httpClient
protected org.apache.http.client.HttpClient httpClient
-
PROPERTIES_ATTRIBUTE
public static final String PROPERTIES_ATTRIBUTE
- See Also:
- Constant Field Values
-
SOLRHOME_ATTRIBUTE
public static final String SOLRHOME_ATTRIBUTE
- See Also:
- Constant Field Values
-
SOLR_INSTALL_DIR_ATTRIBUTE
public static final String SOLR_INSTALL_DIR_ATTRIBUTE
- See Also:
- Constant Field Values
-
SOLR_DEFAULT_CONFDIR_ATTRIBUTE
public static final String SOLR_DEFAULT_CONFDIR_ATTRIBUTE
- See Also:
- Constant Field Values
-
SOLR_LOG_MUTECONSOLE
public static final String SOLR_LOG_MUTECONSOLE
- See Also:
- Constant Field Values
-
SOLR_LOG_LEVEL
public static final String SOLR_LOG_LEVEL
- See Also:
- Constant Field Values
-
-
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
-
getCores
public CoreContainer getCores()
-
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)
-
-