You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by jo...@bnpparibas.com on 2002/02/01 17:13:07 UTC
servlet url at init time
Hello all,
I would like to know the URL of a servlet _in its init method_:
I need it to know how it is called without having to tell it via a
config file...
I know how to get it when dealing with doGet or doPost, but can't
find any api at init time :(
did I miss something?
thanks
--
Joseph
This message and any attachments (the "message") is
intended solely for the addressees and is confidential.
If you receive this message in error, please delete it and
immediately notify the sender. Any use not in accord with
its purpose, any dissemination or disclosure, either whole
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message.
BNP PARIBAS (and its subsidiaries) shall (will) not
therefore be liable for the message if modified.
---------------------------------------------
Ce message et toutes les pieces jointes (ci-apres le
"message") sont etablis a l'intention exclusive de ses
destinataires et sont confidentiels. Si vous recevez ce
message par erreur, merci de le detruire et d'en avertir
immediatement l'expediteur. Toute utilisation de ce
message non conforme a sa destination, toute diffusion
ou toute publication, totale ou partielle, est interdite, sauf
autorisation expresse. L'internet ne permettant pas
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce
message, dans l'hypothese ou il aurait ete modifie.
--
To unsubscribe: <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>
Re: servlet url at init time
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Fri, 1 Feb 2002 joseph.vallot@bnpparibas.com wrote:
> Date: Fri, 1 Feb 2002 17:13:07 +0100
> From: joseph.vallot@bnpparibas.com
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: tomcat-user@jakarta.apache.org
> Subject: servlet url at init time
>
>
> Hello all,
>
> I would like to know the URL of a servlet _in its init method_:
> I need it to know how it is called without having to tell it via a
> config file...
> I know how to get it when dealing with doGet or doPost, but can't
> find any api at init time :(
>
There is no such API, but see below for part of the answer.
> did I miss something?
>
Keep in mind that a servlet doesn't have to have "a" URL -- you can map as
many different URL patterns as you like to it. Therefore, if you *really*
want to know, you can use an XML parser to read the "/WEB-INF/web.xml"
resource and figure them all out. You can find out your own
<servlet-name> (in servlet 2.3 at least) from the ServletConfig object, so
it's just a matter of looking for all the <url-pattern> values that map to
this name.
This still only tells you the context-relative part of the URL -- the
context path is not visible until a request comes in.
> thanks
> --
> Joseph
>
Craig
>
>
>
> This message and any attachments (the "message") is
> intended solely for the addressees and is confidential.
> If you receive this message in error, please delete it and
> immediately notify the sender. Any use not in accord with
> its purpose, any dissemination or disclosure, either whole
> or partial, is prohibited except formal approval. The internet
> can not guarantee the integrity of this message.
> BNP PARIBAS (and its subsidiaries) shall (will) not
> therefore be liable for the message if modified.
>
> ---------------------------------------------
>
> Ce message et toutes les pieces jointes (ci-apres le
> "message") sont etablis a l'intention exclusive de ses
> destinataires et sont confidentiels. Si vous recevez ce
> message par erreur, merci de le detruire et d'en avertir
> immediatement l'expediteur. Toute utilisation de ce
> message non conforme a sa destination, toute diffusion
> ou toute publication, totale ou partielle, est interdite, sauf
> autorisation expresse. L'internet ne permettant pas
> d'assurer l'integrite de ce message, BNP PARIBAS (et ses
> filiales) decline(nt) toute responsabilite au titre de ce
> message, dans l'hypothese ou il aurait ete modifie.
>
>
> --
> To unsubscribe: <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
>
>
--
To unsubscribe: <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>