tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Milo Hyson <>
Subject Re: Baked-in context paths
Date Thu, 07 Nov 2013 19:46:34 GMT
On Nov 7, 2013, at 7:57 AM, Christopher Schultz <> wrote:

> The only way to reliably mutate context-paths during proxying is to
> re-write the headers and content of the pages. It's miserable.

Perhaps YOUR experiences have been miserable, but clearly that's not the case for everyone.
The only headers I've ever needed to modify are request URL and cookie path, both of which
can easily be adjusted with HTTPD directives. As for content, due to my use of relative linking,
I've never needed to tweak it after leaving Tomcat.

> To be clear, I've *only* been recommending context-relative resources.

You've been recommending server-relative references. The context-path, by definition, gives
a location that is relative to the server, and therefore anything it prefixes becomes server-relative.
A context-relative path is one that is relative to the context. Please see

> Note that it's much more convenient to use Velocity Tools' LinkTool,
> which not only can construct "relative" URLs, but it will properly
> encode them with the session id when cookies are not in use. Also note
> that "relative" links will become context-relative links.

First of all, LinkTool returns server-relative links, not context-relative. Second, not everybody
needs to encode session IDs into URLs. In fact, some people don't even use sessions. Were
these issues for me I would of course take a different approach. Third, a single VTL variable
is pretty damn convenient. As a content developer I just put that in my template and as if
by magic the links work. Granted, the framework developer had to write code to initialize
that variable, but it was trivial and only had to be done once.

> You have been fairly lucky. You must not use #parse() a lot.

Except for experimentation, no, I don't. Even if I did, I'm not sure why that would be a problem.
So far as I know, all parse() does is temporarily switch the VelocityEngine to a different

- Milo Hyson
Chief Scientist
CyberLife Labs, Inc.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message