You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jv...@apache.org on 2001/09/16 05:33:01 UTC

cvs commit: jakarta-turbine-2/src/java/org/apache/turbine Turbine.java

jvanzyl     01/09/15 20:33:01

  Modified:    src/java/org/apache/turbine Turbine.java
  Log:
  - collecting the server info on the first request and storing it
    so that it can be made available to the servlet service which
    is currently responsible to disseminating this info the processes
    which require server info but do not have access to RunData.
  
  Revision  Changes    Path
  1.3       +61 -2     jakarta-turbine-2/src/java/org/apache/turbine/Turbine.java
  
  Index: Turbine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/Turbine.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Turbine.java	2001/08/28 16:33:46	1.2
  +++ Turbine.java	2001/09/16 03:33:01	1.3
  @@ -116,7 +116,7 @@
    * @author <a href="mailto:frank.kim@clearink.com">Frank Y. Kim</a>
    * @author <a href="mailto:krzewski@e-point.pl">Rafal Krzewski</a>
    * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
  - * @version $Id: Turbine.java,v 1.2 2001/08/28 16:33:46 jvanzyl Exp $
  + * @version $Id: Turbine.java,v 1.3 2001/09/16 03:33:01 jvanzyl Exp $
    */
   public class Turbine 
       extends HttpServlet
  @@ -151,8 +151,23 @@
        */
       private static boolean firstDoGet = true;
   
  +    /**
  +     * The base from which the Turbine application
  +     * will operate.
  +     */
       private static String applicationRoot;
  -
  +    
  +    /**
  +     * Server information. This information needs to
  +     * be made available to processes that do not have
  +     * access to RunData and the ServletService doesn't
  +     * seem to be working in all cases.
  +     */
  +    private static String serverName;
  +    private static String serverScheme;
  +    private static String serverPort;
  +    private static String contextPath;
  +    
       /**
        * This init method will load the default resources from a
        * properties file.
  @@ -224,6 +239,10 @@
               {
                   if (firstDoGet)
                   {
  +                    serverName = data.getRequest().getServerName();
  +                    serverPort = Integer.toString(data.getRequest().getServerPort());
  +                    serverScheme = data.getRequest().getScheme();
  +                    contextPath = applicationRoot;
                       log("Turbine: Starting HTTP initialization of services");
                       TurbineServices.getInstance().initServices(data);
                       log("Turbine: Completed HTTP initialization of services");
  @@ -233,6 +252,46 @@
                  }
               }
           }
  +    }
  +
  +    /**
  +     * Return the server name.
  +     *
  +     * @return String server name
  +     */
  +    public static String getServerName()
  +    {
  +        return serverName;
  +    }
  +
  +    /**
  +     * Return the server scheme.
  +     *
  +     * @return String server scheme
  +     */
  +    public static String getServerScheme()
  +    {
  +        return serverScheme;
  +    }
  +
  +    /**
  +     * Return the server port.
  +     *
  +     * @return String server port
  +     */
  +    public static String getServerPort()
  +    {
  +        return serverPort;
  +    }
  +
  +    /**
  +     * Return the context path.
  +     *
  +     * @return String context path
  +     */
  +    public static String getContextPath()
  +    {
  +        return contextPath;
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org