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