View Javadoc

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