servlet URL

2003-02-07 Thread Felipe Schnack
  How I retrieve the URL an HttpServlet instance is mapped to?

-- 

Felipe Schnack
Analista de Sistemas
[EMAIL PROTECTED]
Cel.: (51)91287530
Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
[EMAIL PROTECTED]
Fone/Fax.: (51)32303341


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: servlet URL

2003-02-07 Thread Filip Hanik
take a look at the javax.servlet.http.HttpServletRequest API,
it has a bunch of methods that you can use to retrieve all kinds of info about the 
request.

but if you mean how do you retrieve the info that is in web.xml for your particular 
servlet,
give us the scenario where you would like this info and how?

Filip


-Original Message-
From: Felipe Schnack [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 07, 2003 10:58 AM
To: Tomcat Users List
Subject: servlet URL


  How I retrieve the URL an HttpServlet instance is mapped to?

-- 

Felipe Schnack
Analista de Sistemas
[EMAIL PROTECTED]
Cel.: (51)91287530
Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
[EMAIL PROTECTED]
Fone/Fax.: (51)32303341


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: servlet URL

2003-02-07 Thread Felipe Schnack
  I'm writing a servlet that requires to be a Singleton (much like
Struts' servlet), and I have some other objects that need to know the
URL of this Servlet to make some redirects to it... so I need this
servlet to have a method that return its URL, as in web.xml
  I can get this from HttpServletRequest??

On Fri, 2003-02-07 at 17:04, Filip Hanik wrote:
 take a look at the javax.servlet.http.HttpServletRequest API,
 it has a bunch of methods that you can use to retrieve all kinds of info about the 
request.
 
 but if you mean how do you retrieve the info that is in web.xml for your particular 
servlet,
 give us the scenario where you would like this info and how?
 
 Filip
 
 
 -Original Message-
 From: Felipe Schnack [mailto:[EMAIL PROTECTED]]
 Sent: Friday, February 07, 2003 10:58 AM
 To: Tomcat Users List
 Subject: servlet URL
 
 
   How I retrieve the URL an HttpServlet instance is mapped to?
 
 -- 
 
 Felipe Schnack
 Analista de Sistemas
 [EMAIL PROTECTED]
 Cel.: (51)91287530
 Linux Counter #281893
 
 Centro Universitário Ritter dos Reis
 http://www.ritterdosreis.br
 [EMAIL PROTECTED]
 Fone/Fax.: (51)32303341
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
-- 

Felipe Schnack
Analista de Sistemas
[EMAIL PROTECTED]
Cel.: (51)91287530
Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
[EMAIL PROTECTED]
Fone/Fax.: (51)32303341


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: servlet URL

2003-02-07 Thread Filip Hanik
not sure that what you are trying to do makes sense?
why do you need the servlet to return its url? You configure the URL in the web.xml 
file, so you should already know what it is and not have to ask the servlet itself.

This is from the spec

By default, there must be only one instance of a servlet class per servlet definition 
in a container. In the case of a servlet that implements the SingleThreadModel 
interface, the servlet container may instantiate multiple instances of that servlet so 
that it can handle a heavy request load while still serializing requests to a single 
instance.

so by default the servlet is a singleton.

and for the other objects, give them the url through a config file

Filip

-Original Message-
From: Felipe Schnack [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 07, 2003 11:11 AM
To: Tomcat Users List
Subject: RE: servlet URL


  I'm writing a servlet that requires to be a Singleton (much like
Struts' servlet), and I have some other objects that need to know the
URL of this Servlet to make some redirects to it... so I need this
servlet to have a method that return its URL, as in web.xml
  I can get this from HttpServletRequest??

On Fri, 2003-02-07 at 17:04, Filip Hanik wrote:
 take a look at the javax.servlet.http.HttpServletRequest API,
 it has a bunch of methods that you can use to retrieve all kinds of info about the 
request.
 
 but if you mean how do you retrieve the info that is in web.xml for your particular 
servlet,
 give us the scenario where you would like this info and how?
 
 Filip
 
 
 -Original Message-
 From: Felipe Schnack [mailto:[EMAIL PROTECTED]]
 Sent: Friday, February 07, 2003 10:58 AM
 To: Tomcat Users List
 Subject: servlet URL
 
 
   How I retrieve the URL an HttpServlet instance is mapped to?
 
 -- 
 
 Felipe Schnack
 Analista de Sistemas
 [EMAIL PROTECTED]
 Cel.: (51)91287530
 Linux Counter #281893
 
 Centro Universitário Ritter dos Reis
 http://www.ritterdosreis.br
 [EMAIL PROTECTED]
 Fone/Fax.: (51)32303341
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
-- 

Felipe Schnack
Analista de Sistemas
[EMAIL PROTECTED]
Cel.: (51)91287530
Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
[EMAIL PROTECTED]
Fone/Fax.: (51)32303341


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: servlet URL

2003-02-07 Thread Erik Price


Felipe Schnack wrote:

  I'm writing a servlet that requires to be a Singleton (much like
Struts' servlet), and I have some other objects that need to know the
URL of this Servlet to make some redirects to it... so I need this
servlet to have a method that return its URL, as in web.xml


Presumably this doesn't change, right?  You could either store it as a 
constant (public static final String) of the servlet or as a web.xml 
context-parameter.

  I can get this from HttpServletRequest??


You can get various parts of the URI from the HttpServletRequest in that 
particular servlet, since presumably the request contains the URL that 
was used to fetch the servlet.  But doesn't sound like what you are 
looking for (a way to determine the URL from within other classes, not 
the servlet).



Erik


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: servlet URL

2003-02-07 Thread Felipe Schnack
  Yes, I know it's a singleton... but you mean I should have another
config file specifying my servlet's URL? Well, I could do that, but I
don't think it's a good idea, after all I already have this data on
web.xml...
  Must be a way to know that...

On Fri, 2003-02-07 at 17:19, Filip Hanik wrote:
 not sure that what you are trying to do makes sense?
 why do you need the servlet to return its url? You configure the URL in the web.xml 
file, so you should already know what it is and not have to ask the servlet itself.
 
 This is from the spec
 
 By default, there must be only one instance of a servlet class per servlet 
definition in a container. In the case of a servlet that implements the 
SingleThreadModel interface, the servlet container may instantiate multiple instances 
of that servlet so that it can handle a heavy request load while still serializing 
requests to a single instance.
 
 so by default the servlet is a singleton.
 
 and for the other objects, give them the url through a config file
 
 Filip
 
 -Original Message-
 From: Felipe Schnack [mailto:[EMAIL PROTECTED]]
 Sent: Friday, February 07, 2003 11:11 AM
 To: Tomcat Users List
 Subject: RE: servlet URL
 
 
   I'm writing a servlet that requires to be a Singleton (much like
 Struts' servlet), and I have some other objects that need to know the
 URL of this Servlet to make some redirects to it... so I need this
 servlet to have a method that return its URL, as in web.xml
   I can get this from HttpServletRequest??
 
 On Fri, 2003-02-07 at 17:04, Filip Hanik wrote:
  take a look at the javax.servlet.http.HttpServletRequest API,
  it has a bunch of methods that you can use to retrieve all kinds of info about the 
request.
  
  but if you mean how do you retrieve the info that is in web.xml for your 
particular servlet,
  give us the scenario where you would like this info and how?
  
  Filip
  
  
  -Original Message-
  From: Felipe Schnack [mailto:[EMAIL PROTECTED]]
  Sent: Friday, February 07, 2003 10:58 AM
  To: Tomcat Users List
  Subject: servlet URL
  
  
How I retrieve the URL an HttpServlet instance is mapped to?
  
  -- 
  
  Felipe Schnack
  Analista de Sistemas
  [EMAIL PROTECTED]
  Cel.: (51)91287530
  Linux Counter #281893
  
  Centro Universitário Ritter dos Reis
  http://www.ritterdosreis.br
  [EMAIL PROTECTED]
  Fone/Fax.: (51)32303341
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
 -- 
 
 Felipe Schnack
 Analista de Sistemas
 [EMAIL PROTECTED]
 Cel.: (51)91287530
 Linux Counter #281893
 
 Centro Universitário Ritter dos Reis
 http://www.ritterdosreis.br
 [EMAIL PROTECTED]
 Fone/Fax.: (51)32303341
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
-- 

Felipe Schnack
Analista de Sistemas
[EMAIL PROTECTED]
Cel.: (51)91287530
Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
[EMAIL PROTECTED]
Fone/Fax.: (51)32303341


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: servlet URL

2003-02-07 Thread Felipe Schnack
  Sorry, context-parameter? But then I wouldn't have (again) my
servlet's URL written in two different places? This kind of thing
worries me, because somebody can change in one place but not on another.
  I think I can understand the HttpServletRequest way of doing it... but
then I could only determine after my servlet is first called, right?
  Anyway, how I would do that? Getting all bytes from the string from
the beginning 'till the end or '?' character?

On Fri, 2003-02-07 at 17:20, Erik Price wrote:
 
 
 Felipe Schnack wrote:
I'm writing a servlet that requires to be a Singleton (much like
  Struts' servlet), and I have some other objects that need to know the
  URL of this Servlet to make some redirects to it... so I need this
  servlet to have a method that return its URL, as in web.xml
 
 Presumably this doesn't change, right?  You could either store it as a 
 constant (public static final String) of the servlet or as a web.xml 
 context-parameter.
 
I can get this from HttpServletRequest??
 
 You can get various parts of the URI from the HttpServletRequest in that 
 particular servlet, since presumably the request contains the URL that 
 was used to fetch the servlet.  But doesn't sound like what you are 
 looking for (a way to determine the URL from within other classes, not 
 the servlet).
 
 
 
 Erik
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
-- 

Felipe Schnack
Analista de Sistemas
[EMAIL PROTECTED]
Cel.: (51)91287530
Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
[EMAIL PROTECTED]
Fone/Fax.: (51)32303341


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: servlet URL

2003-02-07 Thread Craig R. McClanahan


On Fri, 7 Feb 2003, Felipe Schnack wrote:

 Date: 07 Feb 2003 17:11:03 -0200
 From: Felipe Schnack [EMAIL PROTECTED]
 Reply-To: Tomcat Users List [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Subject: RE: servlet URL

   I'm writing a servlet that requires to be a Singleton (much like
 Struts' servlet), and I have some other objects that need to know the
 URL of this Servlet to make some redirects to it... so I need this
 servlet to have a method that return its URL, as in web.xml
   I can get this from HttpServletRequest??


You can get the part that matched on this request by calling
request.getServletPath(), and use that to infer the mapping.

Or, you can look at the source and do what Struts actually does :-), which
is to parse the web.xml file itself.  In a 1.1 release, look at the
initServlet() method of ActionServlet.

Craig McClanahan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: servlet URL

2003-02-07 Thread Will Hartung
I see the problem and I think you're stuck having to code it someplace.

The problem is that a Servlet can be mapped to multiple URLs, and the
Servlet itself is really not aware of this mapping as it's maintained in the
actual container.

So, the only way to identify a Servlet within the container is, essentially,
by its mapping.

In fact, I can't even think of a portable way to actually read the web.xml
file, as its not in any of the conventional spots for resources.

I think you're stuck.

Regards,

Will Hartung
([EMAIL PROTECTED])

- Original Message -
From: Felipe Schnack [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Friday, February 07, 2003 11:21 AM
Subject: RE: servlet URL


  Yes, I know it's a singleton... but you mean I should have another
config file specifying my servlet's URL? Well, I could do that, but I
don't think it's a good idea, after all I already have this data on
web.xml...
  Must be a way to know that...




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: servlet URL

2003-02-07 Thread Erik Price


Felipe Schnack wrote:

  Sorry, context-parameter? But then I wouldn't have (again) my
servlet's URL written in two different places? This kind of thing
worries me, because somebody can change in one place but not on another.


You're right, this kind of data redundancy can be dangerous, and there 
are probably better ways to do it.  I was just giving you two 
suggestions on where you could store the URL so that it is accessible to 
other objects in your webapp.

  I think I can understand the HttpServletRequest way of doing it... but
then I could only determine after my servlet is first called, right?


Right, this won't work if you're trying to get the URL from an unrelated 
class, like a bean or something, unless you have some way of passing the 
request in.

  Anyway, how I would do that? Getting all bytes from the string from
the beginning 'till the end or '?' character?


public void doProcessing(HttpServletRequest request,
 HttpServletResponse response)
throws ServletException, IOException {

String url = request.getRequestURL();
}


Erik


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: servlet URL

2003-02-07 Thread Sean Dockery
HttpServlet.getServletName() would seem like the logical choice.
--
Sean Dockery
[EMAIL PROTECTED]
Certified Java Web Component Developer
Certified Delphi Programmer
SBD Consultants
http://www.sbdconsultants.com


Felipe Schnack [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  How I retrieve the URL an HttpServlet instance is mapped to?

--

Felipe Schnack
Analista de Sistemas
[EMAIL PROTECTED]
Cel.: (51)91287530
Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
[EMAIL PROTECTED]
Fone/Fax.: (51)32303341




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: servlet URL

2003-02-07 Thread Will Hartung
That only works when the requester is the servlet itself. Also, just because
you have the name of a servlet doesn't mean you know a valid URL for that
servlet, as they don't have to match.

The key here, I think, is that in the past servlets were able to see other
servlets within the webapp, but today I think that access is limited.

So, if you are in ServletA and want the URL to ServeltB, there's no obvious
way find that information.

Regards,

Will Hartung
([EMAIL PROTECTED])

- Original Message -
From: Sean Dockery [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, February 07, 2003 11:05 AM
Subject: Re: servlet URL


 HttpServlet.getServletName() would seem like the logical choice.
 --
 Sean Dockery
 [EMAIL PROTECTED]
 Certified Java Web Component Developer
 Certified Delphi Programmer
 SBD Consultants
 http://www.sbdconsultants.com


 Felipe Schnack [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   How I retrieve the URL an HttpServlet instance is mapped to?

 --

 Felipe Schnack
 Analista de Sistemas
 [EMAIL PROTECTED]
 Cel.: (51)91287530
 Linux Counter #281893

 Centro Universitário Ritter dos Reis
 http://www.ritterdosreis.br
 [EMAIL PROTECTED]
 Fone/Fax.: (51)32303341




 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: servlet URL

2003-02-07 Thread Sean Dockery
Oops.  Felipe did ask for the servlet URL.

For finding other servlets in the application, I suppose that a servlet
could read its own .xml file.  :-)

Will Hartung [EMAIL PROTECTED] wrote in message
088201c2cee6$7280f890$0101@Will">news:088201c2cee6$7280f890$0101@Will...
 That only works when the requester is the servlet itself. Also, just
because
 you have the name of a servlet doesn't mean you know a valid URL for that
 servlet, as they don't have to match.

 The key here, I think, is that in the past servlets were able to see
other
 servlets within the webapp, but today I think that access is limited.

 So, if you are in ServletA and want the URL to ServeltB, there's no
obvious
 way find that information.

 Regards,

 Will Hartung
 ([EMAIL PROTECTED])

 - Original Message -
 From: Sean Dockery [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, February 07, 2003 11:05 AM
 Subject: Re: servlet URL


  HttpServlet.getServletName() would seem like the logical choice.
  --
  Sean Dockery
  [EMAIL PROTECTED]
  Certified Java Web Component Developer
  Certified Delphi Programmer
  SBD Consultants
  http://www.sbdconsultants.com
 
 
  Felipe Schnack [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
How I retrieve the URL an HttpServlet instance is mapped to?
 
  --
 
  Felipe Schnack
  Analista de Sistemas
  [EMAIL PROTECTED]
  Cel.: (51)91287530
  Linux Counter #281893
 
  Centro Universitário Ritter dos Reis
  http://www.ritterdosreis.br
  [EMAIL PROTECTED]
  Fone/Fax.: (51)32303341
 
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: servlet URL

2003-02-07 Thread Steve Burrus

will, this has NOTHING to do with what you responded to, i.e., whatever problem some 
Tomcat user had, but I was honestly wondering why you haven't seen fit to respond back 
to my email to u some time ago, like some 10 days to 2 weeks ago?!!

 Don't you respect me enough to respond back to my rather creative, I thought, email 
posting to you?!! And, I hope to God that I am not starting another so-called flame 
war again, heaven knows that I have personally been involved in enough of them 
recently! So, please Will, IF you still have my email to you, kindly respond back to 
me. My impression of you would be greatly improved if you would. :)



RE: servlet URL

2003-02-07 Thread Ron Day
Will,

How can you resist ?

-Original Message-
From: Steve Burrus [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 07, 2003 2:28 PM
To: Tomcat Users List
Subject: Re: servlet URL



will, this has NOTHING to do with what you responded to, i.e., whatever
problem some Tomcat user had, but I was honestly wondering why you haven't
seen fit to respond back to my email to u some time ago, like some 10 days
to 2 weeks ago?!!

 Don't you respect me enough to respond back to my rather creative, I
thought, email posting to you?!! And, I hope to God that I am not starting
another so-called flame war again, heaven knows that I have personally
been involved in enough of them recently! So, please Will, IF you still have
my email to you, kindly respond back to me. My impression of you would be
greatly improved if you would. :)


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Tomcat examples servlet URL mappings

2002-02-12 Thread Steve D George

Hi, I've just installed Tomcat for the first time and one thing that is
confusing me.

If you enter a URL of http://localhost:8080/examples/servlets/index.html,
you get to the servlets examples page  where there are six example
servlets.

If you hover over the link to the Hello World servlet the URL is
http://localhost:8080/examples/servlet/HelloWorldExample.

If you then look in the tomcat_home/webapps/examples/web-inf/classes
directory, you'll find the HelloWorldExample servlet, together with the
other servlet examples.

The thing confusing me is, why is there no servlet mapping in the web.xml
file for the HelloWorldExample servlet? I was expecting to see something
that mapped a URL of /servlet/HelloWorldExample to the HelloWorldExample
class in the classes directory? And since there is no mapping for this
servlet or all the other example servlets, how is the correct servlet
resolved from the URL?

I'm sure this is something dead simple.

Thanks for any help.

Cheers,

Steve George



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




servlet url at init time

2002-02-01 Thread joseph . vallot


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:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: servlet url at init time

2002-02-01 Thread Craig R. McClanahan



On Fri, 1 Feb 2002 [EMAIL PROTECTED] wrote:

 Date: Fri, 1 Feb 2002 17:13:07 +0100
 From: [EMAIL PROTECTED]
 Reply-To: Tomcat Users List [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 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:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Changing Tomcats default servlet url?

2001-05-24 Thread William Kaufman

 I need the url to not have the 'servlet' in it.  Anybody know 
 how to do this?

Add a servlet-mapping tag to your web.xml file.  The DTD for that file
(for JSDK 2.2 / Tomcat 3.2) is available at

  http://java.sun.com/j2ee/dtds/web-app_2_2.dtd

and in the JSDK 2.2 specification.

 Also, how does tomcat determine the servlet is in the
 WEB-INF\classes directory?  Does it alias that as 'servlet'?  

Yup.

 If so, where is this done?

I believe that's done in code, not in a configuration file.

-- Bill K.


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 23, 2001 7:48 PM
 To: [EMAIL PROTECTED]
 Subject: Changing Tomcats default servlet url?
 
 
 Sorry, if this is a duplicate posting...but I received no 
 responses and
 thought I sent it incorrectly.
 
 
 I'm in the process of switching from JServ to Tomcat.  All 
 the servlets
 that were running previously are running now on tomcat but they have
 different urls.  I need the url to be the same as it was 
 before I switched
 to tomcat and am having trouble.
 
 My servlet is in:
  c:\tomcat\webapps\dir1\WEB-INF\classes
 I used the same setup as the examples that come with tomcat.  
 To reach that
 servlet you have to
 use the following url:
 http://localhost/dir1/servlet/ServletName
 
 I need the url to not have the 'servlet' in it.  Anybody know 
 how to do
 this?  Also, how does tomcat determine the servlet is in the
 WEB-INF\classes directory?  Does it alias that as 'servlet'?  
 If so, where
 is this done?
 
 Frustrated...
 
 
 Jason E. Brawner
 Consultant
 Silenus Group, Inc.
 248.735.8077 Ext. 184
 810.252.9944 Cellular
 



Changing Tomcats default servlet url?

2001-05-23 Thread JBrawner

Sorry, if this is a duplicate posting...but I received no responses and
thought I sent it incorrectly.


I'm in the process of switching from JServ to Tomcat.  All the servlets
that were running previously are running now on tomcat but they have
different urls.  I need the url to be the same as it was before I switched
to tomcat and am having trouble.

My servlet is in:
 c:\tomcat\webapps\dir1\WEB-INF\classes
I used the same setup as the examples that come with tomcat.  To reach that
servlet you have to
use the following url:
http://localhost/dir1/servlet/ServletName

I need the url to not have the 'servlet' in it.  Anybody know how to do
this?  Also, how does tomcat determine the servlet is in the
WEB-INF\classes directory?  Does it alias that as 'servlet'?  If so, where
is this done?

Frustrated...


Jason E. Brawner
Consultant
Silenus Group, Inc.
248.735.8077 Ext. 184
810.252.9944 Cellular




Re: Changing default servlet url

2001-05-23 Thread Boris Niyazov

You may want to use redirect in your web server config:

Redirect /dir1 http://hostname/dir1/servlet/servletname

but be aware of the problem with redirecting POSTS: it could not work, 
especially if you use absolute pathes instead of relative in your servlets.
hth
*
* Boris NiyazovPh:  212-854-4094  Fax: 212-854-1749 *
* Systems Manager  Email: [EMAIL PROTECTED] * 
* Columbia Law School  URL: http://www.law.columbia.edu *
*  
 


  


I'm in the process of switching from JServ to Tomcat.  All the servlets
that were running previously are running now on tomcat but they have
different urls.  I need the url to be the same as it was before I switched
to tomcat and am having trouble.

My servlet is in:
 c:\tomcat\webapps\dir1\WEB-INF\classes
I used the same setup as the examples.  To reach that servlet you have to
use the following url:
http://localhost/dir1/servlet/ServletName

I need the url to not have the 'servlet' in it.  Anybody know how to do
this?  Also, how does tomcat determine the servlet is in the
WEB-INF\classes directory?  Does it alias that as 'servlet'?  If so, where
is this done?

Frustrated...

Jason E. Brawner
Consultant
Silenus Group, Inc.
248.735.8077 Ext. 184
810.252.9944 Cellular





Changing default servlet url

2001-05-22 Thread JBrawner

I'm in the process of switching from JServ to Tomcat.  All the servlets
that were running previously are running now on tomcat but they have
different urls.  I need the url to be the same as it was before I switched
to tomcat and am having trouble.

My servlet is in:
 c:\tomcat\webapps\dir1\WEB-INF\classes
I used the same setup as the examples.  To reach that servlet you have to
use the following url:
http://localhost/dir1/servlet/ServletName

I need the url to not have the 'servlet' in it.  Anybody know how to do
this?  Also, how does tomcat determine the servlet is in the
WEB-INF\classes directory?  Does it alias that as 'servlet'?  If so, where
is this done?

Frustrated...

Jason E. Brawner
Consultant
Silenus Group, Inc.
248.735.8077 Ext. 184
810.252.9944 Cellular




servlet url mapping problems

2000-11-21 Thread Yin Tse

Hi,
Has anyone come across this problem :

My url mapping isn't working. Of course if I use a url mapping which is
similar to my servlet name, it will work , but as soon as I change the url
mappping to something else, it doesn't work.
eg 
servlet
   servlet-name
   myServlet
   /servlet-name
servlet-class
  SomeFoolServlet
   /servlet-class
/servlet
servlet-mapping
   servlet-namemyServlet/servlet-name
   url-pattern/myGod/url-pattern
/servlet-mapping

http://locahost/foo/servlet/myServlet  will work
but http://locahost/foo/servlet/myGod won't work. 
Has anyone experienced similar problems ?

Thanks. 



Re: servlet url mapping problems

2000-11-21 Thread Kurt Bernhard Pruenner

Yin Tse wrote:
 http://locahost/foo/servlet/myServlet  will work
 but http://locahost/foo/servlet/myGod won't work.

Try http://localhost/foo/myGod ... I don't see no "/servlet" in your
servlet-mapping

-- 
Kurt Bernhard Pruenner --- Haendelstrasse 17 --- 4020 Linz --- Austria
Music: http://www.mp3.com/Leak --- Work: http://www.ssw.uni-linz.ac.at
...It might be written "Mindfuck", but it's spelt "L-A-I-N"...
np: Up, Bustle  Out - The Educators (Master Sessions 1)



Tomcat 3.1 : Servlet URl without /servlet/

2000-11-20 Thread Pascal Bourachot


I have a servlet called "myServlet"

and i have defined  a context "foo"

How i can access to this servlet whitout "servlet" in the url -
http://locahost/foo/servlet/myServlet

I will prefer to access it with http://localhost/foo/myServlet.

I saw that with Tomcat 3.2b-8, we can use

RequestInterceptor
 className="org.apache.tomcat.request.InvokerInterceptor"
 debug="0" prefix="/servlet/" /

but i use tomcat 3.1.


Thanks

scal.