Tomcat 7 manager - Disable "undeploy button"
Asked Answered
C

1

8

I upgraded from Tomcat 6 to Tomcat 7 and the manager differs some. In Tomcat 6's manager I would get a confirmation box when trying to stop or undeploy an app but in Tomcat 7 it just happens.

My questions is, can I disable or at least attach a confirmation javascript to the undeploy button?

Corsetti answered 31/10, 2012 at 11:31 Comment(2)
were you able to solve this one? if not please post your findingsByler
I would be very interested in a solution, too (or to know if you could solve the problem with the answer).Earvin
B
2

The short answer version is NO, because the html is within the java class hardcoded as you can see it here:

HTMLManagerServlet

But you can still do the following:

  • extends HTMLManagerServlet and override the following method

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

    STARTED_DEPLOYED_APPS_ROW_BUTTON_SECTION, args));
    

and in YOUR_STARTED_DEPLOYED_APPS_ROW_BUTTON_SECTION variable you can inject your JS code that will handle the onclick event see this can be of help too:

Inline onclick JavaScript variable

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

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

to:

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

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

Byler answered 29/11, 2012 at 10:12 Comment(1)
maybe see also this Answer/Post: https://mcmap.net/q/1473342/-how-to-prevent-undeploying-applications-in-tomcat-apache-7Involucrum

© 2022 - 2024 — McMap. All rights reserved.