View | Details | Raw Unified | Return to bug 57701
Collapse All | Expand All

(-)java/org/apache/catalina/manager/HTMLManagerServlet.java (-26 / +61 lines)
Lines 151-157 Link Here
151
        } else if (command.equals("/upload") || command.equals("/deploy") ||
151
        } else if (command.equals("/upload") || command.equals("/deploy") ||
152
                command.equals("/reload") || command.equals("/undeploy") ||
152
                command.equals("/reload") || command.equals("/undeploy") ||
153
                command.equals("/expire") || command.equals("/start") ||
153
                command.equals("/expire") || command.equals("/start") ||
154
                command.equals("/stop")) {
154
                command.equals("/stop") || command.equals("/redeploy") ) {
155
            message =
155
            message =
156
                smClient.getString("managerServlet.postCommand", command);
156
                smClient.getString("managerServlet.postCommand", command);
157
        } else {
157
        } else {
Lines 213-218 Link Here
213
                    smClient);
213
                    smClient);
214
        } else if (command.equals("/reload")) {
214
        } else if (command.equals("/reload")) {
215
            message = reload(cn, smClient);
215
            message = reload(cn, smClient);
216
        } else if (command.equals("/redeploy")) {
217
            message = redeploy(cn, smClient);
216
        } else if (command.equals("/undeploy")) {
218
        } else if (command.equals("/undeploy")) {
217
            message = undeploy(cn, smClient);
219
            message = undeploy(cn, smClient);
218
        } else if (command.equals("/expire")) {
220
        } else if (command.equals("/expire")) {
Lines 401-406 Link Here
401
        String appsStart = smClient.getString("htmlManagerServlet.appsStart");
403
        String appsStart = smClient.getString("htmlManagerServlet.appsStart");
402
        String appsStop = smClient.getString("htmlManagerServlet.appsStop");
404
        String appsStop = smClient.getString("htmlManagerServlet.appsStop");
403
        String appsReload = smClient.getString("htmlManagerServlet.appsReload");
405
        String appsReload = smClient.getString("htmlManagerServlet.appsReload");
406
        String appsRedeploy = smClient.getString("htmlManagerServlet.appsRedeploy");
404
        String appsUndeploy =
407
        String appsUndeploy =
405
            smClient.getString("htmlManagerServlet.appsUndeploy");
408
            smClient.getString("htmlManagerServlet.appsUndeploy");
406
        String appsExpire = smClient.getString("htmlManagerServlet.appsExpire");
409
        String appsExpire = smClient.getString("htmlManagerServlet.appsExpire");
Lines 476-482 Link Here
476
                writer.print
479
                writer.print
477
                    (MessageFormat.format(APPS_ROW_DETAILS_SECTION, args));
480
                    (MessageFormat.format(APPS_ROW_DETAILS_SECTION, args));
478
481
479
                args = new Object[14];
482
                args = new Object[16];
480
                args[0] = RequestUtil.filter(response.encodeURL(request
483
                args[0] = RequestUtil.filter(response.encodeURL(request
481
                        .getContextPath() + "/html/start?" + pathVersion));
484
                        .getContextPath() + "/html/start?" + pathVersion));
482
                args[1] = appsStart;
485
                args[1] = appsStart;
Lines 487-508 Link Here
487
                        .getContextPath() + "/html/reload?" + pathVersion));
490
                        .getContextPath() + "/html/reload?" + pathVersion));
488
                args[5] = appsReload;
491
                args[5] = appsReload;
489
                args[6] = RequestUtil.filter(response.encodeURL(request
492
                args[6] = RequestUtil.filter(response.encodeURL(request
493
                        .getContextPath() + "/html/redeploy?" + pathVersion));
494
                args[7] = appsRedeploy;
495
                args[8] = RequestUtil.filter(response.encodeURL(request
490
                        .getContextPath() + "/html/undeploy?" + pathVersion));
496
                        .getContextPath() + "/html/undeploy?" + pathVersion));
491
                args[7] = appsUndeploy;
497
                args[9] = appsUndeploy;
492
                args[8] = RequestUtil.filter(response.encodeURL(request
498
                args[10] = RequestUtil.filter(response.encodeURL(request
493
                        .getContextPath() + "/html/expire?" + pathVersion));
499
                        .getContextPath() + "/html/expire?" + pathVersion));
494
                args[9] = appsExpire;
500
                args[11] = appsExpire;
