From d7b1338622dd3e9c8f5e85c10c72c2153308cada Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Tue, 4 Nov 2008 08:30:44 +0000 Subject: [PATCH] fixes #2150, client side debug console now cannot be opened unless debug flag is set in app init svn changeset:5804/svn branch:trunk --- WebContent/WEB-INF/web.xml | 8 ++- .../gwt/client/ApplicationConnection.java | 12 +++-- .../gwt/server/ApplicationServlet.java | 50 ++++++++----------- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml index 7c4b790170..87d3b3d34a 100644 --- a/WebContent/WEB-INF/web.xml +++ b/WebContent/WEB-INF/web.xml @@ -9,7 +9,13 @@ IT Mill Toolkit examples - + + + Debug + true + IT Mill Toolkit debug mode + + testingToolsActive diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java b/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java index 0c2a295347..29ea8ba05f 100755 --- a/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java @@ -248,9 +248,13 @@ public class ApplicationConnection { private native static boolean isDebugMode() /*-{ - var uri = $wnd.location; - var re = /debug[^\/]*$/; - return re.test(uri); + if($wnd.itmill.debug) { + var uri = $wnd.location; + var re = /debug[^\/]*$/; + return re.test(uri); + } else { + return false; + } }-*/; private native static boolean isQuietDebugMode() @@ -633,7 +637,7 @@ public class ApplicationConnection { } if (html.length() != 0) { - INotification n = new INotification(1000 * 60 * 45); //45min + INotification n = new INotification(1000 * 60 * 45); // 45min n.addEventListener(new NotificationRedirect(url)); n.show(html, INotification.CENTERED_TOP, INotification.STYLE_SYSTEM); diff --git a/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java b/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java index 57afcbd304..ac33a259ef 100644 --- a/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java +++ b/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java @@ -149,7 +149,7 @@ public class ApplicationServlet extends HttpServlet { private String resourcePath = null; - private String debugMode = ""; + private boolean debugMode = false; // Is this servlet application runner boolean isApplicationRunnerServlet = false; @@ -211,17 +211,11 @@ public class ApplicationServlet extends HttpServlet { .getInitParameter(name)); } - // Gets the debug window parameter - final String debug = getApplicationOrSystemProperty(PARAMETER_DEBUG, "") - .toLowerCase(); - - // Enables application specific debug - if (!"".equals(debug) && !"true".equals(debug) - && !"false".equals(debug)) { - throw new ServletException( - "If debug parameter is given for an application, it must be 'true' or 'false'"); + // check if application is in debug mode + if (getApplicationOrSystemProperty(PARAMETER_DEBUG, "false").equals( + "true")) { + debugMode = true; } - debugMode = debug; // Gets Testing Tools parameters if feature is activated if (getApplicationOrSystemProperty("testingToolsActive", "false") @@ -872,6 +866,10 @@ public class ApplicationServlet extends HttpServlet { + "itmill.toolkitConfigurations = {};\n" + "itmill.themesLoaded = {}};\n"); + if (isDebugMode()) { + page.write("itmill.debug = true;\n"); + } + page.write("itmill.toolkitConfigurations[\"" + appId + "\"] = {"); page.write("appUri:'" + appUrl + "', "); page.write("pathInfo: '" + pathInfo + "', "); @@ -912,6 +910,9 @@ public class ApplicationServlet extends HttpServlet { + "if(!itmill) { var itmill = {}} \n" + "itmill.toolkitConfigurations = {};\n" + "itmill.themesLoaded = {};\n"); + if (isDebugMode()) { + page.write("itmill.debug = true;\n"); + } page .write("document.write('