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/10/10 15:35:33 UTC
cvs commit: jakarta-turbine-2/src/java/org/apache/turbine Turbine.java
jvanzyl 01/10/10 06:35:33
Modified: src/java/org/apache/turbine Turbine.java
Log:
- fixing the problem where getContextPath() was returning the application
root. this was in turn causing a problem with
$ui.image($ui.logo)
type calls. the ui manager now works properly.
Revision Changes Path
1.6 +33 -11 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Turbine.java 2001/09/26 01:23:02 1.5
+++ Turbine.java 2001/10/10 13:35:33 1.6
@@ -54,32 +54,24 @@
* <http://www.apache.org/>.
*/
-// Java Core Classes
import java.io.IOException;
import java.io.PrintWriter;
+import java.io.File;
import java.util.Enumeration;
-
-// Java Servlet Classes
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
-// Turbine Modules
import org.apache.turbine.modules.ActionLoader;
import org.apache.turbine.modules.PageLoader;
import org.apache.turbine.modules.actions.sessionvalidator.SessionValidator;
-
-// Turbine Utility Classes
import org.apache.turbine.util.DynamicURI;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.RunDataFactory;
import org.apache.turbine.util.StringUtils;
import org.apache.turbine.util.security.AccessControlList;
-
-//Turbine Services
import org.apache.turbine.services.TurbineServices;
import org.apache.turbine.services.resources.TurbineResources;
import org.apache.turbine.services.logging.LoggingService;
@@ -117,7 +109,7 @@
* @author <a href="mailto:krzewski@e-point.pl">Rafal Krzewski</a>
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
* @author <a href="mailto:sean@informage.net">Sean Legassick</a>
- * @version $Id: Turbine.java,v 1.5 2001/09/26 01:23:02 legassick Exp $
+ * @version $Id: Turbine.java,v 1.6 2001/10/10 13:35:33 jvanzyl Exp $
*/
public class Turbine
extends HttpServlet
@@ -205,6 +197,10 @@
applicationRoot = config.getServletContext().getRealPath("");
}
+ // Create any directories that need to be setup for
+ // a running Turbine application.
+ createRuntimeDirectories();
+
// Initalize TurbineServices and init bootstrap services
TurbineServices services =
(TurbineServices) TurbineServices.getInstance();
@@ -235,6 +231,27 @@
}
/**
+ * Create any directories that might be needed during
+ * runtime. Right now this includes:
+ *
+ * i) directories for logging
+ *
+ */
+ private static void createRuntimeDirectories()
+ {
+ // Create the logging directory
+ File logDir = new File(getRealPath("/logs"));
+
+ if (logDir.exists() == false)
+ {
+ if(logDir.mkdirs() == false)
+ {
+ System.err.println("Cannot create directory for logs!");
+ }
+ }
+ }
+
+ /**
* Initializes the services which need <code>RunData</code> to
* initialize themselves (post startup).
*
@@ -251,7 +268,12 @@
serverName = data.getRequest().getServerName();
serverPort = Integer.toString(data.getRequest().getServerPort());
serverScheme = data.getRequest().getScheme();
- contextPath = applicationRoot;
+
+ // Store the context path for tools like ContentURI and
+ // the UIManager that use webapp context path information
+ // for constructing URLs.
+ contextPath = data.getRequest().getContextPath();
+
log("Turbine: Starting HTTP initialization of services");
TurbineServices.getInstance().initServices(data);
log("Turbine: Completed HTTP initialization of services");
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org