1 /*
2 * Copyright 2006-2008 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.springframework.osgi.web.deployer;
18
19 import javax.servlet.ServletContext;
20
21 import org.osgi.framework.Bundle;
22 import org.osgi.framework.BundleContext;
23
24 /**
25 * Context associated with a war deployment. Provides access to various war
26 * properties such as the owning bundle, context path or associated servlet
27 * context.
28 *
29 * @see WarDeployment
30 * @see ServletContext
31 *
32 * @author Costin Leau
33 *
34 */
35 public interface WarDeploymentContext {
36
37 /**
38 * Convenience context attribute under which the OSGi BundleContext is
39 * bound. Implementations are required to support this attribute.
40 */
41 static final String OSGI_BUNDLE_CONTEXT_ATTRIBUTE = "org.springframework.osgi.web." + BundleContext.class.getName();
42
43
44 /**
45 * Returns the bundle associated with this war deployment.
46 *
47 * @return bundle associated with this war deployment
48 */
49 Bundle getBundle();
50
51 /**
52 * Returns the context path under which this war deployment resides.
53 *
54 * @return the context path for this war deployment
55 */
56 String getContextPath();
57
58 /**
59 * Returns the ServletContext used by the war backing this deployment.
60 *
61 * @return the servlet context associated with this war
62 */
63 ServletContext getServletContext();
64 }