From: Jani Laakso Date: Wed, 31 Oct 2007 19:21:11 +0000 (+0000) Subject: Added com.itmill.toolkit.terminal.web.ApplicationServlet which eases running Millston... X-Git-Tag: 6.7.0.beta1~5729 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=44f1e40359fdc368a0f366608091b50ba89318ef;p=vaadin-framework.git Added com.itmill.toolkit.terminal.web.ApplicationServlet which eases running Millstone3, Toolkit 4 projects without requiring changes to web.xml BUT prints [WARNING] Compatiblity class in use. Please use com.itmill.toolkit.terminal.gwt.server.ApplicationServlet instead. You probably need to update your web.xml. Moved Log class to better place, opened it as public so whole Toolkit may use it (I consider it's not a major thing if Toolkit users see it aswell) svn changeset:2649/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/Log.java b/src/com/itmill/toolkit/Log.java new file mode 100644 index 0000000000..1f3acd11df --- /dev/null +++ b/src/com/itmill/toolkit/Log.java @@ -0,0 +1,132 @@ +/* ************************************************************************* + + IT Mill Toolkit + + Development of Browser User Interfaces Made Easy + + Copyright (C) 2000-2006 IT Mill Ltd + + ************************************************************************* + + This product is distributed under commercial license that can be found + from the product package on license.pdf. Use of this product might + require purchasing a commercial license from IT Mill Ltd. For guidelines + on usage, see licensing-guidelines.html + + ************************************************************************* + + For more information, contact: + + IT Mill Ltd phone: +358 2 4802 7180 + Ruukinkatu 2-4 fax: +358 2 4802 7181 + 20540, Turku email: info@itmill.com + Finland company www: www.itmill.com + + Primary source for information and releases: www.itmill.com + + ********************************************************************** */ + +package com.itmill.toolkit; + +/** + *

+ * Class providing centralized logging services. The logger defines five message + * types, and provides methods to create messages of those types. These types + * are: + *

+ * + * + * + *

+ * Currently the class offers logging only to the standard output. + *

+ * + * @author IT Mill Ltd. + * @version + * @VERSION@ + * @since 5.0 + */ +public class Log { + + private static boolean useStdOut = true; + + private static String LOG_MSG_INFO = "[INFO]"; + + private static String LOG_MSG_ERROR = "[ERROR]"; + + private static String LOG_MSG_WARN = "[WARNING]"; + + private static String LOG_MSG_DEBUG = "[DEBUG]"; + + private static String LOG_MSG_EXCEPT = "[EXCEPTION]"; + + /** + * Logs the warning message. + * + * @param message + * the Message String to be logged. + */ + public static synchronized void warn(java.lang.String message) { + if (Log.useStdOut) + System.out.println(LOG_MSG_WARN + " " + message); + } + + /** + * Logs the debug message. + * + * @param message + * the Message String to be logged. + */ + public static synchronized void debug(java.lang.String message) { + if (Log.useStdOut) + System.out.println(LOG_MSG_DEBUG + " " + message); + } + + /** + * Logs an info message. + * + * @param message + * the Message String to be logged. + */ + public static synchronized void info(java.lang.String message) { + if (Log.useStdOut) + System.out.println(LOG_MSG_INFO + " " + message); + } + + /** + * Logs the Java exception and an accompanying error message. + * + * @param message + * the Message String to be logged. + * @param e + * the Exception to be logged. + */ + public static synchronized void except(java.lang.String message, Exception e) { + if (Log.useStdOut) { + System.out.println(LOG_MSG_EXCEPT + " " + message); + e.printStackTrace(); + } + } + + /** + * Logs the error message. + * + * @param message + * the Message String to be logged. + */ + public static synchronized void error(java.lang.String message) { + if (Log.useStdOut) + System.out.println(LOG_MSG_ERROR + " " + message); + } +} diff --git a/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java b/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java index ef715ca475..c859d2a0b5 100644 --- a/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java +++ b/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java @@ -29,7 +29,6 @@ package com.itmill.toolkit.terminal.gwt.server; import java.io.BufferedWriter; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -55,6 +54,7 @@ import javax.servlet.http.HttpSession; import org.xml.sax.SAXException; import com.itmill.toolkit.Application; +import com.itmill.toolkit.Log; import com.itmill.toolkit.external.org.apache.commons.fileupload.servlet.ServletFileUpload; import com.itmill.toolkit.service.FileTypeResolver; import com.itmill.toolkit.terminal.DownloadStream; diff --git a/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java b/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java index 38a46258e4..33fab13123 100644 --- a/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java +++ b/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java @@ -67,6 +67,7 @@ import com.itmill.toolkit.external.org.apache.commons.fileupload.ProgressListene import com.itmill.toolkit.external.org.apache.commons.fileupload.servlet.ServletFileUpload; import com.itmill.toolkit.Application; +import com.itmill.toolkit.Log; import com.itmill.toolkit.Application.WindowAttachEvent; import com.itmill.toolkit.Application.WindowDetachEvent; import com.itmill.toolkit.terminal.DownloadStream; diff --git a/src/com/itmill/toolkit/terminal/gwt/server/Log.java b/src/com/itmill/toolkit/terminal/gwt/server/Log.java deleted file mode 100644 index 5fe6417dad..0000000000 --- a/src/com/itmill/toolkit/terminal/gwt/server/Log.java +++ /dev/null @@ -1,132 +0,0 @@ -/* ************************************************************************* - - IT Mill Toolkit - - Development of Browser User Interfaces Made Easy - - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* - - This product is distributed under commercial license that can be found - from the product package on license.pdf. Use of this product might - require purchasing a commercial license from IT Mill Ltd. For guidelines - on usage, see licensing-guidelines.html - - ************************************************************************* - - For more information, contact: - - IT Mill Ltd phone: +358 2 4802 7180 - Ruukinkatu 2-4 fax: +358 2 4802 7181 - 20540, Turku email: info@itmill.com - Finland company www: www.itmill.com - - Primary source for information and releases: www.itmill.com - - ********************************************************************** */ - -package com.itmill.toolkit.terminal.gwt.server; - -/** - *

- * Class providing centralized logging services. The logger defines five message - * types, and provides methods to create messages of those types. These types - * are: - *

- * - * - * - *

- * Currently the class offers logging only to the standard output. - *

- * - * @author IT Mill Ltd. - * @version - * @VERSION@ - * @since 5.0 - */ -class Log { - - private static boolean useStdOut = true; - - private static String LOG_MSG_INFO = "[INFO]"; - - private static String LOG_MSG_ERROR = "[ERROR]"; - - private static String LOG_MSG_WARN = "[WARNING]"; - - private static String LOG_MSG_DEBUG = "[DEBUG]"; - - private static String LOG_MSG_EXCEPT = "[EXCEPTION]"; - - /** - * Logs the warning message. - * - * @param message - * the Message String to be logged. - */ - static synchronized void warn(java.lang.String message) { - if (Log.useStdOut) - System.out.println(LOG_MSG_WARN + " " + message); - } - - /** - * Logs the debug message. - * - * @param message - * the Message String to be logged. - */ - static synchronized void debug(java.lang.String message) { - if (Log.useStdOut) - System.out.println(LOG_MSG_DEBUG + " " + message); - } - - /** - * Logs an info message. - * - * @param message - * the Message String to be logged. - */ - static synchronized void info(java.lang.String message) { - if (Log.useStdOut) - System.out.println(LOG_MSG_INFO + " " + message); - } - - /** - * Logs the Java exception and an accompanying error message. - * - * @param message - * the Message String to be logged. - * @param e - * the Exception to be logged. - */ - static synchronized void except(java.lang.String message, Exception e) { - if (Log.useStdOut) { - System.out.println(LOG_MSG_EXCEPT + " " + message); - e.printStackTrace(); - } - } - - /** - * Logs the error message. - * - * @param message - * the Message String to be logged. - */ - static synchronized void error(java.lang.String message) { - if (Log.useStdOut) - System.out.println(LOG_MSG_ERROR + " " + message); - } -} diff --git a/src/com/itmill/toolkit/terminal/web/ApplicationServlet.java b/src/com/itmill/toolkit/terminal/web/ApplicationServlet.java new file mode 100644 index 0000000000..312f41d850 --- /dev/null +++ b/src/com/itmill/toolkit/terminal/web/ApplicationServlet.java @@ -0,0 +1,31 @@ +package com.itmill.toolkit.terminal.web; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; + +import com.itmill.toolkit.Log; + +/** + * This package and servlet is only provided for backward compatibility. Since + * Toolkit version 5.0 you should use + * com.itmill.toolkit.terminal.gwt.server.ApplicationServlet instead of this + * class. + * + * @author IT Mill Ltd. + * @version + * @VERSION@ + * @since 5.0 + */ +public class ApplicationServlet extends + com.itmill.toolkit.terminal.gwt.server.ApplicationServlet { + + private static final long serialVersionUID = -1471357707917217303L; + + @Override + public void init(ServletConfig servletConfig) throws ServletException { + Log + .warn("Compatiblity class in use. Please use com.itmill.toolkit.terminal.gwt.server.ApplicationServlet instead. You probably need to update your web.xml."); + super.init(servletConfig); + } + +}