• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

keeping the directory path hidden

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
right now i have tomcat 4 running in conjunction with apache 2, and when the user visits my site via the address www.mysite.com, he is automatically redirected to www.mysite.com/myapps/index.html. and if the user logs in, he is directed to www.mysite.com/myapps/servlet/ControlServlet, and so on.
my question is, is there any way for me to hide the path so that in the user browser's address box only something concise like www.mysite.com is displayed? thanks in advance.
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer (I think) is "well...... hmm...... kinda.. but not really"

The problem is links.

You might be able to 'hide' the first entry point. Instead of 'redirecting', you might be able to accomplish a server-side forward. Such that www.foo.com/home would be a servlet that actually invokes something hideous like www.foo.com/home/servlet/blah?foo=1&bar=2

But what about the "next" step?

You can make your HTML *look* pretty, the text of the link can say anything, but the ACTUAL link must still point to
www.foo.com/home/servlet/anotherservlet?with=more&cruff=here

The answer in this case, is to 'hide' the fact you are invoking a servlet.

Perl junkies love doing this. And it's possible in Java as well, expecially if you don't mind parsing the results of calling getRequestURL(), getRequestURI() or even getPathInfo()

So you'd parse something "nice" looking like
www.foo.com/home/a/b
to mean:
www.foo.com/home/servlet/blah?foo=a&bar=b

But in the end.. *something* has to tell your application what to do.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!