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 classSolrDispatchFilter.ActionEnum to define action that needs to be processed.static classSolrDispatchFilter.ClosedServletInputStreamstatic classSolrDispatchFilter.ClosedServletOutputStream
-
Field Summary
Fields Modifier and Type Field Description protected StringabortErrorMessageprotected CoreContainercoresprotected org.apache.http.client.HttpClienthttpClientprotected CountDownLatchinitstatic StringPROPERTIES_ATTRIBUTEstatic StringSOLR_DEFAULT_CONFDIR_ATTRIBUTEstatic StringSOLR_INSTALL_DIR_ATTRIBUTEstatic StringSOLR_LOG_LEVELstatic StringSOLR_LOG_MUTECONSOLEstatic StringSOLRHOME_ATTRIBUTE
-
Constructor Summary
Constructors Constructor Description SolrDispatchFilter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidcloseOnDestroy(boolean closeOnDestroy)static javax.servlet.http.HttpServletRequestcloseShield(javax.servlet.http.HttpServletRequest request, boolean retry)Wrap the request's input stream with a close shield.static javax.servlet.http.HttpServletResponsecloseShield(javax.servlet.http.HttpServletResponse response, boolean retry)Wrap the response's output stream with a close shield.protected CoreContainercreateCoreContainer(Path solrHome, Properties extraProperties)Override this to change CoreContainer initializationvoiddestroy()voiddoFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)voiddoFilter(javax.servlet.ServletRequest _request, javax.servlet.ServletResponse _response, javax.servlet.FilterChain chain, boolean retry)CoreContainergetCores()protected HttpSolrCallgetHttpSolrCall(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean retry)Allow a subclass to modify the HttpSolrCall.voidinit(javax.servlet.FilterConfig config)static NodeConfigloadNodeConfig(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:
IOExceptionjavax.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:
IOExceptionjavax.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
InputStreamthat 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
OutputStreamthat will ignore calls to close.
-
closeOnDestroy
public void closeOnDestroy(boolean closeOnDestroy)
-
-