1
2
3 /*
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5 *
6 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
7 *
8 * Portions Copyright Apache Software Foundation.
9 *
10 * The contents of this file are subject to the terms of either the GNU
11 * General Public License Version 2 only ("GPL") or the Common Development
12 * and Distribution License("CDDL") (collectively, the "License"). You
13 * may not use this file except in compliance with the License. You can obtain
14 * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
15 * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
16 * language governing permissions and limitations under the License.
17 *
18 * When distributing the software, include this License Header Notice in each
19 * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
20 * Sun designates this particular file as subject to the "Classpath" exception
21 * as provided by Sun in the GPL Version 2 section of the License file that
22 * accompanied this code. If applicable, add the following below the License
23 * Header, with the fields enclosed by brackets [] replaced by your own
24 * identifying information: "Portions Copyrighted [year]
25 * [name of copyright owner]"
26 *
27 * Contributor(s):
28 *
29 * If you wish your version of this file to be governed by only the CDDL or
30 * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 * elects to include this software in this distribution under the [CDDL or GPL
32 * Version 2] license." If you don't indicate a single choice of license, a
33 * recipient has the option to distribute your version of this file under
34 * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 * its licensees as provided above. However, if you add GPL Version 2 code
36 * and therefore, elected the GPL Version 2 license, then the option applies
37 * only if the new code is made subject to such option by the copyright
38 * holder.
39 */
40
41
42 package org.apache.catalina;
43
44
45 import javax.servlet.ServletContext;
46
47 /**
48 * A <b>Host</b> is a Container that represents a virtual host in the
49 * Catalina servlet engine. It is useful in the following types of scenarios:
50 * <ul>
51 * <li>You wish to use Interceptors that see every single request processed
52 * by this particular virtual host.
53 * <li>You wish to run Catalina in with a standalone HTTP connector, but still
54 * want support for multiple virtual hosts.
55 * </ul>
56 * In general, you would not use a Host when deploying Catalina connected
57 * to a web server (such as Apache), because the Connector will have
58 * utilized the web server's facilities to determine which Context (or
59 * perhaps even which Wrapper) should be utilized to process this request.
60 * <p>
61 * The parent Container attached to a Host is generally an Engine, but may
62 * be some other implementation, or may be omitted if it is not necessary.
63 * <p>
64 * The child containers attached to a Host are generally implementations
65 * of Context (representing an individual servlet context).
66 *
67 * @author Craig R. McClanahan
68 * @version $Revision: 1.3 $ $Date: 2007/05/05 05:31:51 $
69 */
70
71 public interface Host extends Container {
72
73
74 // ----------------------------------------------------- Manifest Constants
75
76
77 /**
78 * The ContainerEvent event type sent when a new alias is added
79 * by <code>addAlias()</code>.
80 */
81 public static final String ADD_ALIAS_EVENT = "addAlias";
82
83
84 /**
85 * The ContainerEvent event type sent when an old alias is removed
86 * by <code>removeAlias()</code>.
87 */
88 public static final String REMOVE_ALIAS_EVENT = "removeAlias";
89
90
91 // ------------------------------------------------------------- Properties
92
93
94 /**
95 * Return the application root for this Host. This can be an absolute
96 * pathname, a relative pathname, or a URL.
97 */
98 public String getAppBase();
99
100
101 /**
102 * Set the application root for this Host. This can be an absolute
103 * pathname, a relative pathname, or a URL.
104 *
105 * @param appBase The new application root
106 */
107 public void setAppBase(String appBase);
108
109
110 /**
111 * Return the value of the auto deploy flag. If true, it indicates that
112 * this host's child webapps should be discovred and automatically
113 * deployed dynamically.
114 */
115 public boolean getAutoDeploy();
116
117
118 /**
119 * Set the auto deploy flag value for this host.
120 *
121 * @param autoDeploy The new auto deploy flag
122 */
123 public void setAutoDeploy(boolean autoDeploy);
124
125
126 /**
127 * Set the DefaultContext
128 * for new web applications.
129 *
130 * @param defaultContext The new DefaultContext
131 */
132 public void addDefaultContext(DefaultContext defaultContext);
133
134
135 /**
136 * Retrieve the DefaultContext for new web applications.
137 */
138 public DefaultContext getDefaultContext();
139
140
141 /**
142 * Return the value of the deploy on startup flag. If true, it indicates
143 * that this host's child webapps should be discovred and automatically
144 * deployed.
145 */
146 public boolean getDeployOnStartup();
147
148
149 /**
150 * Set the deploy on startup flag value for this host.
151 *
152 * @param deployOnStartup The new deploy on startup flag
153 */
154 public void setDeployOnStartup(boolean deployOnStartup);
155
156
157 /**
158 * Return the canonical, fully qualified, name of the virtual host
159 * this Container represents.
160 */
161 public String getName();
162
163
164 /**
165 * Set the canonical, fully qualified, name of the virtual host
166 * this Container represents.
167 *
168 * @param name Virtual host name
169 *
170 * @exception IllegalArgumentException if name is null
171 */
172 public void setName(String name);
173
174
175 /**
176 * Get the server.xml <host> attribute's xmlNamespaceAware.
177 * @return true if namespace awarenes is enabled.
178 *
179 */
180 public boolean getXmlNamespaceAware();
181
182
183 /**
184 * Get the server.xml <host> attribute's xmlValidation.
185 * @return true if validation is enabled.
186 *
187 */
188 public boolean getXmlValidation();
189
190
191 /**
192 * Set the validation feature of the XML parser used when
193 * parsing xml instances.
194 * @param xmlValidation true to enable xml instance validation
195 */
196 public void setXmlValidation(boolean xmlValidation);
197
198
199 /**
200 * Set the namespace aware feature of the XML parser used when
201 * parsing xml instances.
202 * @param xmlNamespaceAware true to enable namespace awareness
203 */
204 public void setXmlNamespaceAware(boolean xmlNamespaceAware);
205
206
207 // BEGIN S1AS 5000999
208 /**
209 * Associates this Host with the given port numbers.
210 *
211 * @param ports The port numbers with which to associate this Host
212 */
213 public void setPorts(int[] ports);
214
215 /**
216 * Gets the port numbers with which this Host is associated.
217 *
218 * @return The port numbers with which this Host is associated,
219 * or null if this Host has not been associated with any ports
220 */
221 public int[] getPorts();
222 // END S1AS 5000999
223
224
225 // --------------------------------------------------------- Public Methods
226
227
228 /**
229 * Import the DefaultContext config into a web application context.
230 *
231 * @param context web application context to import default context
232 */
233 public void importDefaultContext(Context context);
234
235
236 /**
237 * Add an alias name that should be mapped to this same Host.
238 *
239 * @param alias The alias to be added
240 */
241 public void addAlias(String alias);
242
243
244 /**
245 * Return the set of alias names for this Host. If none are defined,
246 * a zero length array is returned.
247 */
248 public String[] findAliases();
249
250
251 /**
252 * Return the Context that would be used to process the specified
253 * host-relative request URI, if any; otherwise return <code>null</code>.
254 *
255 * @param uri Request URI to be mapped
256 */
257 public Context map(String uri);
258
259
260 /**
261 * Remove the specified alias name from the aliases for this Host.
262 *
263 * @param alias Alias name to be removed
264 */
265 public void removeAlias(String alias);
266
267
268 }