Why this doesn't work as expected exposes an important point about the
/servlets/ directory. It's not a directory at all+ACE-
In JRun, at least, the virtual path /servlet/ is mapped to a servlet called
+ACI-invoker+ACI-. When a request comes to the web server that contains the string
+ACI-/servlet/+ACI- the web server via JRun, redirects this request to the invoker
servlet. The 'extra path info' is set to whatever the remainder of the
string is.
For example, if you ask for this URL: www.myservletdomain.com/servlet/hello
what you wind up with is a request to the invoker servlet with extra path
info of +ACI-hello+ACI-. If you make a request to
www.myservletdomain.com/servlet/subdir/hello the invoker servlet is trying
to load a servlet called +ACI-subdir/hello+ACI-, which doesn't exist.
For a real site, I imagine that you'd want to remove the /servlet/ mapping,
because this allows people to invoke any of the servlets you have in your
servlet classpath which isn't something you necessarily want. Not the least
of which is that seeing +ACI-/servlet/+ACI- in the URL is about as attractive as
seeing +ACI-cgi-bin+ACI- in the URL (I happen to think that URL's - even internal
ones - should be attractive and easy to remember and therefore contain only
relevant information).
I really think of this as a blessing. A search servlet, for example, is
much better off with the URL http://www.domain.com/search/ than it is with
www.domain.com/servlet/search/
If you want to refer to your servlet as domain.com/servlet/test/hello then
you could create an alias in JRun to map /test/hello to the hello servlet,
which you'd put in the root of the servlet classpath.
Probably the most elegant solution, however, is to get rid of the /servlet/
alias entirely, and create a JSP file with a +ADw-SERVLET+AD4- tag in it. That will
allow you to refer to your servlets conveniently by whatever URL you like,
without mucking around with aliases.
Michael
----- Original Message -----
From: Lily Y. Fu +ADw-lily+AEA-TIGR.ORG+AD4-
To: +ADw-SERVLET-INTEREST+AEA-JAVA.SUN.COM+AD4-
Sent: Thursday, April 29, 1999 1:17 PM
Subject: subdir under servlets directory
+AD4- I am new to the servlet world, I have a baisc question:
+AD4-
+AD4- I configured my Netscape Enterprise Webserver as such that
+AD4- all servlets (java class files) are put under
+AD4- the /servlets/ directory, so if I have a
+AD4-
+AD4- /servlets/HelloWorld.class
+AD4- I can access it from a brower at http://webserver.../servlet/HelloWorld
+AD4-
+AD4- However, I'd like to organize the servlet inthe servlets directory,
+AD4- to make subdirectories, so I had
+AD4-
+AD4- /servlets/test/HelloWorld.class
+AD4-
+AD4- when I tried to access it from
+AD4- http://webserver.../servlet/test/HelloWorld
+AD4-
+AD4- it gave me server error: servlet test not found.
+AD4-
+AD4- Is there a way to solve this problem?
+AD4-
+AD4- Thanks,
+AD4-
+AD4- Lily
+AD4-
+AD4-
+AF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBf-
+AD4- To unsubscribe, send email to listserv+AEA-java.sun.com and include in the
body
+AD4- of the message +ACI-signoff SERVLET-INTEREST+ACI-.
+AD4-
+AD4- Archives: http://archives.java.sun.com/archives/servlet-interest.html
+AD4- Resources: http://java.sun.com/products/servlet/external-resources.html
+AD4- LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
+AD4-
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html