struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael P. Soulier" <>
Subject Re: forcing relative urls from struts instead of the absolute urls!
Date Tue, 03 Jan 2006 21:51:12 GMT
On 13/12/05 Max Cooper did say:

> It sounds like your main challenge is that you have requests to a web
> server that look like mapped to an app
> deployed on an app server that you might access directly as
> The app will make site-root relative URLs
> like /me/foo.html, and the browser will them make a request to the web
> server like which is not what you
> want.

That is correct. 

> What is stopping you from deploying the app with a "/foo/bar/me"
> context, so that it matches the "public" context on the web server? This
> is almost certainly the easiest solution if you can do it.

In this case, is a prefix for a lot of UI
elements that are pluggable for separate applications. That would mean
that if /foo became a web application in tomcat, it would be much more
difficult for applications to plug-in to it. If each application
delivered a .war file, as a separate web application, that would be far
easier to maintain in the long run than requiring all developers to
coexist in one large web app under tomcat. 

> Alternately, perhaps there is some proxy configuration magic that would
> work. To be robust, you'd probably need to use a connector (e.g. mod_jk)
> rather than just using a "dumb" proxy to forward requests, because I
> think the app server really needs to know the desired context path in
> order to render the pages with the proper URLs. (The alternative of
> filtering the response stream after-the-fact in hopes of converting all
> URLs is a lousy design for many reasons and not an approach I would
> recommend.)

I'm currently using ProxyPass in apache, but if this can be done with
mod_jk, then I'll focus on that. Do you know it's possible with AJP?

> Using context-relative references is really useful. Actions have the
> same name (path) no matter what page you are working on. Images are
> always "/img/..." (or whatever) without having to think twice what the
> request URL was that caused the JSP you are editing to execute (note
> that the request may not match the JSP file path). And you can choose
> (and change) the context path at deployment time without breaking
> anything.
> However, if you are dead set on using strictly relative references, you
> may still be able to get it to work. I am pretty sure I have seen
> <html:form action=""> work, for instance. Why don't you post
> a specific example of something that isn't working for you.

I tried that, but I couldn't get the existing web application to load
once I'd made those changes. Perhaps I did it wrong. 

Michael P. Soulier <>, 613-592-2122 x2522
"Any intelligent fool can make things bigger and more complex... It takes a
touch of genius - and a lot of courage to move in the opposite direction."
--Albert Einstein

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message