List deployed webapps in Apache Tomcat

前端 未结 7 1359
予麋鹿
予麋鹿 2020-12-09 02:29

I need to get a list of deployed webapps in Apache Tomcat. Also, for each webapp I need to get a list of initialized servlets and JSPs. Any ideas how this can be done?

7条回答
  •  我在风中等你
    2020-12-09 03:13

    In order to get a list of deployed apps of your tomcat you just need configure user/roles and use /manager/text/list tomcat endpoint

    Configure user and roles in Tomcat

    Add this in your /.../.../TOMCAT_HOME/conf/tomcat-users.xml

    
    
    
    
    
    
    
    
    

    You could skip "admin-gui" & "admin-script" roles if you will not perform admin operations.

    After that, restart tomcat

    List apps using browser

    Go to your favorite browser and enter this url:

    http://some_ip:some_port/manager/text/list
    

    A login will appear. Enter the user/password configured in your TOMCAT_HOME/conf/tomcat-users.xml

    Using command line

    Just execute this:

    curl -v -u my_user:my_pass http://127.0.0.1:some_port/manager/text/list
    

    The result should be:

    OK - Listed applications for virtual host localhost
    /manager:running:0:manager
    /:running:0:ROOT
    /docs:running:0:docs
    /examples:running:0:examples
    /host-manager:running:0:host-manager
    /my_app:running:0:my_app
    /my_other_app:running:0:my_other_app
    ....
    * Connection #0 to host 127.0.0.1 left intact
    

    List apps with curl is used by a plugins related to automated tomcat deploys (Devops)

    HTH

提交回复
热议问题