public final class SolrPaths extends Object
Modifier and Type | Field and Description |
---|---|
static String |
USER_FILES_DIRECTORY
Solr allows users to store arbitrary files in a special directory located directly under SOLR_HOME.
|
Modifier and Type | Method and Description |
---|---|
static void |
assertPathAllowed(Path pathToAssert,
Set<Path> allowPaths)
Checks that the given path is relative to one of the allowPaths supplied.
|
static void |
ensureUserFilesDataDir(Path solrHome) |
static Path |
getUserFilesPath(Path solrHome) |
static Path |
locateSolrHome()
Finds the solrhome based on looking up the value in one of three places:
JNDI: via java:comp/env/solr/home
The system property solr.solr.home
Look in the current working directory for a solr/ directory
|
static String |
normalizeDir(String path)
Ensures a directory name always ends with a '/'.
|
public static final String USER_FILES_DIRECTORY
This directory is generally created by each node on startup. Files located in this directory can then be manipulated using select Solr features (e.g. streaming expressions).
public static Path locateSolrHome()
The return value is normalized. Normalization essentially means it ends in a trailing slash.
normalizeDir(String)
public static void ensureUserFilesDataDir(Path solrHome)
public static String normalizeDir(String path)
public static void assertPathAllowed(Path pathToAssert, Set<Path> allowPaths) throws SolrException
CoreContainer.assertPathAllowed(Path)
and allowPaths pre-filled with the node's
SOLR_HOME, SOLR_DATA_HOME and coreRootDirectory folders, as well as any paths specified in
solr.xml's allowPaths element. The following paths will always fail validation:
..
\\host\share\path
)pathToAssert
- path to checkallowPaths
- list of paths that should be allowed prefixes for pathToAssertSolrException
- if path is outside allowed pathsCopyright © 2000-2022 Apache Software Foundation. All Rights Reserved.