On Thu, 1 Mar 2001, Jason Novotny wrote:
> I would like to be able to access a servlet with the URL
> http://localhost:8080/demo
>
> However, it only works if I go to
> http://localhost:8080/demo/servlet/demo
[ ... ]
How timely! I just joined the list yesterday, and this is exactly one
of the questions I was going to ask, since I'm trying to do the same
thing. I have managed to get close to what I want, but not quite.
I tried some similar things as you with a context in the server.xml
and with servlet names and mappings in web.xml without luck.
However, I did find this question in the FAQ-o-matic at jakarta.apache.org:
http://jakarta.apache.org:8080/jyve-faq/Turbine/screen/DisplayQuestionAnswer/action/SetAll/project_id/2/faq_id/12/topic_id/43/question_id/532
It's a bit cryptic, but it suggests two ways of doing this: One, have
an index page (jsp or html) that does a redirect to the servlet, or
two, use Apache's mod_rewrite.
Now, I tried the first of these, using both a META Refresh in an
index.html file and a RequestDispatcher forward() in an index.jsp
file, and it basically worked either way. That is, it got it to the
right place from just a "http://localhost/demo" URL. The problem is
that it changed the Location to "http://localhost/demo/servlet/demo",
which I'd like to avoid.
Now, I'm not familiar with mod_rewrite (and I don't currently have it
installed), so I don't know if it provides a cleaner way to do this
and/or avoids the above problem. Maybe you or someone else here knows
the answer to that.
Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]