The moose likes Tomcat and the fly likes keeping the directory path hidden Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "keeping the directory path hidden" Watch "keeping the directory path hidden" New topic

keeping the directory path hidden

John Kim

Joined: Jun 16, 2003
Posts: 6
right now i have tomcat 4 running in conjunction with apache 2, and when the user visits my site via the address, he is automatically redirected to and if the user logs in, he is directed to, 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 is displayed? thanks in advance.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

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 would be a servlet that actually invokes something hideous like

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

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
to mean:

But in the end.. *something* has to tell your application what to do.
I agree. Here's the link:
subject: keeping the directory path hidden
It's not a secret anymore!