You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dhaval Patel <dh...@yahoo.com> on 2005/12/28 21:11:43 UTC
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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Getting list of all deployed web applications
Posted by Martin Gainty <mg...@hotmail.com>.
Good Call-
Thanks Bill,
Martin Gainty
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official
business of Sender. This transmission is of a confidential nature and Sender
does not endorse distribution to any party other than intended recipient.
>
>"Martin Gainty" <mg...@hotmail.com> wrote in message
>news:BAY103-DAV11033970509E17EFD10A6AAE360@phx.gbl...
> > Hello Dhaval
> >
> > Did you try
> > Host myHost = (Host)context.getParent()?
> > Anyone else?
> >
>
>You're Context needs to be privileged for that to work.
>
>If you're not using a SecurityManager, you should be able to do it via JMX.
>Something like:
> ObjectName oname = new ObjectName("*:j2eeType=WebModule,*");
> Set contexts = mBeanServer.queryMBeans(oname);
> Iterator it = contexts.iterator();
> while(it.hasNext()) {
> ObjectInstance oi = (ObjectInstance)it.next();
> ObjectName cname = oi.getObjectName();
> // Do something with it here
> }
>
>
>
> > Martin-
> > -- Original Message -----
> > From: "Dhaval Patel" <dh...@yahoo.com>
> > To: "Tomcat Users List" <us...@tomcat.apache.org>; "Martin Gainty"
> > <mg...@hotmail.com>
> > 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 <mg...@hotmail.com> 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" <dh...@yahoo.com>
> >>> To: <us...@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: users-unsubscribe@tomcat.apache.org
> >>> > For additional commands, e-mail: users-help@tomcat.apache.org
> >>> >
> >>> >
> >>
> >>
> >>
> >>
> >> __________________________________________
> >> Yahoo! DSL - Something to write home about.
> >> Just $16.99/mo. or less.
> >> dsl.yahoo.com
> >>
> >>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Getting list of all deployed web applications
Posted by Bill Barker <wb...@wilshire.com>.
"Martin Gainty" <mg...@hotmail.com> wrote in message
news:BAY103-DAV11033970509E17EFD10A6AAE360@phx.gbl...
> Hello Dhaval
>
> Did you try
> Host myHost = (Host)context.getParent()?
> Anyone else?
>
You're Context needs to be privileged for that to work.
If you're not using a SecurityManager, you should be able to do it via JMX.
Something like:
ObjectName oname = new ObjectName("*:j2eeType=WebModule,*");
Set contexts = mBeanServer.queryMBeans(oname);
Iterator it = contexts.iterator();
while(it.hasNext()) {
ObjectInstance oi = (ObjectInstance)it.next();
ObjectName cname = oi.getObjectName();
// Do something with it here
}
> Martin-
> -- Original Message -----
> From: "Dhaval Patel" <dh...@yahoo.com>
> To: "Tomcat Users List" <us...@tomcat.apache.org>; "Martin Gainty"
> <mg...@hotmail.com>
> 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 <mg...@hotmail.com> 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" <dh...@yahoo.com>
>>> To: <us...@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: users-unsubscribe@tomcat.apache.org
>>> > For additional commands, e-mail: users-help@tomcat.apache.org
>>> >
>>> >
>>
>>
>>
>>
>> __________________________________________
>> Yahoo! DSL - Something to write home about.
>> Just $16.99/mo. or less.
>> dsl.yahoo.com
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Getting list of all deployed web applications
Posted by Martin Gainty <mg...@hotmail.com>.
Hello Dhaval
Did you try
Host myHost = (Host)context.getParent()?
Anyone else?
Martin-
-- Original Message -----
From: "Dhaval Patel" <dh...@yahoo.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>; "Martin Gainty" <mg...@hotmail.com>
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 <mg...@hotmail.com> 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" <dh...@yahoo.com>
>> To: <us...@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: users-unsubscribe@tomcat.apache.org
>> > For additional commands, e-mail: users-help@tomcat.apache.org
>> >
>> >
>
>
>
>
> __________________________________________
> Yahoo! DSL - Something to write home about.
> Just $16.99/mo. or less.
> dsl.yahoo.com
>
>
Re: Getting list of all deployed web applications
Posted by Dhaval Patel <dh...@yahoo.com>.
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 <mg...@hotmail.com> 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" <dh...@yahoo.com>
> To: <us...@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: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
__________________________________________
Yahoo! DSL Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Getting list of all deployed web applications
Posted by Martin Gainty <mg...@hotmail.com>.
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" <dh...@yahoo.com>
To: <us...@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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>