org.glassfish.embeddable.web.VirtualServer Maven / Gradle / Ivy
Show all versions of payara-micro Show documentation
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2011 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package org.glassfish.embeddable.web;
import java.io.File;
import java.util.Collection;
import org.glassfish.embeddable.web.config.VirtualServerConfig;
import org.glassfish.embeddable.GlassFishException;
/**
* 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.
*
*
See {@link WebContainer} for usage example.
*
* @author Rajiv Mordani
* @author Jan Luehe
*/
public interface VirtualServer {
/**
* Sets the id of this VirtualServer.
*
* @param ID id of this VirtualServer.
*/
public void setID(String ID);
/**
* Gets the id of this VirtualServer.
*
* @return the id of this VirtualServer
*/
public String getID();
/**
* Sets the docroot of this VirtualServer.
*
* @param docRoot the docroot of this VirtualServer.
*/
public void setDocRoot(File docRoot);
/**
* Gets the docroot of this VirtualServer.
*
* @return the docroot of this VirtualServer
*/
public File getDocRoot();
/**
* Gets the collection of WebListener instances from which
* this VirtualServer receives requests.
*
* @return the collection of WebListener instances from which
* this VirtualServer receives requests.
*/
public Collection getWebListeners();
/**
* Adds the given Valve to this VirtualServer
*
* @param valve the Valve to be added
*/
//public void addValve(Valve valve);
/**
* 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.
*
* @param context the Context to register
* @param contextRoot the context root at which to register
*
* @throws ConfigException if a Context already exists
* at the given context root on this VirtualServer
* @throws GlassFishException if the given context fails
* to be started
*/
public void addContext(Context context, String contextRoot)
throws ConfigException, GlassFishException;
/**
* Stops the given context and removes it from this
* VirtualServer.
*
* @param context the Context to be stopped and removed
*
* @throws GlassFishException if an error occurs during the stopping
* or removal of the given context
*/
public void removeContext(Context context)
throws GlassFishException;
/**
* Finds the Context registered at the given context root.
*
* @param contextRoot the context root whose Context to get
*
* @return the Context registered at the given context root,
* or null if no Context exists at the given context
* root
*/
public Context getContext(String contextRoot);
/**
* Gets the collection of Context instances registered with
* this VirtualServer.
*
* @return the (possibly empty) collection of Context
* instances registered with this VirtualServer
*/
public Collection getContexts();
/**
* Reconfigures this VirtualServer with the given
* configuration.
*
* In order for the given configuration to take effect, this
* VirtualServer may be stopped and restarted.
*
* @param config the configuration to be applied
*
* @throws ConfigException if the configuration requires a restart,
* and this VirtualServer fails to be restarted
*/
public void setConfig(VirtualServerConfig config)
throws ConfigException;
/**
* Gets the current configuration of this VirtualServer.
*
* @return the current configuration of this VirtualServer,
* or null if no special configuration was ever applied to this
* VirtualServer
*/
public VirtualServerConfig getConfig();
}