Author: rjung
Date: Mon Mar  2 23:05:39 2009
New Revision: 749463

URL: http://svn.apache.org/viewvc?rev=749463&view=rev
Log:
Make writing of the "OK" refresh page in status worker
a separate function. Do not generate the page, in case
any error occured, so that the user can read the error
and must "commit" it by navigating back to the status
page.

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_status.c

Modified: tomcat/connectors/trunk/jk/native/common/jk_status.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_status.c?rev=749463&r1=749462&r2=749463&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_status.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_status.c Mon Mar  2 23:05:39 
2009
@@ -1218,6 +1218,22 @@
     return JK_TRUE;
 }
 
+static void write_html_refresh_response(jk_ws_service_t *s,
+                                        status_endpoint_t *p,
+                                        const char *err,
+                                        jk_logger_t *l)
+{
+    if (!err) {
+        jk_puts(s, "\n<meta http-equiv=\"Refresh\" content=\""
+                JK_STATUS_WAIT_AFTER_UPDATE ";url=");
+        status_write_uri(s, p, NULL, JK_STATUS_CMD_UNKNOWN, 
JK_STATUS_MIME_UNKNOWN,
+                         NULL, NULL, 0, 0, NULL, l);
+        jk_puts(s, "\">");
+        jk_putv(s, "<p><b>Result: OK - You will be redirected in "
+                JK_STATUS_WAIT_AFTER_UPDATE " seconds.</b><p/>", NULL);
+    }
+}
+
 static int fetch_worker_and_sub_worker(status_endpoint_t *p,
                                        const char *operation,
                                        const char **worker,
@@ -4433,15 +4449,7 @@
             /* unlock the shared memory */
             jk_shm_unlock();
             if (mime == JK_STATUS_MIME_HTML) {
-                jk_puts(s, "\n<meta http-equiv=\"Refresh\" content=\""
-                        JK_STATUS_WAIT_AFTER_UPDATE ";url=");
-                status_write_uri(s, p, NULL, JK_STATUS_CMD_UNKNOWN, 
JK_STATUS_MIME_UNKNOWN,
-                                 NULL, NULL, 0, 0, NULL, l);
-                jk_puts(s, "\">");
-                if (!err) {
-                    jk_putv(s, "<p><b>Result: OK - You will be redirected in "
-                            JK_STATUS_WAIT_AFTER_UPDATE " seconds.</b><p/>", 
NULL);
-                }
+                write_html_refresh_response(s, p, err, l);
             }
         }
         else if (cmd == JK_STATUS_CMD_RESET) {
@@ -4453,15 +4461,7 @@
             /* unlock the shared memory */
             jk_shm_unlock();
             if (mime == JK_STATUS_MIME_HTML) {
-                jk_puts(s, "\n<meta http-equiv=\"Refresh\" content=\""
-                        JK_STATUS_WAIT_AFTER_UPDATE ";url=");
-                status_write_uri(s, p, NULL, JK_STATUS_CMD_UNKNOWN, 
JK_STATUS_MIME_UNKNOWN,
-                                 NULL, NULL, 0, 0, NULL, l);
-                jk_puts(s, "\">");
-                if (!err) {
-                    jk_putv(s, "<p><b>Result: OK - You will be redirected in "
-                            JK_STATUS_WAIT_AFTER_UPDATE " seconds.</b><p/>", 
NULL);
-                }
+                write_html_refresh_response(s, p, err, l);
             }
         }
         else if (cmd == JK_STATUS_CMD_RECOVER) {
@@ -4473,15 +4473,7 @@
             /* unlock the shared memory */
             jk_shm_unlock();
             if (mime == JK_STATUS_MIME_HTML) {
-                jk_puts(s, "\n<meta http-equiv=\"Refresh\" content=\""
-                        JK_STATUS_WAIT_AFTER_UPDATE ";url=");
-                status_write_uri(s, p, NULL, JK_STATUS_CMD_UNKNOWN, 
JK_STATUS_MIME_UNKNOWN,
-                                 NULL, NULL, 0, 0, NULL, l);
-                jk_puts(s, "\">");
-                if (!err) {
-                    jk_putv(s, "<p><b>Result: OK - You will be redirected in "
-                            JK_STATUS_WAIT_AFTER_UPDATE " seconds.</b><p/>", 
NULL);
-                }
+                write_html_refresh_response(s, p, err, l);
             }
         }
         else {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to