001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.catalina;
019:
020: /**
021: * A <b>Host</b> is a Container that represents a virtual host in the
022: * Catalina servlet engine. It is useful in the following types of scenarios:
023: * <ul>
024: * <li>You wish to use Interceptors that see every single request processed
025: * by this particular virtual host.
026: * <li>You wish to run Catalina in with a standalone HTTP connector, but still
027: * want support for multiple virtual hosts.
028: * </ul>
029: * In general, you would not use a Host when deploying Catalina connected
030: * to a web server (such as Apache), because the Connector will have
031: * utilized the web server's facilities to determine which Context (or
032: * perhaps even which Wrapper) should be utilized to process this request.
033: * <p>
034: * The parent Container attached to a Host is generally an Engine, but may
035: * be some other implementation, or may be omitted if it is not necessary.
036: * <p>
037: * The child containers attached to a Host are generally implementations
038: * of Context (representing an individual servlet context).
039: *
040: * @author Craig R. McClanahan
041: * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
042: */
043:
044: public interface Host extends Container {
045:
046: // ----------------------------------------------------- Manifest Constants
047:
048: /**
049: * The ContainerEvent event type sent when a new alias is added
050: * by <code>addAlias()</code>.
051: */
052: public static final String ADD_ALIAS_EVENT = "addAlias";
053:
054: /**
055: * The ContainerEvent event type sent when an old alias is removed
056: * by <code>removeAlias()</code>.
057: */
058: public static final String REMOVE_ALIAS_EVENT = "removeAlias";
059:
060: // ------------------------------------------------------------- Properties
061:
062: /**
063: * Return the application root for this Host. This can be an absolute
064: * pathname, a relative pathname, or a URL.
065: */
066: public String getAppBase();
067:
068: /**
069: * Set the application root for this Host. This can be an absolute
070: * pathname, a relative pathname, or a URL.
071: *
072: * @param appBase The new application root
073: */
074: public void setAppBase(String appBase);
075:
076: /**
077: * Return the value of the auto deploy flag. If true, it indicates that
078: * this host's child webapps should be discovred and automatically
079: * deployed dynamically.
080: */
081: public boolean getAutoDeploy();
082:
083: /**
084: * Set the auto deploy flag value for this host.
085: *
086: * @param autoDeploy The new auto deploy flag
087: */
088: public void setAutoDeploy(boolean autoDeploy);
089:
090: /**
091: * Return the Java class name of the context configuration class
092: * for new web applications.
093: */
094: public String getConfigClass();
095:
096: /**
097: * Set the Java class name of the context configuration class
098: * for new web applications.
099: *
100: * @param configClass The new context configuration class
101: */
102: public void setConfigClass(String configClass);
103:
104: /**
105: * Return the value of the deploy on startup flag. If true, it indicates
106: * that this host's child webapps should be discovred and automatically
107: * deployed.
108: */
109: public boolean getDeployOnStartup();
110:
111: /**
112: * Set the deploy on startup flag value for this host.
113: *
114: * @param deployOnStartup The new deploy on startup flag
115: */
116: public void setDeployOnStartup(boolean deployOnStartup);
117:
118: /**
119: * Return the canonical, fully qualified, name of the virtual host
120: * this Container represents.
121: */
122: public String getName();
123:
124: /**
125: * Set the canonical, fully qualified, name of the virtual host
126: * this Container represents.
127: *
128: * @param name Virtual host name
129: *
130: * @exception IllegalArgumentException if name is null
131: */
132: public void setName(String name);
133:
134: /**
135: * Get the server.xml <host> attribute's xmlNamespaceAware.
136: * @return true if namespace awarenes is enabled.
137: *
138: */
139: public boolean getXmlNamespaceAware();
140:
141: /**
142: * Get the server.xml <host> attribute's xmlValidation.
143: * @return true if validation is enabled.
144: *
145: */
146: public boolean getXmlValidation();
147:
148: /**
149: * Set the validation feature of the XML parser used when
150: * parsing xml instances.
151: * @param xmlValidation true to enable xml instance validation
152: */
153: public void setXmlValidation(boolean xmlValidation);
154:
155: /**
156: * Set the namespace aware feature of the XML parser used when
157: * parsing xml instances.
158: * @param xmlNamespaceAware true to enable namespace awareness
159: */
160: public void setXmlNamespaceAware(boolean xmlNamespaceAware);
161:
162: // --------------------------------------------------------- Public Methods
163:
164: /**
165: * Add an alias name that should be mapped to this same Host.
166: *
167: * @param alias The alias to be added
168: */
169: public void addAlias(String alias);
170:
171: /**
172: * Return the set of alias names for this Host. If none are defined,
173: * a zero length array is returned.
174: */
175: public String[] findAliases();
176:
177: /**
178: * Return the Context that would be used to process the specified
179: * host-relative request URI, if any; otherwise return <code>null</code>.
180: *
181: * @param uri Request URI to be mapped
182: */
183: public Context map(String uri);
184:
185: /**
186: * Remove the specified alias name from the aliases for this Host.
187: *
188: * @param alias Alias name to be removed
189: */
190: public void removeAlias(String alias);
191:
192: }
|