View Javadoc

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