aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "keeping the directory path hidden" Watch "keeping the directory path hidden" New topic
Author

keeping the directory path hidden

John Kim
Greenhorn

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 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.
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 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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: keeping the directory path hidden