Re: Servlet Questions

"David P. White" wrote:

> Benoit Mahe wrote:
> >
> > The servletwrapper is not an alias, it's the way Jigsaw handle servlets.
> > So yes, all servlets must be referenced via a ServletWrapper. But,
> > you can call a servlet with is full classname.
> > For example, it the servlet com.foobar.servlets.TestServlet is in your CLASSPATH
> >
> > or under a ServletDirectory, you reach it at
> >
> > http://hostname:port/servlet/com.foobar.servlets.TestServlet
> >
> > A ServletWrapper, ("com.foobar.servlets.TestServlet"), will be
> > created by the ServletIndexer.
> >
> > Regards, Benoit.
>
> Benoit,
>
> When I first tried this, I merely placed my servlet's class file in the
> servlet subdir under www. When I tried to reference it via it's fully
> qualified classname, it was not found.
>
> I then thought to place a series of subdir under the servlet subdir
> which map to the elements of the servlet's classname. Therefore, with a
> servlet named "foobar.servlets.TestServlet" the directory tree would be
> www/servlet/foobar/servlets and the file TestServlet.class would be
> placed therein.
>
> When I do this, I can indeed reference the servlet with my browser
> pointed to http://localhost:8001/servlet/foorbar.servlets.TestServlet.
> However, this only works the very first time I reference it. If I point
> my browser to another location and then back to the afore-mentioned
> servlet, I get a text page displayed in my browser which simply says
> "Servlet not configured properly". This occurs every time except the
> first.

Well, I just test it with a sample servlet and it works.

> I have no idea what's going on here. When I look (via jigadmin) at the
> servlet directory frame, it now includes a ServletWrapper called
> "foo\servlets\TestServlet" which references class

The servlet wrapper name should be "foo.servlets.TestServlet" and the servlet
class "foo.servlets.TestServlet.class".

> In addition, jigadmin shows directory

> resources/http frames for the directories placed under the servlet
> directory (foo and servlets). For the file TestServlet.class, there is
> also a file resource/http frame combination. Finally, in the jigsaw
> console, I see, "Create Servlet : foo\servlets\TestServlet.class". There
> are no other messages.
>
> This all seems ok to me. Is it what you'd expect? Any idea why I cannot
> access the servlet more than one time?

Well, that's strange, could you send me your servlet, so I'll be able to find
the problem (or may be the bug).

> Finally, should I be able to place a .jar or .zip file containing
> servlet code in the servlet directory under www? Or can these be only
> .class files?

Only class files are supported in the servlet directory.

--
- Benoît Mahé -------------------------------------------------------
                      World Wide Web Consortium   (W3C)
                    Architecture domain - Jigsaw Engineer

                http://www.w3.org/People/Mahe  - bmahe@w3.org
---------------------------------------------------------------------

Received on Tuesday, 15 June 1999 04:56:53 UTC