IT Mill Toolkit examples
</description>
+ <session-config>
+ <session-timeout>20</session-timeout>
+ </session-config>
+
<!-- Permit use of IT Mill Testing Tools for this servlet container -->
<context-param>
<param-name>testingToolsActive</param-name>
</init-param>
</servlet>
- <!-- Automated tests used by Testing Tools plug-in client -->
+ <!-- Section begins: Automated tests used by Testing Tools plug-in client -->
<servlet>
<servlet-name>TestSimplestApplication</servlet-name>
<servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
</init-param>
</servlet>
+ <servlet>
+ <servlet-name>StatusServlet</servlet-name>
+ <servlet-class>com.itmill.toolkit.automatedtests.util.StatusServlet</servlet-class>
+ </servlet>
+ <!-- Section ends: Automated tests used by Testing Tools plug-in client -->
+
<servlet-mapping>
<servlet-name>ITMillToolkitApplicationRunner</servlet-name>
<url-pattern>/run/*</url-pattern>
<url-pattern>/NotificationDemo/*</url-pattern>
</servlet-mapping>
- <!-- Automated tests used by Testing Tools plug-in client -->
+ <!-- Section begins: Automated tests used by Testing Tools plug-in client -->
<servlet-mapping>
<servlet-name>TestSimplestApplication</servlet-name>
<url-pattern>/TestSimplestApplication/*</url-pattern>
<servlet-name>TestFeatureBrowser</servlet-name>
<url-pattern>/TestFeatureBrowser/*</url-pattern>
</servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>StatusServlet</servlet-name>
+ <url-pattern>/StatusServlet/*</url-pattern>
+ </servlet-mapping>
+ <!-- Section ends: Automated tests used by Testing Tools plug-in client -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
--- /dev/null
+/*
+@ITMillApache2LicenseForJavaFiles@
+ */
+
+package com.itmill.toolkit.automatedtests.util;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class StatusServlet extends HttpServlet {
+
+ private static final long serialVersionUID = -6764317622536660947L;
+
+ public static DateFormat dfHuman = new SimpleDateFormat(
+ "yyyy-MM-dd HH:mm:ss");
+
+ /**
+ * Version number of this release. For example "5.0.0".
+ */
+ public static final String VERSION;
+
+ /**
+ * Major version number. For example 5 in 5.1.0.
+ */
+ public static final int VERSION_MAJOR;
+
+ /**
+ * Minor version number. For example 1 in 5.1.0.
+ */
+ public static final int VERSION_MINOR;
+
+ /**
+ * Builds number. For example 0-custom_tag in 5.0.0-custom_tag.
+ */
+ public static final String VERSION_BUILD;
+
+ /* Initialize version numbers from string replaced by build-script. */
+ static {
+ if ("@VERSION@".equals("@" + "VERSION" + "@")) {
+ VERSION = "5.9.9-INTERNAL-NONVERSIONED-DEBUG-BUILD";
+ } else {
+ VERSION = "@VERSION@";
+ }
+ final String[] digits = VERSION.split("\\.");
+ VERSION_MAJOR = Integer.parseInt(digits[0]);
+ VERSION_MINOR = Integer.parseInt(digits[1]);
+ VERSION_BUILD = digits[2];
+ }
+
+ public void init(javax.servlet.ServletConfig servletConfig)
+ throws javax.servlet.ServletException {
+ super.init(servletConfig);
+ }
+
+ protected void service(HttpServletRequest request,
+ HttpServletResponse response) throws ServletException, IOException {
+ Writer w = response.getWriter();
+
+ // not cacheable
+ response.setHeader("Cache-Control", "no-cache");
+ response.setHeader("Pragma", "no-cache");
+ response.setDateHeader("Expires", 0);
+ response.setContentType("text/html");
+
+ String p = "";
+ p += "<p>StatusServlet " + dfHuman.format(new Date()) + "</p>";
+
+ System.gc();
+ long inUse = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime()
+ .freeMemory());
+ p += "<p>Memory:<br />\n<memused>" + inUse
+ + "</memused> (Used)<br />\n" + "<memtotal>"
+ + Runtime.getRuntime().totalMemory()
+ + "<memtotal> (Total)<br />\n" + "<memfree>"
+ + Runtime.getRuntime().freeMemory() + "<memfree> (Free)</p>\n";
+
+ w.write("<html>\n" + p + "</html>\n");
+ }
+}