</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-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>
* Mir.java - main servlet, that dispatches to servletmodules
*
* @author $Author: mh $
- * @version $Revision: 1.17.2.1 $ $Date: 2002/09/01 21:31:39 $
+ * @version $Revision: 1.17.2.2 $ $Date: 2002/11/25 21:59:47 $
*
* $Log: Mir.java,v $
+ * Revision 1.17.2.2 2002/11/25 21:59:47 mh
+ * use req.getContextPath to find the RootUri.. much more robust. 4.0 and 4.1 compatible due to new web.xml mapping
+ *
* Revision 1.17.2.1 2002/09/01 21:31:39 mh
* Mir goes GPL
*
private static ModuleMessage messageModule = null;
private final static HashMap servletModuleInstanceHash = new HashMap();
+ private static boolean nameSet = false;
+
public HttpSession session;
public void doGet(HttpServletRequest req, HttpServletResponse res)
if (getServletContext().getAttribute("mir.confed") == null) {
getConfig(req);
}
- MirConfig.setServletName(getServletName());
+
+ if (!nameSet) {
+ MirConfig.setAdminServletName(getServletName());
+ nameSet = true;
+ }
session = req.getSession(true);
private static String lang;
public HttpSession session;
+ private boolean nameSet = false;
+
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
doPost(req,res);
if(getServletContext().getAttribute("mir.confed") == null) {
getConfig(req);
}
+ if (!nameSet) {
+ MirConfig.setOpenServletName(getServletName());
+ nameSet = true;
+ }
+
session = req.getSession();
if(session.getAttribute("Language")==null){
//actionRoot = docRoot + "/servlet/" + MirConfig.getProp("ServletName");
//actionRoot = docRoot + "/servlet/NadirAktuell";
- actionRoot = docRoot + "/servlet/Mir";
+ actionRoot = docRoot + "/Mir";
defEncoding = MirConfig.getProp("Mir.DefaultEncoding");
openAction = MirConfig.getProp("Producer.OpenAction");
* @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(confName);
configHash = new HashMap();
configHash.put("Home", ctx.getRealPath("/"));
configHash.put("ServletContext", ctx);
- configHash.put("RootUri", uri);
+ configHash.put("RootUri", ctxPath);
Enumeration resKeys = getResourceKeys();
while(resKeys.hasMoreElements()) {
configHash.put(keyNm, getProperty(keyNm));
}
}
- /**
- * Returns the property asked for by pulling it out a HashMap
- * @param a String containing the property name (key)
- * @return a String containing the prop. value
- */
- public static void setServletName(String servletName) {
- configHash.put("ServletName",servletName);
+
+ public static void setAdminServletName(String servletName) {
+ configHash.put("AdminServletName",servletName);
+ }
+
+ public static void setOpenServletName(String servletName) {
+ configHash.put("OpenServletName",servletName);
}
/**
/**
* Title: Mir
* Description: Abstract servlet-class
- * Copyright: Copyright (c) 2001
- * Company: Indymedia
- * @author idfx
- * @version 1.0
+ * Copyright: Copyright (c) 2001, 2002
+ * Company: Mir-coders group
+ * @author idfx, the Mir-coders group
+ * @version $Id: AbstractServlet.java,v 1.15.4.4 2002/11/25 21:59:46 mh Exp $
*/
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, "");
// 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.");
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") + "/Mir";
protected static Logfile theLog = Logfile.getInstance(MirConfig.getProp("Home") + "/" + MirConfig.getProp("Producer.Logfile"));