View Javadoc

1   package org.apache.turbine.services.servlet;
2   
3   /*
4    * Copyright 2001-2005 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License")
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import java.io.InputStream;
20  import java.net.URL;
21  import javax.servlet.ServletConfig;
22  import javax.servlet.ServletContext;
23  
24  import org.apache.turbine.services.Service;
25  
26  /***
27   * <p>This interface exposes methods of the runner context in order
28   * resolve or get access to external resources</p>
29   *
30   * @author <a href="mailto:ekkerbj@netscape.net">Jeff Brekke</a>
31   * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>
32   * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
33   * @version $Id: ServletService.java 278958 2005-09-06 09:35:39Z henning $
34   */
35  public interface ServletService extends Service
36  {
37      /***
38       * The service identifier
39       */
40      String SERVICE_NAME = "ServletService";
41  
42      /***
43       * Returns an URL object for a given URI string.
44       *
45       * @param uri the URI to resolve as an URL
46       * @return an URL object or null is the uri is malformed or
47       * can't be resolved
48       */
49      URL getResource(String uri);
50  
51      /***
52       * Same as getResource except that it returns an InputStream
53       *
54       * @param uri the URI to resolve
55       * @return an InputStream on the URI content or null
56       */
57      InputStream getResourceAsStream(String uri);
58  
59      /***
60       * Returns the complete filesystem path for a
61       * given URI
62       *
63       * @param uri the URI to resolve
64       * @return the full system path of this URI
65       */
66      String getRealPath(String uri);
67  
68      /***
69       * Returns the servlet config used by this
70       * Turbine web application.
71       *
72       * @return turbine servlet config
73       */
74      ServletConfig getServletConfig();
75  
76      /***
77       * Returns the servlet context used by this
78       * Turbine web application.
79       *
80       * @return turbine servlet context
81       */
82      ServletContext getServletContext();
83  
84      /***
85       * Returns the server scheme for this
86       * Turbine application. This will either
87       * be http or https.
88       *
89       * @return String
90       */
91      String getServerScheme();
92  
93      /***
94       * Returns the server name that this
95       * Turbine application is running
96       * on.
97       *
98       * @return String
99       */
100     String getServerName();
101 
102     /***
103      * Returns the port that this Turbine
104      * application is running through
105      * on the server.
106      *
107      * @return String
108      */
109     String getServerPort();
110 
111     /***
112      * Returns the context path for this
113      * Turbine application.
114      *
115      * @return String
116      */
117     String getContextPath();
118 }