495
                args[10] = smClient.getString(
501
                args[12] = smClient.getString(
496
                        "htmlManagerServlet.expire.explain");
502
                        "htmlManagerServlet.expire.explain");
497
                if (manager == null) {
503
                if (manager == null) {
498
                    args[11] = smClient.getString(
504
                    args[13] = smClient.getString(
499
                            "htmlManagerServlet.noManager");
505
                            "htmlManagerServlet.noManager");
500
                } else {
506
                } else {
501
                    args[11] = Integer.valueOf(
507
                    args[13] = Integer.valueOf(
502
                            ctxt.getManager().getMaxInactiveInterval()/60);
508
                            ctxt.getManager().getMaxInactiveInterval()/60);
503
                }
509
                }
504
                args[12] = smClient.getString("htmlManagerServlet.expire.unit");
510
                args[14] = smClient.getString("htmlManagerServlet.expire.unit");
505
                args[13] = highlightColor;
511
                args[15] = highlightColor;
506
512
507
                if (ctxt.getName().equals(this.context.getName())) {
513
                if (ctxt.getName().equals(this.context.getName())) {
508
                    writer.print(MessageFormat.format(
514
                    writer.print(MessageFormat.format(
Lines 617-622 Link Here
617
    }
623
    }
618
624
619
    /**
625
    /**
626
     * Redeploy the web application at the specified context path.
627
     *
628
     * @see ManagerServlet#redeploy(PrintWriter, ContextName, StringManager)
629
     *
630
     * @param cn Name of the application to be restarted
631
     * @param smClient  StringManager for the client's locale
632
     * @return message String
633
     */
634
    protected String redeploy(ContextName cn, StringManager smClient) {
635
636
        StringWriter stringWriter = new StringWriter();
637
        PrintWriter printWriter = new PrintWriter(stringWriter);
638
639
        super.redeploy(printWriter, cn, smClient);
640
641
        return stringWriter.toString();
642
    }
643
644
645
    /**
620
     * Undeploy the web application at the specified context path.
646
     * Undeploy the web application at the specified context path.
621
     *
647
     *
622
     * @see ManagerServlet#undeploy(PrintWriter, ContextName, StringManager)
648
     * @see ManagerServlet#undeploy(PrintWriter, ContextName, StringManager)
Lines 1121-1139 Link Here
1121
        "<small><a href=\"{4}\">{5}</a></small></td>\n";
1147
        "<small><a href=\"{4}\">{5}</a></small></td>\n";
1122
1148
1123
    private static final String MANAGER_APP_ROW_BUTTON_SECTION =
1149
    private static final String MANAGER_APP_ROW_BUTTON_SECTION =
1124
        " <td class=\"row-left\" bgcolor=\"{13}\">\n" +
1150
        " <td class=\"row-left\" bgcolor=\"{15}\">\n" +
1125
        "  <small>\n" +
1151
        "  <small>\n" +
1126
        "  &nbsp;{1}&nbsp;\n" +
1152
        "  &nbsp;{1}&nbsp;\n" +
1127
        "  &nbsp;{3}&nbsp;\n" +
1153
        "  &nbsp;{3}&nbsp;\n" +
1128
        "  &nbsp;{5}&nbsp;\n" +
1154
        "  &nbsp;{5}&nbsp;\n" +
1129
        "  &nbsp;{7}&nbsp;\n" +
1155
        "  &nbsp;{7}&nbsp;\n" +
1156
        "  &nbsp;{9}&nbsp;\n" +
1130
        "  </small>\n" +
1157
        "  </small>\n" +
1131
        " </td>\n" +
1158
        " </td>\n" +
1132
        "</tr><tr>\n" +
1159
        "</tr><tr>\n" +
1133
        " <td class=\"row-left\" bgcolor=\"{13}\">\n" +
1160
        " <td class=\"row-left\" bgcolor=\"{15}\">\n" +
1134
        "  <form method=\"POST\" action=\"{8}\">\n" +
1161
        "  <form method=\"POST\" action=\"{10}\">\n" +
1135
        "  <small>\n" +
1162
        "  <small>\n" +
1136
        "  &nbsp;<input type=\"submit\" value=\"{9}\">&nbsp;{10}&nbsp;<input type=\"text\" name=\"idle\" size=\"5\" value=\"{11}\">&nbsp;{12}&nbsp;\n" +
1163
        "  &nbsp;<input type=\"submit\" value=\"{11}\">&nbsp;{12}&nbsp;<input type=\"text\" name=\"idle\" size=\"5\" value=\"{13}\">&nbsp;{14}&nbsp;\n" +
1137
        "  </small>\n" +
1164
        "  </small>\n" +
1138
        "  </form>\n" +
1165
        "  </form>\n" +
1139
        " </td>\n" +
1166
        " </td>\n" +
Lines 1140-1146 Link Here
1140
        "</tr>\n";
1167
        "</tr>\n";
1141
1168
1142
    private static final String STARTED_DEPLOYED_APPS_ROW_BUTTON_SECTION =
1169
    private static final String STARTED_DEPLOYED_APPS_ROW_BUTTON_SECTION =
1143
        " <td class=\"row-left\" bgcolor=\"{13}\">\n" +
1170
        " <td class=\"row-left\" bgcolor=\"{15}\">\n" +
1144
        "  &nbsp;<small>{1}</small>&nbsp;\n" +
1171
        "  &nbsp;<small>{1}</small>&nbsp;\n" +
1145
        "  <form class=\"inline\" method=\"POST\" action=\"{2}\">" +
1172
        "  <form class=\"inline\" method=\"POST\" action=\"{2}\">" +
1146
        "  <small><input type=\"submit\" value=\"{3}\"></small>" +
1173
        "  <small><input type=\"submit\" value=\"{3}\"></small>" +
Lines 1151-1162 Link Here
1151
        "  <form class=\"inline\" method=\"POST\" action=\"{6}\">" +
1178
        "  <form class=\"inline\" method=\"POST\" action=\"{6}\">" +
1152
        "  <small><input type=\"submit\" value=\"{7}\"></small>" +
1179
        "  <small><input type=\"submit\" value=\"{7}\"></small>" +
1153
        "  </form>\n" +
1180
        "  </form>\n" +
1181
        "  <form class=\"inline\" method=\"POST\" action=\"{8}\">" +
1182
        "  <small><input type=\"submit\" value=\"{9}\"></small>" +
1183
        "  </form>\n" +
1154
        " </td>\n" +
1184
        " </td>\n" +
1155
        " </tr><tr>\n" +
1185
        " </tr><tr>\n" +
1156
        " <td class=\"row-left\" bgcolor=\"{13}\">\n" +
1186
        " <td class=\"row-left\" bgcolor=\"{15}\">\n" +
1157
        "  <form method=\"POST\" action=\"{8}\">\n" +
1187
        "  <form method=\"POST\" action=\"{10}\">\n" +
1158
        "  <small>\n" +
1188
        "  <small>\n" +
1159
        "  &nbsp;<input type=\"submit\" value=\"{9}\">&nbsp;{10}&nbsp;<input type=\"text\" name=\"idle\" size=\"5\" value=\"{11}\">&nbsp;{12}&nbsp;\n" +
1189
        "  &nbsp;<input type=\"submit\" value=\"{11}\">&nbsp;{12}&nbsp;<input type=\"text\" name=\"idle\" size=\"5\" value=\"{13}\">&nbsp;{14}&nbsp;\n" +
1160
        "  </small>\n" +
1190
        "  </small>\n" +
1161
        "  </form>\n" +
1191
        "  </form>\n" +
1162
        " </td>\n" +
1192
        " </td>\n" +
Lines 1163-1176 Link Here
1163
        "</tr>\n";
1193
        "</tr>\n";
1164
1194
1165
    private static final String STOPPED_DEPLOYED_APPS_ROW_BUTTON_SECTION =
1195
    private static final String STOPPED_DEPLOYED_APPS_ROW_BUTTON_SECTION =
1166
        " <td class=\"row-left\" bgcolor=\"{13}\" rowspan=\"2\">\n" +
1196
        " <td class=\"row-left\" bgcolor=\"{15}\" rowspan=\"2\">\n" +
1167
        "  <form class=\"inline\" method=\"POST\" action=\"{0}\">" +
1197
        "  <form class=\"inline\" method=\"POST\" action=\"{0}\">" +
1168
        "  <small><input type=\"submit\" value=\"{1}\"></small>" +
1198
        "  <small><input type=\"submit\" value=\"{1}\"></small>" +
1169
        "  </form>\n" +
1199
        "  </form>\n" +
1170
        "  &nbsp;<small>{3}</small>&nbsp;\n" +
1200
        "  &nbsp;<small>{3}</small>&nbsp;\n" +
1171
        "  &nbsp;<small>{5}</small>&nbsp;\n" +
1201
        "  &nbsp;<small>{5}</small>&nbsp;\n" +
1172
        "  <form class=\"inline\" method=\"POST\" action=\"{6}\">" +
1202
        "  &nbsp;<small>{7}</small>&nbsp;\n" +
1173
        "  <small><input type=\"submit\" value=\"{7}\"></small>" +
1203
        "  <form class=\"inline\" method=\"POST\" action=\"{8}\">" +
1204
        "  <small><input type=\"submit\" value=\"{9}\"></small>" +
1174
        "  </form>\n" +
1205
        "  </form>\n" +
1175
        " </td>\n" +
1206
        " </td>\n" +
1176
        "</tr>\n<tr></tr>\n";
1207
        "</tr>\n<tr></tr>\n";
Lines 1184-1196 Link Here
1184
        "  <form class=\"inline\" method=\"POST\" action=\"{4}\">" +
1215
        "  <form class=\"inline\" method=\"POST\" action=\"{4}\">" +
1185
        "  <small><input type=\"submit\" value=\"{5}\"></small>" +
1216
        "  <small><input type=\"submit\" value=\"{5}\"></small>" +
1186
        "  </form>\n" +
1217
        "  </form>\n" +
1187
        "  &nbsp;<small>{7}</small>&nbsp;\n" +
1218
        "  <form class=\"inline\" method=\"POST\" action=\"{6}\">" +
1219
        "  <small><input type=\"submit\" value=\"{7}\"></small>" +
1220
        "  </form>\n" +
1221
        "  &nbsp;<small>{9}</small>&nbsp;\n" +
1188
        " </td>\n" +
1222
        " </td>\n" +
1189
        " </tr><tr>\n" +
1223
        " </tr><tr>\n" +
1190
        " <td class=\"row-left\" bgcolor=\"{13}\">\n" +
1224
        " <td class=\"row-left\" bgcolor=\"{15}\">\n" +
1191
        "  <form method=\"POST\" action=\"{8}\">\n" +
1225
        "  <form method=\"POST\" action=\"{10}\">\n" +
1192
        "  <small>\n" +
1226
        "  <small>\n" +
1193
        "  &nbsp;<input type=\"submit\" value=\"{9}\">&nbsp;{10}&nbsp;<input type=\"text\" name=\"idle\" size=\"5\" value=\"{11}\">&nbsp;{12}&nbsp;\n" +
1227
        "  &nbsp;<input type=\"submit\" value=\"{11}\">&nbsp;{12}&nbsp;<input type=\"text\" name=\"idle\" size=\"5\" value=\"{13}\">&nbsp;{14}&nbsp;\n" +
1194
        "  </small>\n" +
1228
        "  </small>\n" +
1195
        "  </form>\n" +
1229
        "  </form>\n" +
1196
        " </td>\n" +
1230
        " </td>\n" +
Lines 1197-1203 Link Here
1197
        "</tr>\n";
1231
        "</tr>\n";
1198
1232
1199
    private static final String STOPPED_NONDEPLOYED_APPS_ROW_BUTTON_SECTION =
1233
    private static final String STOPPED_NONDEPLOYED_APPS_ROW_BUTTON_SECTION =
1200
        " <td class=\"row-left\" bgcolor=\"{13}\" rowspan=\"2\">\n" +
1234
        " <td class=\"row-left\" bgcolor=\"{15}\" rowspan=\"2\">\n" +
1201
        "  <form class=\"inline\" method=\"POST\" action=\"{0}\">" +
1235
        "  <form class=\"inline\" method=\"POST\" action=\"{0}\">" +
1202
        "  <small><input type=\"submit\" value=\"{1}\"></small>" +
1236
        "  <small><input type=\"submit\" value=\"{1}\"></small>" +
1203
        "  </form>\n" +
1237
        "  </form>\n" +
Lines 1204-1209 Link Here
1204
        "  &nbsp;<small>{3}</small>&nbsp;\n" +
1238
        "  &nbsp;<small>{3}</small>&nbsp;\n" +
1205
        "  &nbsp;<small>{5}</small>&nbsp;\n" +
1239
        "  &nbsp;<small>{5}</small>&nbsp;\n" +
1206
        "  &nbsp;<small>{7}</small>&nbsp;\n" +
1240
        "  &nbsp;<small>{7}</small>&nbsp;\n" +
1241
        "  &nbsp;<small>{9}</small>&nbsp;\n" +
1207
        " </td>\n" +
1242
        " </td>\n" +
1208
        "</tr>\n<tr></tr>\n";
1243
        "</tr>\n<tr></tr>\n";
1209
1244
(-)java/org/apache/catalina/manager/LocalStrings.properties (+2 lines)
Lines 17-22 Link Here
17
htmlManagerServlet.appsName=Display Name
17
htmlManagerServlet.appsName=Display Name
18
htmlManagerServlet.appsPath=Path
18
htmlManagerServlet.appsPath=Path
19
htmlManagerServlet.appsReload=Reload
19
htmlManagerServlet.appsReload=Reload
20
htmlManagerServlet.appsRedeploy=Redeploy
20
htmlManagerServlet.appsUndeploy=Undeploy
21
htmlManagerServlet.appsUndeploy=Undeploy
21
htmlManagerServlet.appsVersion=Version
22
htmlManagerServlet.appsVersion=Version
22
htmlManagerServlet.appsExpire=Expire sessions
23
htmlManagerServlet.appsExpire=Expire sessions
Lines 97-102 Link Here
97
managerServlet.objectNameFail=FAIL - Unable to register object name [{0}] for Manager Servlet
98
managerServlet.objectNameFail=FAIL - Unable to register object name [{0}] for Manager Servlet
98
managerServlet.postCommand=FAIL - Tried to use command {0} via a GET request but POST is required
99
managerServlet.postCommand=FAIL - Tried to use command {0} via a GET request but POST is required
99
managerServlet.reloaded=OK - Reloaded application at context path {0}
100
managerServlet.reloaded=OK - Reloaded application at context path {0}
101
managerServlet.redeployed=OK - Redeployed application at context path {0}
100
managerServlet.resourcesAll=OK - Listed global resources of all types
102
managerServlet.resourcesAll=OK - Listed global resources of all types
101
managerServlet.resourcesType=OK - Listed global resources of type {0}
103
managerServlet.resourcesType=OK - Listed global resources of type {0}
102
managerServlet.saveFail=FAIL - Configuration save failed: {0}
104
managerServlet.saveFail=FAIL - Configuration save failed: {0}
(-)java/org/apache/catalina/manager/ManagerServlet.java (+54 lines)
Lines 1015-1021 Link Here
1015
1015
1016
    }
1016
    }
1017
1017
1018
    /**
1019
     * Reload the web application at the specified context path.
1020
     *
1021
     * @param writer Writer to render to
1022
     * @param cn Name of the application to be restarted
1023
     */
1024
    protected void redeploy(PrintWriter writer, ContextName cn,
1025
            StringManager smClient) {
1018
1026
1027
        if (debug >= 1)
1028
            log("restart: Redeploying web application '" + cn + "'");
1029
1030
        if (!validateContextName(cn, writer, smClient)) {
1031
            return;
1032
        }
1033
1034
        try {
1035
            Context context = (Context) host.findChild(cn.getName());
1036
            if (context == null) {
1037
                writer.println(smClient.getString("managerServlet.noContext",
1038
                        RequestUtil.filter(cn.getDisplayName())));
1039
                return;
1040
            }
1041
            // It isn't possible for the manager to reload itself
1042
            if (context.getName().equals(this.context.getName())) {
1043
                writer.println(smClient.getString("managerServlet.noSelf"));
1044
                return;
1045
            }
1046
1047
            // step 1 of 3 - copy to tmp
1048
            File warFile = new File(host.getAppBaseFile(), cn.getBaseName() + ".war");
1049
            String tmpdir = System.getProperty("java.io.tmpdir");
1050
            File tmpWarFile = new File( tmpdir + File.separator+ "_tmp_"+ cn.getBaseName() + ".war" );
1051
            context.stop();
1052
1053
            copy(warFile, tmpWarFile);
1054
1055
            // step 2 of 3 - undeploy
1056
            undeploy(writer,cn,smClient);
1057
1058
            // step 3 of 3 - deploy again =)
1059
            copy(tmpWarFile, warFile);
1060
1061
            writer.println(smClient.getString("managerServlet.redeployed",
1062
                    cn.getDisplayName()));
1063
        } catch (Throwable t) {
1064
            ExceptionUtils.handleThrowable(t);
1065
            log("ManagerServlet.reload[" + cn.getDisplayName() + "]", t);
1066
            writer.println(smClient.getString("managerServlet.exception",
1067
                    t.toString()));
1068
        }
1069
1070
    }
1071
1072
1019
    /**
1073
    /**
1020
     * Render a list of available global JNDI resources.
1074
     * Render a list of available global JNDI resources.
1021
     *
1075
     *

Return to bug 57701