use req.getContextPath to find the RootUri.. much more robust. 4.0 and 4.1 compatible...
authormh <mh>
Tue, 26 Nov 2002 00:25:59 +0000 (00:25 +0000)
committermh <mh>
Tue, 26 Nov 2002 00:25:59 +0000 (00:25 +0000)
etc/web.xml
source/mir/misc/HTMLTemplateProcessor.java
source/mir/misc/MirConfig.java
source/mir/servlet/AbstractServlet.java
source/mircoders/producer/Producer.java

index d47a97e..42b5798 100755 (executable)
 
     </servlet>
     
-    <servlet>
+    <servlet-mapping>
         <servlet-name>
-            OutputMir
+            Mir
         </servlet-name>
-        <servlet-class>
-            OutputMir
-        </servlet-class>
-
-        <init-param>
-            <param-name>Config</param-name>
-            <param-value>config</param-value>
-        </init-param>
-
-    </servlet>
+        <url-pattern>
+            /Mir
+        </url-pattern>
+    </servlet-mapping>
 
     <servlet-mapping>
         <servlet-name>
             Mir
         </servlet-name>
         <url-pattern>
-            /Mir
+            /servlet/Mir
         </url-pattern>
     </servlet-mapping>
 
         <servlet-name>OpenMir</servlet-name>
         <url-pattern>/OpenMir</url-pattern>
     </servlet-mapping>
-
     <servlet-mapping>
-        <servlet-name>OutputMir</servlet-name>
-        <url-pattern>/OutputMir</url-pattern>
+        <servlet-name>OpenMir</servlet-name>
+        <url-pattern>/servlet/OpenMir</url-pattern>
     </servlet-mapping>
 
     <mime-mapping>
index 3f014cc..b86fd25 100755 (executable)
@@ -68,7 +68,7 @@ public final class HTMLTemplateProcessor {
             actionRoot = docRoot + MirConfig.getProp("Producer.ActionServlet");
         } catch (ConfigException ce) {
             // if  Producer.ActionServlet is not set in the conf file
-            actionRoot = docRoot + "/servlet/Mir";
+            actionRoot = docRoot + "/Mir";
         }
     }
 
index b84c21b..ebcd965 100755 (executable)
@@ -74,7 +74,7 @@ public class MirConfig extends Configuration {
    * @param name, The name of the servlet (usually "Mir")
    * @param confName, the name of the config file to load.
    */
-  public static synchronized void initConfig(ServletContext ctx, String uri,
+  public static synchronized void initConfig(ServletContext ctx, String ctxPath,
                                             String name, String confName) {
 
     initConfResource(ctx.getRealPath("/WEB-INF/")+"/"+confName);
@@ -83,7 +83,7 @@ public class MirConfig extends Configuration {
 
     configHash.put("Home", ctx.getRealPath("/WEB-INF/")+"/");
     configHash.put("ServletContext", ctx);
-    configHash.put("RootUri", uri);
+    configHash.put("RootUri", ctxPath);
 
     Enumeration resKeys = getResourceKeys();
     while(resKeys.hasMoreElements()) {
index 70ddc61..b9a99e5 100755 (executable)
@@ -63,17 +63,15 @@ public abstract class AbstractServlet extends HttpServlet {
             throws UnavailableException {
 
         //String RealPath = super.getServletContext().getRealPath("/");
-        String Uri = req.getRequestURI();
-        String Name = super.getServletName();
-        String RootUri = StringUtil.replace(Uri, "/servlet/" + Name, "");
+        String name = super.getServletName();
 
         // init config
         //MirConfig.initConfig(RealPath, RootUri, Name, getInitParameter("Config"));
-        MirConfig.initConfig(super.getServletContext(), RootUri, Name,
-                              getInitParameter("Config"));
+        MirConfig.initConfig(super.getServletContext(), req.getContextPath(),
+                              name, getInitParameter("Config"));
 
-        theLog = Logfile.getInstance(MirConfig.getPropWithHome(Name + ".Logfile"));
-        theLog.printInfo(Name + " started.");
+        theLog = Logfile.getInstance(MirConfig.getPropWithHome(name + ".Logfile"));
+        theLog.printInfo(name + " started.");
         theLog.printInfo("Path is: " + MirConfig.getProp("Home"));
         theLog.printInfo("Root URI is: " + MirConfig.getProp("RootUri"));
         theLog.printInfo("StandardLanguage is: " + MirConfig.getProp("StandardLanguage"));
index c2cb977..94e08e5 100755 (executable)
@@ -50,8 +50,7 @@ abstract public class Producer {
   protected static String   producerProductionHost = MirConfig.getProp("Producer.ProductionHost");
   protected static String   producerOpenAction = MirConfig.getProp("Producer.OpenAction");;
 
-  /** @todo same as in HTMLTemplateProcessor, this should be dynamically set */
-  protected static String   actionRoot = MirConfig.getProp("RootUri") + "/servlet/Mir";
+  protected static String   actionRoot = MirConfig.getProp("RootUri") + "/Mir";
 
   protected static Logfile theLog = Logfile.getInstance(MirConfig.getProp("Home") + "/" + MirConfig.getProp("Producer.Logfile"));
   protected static ModuleTopics         topicsModule;