org.glassfish.api.embedded.web
Interface VirtualServer

All Superinterfaces:
Lifecycle

public interface VirtualServer
extends Lifecycle

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 javax.servlet.http.HttpServletResponse#SC_NOT_FOUND.


Method Summary
 void addContext(Context context, String contextRoot)
          Registers the given Context with this VirtualServer at the given context root.
 void addValve(Valve valve)
          Adds the given Valve to this VirtualServer
 Context findContext(String contextRoot)
          Finds the Context registered at the given context root.
 VirtualServerConfig getConfig()
          Gets the current configuration of this VirtualServer.
 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.
 
Methods inherited from interface org.glassfish.api.embedded.web.Lifecycle
disable, enable
 

Method Detail

getID

String getID()
Gets the id of this VirtualServer.

Returns:
the id 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.

addValve

void addValve(Valve valve)
Adds the given Valve to this VirtualServer

Parameters:
valve - the Valve to be added

addContext

void addContext(Context context,
                String contextRoot)
                throws ConfigException,
                       LifecycleException
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 register
contextRoot - the context root at which to register
Throws:
ConfigException - if a Context already exists at the given context root on this VirtualServer
LifecycleException - if the given context fails to be started

removeContext

void removeContext(Context context)
Stops the given context and removes it from this VirtualServer.

Parameters:
context - the Context to be stopped and removed
Throws:
LifecycleException - if an error occurs during the stopping or removal of the given context

findContext

Context findContext(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


Submit a bug or feature

Copyright © 2009 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.

Generated on 12-March-2010 04:35