Interface VirtualHostConfig
- All Superinterfaces:
Config
A Virtual Host is part of the configuration of a File Service
within a Web Server
. Values may not be
changed once the server has been started.
- Since:
- 4.4
-
Method Summary
Modifier and TypeMethodDescriptionAdd a realm.Gets the alias file.getCache()
Gets the cache configuration.int
Gets the compression threshold.Gets the document root.Gets the error page.Gets the home page.getHost()
Gets the host.getName()
Gets the virtual host name.Get a named realm.Gets the configured Realms.boolean
isDebug()
Is debug set?boolean
isMinify()
Is minify option set?boolean
isStatic()
Is static set?removeRealm
(String name) Remove a named realm.void
setAliasFile
(String aliasFile) Sets the alias file.void
setCompressionThreshold
(int threshold) Sets the compression threshold.void
setDebug
(boolean debug) Sets debug option.void
setErrorPage
(String errorPage) Sets the error page.void
setMinify
(boolean minify) Sets minify option.void
setStatic
(boolean isStatic) Sets static option.
-
Method Details
-
getName
String getName()Gets the virtual host name.- Returns:
- name
-
getHost
String getHost()Gets the host.- Returns:
- host
-
getDocumentRoot
String getDocumentRoot()Gets the document root.- Returns:
- document root directory
-
getHomePage
String getHomePage()Gets the home page.- Returns:
- the home page
-
setErrorPage
Sets the error page.This is used to control the 404 response. The server will look for one of this files in the directory of the request, if the file does not exist, it will look for this file in the virtual directory.
If left blank or the file doesn't exist a standard 404 response HTML document will be sent.
- Parameters:
errorPage
- the error page- Throws:
ConfigException
- if unable to set property
-
getErrorPage
String getErrorPage()Gets the error page.- Returns:
- error page
-
setStatic
Sets static option.If static set to true, after loading the resource once, the file system will not be checked again. This increases performance.
Default is false.
- Parameters:
isStatic
- true if static- Throws:
ConfigException
- if unable to set property
-
isStatic
boolean isStatic()Is static set?- Returns:
- true if static option set
-
setMinify
Sets minify option.Minify html. This will happen before the file is compressed.
Default is false.
- Parameters:
minify
- true to minify- Throws:
ConfigException
- if unable to set property
-
isMinify
boolean isMinify()Is minify option set?- Returns:
- true if minify set
-
setCompressionThreshold
Sets the compression threshold.Enable compression for HTTP responses over this size.
If not specified, 512 is assumed.
- Parameters:
threshold
- in bytes- Throws:
ConfigException
- if unable to set property
-
getCompressionThreshold
int getCompressionThreshold()Gets the compression threshold.- Returns:
- compression threshold in bytes
-
setAliasFile
Sets the alias file.Optionally specifies a file to use for URL aliasing.
- Parameters:
aliasFile
- the alias file name- Throws:
ConfigException
- if unable to set property
-
getAliasFile
String getAliasFile()Gets the alias file.- Returns:
- alias file name or null if none set
-
getCache
VirtualHostCacheConfig getCache()Gets the cache configuration.- Returns:
- cache configuration.
-
getRealms
List<VirtualHostRealmConfig> getRealms()Gets the configured Realms.- Returns:
- list of realms
-
getRealm
Get a named realm.- Parameters:
name
- realm name- Returns:
- the realm or null if not defined
-
addRealm
Add a realm.- Parameters:
name
- realm namepath
- realm path- Returns:
- realm configuration
- Throws:
ConfigException
- if unable to add a realm
-
removeRealm
Remove a named realm.- Parameters:
name
- realm name- Returns:
- realm config or null if it did not exist
- Throws:
ConfigException
- if unable to remove
-
setDebug
Sets debug option.Default is false.
- Parameters:
debug
- true to set.- Throws:
ConfigException
- if unable to set property
-
isDebug
boolean isDebug()Is debug set?- Returns:
- true if debug set
-