Hello Dhaval Did you try Host myHost = (Host)context.getParent()? Anyone else?
Martin- -- Original Message ----- From: "Dhaval Patel" <[EMAIL PROTECTED]> To: "Tomcat Users List" <users@tomcat.apache.org>; "Martin Gainty" <[EMAIL PROTECTED]> Sent: Wednesday, December 28, 2005 5:21 PM Subject: Re: Getting list of all deployed web applications > Hi Martin, > > Thanks for reply but I am looking at something different. System.getEnv(...) > returns string > which it supposed to. The method is for retriving environment variables > (which are loaded from > properties file, etc. while starting an application-tomcat) > > The "host" that I am talking about is org.apache.catalina.Host object. If > you have tomcat 5.5.12 > source, take a look at ManagerServlet.java . It has method called list(...) > which is used to > retrive list of deployed webapps. For your reading, it is as follows: > > protected void list(...) > { > org.apache.catalina.Host myHost = ?? > Container[] contexts = myHost.findChildren(); > for (int i = 0; i < contexts.length; i++) > { > Context context = (Context) contexts[i]; > if (context != null ) > { > //display context to page as link > } > } > } > > Also one request to tomcat experts. If you know any other way of finding the > list of depolyed > web applications, please let me know > > Thanks. > > Regards, > Dhaval > > --- Martin Gainty <[EMAIL PROTECTED]> wrote: > >> If I'm not mistaken its an environment variable which can be obtained via >> java.lang.System.getEnv("HTTP_HOST"); >> Take a look at >> http://java.sun.com/j2se/1.5.0/docs/api/ >> >> Martin- >> ----- Original Message ----- >> From: "Dhaval Patel" <[EMAIL PROTECTED]> >> To: <users@tomcat.apache.org> >> Sent: Wednesday, December 28, 2005 3:11 PM >> Subject: Getting list of all deployed web applications >> >> >> > Hi, >> > >> > Is there a way by which you can list of all web applications deployed? I >> > know that if you go >> to >> > manager webapp, you will see list of deployed applications. I want to >> > achieve the same >> > functionality but using jsp pages. >> > >> > I tried to understand the source of manager webapp but I could not find >> > one thing. How do you >> > get catalina.host object? Once I get the host, I can use the list(...) >> > method of >> > ManagerServlet.java into jsp page and thus can able to retrieve the list >> > of deployed webapps >> > (hopefully !! Correct me if I am wrong or suggest me something better). >> > This is not for any >> > production ready environment but for my own learning purpose. >> > >> > Thanks for your help. >> > >> > Regards, >> > D >> > >> > >> > >> > >> > __________________________________ >> > Yahoo! for Good - Make a difference this year. >> > http://brand.yahoo.com/cybergivingweek2005/ >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > > > > > > __________________________________________ > Yahoo! DSL - Something to write home about. > Just $16.99/mo. or less. > dsl.yahoo.com > >