You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by James Cook <ji...@iname.com> on 2000/02/18 04:31:54 UTC

Self Discovery

Is it possible for a servlet, that is preloaded by the server, to discover
what URL will invoke him? I want my servlets to be able to broadcast to
other services, which URL can invoke them. Since this can be changed at
deployment time, the only "safe" way to do this is through some kind of
server context. Has this been addressed?

thanks,
jim


Re: Self Discovery

Posted by "Craig R. McClanahan" <cm...@mytownnet.com>.
James Cook wrote:

> Is it possible for a servlet, that is preloaded by the server, to discover
> what URL will invoke him? I want my servlets to be able to broadcast to
> other services, which URL can invoke them. Since this can be changed at
> deployment time, the only "safe" way to do this is through some kind of
> server context. Has this been addressed?
>

Not to solve the problem to which you are referring.

One thing to keep in mind is that there is no restriction allowing only *one*
mapping for a given servlet definition.  You can map the same servlet to
several URI paths, several extensions, and even invoke it via /servlet/xxxxx
if you've configured your servlet container for that.

The only time you unambiguously know how you can be invoked is when you are
processing a specific request -- you can examine the portions of of the
request URI in order to reconstruct a URI that can access themselves.

>
> thanks,
> jim
>

Craig McClanahan