Package org.glassfish.embeddable.web
Interface VirtualServer
-
- All Known Implementing Classes:
PEVirtualServer
,VirtualServer
,VirtualServerFacade
public interface VirtualServer
Representation of a virtual server.Instances of VirtualServer may be in one of two states: stopped or started. Any requests mapped to a VirtualServer that was stopped will result in a response with a status code equal to jakarta.servlet.http.HttpServletResponse#SC_NOT_FOUND.
SeeWebContainer
for usage example.- Author:
- Rajiv Mordani, Jan Luehe
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addContext(Context context, String contextRoot)
Registers the given Context with this VirtualServer at the given context root.VirtualServerConfig
getConfig()
Gets the current configuration of this VirtualServer.Context
getContext(String contextRoot)
Finds the Context registered at the given context root.Collection<Context>
getContexts()
Gets the collection of Context instances registered with this VirtualServer.File
getDocRoot()
Gets the docroot of this VirtualServer.String
getID()
Gets the id of this VirtualServer.Collection<WebListener>
getWebListeners()
Gets the collection of WebListener instances from which this VirtualServer receives requests.void
removeContext(Context context)
Stops the given context and removes it from this VirtualServer.void
setConfig(VirtualServerConfig config)
Reconfigures this VirtualServer with the given configuration.void
setDocRoot(File docRoot)
Sets the docroot of this VirtualServer.void
setID(String ID)
Sets the id of this VirtualServer.
-
-
-
Method Detail
-
setID
void setID(String ID)
Sets the id of this VirtualServer.- Parameters:
ID
- id of this VirtualServer.
-
getID
String getID()
Gets the id of this VirtualServer.- Returns:
- the id of this VirtualServer
-
setDocRoot
void setDocRoot(File docRoot)
Sets the docroot of this VirtualServer.- Parameters:
docRoot
- the docroot of this VirtualServer.
-
getDocRoot
File getDocRoot()
Gets the docroot of this VirtualServer.- Returns:
- the docroot of this VirtualServer
-
getWebListeners
Collection<WebListener> getWebListeners()
Gets the collection of WebListener instances from which this VirtualServer receives requests.- Returns:
- the collection of WebListener instances from which this VirtualServer receives requests.
-
addContext
void addContext(Context context, String contextRoot) throws ConfigException, GlassFishException
Registers the given Context with this VirtualServer at the given context root.If this VirtualServer has already been started, the given context will be started as well.
- Parameters:
context
- the Context to registercontextRoot
- the context root at which to register- Throws:
ConfigException
- if a Context already exists at the given context root on this VirtualServerGlassFishException
- if the given context fails to be started
-
removeContext
void removeContext(Context context) throws GlassFishException
Stops the given context and removes it from this VirtualServer.- Parameters:
context
- the Context to be stopped and removed- Throws:
GlassFishException
- if an error occurs during the stopping or removal of the given context
-
getContext
Context getContext(String contextRoot)
Finds the Context registered at the given context root.- Parameters:
contextRoot
- the context root whose Context to get- Returns:
- the Context registered at the given context root, or null if no Context exists at the given context root
-
getContexts
Collection<Context> getContexts()
Gets the collection of Context instances registered with this VirtualServer.- Returns:
- the (possibly empty) collection of Context instances registered with this VirtualServer
-
setConfig
void setConfig(VirtualServerConfig config) throws ConfigException
Reconfigures this VirtualServer with the given configuration.In order for the given configuration to take effect, this VirtualServer may be stopped and restarted.
- Parameters:
config
- the configuration to be applied- Throws:
ConfigException
- if the configuration requires a restart, and this VirtualServer fails to be restarted
-
getConfig
VirtualServerConfig getConfig()
Gets the current configuration of this VirtualServer.- Returns:
- the current configuration of this VirtualServer, or null if no special configuration was ever applied to this VirtualServer
-
-