tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <>
Subject Re: Context or Mapping problems Apache 2.2 +mod_JK+ Tomcat 5.5
Date Thu, 24 Jul 2008 19:02:13 GMT
Caldarale, Charles R schrieb:
>> From: kohanm [] Subject: Re: Context
>> or Mapping problems Apache 2.2 +mod_JK+ Tomcat 5.5
>> The webaplication is done now, but my boss asked me to change the
>> name of URL webapplication. IF I change the directory name than
>> there are many jsp pages with many links  with old name's
>> webapplication.
> Now the true problem comes out - the webapp name is hardcoded within
> the webapp; that's extremely bad practice.  I assume fixing those
> won't be an easy task.
> In this case, you're stuck with needing to deploy the webapp in the
> directory corresponding to the old name; there's no way around that.
> You can write a filter or valve in Tomcat that forwards or redirects
> all requests for the new name to the old one.  You should also be
> able to do that with mod_jk directives, but someone else will have to
> help with that.

Someone else says:

If your webapp sends out responses with absolute URLs containing the 
wrong application name, then there's no easy solution.

Case 1: You only want to make the app reachable under the new name, but 
you don't care if users switch to the old name sometime during app use.

That's easy, simply redirect from the new name to the old name with a 
Redirect or RedirectMatch in Apache httpd.

Case 2: You accept occasional occurence of the old name in THE URLs, but 
it should be mostly th enew one.

Deploy the webapp under the new name as Charles suggested. Add a 
RewriteRule to Apache httpd to redirect any URL of the from 
/oldapp/something to /newapp/something. Whenever Users click on an 
oldapp link, the request will be answered by the redirect and the URLs 
quickly get replaced by the newapp URLs in the browser window. Caution: 
there might be problems with redirects and POST requests. All in all 
that's more a hack.

Case 3: The oldapp name is not contained in the body of responses, but 
only used in redirects coming from the webapp. Then you could try using 
mod_proxy, which allows to change the Location headers in redirects.

Case 4: You don't allow any use of the old name and the old name is 
contained in links in response bodies.

Then you dynamically need to patch the responses. This will be a hack. 
Have a look at either mod_substitute (httpd 2.2.8 or above, I think) or 
mod_proxy_html (note: mod_proxy_html != mod_proxy_http).



To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message