Note that Struts isn't writing absolute URLs. As a webapp developer, you
use "context-relative references" that Struts turns into "site-root
relative" URLs. Here are examples of each type of reference, just so we
are all on the same page:

Relative: foo.html

Site-root relative: /myapp/foo.html

(And the special case of context-relative /foo.html inside an app, which
then becomes /myapp/foo.html if you deploy this app with a /myapp
context path.)

Absolute: http://server.com/bar.html


It sounds like your main challenge is that you have requests to a web
server that look like http://web.domain.com/foo/bar/me mapped to an app
deployed on an app server that you might access directly as
http://app.domain.com/me. 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 http://web.domain.com/me/foo.html which is not what you
want.

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.

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.)

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="relative.do"> work, for instance. Why don't you post
a specific example of something that isn't working for you.

-Max

On Mon, 2005-12-12 at 13:52 -0500, Michael P. Soulier wrote:
> Laurie Harper wrote:
> > Because if they were relative Struts would have no way to know what they 
> > were relative *to*?
> 
> But why does it need to know? I have links in sites that I look after like
> 
> foo/bar/bash.html
> 
> If I access this via http://mybox.com/, then the browser does the right 
> thing. If it's accessed via http://otherbox.com/, then it still does the 
> right thing. That's why relative links are always recommended.
> 
> Why does Struts need to know? This seems like another case of a 
> shortsighted framework to me, complicating something that would be dead 
> simple if we were simply generating our own html.
> 
> > Maybe inputPattern and/or pagePattern are what you're looking for?
> > 
> > http://struts.apache.org/struts-doc-1.2.7/userGuide/configuration.html#controller_config
> >  
> 
> Maybe. I'll look at this, and thank you.
> 
> Please pardon my exasperation.
> 
> Mike
> 


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

Reply via email to