Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

How to map Absolute URIs to subdirs in Tomcat's 'ROOT' context?

Jeffery Cann

2003-12-27


Greetings.

I have an application that is currently running within
my $CATALINA_HOME/webapps/mywebapp directory. I
access it as:

http://localhost:8080/mywebapp/

Within this webapp, there is an 'img' subdirectory.
This contains all of the site images used in JSPs:

$CATALINA_HOME/webapps/mywebapp/img/

Consequently, all of the JSPs use the absolute URI to
reference images, i.e.,

<img src="/mywebapp/img/logo.gif">

Now, I wish run mywebapp in Tomcat's 'ROOT'
application context: $CATALINA_HOME/webapps/ROOT so
that I can access it as http://localhost:8080/

I changed an example JSP to refer to this absolute
URI:

<img src="/img/logo.gif">

[The 'img' subdirectory is now located at
$CATALINA_HOME/ROOT/img after I expanded the
mywebapp.war]

Images referenced using the absolute URI /img/logo.gif
do not load. Using a web browser, I can navigate to
http://localhost:8080/img/logo.gif and it will load,
so I don't think there is a permissions problem.

I think when the JSP is compiled by Tomcat, it thinks
that /img is an application context, rather than a
subdirectory of the ROOT application context.

My question: How can I configure Tomcat to allow my
absolute URI reference to this image subdirectory?

[NOTE: For various reasons, like secure (HTTPS)
aliases, we are unable to use relative references to
the 'img' directory.]

Thanks for any suggestions.

Jeff

__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.