Package org.eclipse.jetty.start
Class BaseHome
java.lang.Object
org.eclipse.jetty.start.BaseHome
File access for
${jetty.home}
, ${jetty.base}
, directories.
By default, both ${jetty.home}
and ${jetty.base}
are the same directory, but they can point at different directories.
The ${jetty.home}
directory is where the main Jetty binaries and default configuration is housed.
The ${jetty.base}
directory is where the execution specific configuration and webapps are obtained from.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionBaseHome()
BaseHome
(CommandLineConfigSource cmdLineSource) BaseHome
(ConfigSources sources) -
Method Summary
Modifier and TypeMethodDescriptiongetBase()
getBasePath
(String path) Create aPath
reference to some content in"${jetty.base}"
getHome()
Get a specific path reference.Get a List ofPath
s from a provided pattern.Search specified Path with pattern and return hitsboolean
toShortForm
(File path) Convenience method fortoShortForm(file.toPath())
toShortForm
(String path) Replace/Shorten arbitrary path with property strings"${jetty.home}"
or"${jetty.base}"
where appropriate.toShortForm
(Path path) Replace/Shorten arbitrary path with property strings"${jetty.home}"
or"${jetty.base}"
where appropriate.
-
Field Details
-
JETTY_BASE
- See Also:
-
JETTY_HOME
- See Also:
-
-
Constructor Details
-
BaseHome
- Throws:
IOException
-
BaseHome
- Throws:
IOException
-
BaseHome
- Throws:
IOException
-
BaseHome
-
-
Method Details
-
getBase
-
getBasePath
-
getBasePath
Create aPath
reference to some content in"${jetty.base}"
- Parameters:
path
- the path to reference- Returns:
- the file reference
-
getConfigSources
-
getHome
-
getHomePath
-
getPath
Get a specific path reference.Path references are searched based on the config source search order.
- If provided path is an absolute reference., and exists, return that reference
- If exists relative to
${jetty.base}
, return that reference - If exists relative to and
include-jetty-dir
locations, return that reference - If exists relative to
${jetty.home}
, return that reference - Return standard
Path
reference obtained fromFileSystem.getPath(String, String...)
(no exists check performed)
- Parameters:
path
- the path to get.- Returns:
- the path reference.
-
getPaths
Search specified Path with pattern and return hits- Parameters:
dir
- the path to a directory to start search fromsearchDepth
- the number of directories deep to perform the searchpattern
- the raw pattern to use for the search (must be relative)- Returns:
- the list of Paths found
- Throws:
IOException
- if unable to search the path
-
getPaths
Get a List ofPath
s from a provided pattern.Resolution Steps:
- If the pattern starts with "regex:" or "glob:" then a standard
PathMatcher
is built usingFileSystem.getPathMatcher(String)
as a file search. - If pattern starts with a known filesystem root (using information from
FileSystem.getRootDirectories()
) then this is assumed to be a absolute file system pattern. - All other patterns are treated as relative to BaseHome information:
- Search ${jetty.home} first
- Search ${jetty.base} for overrides
Pattern examples:
lib/logging/*.jar
- Relative pattern, not recursive, search
${jetty.home}
then${jetty.base}
for lib/logging/*.jar content lib/**/*-dev.jar
- Relative pattern, recursive search
${jetty.home}
then${jetty.base}
for files underlib
ending in-dev.jar
etc/jetty.xml
- Relative pattern, no glob, search for
${jetty.home}/etc/jetty.xml
then${jetty.base}/etc/jetty.xml
glob:/opt/app/common/*-corp.jar
- PathMapper pattern, glob, search
/opt/app/common/
for*-corp.jar
Notes:
- FileSystem case sensitivity is implementation specific (eg: linux is case-sensitive, windows is case-insensitive).
SeeFileSystem.getPathMatcher(String)
for more details - Pattern slashes are implementation neutral (use '/' always and you'll be fine)
- Recursive searching is limited to 30 levels deep (not configurable)
- File System loops are detected and skipped
- Parameters:
pattern
- the pattern to search.- Returns:
- the collection of paths found
- Throws:
IOException
- if error during search operation
- If the pattern starts with "regex:" or "glob:" then a standard
-
isBaseDifferent
public boolean isBaseDifferent() -
toShortForm
Convenience method fortoShortForm(file.toPath())
- Parameters:
path
- the path to shorten- Returns:
- the short form of the path as a String
-
toShortForm
Replace/Shorten arbitrary path with property strings"${jetty.home}"
or"${jetty.base}"
where appropriate.- Parameters:
path
- the path to shorten- Returns:
- the potentially shortened path
-
toShortForm
Replace/Shorten arbitrary path with property strings"${jetty.home}"
or"${jetty.base}"
where appropriate.- Parameters:
path
- the path to shorten- Returns:
- the potentially shortened path
-