Tomcat 7 Manager - disable the "undeploy" button

I upgraded from Tomcat 6 to Tomcat 7, and the manager is a little different. In Tomcat 6 Manager, I get a confirmation window when I try to stop or cancel the deployment of the application, but in Tomcat 7 this will happen.

My questions are: can I disable or at least attach confirmation javascript to the undeploy button?

+7
source share
1 answer

The short version of the answer is NO, since html is in the java hardcoded class, as you can see here:

HTMLManagerServlet

But you can still do the following:

  • extends HTMLManagerServlet and overrides the following method

    protected void list(HttpServletRequest request, HttpServletResponse response, String message, StringManager smClient) throws IOException 
  • use another variable instead:

     STARTED_DEPLOYED_APPS_ROW_BUTTON_SECTION, args)); 

and in the variable YOUR_STARTED_DEPLOYED_APPS_ROW_BUTTON_SECTION you can enter your JS code that will handle the onclick event. See also may help:

Inline onclick javascript variable

Then you compile your YourHTMLManagerServlet and change the manager / WEB -INF / web.xml to:

 <servlet> <servlet-name>HTMLManager</servlet-name> <servlet-class>org.apache.catalina.manager.HTMLManagerServlet</servlet-class> <init-param> 

in

 <servlet> <servlet-name>HTMLManager</servlet-name> <servlet-class>your.own.YourHTMLManagerServlet</servlet-class> <init-param> 

put the jar using the tomcat / lib directory and your ready to go.

+1
source

All Articles