Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2011-05-05 21:38:27 +0000
committerChris Goldthorpe2011-05-05 21:38:27 +0000
commit7525a4ce876e4f0cb6e7a556f5c80f6375822c36 (patch)
tree6585ba40cf45f956bdeed5ac63233169c8063c63
parentc1ca7c7233ea3622306042d07be2e44137be0d22 (diff)
downloadeclipse.platform.ua-7525a4ce876e4f0cb6e7a556f5c80f6375822c36.tar.gz
eclipse.platform.ua-7525a4ce876e4f0cb6e7a556f5c80f6375822c36.tar.xz
eclipse.platform.ua-7525a4ce876e4f0cb6e7a556f5c80f6375822c36.zip
Bug 344899 - [Test] Create a servlet in org.eclipse.ua.tests to enable test browser refreshv20110505
-rw-r--r--org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/servlet/CounterServlet.java53
-rw-r--r--org.eclipse.ua.tests/plugin.xml5
2 files changed, 58 insertions, 0 deletions
diff --git a/org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/servlet/CounterServlet.java b/org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/servlet/CounterServlet.java
new file mode 100644
index 000000000..836c2885f
--- /dev/null
+++ b/org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/servlet/CounterServlet.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.ua.tests.browser.servlet;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class CounterServlet extends HttpServlet {
+
+ /**
+ * This servlet contains a counter which increments each time it is called. It is used
+ * to test that a fresh page is loaded in the browser.
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ *
+ */
+ private static final String XHTML_1 = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<title>"; //$NON-NLS-1$
+ private static final String XHTML_2 = "</title>\n <style type = \"text/css\"> td { padding-right : 10px; }</style></head>\n<body>\n"; //$NON-NLS-1$
+ private static final String XHTML_3 = "</body>\n</html>"; //$NON-NLS-1$
+ private static int counter = 0;
+
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+ req.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
+ resp.setContentType("text/html; charset=UTF-8"); //$NON-NLS-1$
+ StringBuffer buf = new StringBuffer();
+ buf.append(XHTML_1);
+ buf.append("Connter Servlet");
+ buf.append(XHTML_2);
+ ++counter;
+ String text = "Times called = " + counter;
+ buf.append(text);
+ buf.append(XHTML_3);
+ String response = buf.toString();
+ resp.getWriter().write(response);
+ }
+
+}
diff --git a/org.eclipse.ua.tests/plugin.xml b/org.eclipse.ua.tests/plugin.xml
index 6c4f1aa72..436a53eef 100644
--- a/org.eclipse.ua.tests/plugin.xml
+++ b/org.eclipse.ua.tests/plugin.xml
@@ -539,6 +539,11 @@
<serviceSelector
filter="(other.info=org.eclipse.help)">
</serviceSelector>
+ <servlet
+ alias="/counter.html"
+ class="org.eclipse.ua.tests.browser.servlet.CounterServlet"
+ httpcontextId="org.eclipse.help.webapp.help">
+ </servlet>
</extension>
<extension
point="org.eclipse.equinox.http.registry.resources">

Back to the top