I haven't actually run the code, but I don't see what the issue would be. If you run:

javap -classpath /path/to/struts.jar org.apache.struts.Globals

You should get something like:

Compiled from "Globals.java"
public class org.apache.struts.Globals extends java.lang.Object implements java.io.Serializable{
...
public static final java.lang.String MODULE_KEY;
...
}


Another approach would be to use the action that fronts the page to create the module path:

ServletContext ctx = getServlet().getServletContext();
ModuleConfig moduleConfig = RequestUtils.getModuleConfig(request, ctx);
String prefix = "";
if (moduleConfig != null) {
  prefix = moduleConfig.getPrefix();
}
String modulePath = request.getContextPath() + prefix;
request.setAttribute("modulePath", modulePath);

Ruth, Brice wrote:
I tried this and got a JSP compile error that MODULE_KEY in org.apache.struts.Globals couldn't be resolved ...

org.apache.struts.Globals _jspx_th_c_rt_set_0.setValue( Globals.MODULE_KEY ); ^ 1 error

?!

Kris Schneider wrote:

If you can accomplish what you want via Apache rewrite rules, that seems like a
simpler solution. If that doesn't work out, here's a JSP/JSTL equivalent of how
<html:img> comes up with the module path:


<%@ page import="org.apache.struts.Globals" %>
<%@ taglib prefix="c"    uri="http://java.sun.com/jstl/core"; %>
<%@ taglib prefix="c_rt" uri="http://java.sun.com/jstl/core_rt"; %>

<c_rt:set var="moduleKey" value="<%= Globals.MODULE_KEY %>"/>
<c:set var="moduleConfig" value="${requestScope[moduleKey]}"/>
<c:set var="prefix" value=""/>
<c:if test="${not empty moduleConfig}">
   <c:set var="prefix" value="${moduleConfig.prefix}"/>
</c:if>
<c:set var="modulePath"
      value="${pageContext.request.contextPath}${prefix}"/>

<img src="<c:out value="${modulePath}/path/to/image"/>">

Quoting dutrieux <[EMAIL PROTECTED]>:



Maybe you can try, But I think the impacts is all pages send to apache then all virtualhosts defiend by the mod_jk.

Ruth, Brice a écrit :



Is this something I can do at a global level, so that it impacts all virtualhosts defined by the mod_jk auto configuration file generated by Tomcat's connector?

dutrieux wrote:



Hello

For Apache v3.x you need to put in "httpd.conf" file this entry :

RewriteRule ^(.*);jsessionid=.*$ $1 [L]

Best regards

Olivier Dutrieux
*

*
Ruth, Brice a écrit :



Ruth, Brice wrote:



Hi. I'm using html:img in certain tiles that are used from very different places in my application with the "page" attribute to take advantage of module-relative naming for the image sources. However, when cookies aren't enabled, or on the first visit to the web application (with no session cookie having been previously detected), the ';jsessionid=X' gets added to the end of the image. Now, I'm not driving any dynamic images, nor do I intend to, so this sessionid is worthless to me. Furthermore - since I'm using Apache+Tomcat+mod_jk to serve this application, Apache seems to choke on serving up this image. I expect its because the sessionid is delimited by ';' instead of '?' as I'm used to, but maybe not.

Either way - does anyone know of a way to get around this? If possible, I'd prefer not having to do anything special in the Apache conf, mainly because I'm using the auto-generated mod_jk conf file for this configuration.

Thanks!


Any takers on this? This is kinda hosin' up my Apache/Tomcat setup ... Tomcat standalone serves up the images fine with the jsessionid junk, but Apache doesn't!



--


------------------------------------------------------------------------
*Olivier Dutrieux*
------------------------------------------------------------------------
<www.pasteur.fr>
------------------------------------------------------------------------

Institut Pasteur
Informatique de gestion
&
Micro-Informatique

25-28 rue du Docteur Roux
75724 PARIS CEDEX 15

------------------------------------------------------------------------
Tel: +33 (0) 1 40 61 31 62
Fax: +33 (0) 1 45 68 89 89

------------------------------------------------------------------------

-- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to