Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat 7 manager - Disable "undeploy button"

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?

like image 429
Jocke Avatar asked Oct 31 '12 11:10

Jocke


1 Answers

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.

like image 154
atlasloewenherz Avatar answered Oct 05 '22 22:10

atlasloewenherz