Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

keeping the directory path hidden

 
John Kim
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.
 
Mike Curwen
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