• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

Tomcat url redirect problem

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using httpd with tomcat and mod_jk

My webapp url is something like:
http://localhost:8080/myapp
- which picks up the JSP from /home/webapps/myapp

But when someone else a url such as
http://localhost:8080/myapp/assets/1.gif, or
http://localhost:8080/myapp/assets/2.jpg
- I want tomcat to retrieve the gif from a different directory on the server -
/usr/share/my_images/1.gif and
/usr/share/my_images/2.jpg

To do this, i created a file called myapp#assets.xml, and placed it in
/usr/share/tomcat6/conf/Catalina/localhost
The content of myapp#assets.xml are -
<Context docbase="/usr/share/my_images/" path="/assets/*"></Context>

But this is not working, and the server just does not find http://localhost:8080/myapp/assets/1.gif.
What am i doing wrong?
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This sounds like the JKAutoAlias apache directive for mod_jk.. see also : http://tomcat.apache.org/connectors-doc/reference/apache.html

i think when you set up the assets like that, to mean that mod_jk would allow apache to fetch the files instead of invoking tomcat, that you no longer can hit tomcat (e.g. you said going to ..:8080/....gif wasn't working.. So, wouldn't that be the direct to tomcat mode,

does, going through apache localhost:80/myapp/assets/... work ?
 
Ankush Bhargava
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.

Eventually what i ended up doing is -
1. unmount the folder


2. create alias in httpd to redirect urls to the specific directory


This seems to work :-)
 
You showed up just in time for the waffles! And this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic