Thanks Chris,

You're right! I did run into that exact same problem. I can add a third solution to the ones you offer. The struts 2 url tag has an "encode" attribute. When you do:

<s:url value="mycssFile.css" encode="false" id="link" />
<link href="${link}" type="text/css" rel="stylesheet" />

The jsessionid is omitted from the generated path. However, this should be used with care, because it removes all encoding. However for css, image, js, and other external files, that shouldn't be a problem.

Eric.

On Mar 5, 2007, at 3:54 PM, Christopher Schultz wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Eric,

Eric Rank wrote:
Solved this problem.

By setting the DefaultType directive to "text/html" in Apache's
httpd.conf, the pages with urls containing the appended ";jsessionid"
display as html, not plain text.

I should have thought of that before :-)

Since you ran across this problem, you are likely to run across another one with url-encoded parameters and Apache httpd out in front of Tomcat:
if you want Apache httpd to serve a static file (say, a CSS file or an
image), the ";jsessionid=..." part is treated as part of the filename
(which will never be found).

There are two ways that I know to fix this so that Apache httpd can
still serve encoded URLs:

1. Use mod_rewrite with this rule:

RewriteRule /myapp/(.*);jsessionid=[0-9A-Z]*(.*) /path/to/myapp/$1 $2 [L]

If your app is deployed as the root, then remove "/myapp" from those URLs.

2. Use "JkStripSession On" in your httpd.conf file. This is a new
   feature of the as-yet-unreleased mod_jk 1.2.21.

I used to use #1 and now I will use #2 because it is more
straightforward and allows me to disable mod_rewrite in my server.

Hope that helps,
- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF7J+V9CaO5/Lv0PARAvTAAKCgCLbbSQCGQUxRBs11cdzkXsA2pwCeK74J
I2ho+x9Etxwhyl0kkjJIbmY=
=w9ZU
-----END PGP SIGNATURE-----

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



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

Reply via email to