diff --git a/Hello.txt b/Hello.txt
new file mode 100644
index 0000000000000000000000000000000000000000..8e5f55b275add78c203aa2a92ea73b44f6e1935a
--- /dev/null
+++ b/Hello.txt
@@ -0,0 +1 @@
+Hello/Users/macoutreachadmin/Documents/SE/2XB3/Project
\ No newline at end of file
diff --git a/Hello:  b/Hello: 
new file mode 100644
index 0000000000000000000000000000000000000000..8e5f55b275add78c203aa2a92ea73b44f6e1935a
--- /dev/null
+++ b/Hello: 	
@@ -0,0 +1 @@
+Hello/Users/macoutreachadmin/Documents/SE/2XB3/Project
\ No newline at end of file
diff --git a/src/web/Director.java b/src/web/Director.java
index 7d66ab8a25cd8dd1afa6bab0570328b6fa9058dc..6538a840fd5df5086c410178880ecdd9046a5952 100755
--- a/src/web/Director.java
+++ b/src/web/Director.java
@@ -23,7 +23,9 @@ public class Director extends HttpServlet {
 	    else if (req.equals("doResult.do"))
     			view = request.getRequestDispatcher("result.jsp");
 	    else if (req.equals("doMap.do"))
-    			view = request.getRequestDispatcher("map.jsp");
+			view = request.getRequestDispatcher("map.jsp");
+	    else if (req.equals("doCluster.do"))
+			view = request.getRequestDispatcher("cluster.jsp");
 	    
 	    view.forward(request, response);
     }
diff --git a/tomcat/webapps/examples/WEB-INF/classes/CookieExample.java b/tomcat/webapps/examples/WEB-INF/classes/CookieExample.java
new file mode 100644
index 0000000000000000000000000000000000000000..c62463becd1574da613243a21868c92db4625dd4
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/CookieExample.java
@@ -0,0 +1,142 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ResourceBundle;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import util.CookieFilter;
+import util.HTMLFilter;
+
+/**
+ * Example servlet showing request headers
+ *
+ * @author James Duncan Davidson <duncan@eng.sun.com>
+ */
+
+public class CookieExample extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final ResourceBundle RB = ResourceBundle.getBundle("LocalStrings");
+
+    @Override
+    public void doGet(HttpServletRequest request,
+                      HttpServletResponse response)
+        throws IOException, ServletException
+    {
+
+        String cookieName = request.getParameter("cookiename");
+        String cookieValue = request.getParameter("cookievalue");
+        Cookie aCookie = null;
+        if (cookieName != null && cookieValue != null) {
+            aCookie = new Cookie(cookieName, cookieValue);
+            aCookie.setPath(request.getContextPath() + "/");
+            response.addCookie(aCookie);
+        }
+
+        response.setContentType("text/html");
+        response.setCharacterEncoding("UTF-8");
+
+        PrintWriter out = response.getWriter();
+        out.println("<!DOCTYPE html><html>");
+        out.println("<head>");
+        out.println("<meta charset=\"UTF-8\" />");
+
+        String title = RB.getString("cookies.title");
+        out.println("<title>" + title + "</title>");
+        out.println("</head>");
+        out.println("<body bgcolor=\"white\">");
+
+        // relative links
+
+        // XXX
+        // making these absolute till we work out the
+        // addition of a PathInfo issue
+
+        out.println("<a href=\"../cookies.html\">");
+        out.println("<img src=\"../images/code.gif\" height=24 " +
+                    "width=24 align=right border=0 alt=\"view code\"></a>");
+        out.println("<a href=\"../index.html\">");
+        out.println("<img src=\"../images/return.gif\" height=24 " +
+                    "width=24 align=right border=0 alt=\"return\"></a>");
+
+        out.println("<h3>" + title + "</h3>");
+
+        Cookie[] cookies = request.getCookies();
+        if ((cookies != null) && (cookies.length > 0)) {
+            HttpSession session = request.getSession(false);
+            String sessionId = null;
+            if (session != null) {
+                sessionId = session.getId();
+            }
+            out.println(RB.getString("cookies.cookies") + "<br>");
+            for (int i = 0; i < cookies.length; i++) {
+                Cookie cookie = cookies[i];
+                String cName = cookie.getName();
+                String cValue = cookie.getValue();
+                out.print("Cookie Name: " + HTMLFilter.filter(cName) + "<br>");
+                out.println("  Cookie Value: "
+                            + HTMLFilter.filter(CookieFilter.filter(cName, cValue, sessionId))
+                            + "<br><br>");
+            }
+        } else {
+            out.println(RB.getString("cookies.no-cookies"));
+        }
+
+        if (aCookie != null) {
+            out.println("<P>");
+            out.println(RB.getString("cookies.set") + "<br>");
+            out.print(RB.getString("cookies.name") + "  "
+                      + HTMLFilter.filter(cookieName) + "<br>");
+            out.print(RB.getString("cookies.value") + "  "
+                      + HTMLFilter.filter(cookieValue));
+        }
+
+        out.println("<P>");
+        out.println(RB.getString("cookies.make-cookie") + "<br>");
+        out.print("<form action=\"");
+        out.println("CookieExample\" method=POST>");
+        out.print(RB.getString("cookies.name") + "  ");
+        out.println("<input type=text length=20 name=cookiename><br>");
+        out.print(RB.getString("cookies.value") + "  ");
+        out.println("<input type=text length=20 name=cookievalue><br>");
+        out.println("<input type=submit></form>");
+
+
+        out.println("</body>");
+        out.println("</html>");
+    }
+
+    @Override
+    public void doPost(HttpServletRequest request,
+                      HttpServletResponse response)
+        throws IOException, ServletException
+    {
+        doGet(request, response);
+    }
+
+}
+
+
diff --git a/tomcat/webapps/examples/WEB-INF/classes/HelloWorldExample.java b/tomcat/webapps/examples/WEB-INF/classes/HelloWorldExample.java
new file mode 100644
index 0000000000000000000000000000000000000000..1a5ea5a68dc930f2eb4108792029cd9ae9b904d6
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/HelloWorldExample.java
@@ -0,0 +1,79 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ResourceBundle;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * The simplest possible servlet.
+ *
+ * @author James Duncan Davidson
+ */
+
+public class HelloWorldExample extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public void doGet(HttpServletRequest request,
+                      HttpServletResponse response)
+        throws IOException, ServletException
+    {
+        ResourceBundle rb =
+            ResourceBundle.getBundle("LocalStrings",request.getLocale());
+        response.setContentType("text/html");
+        response.setCharacterEncoding("UTF-8");
+        PrintWriter out = response.getWriter();
+
+        out.println("<!DOCTYPE html><html>");
+        out.println("<head>");
+        out.println("<meta charset=\"UTF-8\" />");
+
+        String title = rb.getString("helloworld.title");
+
+        out.println("<title>" + title + "</title>");
+        out.println("</head>");
+        out.println("<body bgcolor=\"white\">");
+
+        // note that all links are created to be relative. this
+        // ensures that we can move the web application that this
+        // servlet belongs to to a different place in the url
+        // tree and not have any harmful side effects.
+
+        // XXX
+        // making these absolute till we work out the
+        // addition of a PathInfo issue
+
+        out.println("<a href=\"../helloworld.html\">");
+        out.println("<img src=\"../images/code.gif\" height=24 " +
+                    "width=24 align=right border=0 alt=\"view code\"></a>");
+        out.println("<a href=\"../index.html\">");
+        out.println("<img src=\"../images/return.gif\" height=24 " +
+                    "width=24 align=right border=0 alt=\"return\"></a>");
+        out.println("<h1>" + title + "</h1>");
+        out.println("</body>");
+        out.println("</html>");
+    }
+}
+
+
+
diff --git a/tomcat/webapps/examples/WEB-INF/classes/LocalStrings.properties b/tomcat/webapps/examples/WEB-INF/classes/LocalStrings.properties
new file mode 100644
index 0000000000000000000000000000000000000000..a3f97e54742e527395666b430e4d3f68eb0b74fe
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/LocalStrings.properties
@@ -0,0 +1,51 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Default localized resources for example servlets
+# This locale is en_US
+
+helloworld.title=Hello World!
+
+requestinfo.title=Request Information Example
+requestinfo.label.method=Method:
+requestinfo.label.requesturi=Request URI:
+requestinfo.label.protocol=Protocol:
+requestinfo.label.pathinfo=Path Info:
+requestinfo.label.remoteaddr=Remote Address:
+
+requestheader.title=Request Header Example
+
+requestparams.title=Request Parameters Example
+requestparams.params-in-req=Parameters in this request:
+requestparams.no-params=No Parameters, Please enter some
+requestparams.firstname=First Name:
+requestparams.lastname=Last Name:
+
+cookies.title=Cookies Example
+cookies.cookies=Your browser is sending the following cookies:
+cookies.no-cookies=Your browser isn't sending any cookies
+cookies.make-cookie=Create a cookie to send to your browser
+cookies.name=Name:
+cookies.value=Value:
+cookies.set=You just sent the following cookie to your browser:
+
+sessions.title=Sessions Example
+sessions.id=Session ID:
+sessions.created=Created:
+sessions.lastaccessed=Last Accessed:
+sessions.data=The following data is in your session:
+sessions.adddata=Add data to your session
+sessions.dataname=Name of Session Attribute:
+sessions.datavalue=Value of Session Attribute:
diff --git a/tomcat/webapps/examples/WEB-INF/classes/LocalStrings_en.properties b/tomcat/webapps/examples/WEB-INF/classes/LocalStrings_en.properties
new file mode 100644
index 0000000000000000000000000000000000000000..a3f97e54742e527395666b430e4d3f68eb0b74fe
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/LocalStrings_en.properties
@@ -0,0 +1,51 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Default localized resources for example servlets
+# This locale is en_US
+
+helloworld.title=Hello World!
+
+requestinfo.title=Request Information Example
+requestinfo.label.method=Method:
+requestinfo.label.requesturi=Request URI:
+requestinfo.label.protocol=Protocol:
+requestinfo.label.pathinfo=Path Info:
+requestinfo.label.remoteaddr=Remote Address:
+
+requestheader.title=Request Header Example
+
+requestparams.title=Request Parameters Example
+requestparams.params-in-req=Parameters in this request:
+requestparams.no-params=No Parameters, Please enter some
+requestparams.firstname=First Name:
+requestparams.lastname=Last Name:
+
+cookies.title=Cookies Example
+cookies.cookies=Your browser is sending the following cookies:
+cookies.no-cookies=Your browser isn't sending any cookies
+cookies.make-cookie=Create a cookie to send to your browser
+cookies.name=Name:
+cookies.value=Value:
+cookies.set=You just sent the following cookie to your browser:
+
+sessions.title=Sessions Example
+sessions.id=Session ID:
+sessions.created=Created:
+sessions.lastaccessed=Last Accessed:
+sessions.data=The following data is in your session:
+sessions.adddata=Add data to your session
+sessions.dataname=Name of Session Attribute:
+sessions.datavalue=Value of Session Attribute:
diff --git a/tomcat/webapps/examples/WEB-INF/classes/LocalStrings_es.properties b/tomcat/webapps/examples/WEB-INF/classes/LocalStrings_es.properties
new file mode 100644
index 0000000000000000000000000000000000000000..025a3ff757110ee25ef57a4f7cfa362cff378e5b
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/LocalStrings_es.properties
@@ -0,0 +1,43 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+helloworld.title = Hola Mundo!
+requestinfo.title = Ejemplo de Informacion de Requerimiento:
+requestinfo.label.method = M\u00E9todo:
+requestinfo.label.requesturi = URI de Requerimiento:
+requestinfo.label.protocol = Protocolo:
+requestinfo.label.pathinfo = Info de Ruta:
+requestinfo.label.remoteaddr = Direccion Remota:
+requestheader.title = Ejemplo de Cabecera de Requerimiento:
+requestparams.title = Ejemplo de par\u00E1metros de Requerimiento:
+requestparams.params-in-req = Par\u00E1metros en este Request:
+requestparams.no-params = No hay p\u00E1rametro. Por favor, usa alguno
+requestparams.firstname = Nombre:
+requestparams.lastname = Apellidos:
+cookies.title = Ejemplo de Cookies
+cookies.cookies = Tu navegador est\u00E1 enviando los siguientes cookies:
+cookies.no-cookies = Tu navegador no est\u00E1 enviando cookies
+cookies.make-cookie = Crea un cookie para enviarlo a tu navegador
+cookies.name = Nombre:
+cookies.value = Valor:
+cookies.set = Acabas de enviar a tu navegador estos cookies:
+sessions.title = Ejemplo de Sesiones
+sessions.id = ID de Sesi\u00F3n:
+sessions.created = Creado:
+sessions.lastaccessed = Ultimo Acceso:
+sessions.data = Lo siguientes datos est\u00E1n en tu sesi\u00F3n:
+sessions.adddata = A\u00F1ade datos a tu sesi\u00F3n:
+sessions.dataname = Nombre del atributo de sesi\u00F3n:
+sessions.datavalue = Valor del atributo de sesi\u00F3n:
diff --git a/tomcat/webapps/examples/WEB-INF/classes/LocalStrings_fr.properties b/tomcat/webapps/examples/WEB-INF/classes/LocalStrings_fr.properties
new file mode 100644
index 0000000000000000000000000000000000000000..b6b9a3f5950c6175114c0687f3746b1b8428b8a6
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/LocalStrings_fr.properties
@@ -0,0 +1,51 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Default localized resources for example servlets
+# This locale is fr_FR
+
+helloworld.title=Salut le Monde!
+
+requestinfo.title=Exemple d''information sur la requ\u00eate
+requestinfo.label.method=M\u00e9thode:
+requestinfo.label.requesturi=URI de requ\u00eate:
+requestinfo.label.protocol=Protocole:
+requestinfo.label.pathinfo=Info de chemin:
+requestinfo.label.remoteaddr=Adresse distante:
+
+requestheader.title=Exemple d''information sur les ent\u00eate de requ\u00eate
+
+requestparams.title=Exemple de requ\u00eate avec param\u00eatres
+requestparams.params-in-req=Param\u00eatres dans la requ\u00eate:
+requestparams.no-params=Pas de param\u00eatre, merci dans saisir quelqu'uns
+requestparams.firstname=Pr\u00e9nom:
+requestparams.lastname=Nom:
+
+cookies.title=Exemple d''utilisation de Cookies
+cookies.cookies=Votre navigateur retourne les cookies suivant:
+cookies.no-cookies=Votre navigateur ne retourne aucun cookie
+cookies.make-cookie=Cr\u00e9ation d''un cookie \u00e0 retourner \u00e0 votre navigateur
+cookies.name=Nom:
+cookies.value=Valeur:
+cookies.set=Vous venez d''envoyer le cookie suivant \u00e0 votre navigateur:
+
+sessions.title=Exemple de Sessions
+sessions.id=ID de Session:
+sessions.created=Cr\u00e9e le:
+sessions.lastaccessed=Dernier acc\u00e8s:
+sessions.data=Les donn\u00e9es existantes dans votre session:
+sessions.adddata=Ajouter des donn\u00e9es \u00e0 votre session
+sessions.dataname=Nom de l''Attribut de Session:
+sessions.datavalue=Valeur de l''Attribut de Session:
diff --git a/tomcat/webapps/examples/WEB-INF/classes/LocalStrings_pt.properties b/tomcat/webapps/examples/WEB-INF/classes/LocalStrings_pt.properties
new file mode 100644
index 0000000000000000000000000000000000000000..919643e7eb4a5e98527c15376159ff981f2852fd
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/LocalStrings_pt.properties
@@ -0,0 +1,51 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Default localized resources for example servlets
+# This locale is pt_PT
+
+helloworld.title=Ola Mundo!
+
+requestinfo.title=Exemplo da Informacao do Pedido
+requestinfo.label.method=Metodo:
+requestinfo.label.requesturi=URI do Pedido:
+requestinfo.label.protocol=Protocolo:
+requestinfo.label.pathinfo=Informacao do Caminho:
+requestinfo.label.remoteaddr=Endereco Remoto:
+
+requestheader.title=Exemplo da Cebeceira do Pedido
+
+requestparams.title=Examplo de Parametros do Pedido
+requestparams.params-in-req=Parametros neste pedido:
+requestparams.no-params=Sem Parametros, Por favor entre alguns
+requestparams.firstname=Primeiro Nome:
+requestparams.lastname=Apelido:
+
+cookies.title=CExamplo de Cookies
+cookies.cookies=O se browser esta a enviar os seguintes cookies:
+cookies.no-cookies=O seu browser nao esta a enviar nenhuns cookies
+cookies.make-cookie=Crie um cookie para enviar para o seu browser
+cookies.name=Nome:
+cookies.value=Valor:
+cookies.set=Acabou de enviar o seguinte cookie para o seu browser:
+
+sessions.title=Examplo de sessoes
+sessions.id=Identificador da Sessao:
+sessions.created=Criada:
+sessions.lastaccessed=Ultima vez acedida:
+sessions.data=Os seguintes dados fazem parte da sua sessao:
+sessions.adddata=Adicione data a sua sessao
+sessions.dataname=Nome do atributo da sessao:
+sessions.datavalue=Valor do atributo da Sessao:
diff --git a/tomcat/webapps/examples/WEB-INF/classes/RequestHeaderExample.java b/tomcat/webapps/examples/WEB-INF/classes/RequestHeaderExample.java
new file mode 100644
index 0000000000000000000000000000000000000000..79e7bac116b77e379afce92b1075cf333f403300
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/RequestHeaderExample.java
@@ -0,0 +1,109 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import util.CookieFilter;
+import util.HTMLFilter;
+
+/**
+ * Example servlet showing request headers
+ *
+ * @author James Duncan Davidson <duncan@eng.sun.com>
+ */
+
+public class RequestHeaderExample extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final ResourceBundle RB = ResourceBundle.getBundle("LocalStrings");
+
+    @Override
+    public void doGet(HttpServletRequest request,
+                      HttpServletResponse response)
+        throws IOException, ServletException
+    {
+        response.setContentType("text/html");
+        response.setCharacterEncoding("UTF-8");
+
+        PrintWriter out = response.getWriter();
+        out.println("<!DOCTYPE html><html>");
+        out.println("<head>");
+        out.println("<meta charset=\"UTF-8\" />");
+
+        String title = RB.getString("requestheader.title");
+        out.println("<title>" + title + "</title>");
+        out.println("</head>");
+        out.println("<body bgcolor=\"white\">");
+
+        // all links relative
+
+        // XXX
+        // making these absolute till we work out the
+        // addition of a PathInfo issue
+
+        out.println("<a href=\"../reqheaders.html\">");
+        out.println("<img src=\"../images/code.gif\" height=24 " +
+                    "width=24 align=right border=0 alt=\"view code\"></a>");
+        out.println("<a href=\"../index.html\">");
+        out.println("<img src=\"../images/return.gif\" height=24 " +
+                    "width=24 align=right border=0 alt=\"return\"></a>");
+
+        out.println("<h3>" + title + "</h3>");
+        out.println("<table border=0>");
+        Enumeration<String> e = request.getHeaderNames();
+        while (e.hasMoreElements()) {
+            String headerName = e.nextElement();
+            String headerValue = request.getHeader(headerName);
+            out.println("<tr><td bgcolor=\"#CCCCCC\">");
+            out.println(HTMLFilter.filter(headerName));
+            out.println("</td><td>");
+            if (headerName.toLowerCase(Locale.ENGLISH).contains("cookie")) {
+                HttpSession session = request.getSession(false);
+                String sessionId = null;
+                if (session != null) {
+                    sessionId = session.getId();
+                }
+                out.println(HTMLFilter.filter(CookieFilter.filter(headerValue, sessionId)));
+            } else {
+                out.println(HTMLFilter.filter(headerValue));
+            }
+            out.println("</td></tr>");
+        }
+        out.println("</table>");
+    }
+
+    @Override
+    public void doPost(HttpServletRequest request,
+                      HttpServletResponse response)
+        throws IOException, ServletException
+    {
+        doGet(request, response);
+    }
+
+}
+
diff --git a/tomcat/webapps/examples/WEB-INF/classes/RequestInfoExample.java b/tomcat/webapps/examples/WEB-INF/classes/RequestInfoExample.java
new file mode 100644
index 0000000000000000000000000000000000000000..952e5012fbf1a463b838dc85a98aa4a15943345d
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/RequestInfoExample.java
@@ -0,0 +1,118 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ResourceBundle;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import util.HTMLFilter;
+
+/**
+ * Example servlet showing request information.
+ *
+ * @author James Duncan Davidson <duncan@eng.sun.com>
+ */
+
+public class RequestInfoExample extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final ResourceBundle RB = ResourceBundle.getBundle("LocalStrings");
+
+    @Override
+    public void doGet(HttpServletRequest request,
+                      HttpServletResponse response)
+        throws IOException, ServletException
+    {
+        response.setContentType("text/html");
+        response.setCharacterEncoding("UTF-8");
+
+        PrintWriter out = response.getWriter();
+        out.println("<!DOCTYPE html><html>");
+        out.println("<head>");
+        out.println("<meta charset=\"UTF-8\" />");
+
+        String title = RB.getString("requestinfo.title");
+        out.println("<title>" + title + "</title>");
+        out.println("</head>");
+        out.println("<body bgcolor=\"white\">");
+
+        // img stuff not req'd for source code html showing
+        // all links relative!
+
+        // XXX
+        // making these absolute till we work out the
+        // addition of a PathInfo issue
+
+        out.println("<a href=\"../reqinfo.html\">");
+        out.println("<img src=\"../images/code.gif\" height=24 " +
+                    "width=24 align=right border=0 alt=\"view code\"></a>");
+        out.println("<a href=\"../index.html\">");
+        out.println("<img src=\"../images/return.gif\" height=24 " +
+                    "width=24 align=right border=0 alt=\"return\"></a>");
+
+        out.println("<h3>" + title + "</h3>");
+        out.println("<table border=0><tr><td>");
+        out.println(RB.getString("requestinfo.label.method"));
+        out.println("</td><td>");
+        out.println(HTMLFilter.filter(request.getMethod()));
+        out.println("</td></tr><tr><td>");
+        out.println(RB.getString("requestinfo.label.requesturi"));
+        out.println("</td><td>");
+        out.println(HTMLFilter.filter(request.getRequestURI()));
+        out.println("</td></tr><tr><td>");
+        out.println(RB.getString("requestinfo.label.protocol"));
+        out.println("</td><td>");
+        out.println(HTMLFilter.filter(request.getProtocol()));
+        out.println("</td></tr><tr><td>");
+        out.println(RB.getString("requestinfo.label.pathinfo"));
+        out.println("</td><td>");
+        out.println(HTMLFilter.filter(request.getPathInfo()));
+        out.println("</td></tr><tr><td>");
+        out.println(RB.getString("requestinfo.label.remoteaddr"));
+        out.println("</td><td>");
+        out.println(HTMLFilter.filter(request.getRemoteAddr()));
+        out.println("</td></tr>");
+
+        String cipherSuite=
+                (String)request.getAttribute("javax.servlet.request.cipher_suite");
+        if(cipherSuite!=null){
+            out.println("<tr><td>");
+            out.println("SSLCipherSuite:");
+            out.println("</td><td>");
+            out.println(HTMLFilter.filter(cipherSuite));
+            out.println("</td></tr>");
+        }
+
+        out.println("</table>");
+    }
+
+    @Override
+    public void doPost(HttpServletRequest request,
+                      HttpServletResponse response)
+        throws IOException, ServletException
+    {
+        doGet(request, response);
+    }
+
+}
+
diff --git a/tomcat/webapps/examples/WEB-INF/classes/RequestParamExample.java b/tomcat/webapps/examples/WEB-INF/classes/RequestParamExample.java
new file mode 100644
index 0000000000000000000000000000000000000000..be07415add464680d9458576ab3ab820330f29d7
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/RequestParamExample.java
@@ -0,0 +1,111 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ResourceBundle;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import util.HTMLFilter;
+
+/**
+ * Example servlet showing request headers
+ *
+ * @author James Duncan Davidson <duncan@eng.sun.com>
+ */
+
+public class RequestParamExample extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final ResourceBundle RB = ResourceBundle.getBundle("LocalStrings");
+
+    @Override
+    public void doGet(HttpServletRequest request,
+                      HttpServletResponse response)
+        throws IOException, ServletException
+    {
+        response.setContentType("text/html");
+        response.setCharacterEncoding("UTF-8");
+
+        PrintWriter out = response.getWriter();
+        out.println("<!DOCTYPE html><html>");
+        out.println("<head>");
+        out.println("<meta charset=\"UTF-8\" />");
+
+        String title = RB.getString("requestparams.title");
+        out.println("<title>" + title + "</title>");
+        out.println("</head>");
+        out.println("<body bgcolor=\"white\">");
+
+        // img stuff not req'd for source code html showing
+
+       // all links relative
+
+        // XXX
+        // making these absolute till we work out the
+        // addition of a PathInfo issue
+
+        out.println("<a href=\"../reqparams.html\">");
+        out.println("<img src=\"../images/code.gif\" height=24 " +
+                    "width=24 align=right border=0 alt=\"view code\"></a>");
+        out.println("<a href=\"../index.html\">");
+        out.println("<img src=\"../images/return.gif\" height=24 " +
+                    "width=24 align=right border=0 alt=\"return\"></a>");
+
+        out.println("<h3>" + title + "</h3>");
+        String firstName = request.getParameter("firstname");
+        String lastName = request.getParameter("lastname");
+        out.println(RB.getString("requestparams.params-in-req") + "<br>");
+        if (firstName != null || lastName != null) {
+            out.println(RB.getString("requestparams.firstname"));
+            out.println(" = " + HTMLFilter.filter(firstName) + "<br>");
+            out.println(RB.getString("requestparams.lastname"));
+            out.println(" = " + HTMLFilter.filter(lastName));
+        } else {
+            out.println(RB.getString("requestparams.no-params"));
+        }
+        out.println("<P>");
+        out.print("<form action=\"");
+        out.print("RequestParamExample\" ");
+        out.println("method=POST>");
+        out.println(RB.getString("requestparams.firstname"));
+        out.println("<input type=text size=20 name=firstname>");
+        out.println("<br>");
+        out.println(RB.getString("requestparams.lastname"));
+        out.println("<input type=text size=20 name=lastname>");
+        out.println("<br>");
+        out.println("<input type=submit>");
+        out.println("</form>");
+
+        out.println("</body>");
+        out.println("</html>");
+    }
+
+    @Override
+    public void doPost(HttpServletRequest request,
+                      HttpServletResponse response)
+        throws IOException, ServletException
+    {
+        doGet(request, response);
+    }
+
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/ServletToJsp.java b/tomcat/webapps/examples/WEB-INF/classes/ServletToJsp.java
new file mode 100644
index 0000000000000000000000000000000000000000..53faba2e5f470776cb60e43e26f7ab2838b31656
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/ServletToJsp.java
@@ -0,0 +1,39 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class ServletToJsp extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public void doGet (HttpServletRequest request,
+            HttpServletResponse response) {
+
+       try {
+           // Set the attribute and Forward to hello.jsp
+           request.setAttribute ("servletName", "servletToJsp");
+           getServletConfig().getServletContext().getRequestDispatcher(
+                   "/jsp/jsptoserv/hello.jsp").forward(request, response);
+       } catch (Exception ex) {
+           ex.printStackTrace ();
+       }
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/SessionExample.java b/tomcat/webapps/examples/WEB-INF/classes/SessionExample.java
new file mode 100644
index 0000000000000000000000000000000000000000..471b66bd68fc1f647c9cce760ff7301088d16afd
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/SessionExample.java
@@ -0,0 +1,147 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.ResourceBundle;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import util.HTMLFilter;
+
+/**
+ * Example servlet showing request headers
+ *
+ * @author James Duncan Davidson <duncan@eng.sun.com>
+ */
+
+public class SessionExample extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final ResourceBundle RB = ResourceBundle.getBundle("LocalStrings");
+
+    @Override
+    public void doGet(HttpServletRequest request,
+                      HttpServletResponse response)
+        throws IOException, ServletException
+    {
+        response.setContentType("text/html");
+        response.setCharacterEncoding("UTF-8");
+
+        PrintWriter out = response.getWriter();
+        out.println("<!DOCTYPE html><html>");
+        out.println("<head>");
+        out.println("<meta charset=\"UTF-8\" />");
+
+
+        String title = RB.getString("sessions.title");
+        out.println("<title>" + title + "</title>");
+        out.println("</head>");
+        out.println("<body bgcolor=\"white\">");
+
+        // img stuff not req'd for source code html showing
+        // relative links everywhere!
+
+        // XXX
+        // making these absolute till we work out the
+        // addition of a PathInfo issue
+
+        out.println("<a href=\"../sessions.html\">");
+        out.println("<img src=\"../images/code.gif\" height=24 " +
+                    "width=24 align=right border=0 alt=\"view code\"></a>");
+        out.println("<a href=\"../index.html\">");
+        out.println("<img src=\"../images/return.gif\" height=24 " +
+                    "width=24 align=right border=0 alt=\"return\"></a>");
+
+        out.println("<h3>" + title + "</h3>");
+
+        HttpSession session = request.getSession(true);
+        out.println(RB.getString("sessions.id") + " " + session.getId());
+        out.println("<br>");
+        out.println(RB.getString("sessions.created") + " ");
+        out.println(new Date(session.getCreationTime()) + "<br>");
+        out.println(RB.getString("sessions.lastaccessed") + " ");
+        out.println(new Date(session.getLastAccessedTime()));
+
+        String dataName = request.getParameter("dataname");
+        String dataValue = request.getParameter("datavalue");
+        if (dataName != null && dataValue != null) {
+            session.setAttribute(dataName, dataValue);
+        }
+
+        out.println("<P>");
+        out.println(RB.getString("sessions.data") + "<br>");
+        Enumeration<String> names = session.getAttributeNames();
+        while (names.hasMoreElements()) {
+            String name = names.nextElement();
+            String value = session.getAttribute(name).toString();
+            out.println(HTMLFilter.filter(name) + " = "
+                        + HTMLFilter.filter(value) + "<br>");
+        }
+
+        out.println("<P>");
+        out.print("<form action=\"");
+        out.print(response.encodeURL("SessionExample"));
+        out.print("\" ");
+        out.println("method=POST>");
+        out.println(RB.getString("sessions.dataname"));
+        out.println("<input type=text size=20 name=dataname>");
+        out.println("<br>");
+        out.println(RB.getString("sessions.datavalue"));
+        out.println("<input type=text size=20 name=datavalue>");
+        out.println("<br>");
+        out.println("<input type=submit>");
+        out.println("</form>");
+
+        out.println("<P>GET based form:<br>");
+        out.print("<form action=\"");
+        out.print(response.encodeURL("SessionExample"));
+        out.print("\" ");
+        out.println("method=GET>");
+        out.println(RB.getString("sessions.dataname"));
+        out.println("<input type=text size=20 name=dataname>");
+        out.println("<br>");
+        out.println(RB.getString("sessions.datavalue"));
+        out.println("<input type=text size=20 name=datavalue>");
+        out.println("<br>");
+        out.println("<input type=submit>");
+        out.println("</form>");
+
+        out.print("<p><a href=\"");
+        out.print(HTMLFilter.filter(response.encodeURL("SessionExample?dataname=foo&datavalue=bar")));
+        out.println("\" >URL encoded </a>");
+
+        out.println("</body>");
+        out.println("</html>");
+    }
+
+    @Override
+    public void doPost(HttpServletRequest request,
+                      HttpServletResponse response)
+        throws IOException, ServletException
+    {
+        doGet(request, response);
+    }
+
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/async/Async0.java b/tomcat/webapps/examples/WEB-INF/classes/async/Async0.java
new file mode 100644
index 0000000000000000000000000000000000000000..5bc0ee49acbe8fb92d2e105d512e516580f9ee3e
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/async/Async0.java
@@ -0,0 +1,71 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package async;
+
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import javax.servlet.AsyncContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+
+public class Async0 extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final Log log = LogFactory.getLog(Async0.class);
+
+    @Override
+    protected void service(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
+        if (Boolean.TRUE.equals(req.getAttribute("dispatch"))) {
+            log.info("Received dispatch, completing on the worker thread.");
+            log.info("After complete called started:"+req.isAsyncStarted());
+            Date date = new Date(System.currentTimeMillis());
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
+            resp.getWriter().write("Async dispatch worked: " + sdf.format(date) + "\n");
+        } else {
+            resp.setContentType("text/plain");
+            final AsyncContext actx = req.startAsync();
+            actx.setTimeout(Long.MAX_VALUE);
+            Runnable run = new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        req.setAttribute("dispatch", Boolean.TRUE);
+                        Thread.currentThread().setName("Async0-Thread");
+                        log.info("Putting AsyncThread to sleep");
+                        Thread.sleep(2*1000);
+                        log.info("Dispatching");
+                        actx.dispatch();
+                    }catch (InterruptedException x) {
+                        log.error("Async1",x);
+                    }catch (IllegalStateException x) {
+                        log.error("Async1",x);
+                    }
+                }
+            };
+            Thread t = new Thread(run);
+            t.start();
+        }
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/async/Async1.java b/tomcat/webapps/examples/WEB-INF/classes/async/Async1.java
new file mode 100644
index 0000000000000000000000000000000000000000..dc0dc5912e881bd0ddb15de5d1b0df6a1d6cd0b9
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/async/Async1.java
@@ -0,0 +1,62 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package async;
+
+import java.io.IOException;
+
+import javax.servlet.AsyncContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+
+public class Async1 extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final Log log = LogFactory.getLog(Async1.class);
+
+    @Override
+    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+        final AsyncContext actx = req.startAsync();
+        actx.setTimeout(30*1000);
+        Runnable run = new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    String path = "/jsp/async/async1.jsp";
+                    Thread.currentThread().setName("Async1-Thread");
+                    log.info("Putting AsyncThread to sleep");
+                    Thread.sleep(2*1000);
+                    log.info("Dispatching to "+path);
+                    actx.dispatch(path);
+                }catch (InterruptedException x) {
+                    log.error("Async1",x);
+                }catch (IllegalStateException x) {
+                    log.error("Async1",x);
+                }
+            }
+        };
+        Thread t = new Thread(run);
+        t.start();
+    }
+
+
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/async/Async2.java b/tomcat/webapps/examples/WEB-INF/classes/async/Async2.java
new file mode 100644
index 0000000000000000000000000000000000000000..0682d62116ab49713f18e01c6f570b43b3eccea2
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/async/Async2.java
@@ -0,0 +1,70 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package async;
+
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import javax.servlet.AsyncContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+
+public class Async2 extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final Log log = LogFactory.getLog(Async2.class);
+
+    @Override
+    protected void service(HttpServletRequest req, HttpServletResponse resp)
+            throws ServletException, IOException {
+        final AsyncContext actx = req.startAsync();
+        actx.setTimeout(30*1000);
+        Runnable run = new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    Thread.currentThread().setName("Async2-Thread");
+                    log.info("Putting AsyncThread to sleep");
+                    Thread.sleep(2*1000);
+                    log.info("Writing data.");
+                    Date date = new Date(System.currentTimeMillis());
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
+                    actx.getResponse().getWriter().write(
+                            "Output from background thread. Time: " + sdf.format(date) + "\n");
+                    actx.complete();
+                }catch (InterruptedException x) {
+                    log.error("Async2",x);
+                }catch (IllegalStateException x) {
+                    log.error("Async2",x);
+                }catch (IOException x) {
+                    log.error("Async2",x);
+                }
+            }
+        };
+        Thread t = new Thread(run);
+        t.start();
+    }
+
+
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/async/Async3.java b/tomcat/webapps/examples/WEB-INF/classes/async/Async3.java
new file mode 100644
index 0000000000000000000000000000000000000000..e1ff5e0411b48259d50bb74cb13ca1b6100eaa65
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/async/Async3.java
@@ -0,0 +1,39 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package async;
+
+import java.io.IOException;
+
+import javax.servlet.AsyncContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class Async3 extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+        final AsyncContext actx = req.startAsync();
+        actx.setTimeout(30*1000);
+        actx.dispatch("/jsp/async/async3.jsp");
+    }
+
+
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/async/AsyncStockContextListener.java b/tomcat/webapps/examples/WEB-INF/classes/async/AsyncStockContextListener.java
new file mode 100644
index 0000000000000000000000000000000000000000..685ac239fb2822c24ff184ff5724d108f4ded2c4
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/async/AsyncStockContextListener.java
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package async;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+/*
+ * Ensures the Stockticker is shut down cleanly when the context stops. This
+ * also covers the case when the server shuts down.
+ */
+public class AsyncStockContextListener implements ServletContextListener {
+
+    public static final String STOCK_TICKER_KEY = "StockTicker";
+
+    @Override
+    public void contextInitialized(ServletContextEvent sce) {
+        Stockticker stockticker = new Stockticker();
+        ServletContext sc = sce.getServletContext();
+        sc.setAttribute(STOCK_TICKER_KEY, stockticker);
+    }
+
+    @Override
+    public void contextDestroyed(ServletContextEvent sce) {
+        ServletContext sc = sce.getServletContext();
+        Stockticker stockticker = (Stockticker) sc.getAttribute(STOCK_TICKER_KEY);
+        stockticker.shutdown();
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java b/tomcat/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java
new file mode 100644
index 0000000000000000000000000000000000000000..8b3ac152a1ebfe7d384064addf00f84e62e97719
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java
@@ -0,0 +1,149 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package async;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.servlet.AsyncContext;
+import javax.servlet.AsyncEvent;
+import javax.servlet.AsyncListener;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+
+import async.Stockticker.Stock;
+import async.Stockticker.TickListener;
+
+public class AsyncStockServlet extends HttpServlet implements TickListener, AsyncListener{
+
+    private static final long serialVersionUID = 1L;
+
+    private static final Log log = LogFactory.getLog(AsyncStockServlet.class);
+
+    private static final ConcurrentLinkedQueue<AsyncContext> clients =
+            new ConcurrentLinkedQueue<>();
+    private static final AtomicInteger clientcount = new AtomicInteger(0);
+
+    public AsyncStockServlet() {
+        log.info("AsyncStockServlet created");
+    }
+
+
+    @Override
+    protected void service(HttpServletRequest req, HttpServletResponse resp)
+            throws ServletException, IOException {
+        if (req.isAsyncStarted()) {
+            req.getAsyncContext().complete();
+        } else if (req.isAsyncSupported()) {
+            AsyncContext actx = req.startAsync();
+            actx.addListener(this);
+            resp.setContentType("text/plain");
+            clients.add(actx);
+            if (clientcount.incrementAndGet()==1) {
+                Stockticker ticker = (Stockticker) req.getServletContext().getAttribute(
+                        AsyncStockContextListener.STOCK_TICKER_KEY);
+                ticker.addTickListener(this);
+            }
+        } else {
+            new Exception("Async Not Supported").printStackTrace();
+            resp.sendError(400,"Async is not supported.");
+        }
+    }
+
+
+    @Override
+    public void tick(Stock stock) {
+        Iterator<AsyncContext> it = clients.iterator();
+        while (it.hasNext()) {
+            AsyncContext actx = it.next();
+            try {
+                writeStock(actx, stock);
+            } catch (Exception e) {
+                // Ignore. The async error handling will deal with this.
+            }
+        }
+    }
+
+
+    public void writeStock(AsyncContext actx, Stock stock) throws IOException {
+        HttpServletResponse response = (HttpServletResponse)actx.getResponse();
+        PrintWriter writer = response.getWriter();
+        writer.write("STOCK#");//make client parsing easier
+        writer.write(stock.getSymbol());
+        writer.write("#");
+        writer.write(stock.getValueAsString());
+        writer.write("#");
+        writer.write(stock.getLastChangeAsString());
+        writer.write("#");
+        writer.write(String.valueOf(stock.getCnt()));
+        writer.write("\n");
+        writer.flush();
+        response.flushBuffer();
+    }
+
+
+    @Override
+    public void shutdown() {
+        // The web application is shutting down. Complete any AsyncContexts
+        // associated with an active client.
+        Iterator<AsyncContext> it = clients.iterator();
+        while (it.hasNext()) {
+            AsyncContext actx = it.next();
+            try {
+                actx.complete();
+            } catch (Exception e) {
+                // Ignore. The async error handling will deal with this.
+            }
+        }
+    }
+
+
+    @Override
+    public void onComplete(AsyncEvent event) throws IOException {
+        if (clients.remove(event.getAsyncContext()) && clientcount.decrementAndGet()==0) {
+            ServletContext sc = event.getAsyncContext().getRequest().getServletContext();
+            Stockticker ticker = (Stockticker) sc.getAttribute(
+                    AsyncStockContextListener.STOCK_TICKER_KEY);
+            ticker.removeTickListener(this);
+        }
+    }
+
+    @Override
+    public void onError(AsyncEvent event) throws IOException {
+        event.getAsyncContext().complete();
+    }
+
+    @Override
+    public void onTimeout(AsyncEvent event) throws IOException {
+        event.getAsyncContext().complete();
+    }
+
+
+    @Override
+    public void onStartAsync(AsyncEvent event) throws IOException {
+        // NOOP
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/async/Stockticker.java b/tomcat/webapps/examples/WEB-INF/classes/async/Stockticker.java
new file mode 100644
index 0000000000000000000000000000000000000000..e87744e357e43025795c2172f9c3c48a99dc02a4
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/async/Stockticker.java
@@ -0,0 +1,207 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package async;
+
+import java.text.DecimalFormat;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class Stockticker implements Runnable {
+        public volatile boolean run = true;
+        protected final AtomicInteger counter = new AtomicInteger(0);
+        final List<TickListener> listeners = new CopyOnWriteArrayList<>();
+        protected volatile Thread ticker = null;
+        protected volatile int ticknr = 0;
+
+        public synchronized void start() {
+            run = true;
+            ticker = new Thread(this);
+            ticker.setName("Ticker Thread");
+            ticker.start();
+        }
+
+        public synchronized void stop() {
+            // On context stop this can be called multiple times.
+            // NO-OP is the ticker thread is not set
+            // (i.e. stop() has already completed)
+            if (ticker == null) {
+                return;
+            }
+            run = false;
+            try {
+                ticker.join();
+            }catch (InterruptedException x) {
+                Thread.interrupted();
+            }
+
+            ticker = null;
+        }
+
+        public void shutdown() {
+            // Notify each listener of the shutdown. This enables them to
+            // trigger any necessary clean-up.
+            for (TickListener l : listeners) {
+                l.shutdown();
+            }
+            // Wait for the thread to stop. This prevents warnings in the logs
+            // that the thread is still active when the context stops.
+            stop();
+        }
+
+        public void addTickListener(TickListener listener) {
+            if (listeners.add(listener)) {
+                if (counter.incrementAndGet()==1) start();
+            }
+
+        }
+
+        public void removeTickListener(TickListener listener) {
+            if (listeners.remove(listener)) {
+                if (counter.decrementAndGet()==0) stop();
+            }
+        }
+
+        @Override
+        public void run() {
+            try {
+
+                Stock[] stocks = new Stock[] { new Stock("GOOG", 435.43),
+                        new Stock("YHOO", 27.88), new Stock("ASF", 1015.55), };
+                Random r = new Random(System.currentTimeMillis());
+                while (run) {
+                    for (int j = 0; j < 1; j++) {
+                        int i = r.nextInt() % 3;
+                        if (i < 0)
+                            i = i * (-1);
+                        Stock stock = stocks[i];
+                        double change = r.nextDouble();
+                        boolean plus = r.nextBoolean();
+                        if (plus) {
+                            stock.setValue(stock.getValue() + change);
+                        } else {
+                            stock.setValue(stock.getValue() - change);
+                        }
+                        stock.setCnt(++ticknr);
+                        for (TickListener l : listeners) {
+                            l.tick(stock);
+                        }
+
+                    }
+                    Thread.sleep(850);
+                }
+            } catch (InterruptedException ix) {
+                // Ignore
+            } catch (Exception x) {
+                x.printStackTrace();
+            }
+        }
+
+
+    public static interface TickListener {
+        public void tick(Stock stock);
+        public void shutdown();
+    }
+
+    public static final class Stock implements Cloneable {
+        protected static final DecimalFormat df = new DecimalFormat("0.00");
+        protected final String symbol;
+        protected double value = 0.0d;
+        protected double lastchange = 0.0d;
+        protected int cnt = 0;
+
+        public Stock(String symbol, double initvalue) {
+            this.symbol = symbol;
+            this.value = initvalue;
+        }
+
+        public void setCnt(int c) {
+            this.cnt = c;
+        }
+
+        public int getCnt() {
+            return cnt;
+        }
+
+        public String getSymbol() {
+            return symbol;
+        }
+
+        public double getValue() {
+            return value;
+        }
+
+        public void setValue(double value) {
+            double old = this.value;
+            this.value = value;
+            this.lastchange = value - old;
+        }
+
+        public String getValueAsString() {
+            return df.format(value);
+        }
+
+        public double getLastChange() {
+            return this.lastchange;
+        }
+
+        public void setLastChange(double lastchange) {
+            this.lastchange = lastchange;
+        }
+
+        public String getLastChangeAsString() {
+            return df.format(lastchange);
+        }
+
+        @Override
+        public int hashCode() {
+            return symbol.hashCode();
+        }
+
+        @Override
+        public boolean equals(Object other) {
+            if (other instanceof Stock) {
+                return this.symbol.equals(((Stock) other).symbol);
+            }
+
+            return false;
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder buf = new StringBuilder("STOCK#");
+            buf.append(getSymbol());
+            buf.append("#");
+            buf.append(getValueAsString());
+            buf.append("#");
+            buf.append(getLastChangeAsString());
+            buf.append("#");
+            buf.append(String.valueOf(getCnt()));
+            return buf.toString();
+
+        }
+
+        @Override
+        public Object clone() {
+            Stock s = new Stock(this.getSymbol(), this.getValue());
+            s.setLastChange(this.getLastChange());
+            s.setCnt(this.cnt);
+            return s;
+        }
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/cal/Entries.java b/tomcat/webapps/examples/WEB-INF/classes/cal/Entries.java
new file mode 100644
index 0000000000000000000000000000000000000000..02860195e1c3a455a1f605899c444e9ba6f85c99
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/cal/Entries.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cal;
+
+import java.util.Hashtable;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class Entries {
+
+    private final Hashtable<String, Entry> entries;
+    private static final String[] time = { "8am", "9am", "10am", "11am",
+            "12pm", "1pm", "2pm", "3pm", "4pm", "5pm", "6pm", "7pm", "8pm" };
+    public static final int rows = 12;
+
+    public Entries() {
+        entries = new Hashtable<>(rows);
+        for (int i = 0; i < rows; i++) {
+            entries.put(time[i], new Entry(time[i]));
+        }
+    }
+
+    public int getRows() {
+        return rows;
+    }
+
+    public Entry getEntry(int index) {
+        return this.entries.get(time[index]);
+    }
+
+    public int getIndex(String tm) {
+        for (int i = 0; i < rows; i++)
+            if (tm.equals(time[i]))
+                return i;
+        return -1;
+    }
+
+    public void processRequest(HttpServletRequest request, String tm) {
+        int index = getIndex(tm);
+        if (index >= 0) {
+            String descr = request.getParameter("description");
+            entries.get(time[index]).setDescription(descr);
+        }
+    }
+
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/cal/Entry.java b/tomcat/webapps/examples/WEB-INF/classes/cal/Entry.java
new file mode 100644
index 0000000000000000000000000000000000000000..68e7fdf0fd67359d1a3cf6e52383a2c011fde197
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/cal/Entry.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cal;
+
+public class Entry {
+
+    final String hour;
+    String description;
+
+    public Entry(String hour) {
+        this.hour = hour;
+        this.description = "";
+
+    }
+
+    public String getHour() {
+        return this.hour;
+    }
+
+    public String getColor() {
+        if (description.equals("")) {
+            return "lightblue";
+        }
+        return "red";
+    }
+
+    public String getDescription() {
+        if (description.equals("")) {
+            return "None";
+        }
+        return this.description;
+    }
+
+    public void setDescription(String descr) {
+        description = descr;
+    }
+
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/cal/JspCalendar.java b/tomcat/webapps/examples/WEB-INF/classes/cal/JspCalendar.java
new file mode 100644
index 0000000000000000000000000000000000000000..f9cf20f05cb933c707c12f96b093661da27e5cd3
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/cal/JspCalendar.java
@@ -0,0 +1,151 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package cal;
+
+import java.util.Calendar;
+import java.util.Date;
+
+public class JspCalendar {
+    final Calendar  calendar;
+
+    public JspCalendar() {
+        calendar = Calendar.getInstance();
+        Date trialTime = new Date();
+        calendar.setTime(trialTime);
+    }
+
+
+    public int getYear() {
+        return calendar.get(Calendar.YEAR);
+    }
+
+    public String getMonth() {
+        int m = getMonthInt();
+        String[] months = new String [] { "January", "February", "March",
+                                        "April", "May", "June",
+                                        "July", "August", "September",
+                                        "October", "November", "December" };
+        if (m > 12)
+            return "Unknown to Man";
+
+        return months[m - 1];
+
+    }
+
+    public String getDay() {
+        int x = getDayOfWeek();
+        String[] days = new String[] {"Sunday", "Monday", "Tuesday", "Wednesday",
+                                      "Thursday", "Friday", "Saturday"};
+
+        if (x > 7)
+            return "Unknown to Man";
+
+        return days[x - 1];
+
+    }
+
+    public int getMonthInt() {
+        return 1 + calendar.get(Calendar.MONTH);
+    }
+
+    public String getDate() {
+        return getMonthInt() + "/" + getDayOfMonth() + "/" +  getYear();
+    }
+
+    public String getCurrentDate() {
+        Date dt = new Date ();
+        calendar.setTime (dt);
+        return getMonthInt() + "/" + getDayOfMonth() + "/" +  getYear();
+
+    }
+
+    public String getNextDate() {
+        calendar.set (Calendar.DAY_OF_MONTH, getDayOfMonth() + 1);
+        return getDate ();
+    }
+
+    public String getPrevDate() {
+        calendar.set (Calendar.DAY_OF_MONTH, getDayOfMonth() - 1);
+        return getDate ();
+    }
+
+    public String getTime() {
+        return getHour() + ":" + getMinute() + ":" + getSecond();
+    }
+
+    public int getDayOfMonth() {
+        return calendar.get(Calendar.DAY_OF_MONTH);
+    }
+
+    public int getDayOfYear() {
+        return calendar.get(Calendar.DAY_OF_YEAR);
+    }
+
+    public int getWeekOfYear() {
+        return calendar.get(Calendar.WEEK_OF_YEAR);
+    }
+
+    public int getWeekOfMonth() {
+        return calendar.get(Calendar.WEEK_OF_MONTH);
+    }
+
+    public int getDayOfWeek() {
+        return calendar.get(Calendar.DAY_OF_WEEK);
+    }
+
+    public int getHour() {
+        return calendar.get(Calendar.HOUR_OF_DAY);
+    }
+
+    public int getMinute() {
+        return calendar.get(Calendar.MINUTE);
+    }
+
+
+    public int getSecond() {
+        return calendar.get(Calendar.SECOND);
+    }
+
+
+    public int getEra() {
+        return calendar.get(Calendar.ERA);
+    }
+
+    public String getUSTimeZone() {
+        String[] zones = new String[] {"Hawaii", "Alaskan", "Pacific",
+                                       "Mountain", "Central", "Eastern"};
+
+        return zones[10 + getZoneOffset()];
+    }
+
+    public int getZoneOffset() {
+        return calendar.get(Calendar.ZONE_OFFSET)/(60*60*1000);
+    }
+
+
+    public int getDSTOffset() {
+        return calendar.get(Calendar.DST_OFFSET)/(60*60*1000);
+    }
+
+
+    public int getAMPM() {
+        return calendar.get(Calendar.AM_PM);
+    }
+}
+
+
diff --git a/tomcat/webapps/examples/WEB-INF/classes/cal/TableBean.java b/tomcat/webapps/examples/WEB-INF/classes/cal/TableBean.java
new file mode 100644
index 0000000000000000000000000000000000000000..483bd93dd77f1d0ac4bac9c00b298544c2d98fa7
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/cal/TableBean.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cal;
+
+import java.util.Hashtable;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class TableBean {
+
+    final Hashtable<String, Entries> table;
+    final JspCalendar JspCal;
+    Entries entries;
+    String date;
+    String name = null;
+    String email = null;
+    boolean processError = false;
+
+    public TableBean() {
+        this.table = new Hashtable<>(10);
+        this.JspCal = new JspCalendar();
+        this.date = JspCal.getCurrentDate();
+    }
+
+    public void setName(String nm) {
+        this.name = nm;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public void setEmail(String mail) {
+        this.email = mail;
+    }
+
+    public String getEmail() {
+        return this.email;
+    }
+
+    public String getDate() {
+        return this.date;
+    }
+
+    public Entries getEntries() {
+        return this.entries;
+    }
+
+    public void processRequest(HttpServletRequest request) {
+
+        // Get the name and e-mail.
+        this.processError = false;
+        if (name == null || name.equals(""))
+            setName(request.getParameter("name"));
+        if (email == null || email.equals(""))
+            setEmail(request.getParameter("email"));
+        if (name == null || email == null || name.equals("")
+                || email.equals("")) {
+            this.processError = true;
+            return;
+        }
+
+        // Get the date.
+        String dateR = request.getParameter("date");
+        if (dateR == null)
+            date = JspCal.getCurrentDate();
+        else if (dateR.equalsIgnoreCase("next"))
+            date = JspCal.getNextDate();
+        else if (dateR.equalsIgnoreCase("prev"))
+            date = JspCal.getPrevDate();
+
+        entries = table.get(date);
+        if (entries == null) {
+            entries = new Entries();
+            table.put(date, entries);
+        }
+
+        // If time is provided add the event.
+        String time = request.getParameter("time");
+        if (time != null)
+            entries.processRequest(request, time);
+    }
+
+    public boolean getProcessError() {
+        return this.processError;
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/checkbox/CheckTest.java b/tomcat/webapps/examples/WEB-INF/classes/checkbox/CheckTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..e38269c95af5832888efaaa4f2ecae9fab013000
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/checkbox/CheckTest.java
@@ -0,0 +1,31 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package checkbox;
+
+public class CheckTest {
+
+    String b[] = new String[] { "1", "2", "3", "4" };
+
+    public String[] getFruit() {
+        return b;
+    }
+
+    public void setFruit(String [] b) {
+        this.b = b;
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/colors/ColorGameBean.java b/tomcat/webapps/examples/WEB-INF/classes/colors/ColorGameBean.java
new file mode 100644
index 0000000000000000000000000000000000000000..7c64d94c3b9aefc6ac4ba48fab794e117d597807
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/colors/ColorGameBean.java
@@ -0,0 +1,113 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package colors;
+
+public class ColorGameBean {
+
+    private String background = "yellow";
+    private String foreground = "red";
+    private String color1 = foreground;
+    private String color2 = background;
+    private String hint = "no";
+    private int attempts = 0;
+        private int intval = 0;
+    private boolean tookHints = false;
+
+    public void processRequest() {
+
+        // background = "yellow";
+        // foreground = "red";
+
+        if (! color1.equals(foreground)) {
+            if (color1.equalsIgnoreCase("black") ||
+                        color1.equalsIgnoreCase("cyan")) {
+                        background = color1;
+                }
+        }
+
+        if (! color2.equals(background)) {
+            if (color2.equalsIgnoreCase("black") ||
+                        color2.equalsIgnoreCase("cyan")) {
+                        foreground = color2;
+            }
+        }
+
+        attempts++;
+    }
+
+    public void setColor2(String x) {
+        color2 = x;
+    }
+
+    public void setColor1(String x) {
+        color1 = x;
+    }
+
+    public void setAction(String x) {
+        if (!tookHints)
+            tookHints = x.equalsIgnoreCase("Hint");
+        hint = x;
+    }
+
+    public String getColor2() {
+         return background;
+    }
+
+    public String getColor1() {
+         return foreground;
+    }
+
+    public int getAttempts() {
+        return attempts;
+    }
+
+    public boolean getHint() {
+        return hint.equalsIgnoreCase("Hint");
+    }
+
+    public boolean getSuccess() {
+        if (background.equalsIgnoreCase("black") ||
+            background.equalsIgnoreCase("cyan")) {
+
+            if (foreground.equalsIgnoreCase("black") ||
+                foreground.equalsIgnoreCase("cyan")) {
+                return true;
+            }
+            return false;
+        }
+
+        return false;
+    }
+
+    public boolean getHintTaken() {
+        return tookHints;
+    }
+
+    public void reset() {
+        foreground = "red";
+        background = "yellow";
+    }
+
+    public void setIntval(int value) {
+        intval = value;
+        }
+
+    public int getIntval() {
+        return intval;
+        }
+}
+
diff --git a/tomcat/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilter.java b/tomcat/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilter.java
new file mode 100644
index 0000000000000000000000000000000000000000..fbba3c78f2eb44de6fc9fac805e956e27eceb7b5
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilter.java
@@ -0,0 +1,225 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package compressionFilters;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.servlet.FilterChain;
+import javax.servlet.GenericFilter;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Implementation of <code>javax.servlet.Filter</code> used to compress
+ * the ServletResponse if it is bigger than a threshold.
+ *
+ * @author Amy Roh
+ * @author Dmitri Valdin
+ */
+public class CompressionFilter extends GenericFilter {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Minimal reasonable threshold.
+     */
+    private static final int MIN_THRESHOLD = 128;
+
+    /**
+     * Minimal reasonable buffer.
+     */
+    // 8KB is what tomcat would use by default anyway
+    private static final int MIN_BUFFER = 8192;
+
+    /**
+     * The threshold number to compress.
+     */
+    protected int compressionThreshold = 0;
+
+    /**
+     * The compression buffer size to avoid chunking.
+     */
+    protected int compressionBuffer = 0;
+
+    /**
+     * The mime types to compress.
+     */
+    protected String[] compressionMimeTypes = {"text/html", "text/xml", "text/plain"};
+
+    /**
+     * Debug level for this filter.
+     */
+    private int debug = 0;
+
+    @Override
+    public void init() {
+        String str = getInitParameter("debug");
+        if (str != null) {
+            debug = Integer.parseInt(str);
+        }
+
+        str = getInitParameter("compressionThreshold");
+        if (str != null) {
+            compressionThreshold = Integer.parseInt(str);
+            if (compressionThreshold != 0 && compressionThreshold < MIN_THRESHOLD) {
+                if (debug > 0) {
+                    System.out.println("compressionThreshold should be either 0 - no compression or >= " + MIN_THRESHOLD);
+                    System.out.println("compressionThreshold set to " + MIN_THRESHOLD);
+                }
+                compressionThreshold = MIN_THRESHOLD;
+            }
+        }
+
+        str = getInitParameter("compressionBuffer");
+        if (str != null) {
+            compressionBuffer = Integer.parseInt(str);
+            if (compressionBuffer < MIN_BUFFER) {
+                if (debug > 0) {
+                    System.out.println("compressionBuffer should be >= " + MIN_BUFFER);
+                    System.out.println("compressionBuffer set to " + MIN_BUFFER);
+                }
+                compressionBuffer = MIN_BUFFER;
+            }
+        }
+
+        str = getInitParameter("compressionMimeTypes");
+        if (str != null) {
+            List<String> values = new ArrayList<>();
+            StringTokenizer st = new StringTokenizer(str, ",");
+
+            while (st.hasMoreTokens()) {
+                String token = st.nextToken().trim();
+                if (token.length() > 0) {
+                    values.add(token);
+                }
+            }
+
+            if (values.size() > 0) {
+                compressionMimeTypes = values.toArray(
+                        new String[values.size()]);
+            } else {
+                compressionMimeTypes = null;
+            }
+
+            if (debug > 0) {
+                System.out.println("compressionMimeTypes set to " +
+                        Arrays.toString(compressionMimeTypes));
+            }
+        }
+    }
+
+    /**
+     * The <code>doFilter</code> method of the Filter is called by the container
+     * each time a request/response pair is passed through the chain due
+     * to a client request for a resource at the end of the chain.
+     * The FilterChain passed into this method allows the Filter to pass on the
+     * request and response to the next entity in the chain.<p>
+     * This method first examines the request to check whether the client support
+     * compression. <br>
+     * It simply just pass the request and response if there is no support for
+     * compression.<br>
+     * If the compression support is available, it creates a
+     * CompressionServletResponseWrapper object which compresses the content and
+     * modifies the header if the content length is big enough.
+     * It then invokes the next entity in the chain using the FilterChain object
+     * (<code>chain.doFilter()</code>), <br>
+     **/
+    @Override
+    public void doFilter (ServletRequest request, ServletResponse response, FilterChain chain )
+            throws IOException, ServletException {
+
+        if (debug > 0) {
+            System.out.println("@doFilter");
+        }
+
+        if (compressionThreshold == 0) {
+            if (debug > 0) {
+                System.out.println("doFilter got called, but compressionThreshold is set to 0 - no compression");
+            }
+            chain.doFilter(request, response);
+            return;
+        }
+
+        boolean supportCompression = false;
+        if (request instanceof HttpServletRequest) {
+            if (debug > 1) {
+                System.out.println("requestURI = " + ((HttpServletRequest)request).getRequestURI());
+            }
+
+            // Are we allowed to compress ?
+            String s = ((HttpServletRequest)request).getParameter("gzip");
+            if ("false".equals(s)) {
+                if (debug > 0) {
+                    System.out.println("got parameter gzip=false --> don't compress, just chain filter");
+                }
+                chain.doFilter(request, response);
+                return;
+            }
+
+            Enumeration<String> e =
+                ((HttpServletRequest)request).getHeaders("Accept-Encoding");
+            while (e.hasMoreElements()) {
+                String name = e.nextElement();
+                if (name.indexOf("gzip") != -1) {
+                    if (debug > 0) {
+                        System.out.println("supports compression");
+                    }
+                    supportCompression = true;
+                } else {
+                    if (debug > 0) {
+                        System.out.println("no support for compression");
+                    }
+                }
+            }
+        }
+
+        if (supportCompression) {
+            if (response instanceof HttpServletResponse) {
+                CompressionServletResponseWrapper wrappedResponse =
+                    new CompressionServletResponseWrapper((HttpServletResponse)response);
+                wrappedResponse.setDebugLevel(debug);
+                wrappedResponse.setCompressionThreshold(compressionThreshold);
+                wrappedResponse.setCompressionBuffer(compressionBuffer);
+                wrappedResponse.setCompressionMimeTypes(compressionMimeTypes);
+                if (debug > 0) {
+                    System.out.println("doFilter gets called with compression");
+                }
+                try {
+                    chain.doFilter(request, wrappedResponse);
+                } finally {
+                    wrappedResponse.finishResponse();
+                }
+                return;
+            }
+        } else {
+            if (debug > 0) {
+                System.out.println("doFilter gets called w/o compression");
+            }
+            chain.doFilter(request, response);
+            return;
+        }
+    }
+}
+
diff --git a/tomcat/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilterTestServlet.java b/tomcat/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilterTestServlet.java
new file mode 100644
index 0000000000000000000000000000000000000000..af1a0b9798a8f06bdf5d048c60987b641fcee296
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilterTestServlet.java
@@ -0,0 +1,66 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package compressionFilters;
+
+import java.io.IOException;
+import java.util.Enumeration;
+
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Very Simple test servlet to test compression filter
+ * @author Amy Roh
+ */
+public class CompressionFilterTestServlet extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public void doGet(HttpServletRequest request, HttpServletResponse response)
+        throws ServletException, IOException {
+
+        ServletOutputStream out = response.getOutputStream();
+        response.setContentType("text/plain");
+
+        Enumeration<String> e = request.getHeaders("Accept-Encoding");
+        while (e.hasMoreElements()) {
+            String name = e.nextElement();
+            out.println(name);
+            if (name.indexOf("gzip") != -1) {
+                out.println("gzip supported -- able to compress");
+            }
+            else {
+                out.println("gzip not supported");
+            }
+        }
+
+
+        out.println("Compression Filter Test Servlet");
+        out.println("Minimum content length for compression is 128 bytes");
+        out.println("**********  32 bytes  **********");
+        out.println("**********  32 bytes  **********");
+        out.println("**********  32 bytes  **********");
+        out.println("**********  32 bytes  **********");
+        out.close();
+    }
+
+}
+
diff --git a/tomcat/webapps/examples/WEB-INF/classes/compressionFilters/CompressionResponseStream.java b/tomcat/webapps/examples/WEB-INF/classes/compressionFilters/CompressionResponseStream.java
new file mode 100644
index 0000000000000000000000000000000000000000..ccc66073ad4fb54a427eeef0a77d4d6a8d5b8f4e
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/compressionFilters/CompressionResponseStream.java
@@ -0,0 +1,435 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package compressionFilters;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.zip.GZIPOutputStream;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
+
+/**
+ * Implementation of <b>ServletOutputStream</b> that works with
+ * the CompressionServletResponseWrapper implementation.
+ *
+ * @author Amy Roh
+ * @author Dmitri Valdin
+ */
+public class CompressionResponseStream extends ServletOutputStream {
+
+    // ----------------------------------------------------------- Constructors
+
+    /**
+     * Construct a servlet output stream associated with the specified Response.
+     *
+     * @param responseWrapper The associated response wrapper
+     * @param originalOutput the output stream
+     */
+    public CompressionResponseStream(
+            CompressionServletResponseWrapper responseWrapper,
+            ServletOutputStream originalOutput) {
+
+        super();
+        closed = false;
+        this.response = responseWrapper;
+        this.output = originalOutput;
+    }
+
+
+    // ----------------------------------------------------- Instance Variables
+
+
+    /**
+     * The threshold number which decides to compress or not.
+     * Users can configure in web.xml to set it to fit their needs.
+     */
+    protected int compressionThreshold = 0;
+
+    /**
+     * The compression buffer size to avoid chunking
+     */
+    protected int compressionBuffer = 0;
+
+    /**
+     * The mime types to compress
+     */
+    protected String[] compressionMimeTypes = {"text/html", "text/xml", "text/plain"};
+
+    /**
+     * Debug level
+     */
+    private int debug = 0;
+
+    /**
+     * The buffer through which all of our output bytes are passed.
+     */
+    protected byte[] buffer = null;
+
+    /**
+     * The number of data bytes currently in the buffer.
+     */
+    protected int bufferCount = 0;
+
+    /**
+     * The underlying gzip output stream to which we should write data.
+     */
+    protected OutputStream gzipstream = null;
+
+    /**
+     * Has this stream been closed?
+     */
+    protected boolean closed = false;
+
+    /**
+     * The response with which this servlet output stream is associated.
+     */
+    protected final CompressionServletResponseWrapper response;
+
+    /**
+     * The underlying servlet output stream to which we should write data.
+     */
+    protected final ServletOutputStream output;
+
+
+    // --------------------------------------------------------- Public Methods
+
+    /**
+     * Set debug level.
+     *
+     * @param debug The higher the number, the more detail shown. Currently the
+     *              range 0 (none) to 3 (everything) is used.
+     */
+    public void setDebugLevel(int debug) {
+        this.debug = debug;
+    }
+
+
+    /**
+     * Set the compressionThreshold number and create buffer for this size
+     */
+    protected void setCompressionThreshold(int compressionThreshold) {
+        this.compressionThreshold = compressionThreshold;
+        buffer = new byte[this.compressionThreshold];
+        if (debug > 1) {
+            System.out.println("compressionThreshold is set to "+ this.compressionThreshold);
+        }
+    }
+
+    /**
+     * The compression buffer size to avoid chunking
+     */
+    protected void setCompressionBuffer(int compressionBuffer) {
+        this.compressionBuffer = compressionBuffer;
+        if (debug > 1) {
+            System.out.println("compressionBuffer is set to "+ this.compressionBuffer);
+        }
+    }
+
+    /**
+     * Set supported mime types.
+     *
+     * @param compressionMimeTypes The mimetypes that will be compressed.
+     */
+    public void setCompressionMimeTypes(String[] compressionMimeTypes) {
+        this.compressionMimeTypes = compressionMimeTypes;
+        if (debug > 1) {
+            System.out.println("compressionMimeTypes is set to " +
+                    Arrays.toString(this.compressionMimeTypes));
+        }
+    }
+
+    /**
+     * Close this output stream, causing any buffered data to be flushed and
+     * any further output data to throw an IOException.
+     */
+    @Override
+    public void close() throws IOException {
+
+        if (debug > 1) {
+            System.out.println("close() @ CompressionResponseStream");
+        }
+        if (closed)
+            throw new IOException("This output stream has already been closed");
+
+        if (gzipstream != null) {
+            flushToGZip();
+            gzipstream.close();
+            gzipstream = null;
+        } else {
+            if (bufferCount > 0) {
+                if (debug > 2) {
+                    System.out.print("output.write(");
+                    System.out.write(buffer, 0, bufferCount);
+                    System.out.println(")");
+                }
+                output.write(buffer, 0, bufferCount);
+                bufferCount = 0;
+            }
+        }
+
+        output.close();
+        closed = true;
+
+    }
+
+
+    /**
+     * Flush any buffered data for this output stream, which also causes the
+     * response to be committed.
+     */
+    @Override
+    public void flush() throws IOException {
+
+        if (debug > 1) {
+            System.out.println("flush() @ CompressionResponseStream");
+        }
+        if (closed) {
+            throw new IOException("Cannot flush a closed output stream");
+        }
+
+        if (gzipstream != null) {
+            gzipstream.flush();
+        }
+
+    }
+
+    public void flushToGZip() throws IOException {
+
+        if (debug > 1) {
+            System.out.println("flushToGZip() @ CompressionResponseStream");
+        }
+        if (bufferCount > 0) {
+            if (debug > 1) {
+                System.out.println("flushing out to GZipStream, bufferCount = " + bufferCount);
+            }
+            writeToGZip(buffer, 0, bufferCount);
+            bufferCount = 0;
+        }
+
+    }
+
+    /**
+     * Write the specified byte to our output stream.
+     *
+     * @param b The byte to be written
+     *
+     * @exception IOException if an input/output error occurs
+     */
+    @Override
+    public void write(int b) throws IOException {
+
+        if (debug > 1) {
+            System.out.println("write "+b+" in CompressionResponseStream ");
+        }
+        if (closed)
+            throw new IOException("Cannot write to a closed output stream");
+
+        if (bufferCount >= buffer.length) {
+            flushToGZip();
+        }
+
+        buffer[bufferCount++] = (byte) b;
+
+    }
+
+
+    /**
+     * Write <code>b.length</code> bytes from the specified byte array
+     * to our output stream.
+     *
+     * @param b The byte array to be written
+     *
+     * @exception IOException if an input/output error occurs
+     */
+    @Override
+    public void write(byte b[]) throws IOException {
+
+        write(b, 0, b.length);
+
+    }
+
+
+
+    /**
+     * TODO SERVLET 3.1
+     */
+    @Override
+    public boolean isReady() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+
+    /**
+     * TODO SERVLET 3.1
+     */
+    @Override
+    public void setWriteListener(WriteListener listener) {
+        // TODO Auto-generated method stub
+
+    }
+
+
+    /**
+     * Write <code>len</code> bytes from the specified byte array, starting
+     * at the specified offset, to our output stream.
+     *
+     * @param b The byte array containing the bytes to be written
+     * @param off Zero-relative starting offset of the bytes to be written
+     * @param len The number of bytes to be written
+     *
+     * @exception IOException if an input/output error occurs
+     */
+    @Override
+    public void write(byte b[], int off, int len) throws IOException {
+
+        if (debug > 1) {
+            System.out.println("write, bufferCount = " + bufferCount + " len = " + len + " off = " + off);
+        }
+        if (debug > 2) {
+            System.out.print("write(");
+            System.out.write(b, off, len);
+            System.out.println(")");
+        }
+
+        if (closed)
+            throw new IOException("Cannot write to a closed output stream");
+
+        if (len == 0)
+            return;
+
+        // Can we write into buffer ?
+        if (len <= (buffer.length - bufferCount)) {
+            System.arraycopy(b, off, buffer, bufferCount, len);
+            bufferCount += len;
+            return;
+        }
+
+        // There is not enough space in buffer. Flush it ...
+        flushToGZip();
+
+        // ... and try again. Note, that bufferCount = 0 here !
+        if (len <= (buffer.length - bufferCount)) {
+            System.arraycopy(b, off, buffer, bufferCount, len);
+            bufferCount += len;
+            return;
+        }
+
+        // write direct to gzip
+        writeToGZip(b, off, len);
+    }
+
+    public void writeToGZip(byte b[], int off, int len) throws IOException {
+
+        if (debug > 1) {
+            System.out.println("writeToGZip, len = " + len);
+        }
+        if (debug > 2) {
+            System.out.print("writeToGZip(");
+            System.out.write(b, off, len);
+            System.out.println(")");
+        }
+        if (gzipstream == null) {
+            if (debug > 1) {
+                System.out.println("new GZIPOutputStream");
+            }
+
+            boolean alreadyCompressed = false;
+            String contentEncoding = response.getHeader("Content-Encoding");
+            if (contentEncoding != null) {
+                if (contentEncoding.contains("gzip")) {
+                    alreadyCompressed = true;
+                    if (debug > 0) {
+                        System.out.println("content is already compressed");
+                    }
+                } else {
+                    if (debug > 0) {
+                        System.out.println("content is not compressed yet");
+                    }
+                }
+            }
+
+            boolean compressibleMimeType = false;
+            // Check for compatible MIME-TYPE
+            if (compressionMimeTypes != null) {
+                if (startsWithStringArray(compressionMimeTypes, response.getContentType())) {
+                    compressibleMimeType = true;
+                    if (debug > 0) {
+                        System.out.println("mime type " + response.getContentType() + " is compressible");
+                    }
+                } else {
+                    if (debug > 0) {
+                        System.out.println("mime type " + response.getContentType() + " is not compressible");
+                    }
+                }
+            }
+
+            if (response.isCommitted()) {
+                if (debug > 1)
+                    System.out.print("Response already committed. Using original output stream");
+                gzipstream = output;
+            } else if (alreadyCompressed) {
+                if (debug > 1)
+                    System.out.print("Response already compressed. Using original output stream");
+                gzipstream = output;
+            } else if (!compressibleMimeType) {
+                if (debug > 1)
+                    System.out.print("Response mime type is not compressible. Using original output stream");
+                gzipstream = output;
+            } else {
+                response.addHeader("Content-Encoding", "gzip");
+                response.setContentLength(-1);  // don't use any preset content-length as it will be wrong after gzipping
+                response.setBufferSize(compressionBuffer);
+                gzipstream = new GZIPOutputStream(output);
+            }
+        }
+        gzipstream.write(b, off, len);
+
+    }
+
+
+    // -------------------------------------------------------- Package Methods
+
+    /**
+     * Has this response stream been closed?
+     *
+     * @return <code>true</code> if the stream has been closed, otherwise false.
+     */
+    public boolean closed() {
+        return closed;
+    }
+
+
+    /**
+     * Checks if any entry in the string array starts with the specified value
+     *
+     * @param sArray the StringArray
+     * @param value string
+     */
+    private boolean startsWithStringArray(String sArray[], String value) {
+        if (value == null)
+           return false;
+        for (int i = 0; i < sArray.length; i++) {
+            if (value.startsWith(sArray[i])) {
+                return true;
+            }
+        }
+        return false;
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/compressionFilters/CompressionServletResponseWrapper.java b/tomcat/webapps/examples/WEB-INF/classes/compressionFilters/CompressionServletResponseWrapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..e12859da7274390b89d95794d7b2825c64649094
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/compressionFilters/CompressionServletResponseWrapper.java
@@ -0,0 +1,285 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package compressionFilters;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+/**
+ * Implementation of <b>HttpServletResponseWrapper</b> that works with
+ * the CompressionServletResponseStream implementation..
+ *
+ * @author Amy Roh
+ * @author Dmitri Valdin
+ */
+public class CompressionServletResponseWrapper
+        extends HttpServletResponseWrapper {
+
+    // ----------------------------------------------------- Constructor
+
+    /**
+     * Calls the parent constructor which creates a ServletResponse adaptor
+     * wrapping the given response object.
+     *
+     * @param response The response object to be wrapped.
+     */
+    public CompressionServletResponseWrapper(HttpServletResponse response) {
+        super(response);
+        origResponse = response;
+        if (debug > 1) {
+            System.out.println("CompressionServletResponseWrapper constructor gets called");
+        }
+    }
+
+
+    // ----------------------------------------------------- Instance Variables
+
+    /**
+     * Original response
+     */
+    protected final HttpServletResponse origResponse;
+
+    /**
+     * The ServletOutputStream that has been returned by
+     * <code>getOutputStream()</code>, if any.
+     */
+    protected ServletOutputStream stream = null;
+
+
+    /**
+     * The PrintWriter that has been returned by
+     * <code>getWriter()</code>, if any.
+     */
+    protected PrintWriter writer = null;
+
+    /**
+     * The threshold number to compress
+     */
+    protected int compressionThreshold = 0;
+
+    /**
+     * The compression buffer size
+     */
+    protected int compressionBuffer = 8192;  // 8KB default
+
+    /**
+     * The mime types to compress
+     */
+    protected String[] compressionMimeTypes = {"text/html", "text/xml", "text/plain"};
+
+    /**
+     * Debug level
+     */
+    protected int debug = 0;
+
+    /**
+     * keeps a copy of all headers set
+     */
+    private final Map<String,String> headerCopies = new HashMap<>();
+
+
+    // --------------------------------------------------------- Public Methods
+
+
+    /**
+     * Set threshold number.
+     *
+     * @param threshold The new compression threshold
+     */
+    public void setCompressionThreshold(int threshold) {
+        if (debug > 1) {
+            System.out.println("setCompressionThreshold to " + threshold);
+        }
+        this.compressionThreshold = threshold;
+    }
+
+    /**
+     * Set compression buffer.
+     *
+     * @param buffer New size of buffer to use for compressed output
+     */
+    public void setCompressionBuffer(int buffer) {
+        if (debug > 1) {
+            System.out.println("setCompressionBuffer to " + buffer);
+        }
+        this.compressionBuffer = buffer;
+    }
+
+    /**
+     * Set compressible mime types.
+     *
+     * @param mimeTypes The new list of mime types that will be considered for
+     *                  compression
+     */
+    public void setCompressionMimeTypes(String[] mimeTypes) {
+        if (debug > 1) {
+            System.out.println("setCompressionMimeTypes to " +
+                    Arrays.toString(mimeTypes));
+        }
+        this.compressionMimeTypes = mimeTypes;
+    }
+
+    /**
+     * Set debug level.
+     *
+     * @param debug The new debug level
+     */
+    public void setDebugLevel(int debug) {
+        this.debug = debug;
+    }
+
+
+    /**
+     * Create and return a ServletOutputStream to write the content
+     * associated with this Response.
+     *
+     * @exception IOException if an input/output error occurs
+     *
+     * @return A new servlet output stream that compressed any data written to
+     *         it
+     */
+    protected ServletOutputStream createOutputStream() throws IOException {
+        if (debug > 1) {
+            System.out.println("createOutputStream gets called");
+        }
+
+        CompressionResponseStream stream = new CompressionResponseStream(
+                this, origResponse.getOutputStream());
+        stream.setDebugLevel(debug);
+        stream.setCompressionThreshold(compressionThreshold);
+        stream.setCompressionBuffer(compressionBuffer);
+        stream.setCompressionMimeTypes(compressionMimeTypes);
+
+        return stream;
+    }
+
+
+    /**
+     * Finish a response.
+     */
+    public void finishResponse() {
+        try {
+            if (writer != null) {
+                writer.close();
+            } else {
+                if (stream != null)
+                    stream.close();
+            }
+        } catch (IOException e) {
+            // Ignore
+        }
+    }
+
+
+    // ------------------------------------------------ ServletResponse Methods
+
+
+    /**
+     * Flush the buffer and commit this response.
+     *
+     * @exception IOException if an input/output error occurs
+     */
+    @Override
+    public void flushBuffer() throws IOException {
+        if (debug > 1) {
+            System.out.println("flush buffer @ GZipServletResponseWrapper");
+        }
+        ((CompressionResponseStream)stream).flush();
+
+    }
+
+    /**
+     * Return the servlet output stream associated with this Response.
+     *
+     * @exception IllegalStateException if <code>getWriter</code> has
+     *  already been called for this response
+     * @exception IOException if an input/output error occurs
+     */
+    @Override
+    public ServletOutputStream getOutputStream() throws IOException {
+
+        if (writer != null)
+            throw new IllegalStateException("getWriter() has already been called for this response");
+
+        if (stream == null)
+            stream = createOutputStream();
+        if (debug > 1) {
+            System.out.println("stream is set to "+stream+" in getOutputStream");
+        }
+
+        return stream;
+    }
+
+    /**
+     * Return the writer associated with this Response.
+     *
+     * @exception IllegalStateException if <code>getOutputStream</code> has
+     *  already been called for this response
+     * @exception IOException if an input/output error occurs
+     */
+    @Override
+    public PrintWriter getWriter() throws IOException {
+
+        if (writer != null)
+            return writer;
+
+        if (stream != null)
+            throw new IllegalStateException("getOutputStream() has already been called for this response");
+
+        stream = createOutputStream();
+        if (debug > 1) {
+            System.out.println("stream is set to "+stream+" in getWriter");
+        }
+        String charEnc = origResponse.getCharacterEncoding();
+        if (debug > 1) {
+            System.out.println("character encoding is " + charEnc);
+        }
+        writer = new PrintWriter(new OutputStreamWriter(stream, charEnc));
+
+        return writer;
+    }
+
+    @Override
+    public String getHeader(String name) {
+        return headerCopies.get(name);
+    }
+
+    @Override
+    public void addHeader(String name, String value) {
+        if (headerCopies.containsKey(name)) {
+            String existingValue = headerCopies.get(name);
+            if ((existingValue != null) && (existingValue.length() > 0)) headerCopies.put(name, existingValue + "," + value);
+            else headerCopies.put(name, value);
+        } else headerCopies.put(name, value);
+        super.addHeader(name, value);
+    }
+
+
+    @Override
+    public void setHeader(String name, String value) {
+        headerCopies.put(name, value);
+        super.setHeader(name, value);
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/dates/JspCalendar.java b/tomcat/webapps/examples/WEB-INF/classes/dates/JspCalendar.java
new file mode 100644
index 0000000000000000000000000000000000000000..759edee10f2c15e77ef6d2b8a18c0f3daf2795d6
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/dates/JspCalendar.java
@@ -0,0 +1,153 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package dates;
+
+import java.util.Calendar;
+import java.util.Date;
+
+public class JspCalendar {
+    final Calendar calendar;
+
+    public JspCalendar() {
+        calendar = Calendar.getInstance();
+        Date trialTime = new Date();
+        calendar.setTime(trialTime);
+    }
+
+    public int getYear() {
+        return calendar.get(Calendar.YEAR);
+    }
+
+    public String getMonth() {
+        int m = getMonthInt();
+        String[] months = new String [] { "January", "February", "March",
+                                        "April", "May", "June",
+                                        "July", "August", "September",
+                                        "October", "November", "December" };
+        if (m > 12)
+            return "Unknown to Man";
+
+        return months[m - 1];
+
+    }
+
+    public String getDay() {
+        int x = getDayOfWeek();
+        String[] days = new String[] {"Sunday", "Monday", "Tuesday", "Wednesday",
+                                      "Thursday", "Friday", "Saturday"};
+
+        if (x > 7)
+            return "Unknown to Man";
+
+        return days[x - 1];
+
+    }
+
+    public int getMonthInt() {
+        return 1 + calendar.get(Calendar.MONTH);
+    }
+
+    public String getDate() {
+        return getMonthInt() + "/" + getDayOfMonth() + "/" +  getYear();
+
+    }
+
+    public String getTime() {
+        return getHour() + ":" + getMinute() + ":" + getSecond();
+    }
+
+    public int getDayOfMonth() {
+        return calendar.get(Calendar.DAY_OF_MONTH);
+    }
+
+    public int getDayOfYear() {
+        return calendar.get(Calendar.DAY_OF_YEAR);
+    }
+
+    public int getWeekOfYear() {
+        return calendar.get(Calendar.WEEK_OF_YEAR);
+    }
+
+    public int getWeekOfMonth() {
+        return calendar.get(Calendar.WEEK_OF_MONTH);
+    }
+
+    public int getDayOfWeek() {
+        return calendar.get(Calendar.DAY_OF_WEEK);
+    }
+
+    public int getHour() {
+        return calendar.get(Calendar.HOUR_OF_DAY);
+    }
+
+    public int getMinute() {
+        return calendar.get(Calendar.MINUTE);
+    }
+
+
+    public int getSecond() {
+        return calendar.get(Calendar.SECOND);
+    }
+
+    public static void main(String args[]) {
+        JspCalendar db = new JspCalendar();
+        p("date: " + db.getDayOfMonth());
+        p("year: " + db.getYear());
+        p("month: " + db.getMonth());
+        p("time: " + db.getTime());
+        p("date: " + db.getDate());
+        p("Day: " + db.getDay());
+        p("DayOfYear: " + db.getDayOfYear());
+        p("WeekOfYear: " + db.getWeekOfYear());
+        p("era: " + db.getEra());
+        p("ampm: " + db.getAMPM());
+        p("DST: " + db.getDSTOffset());
+        p("ZONE Offset: " + db.getZoneOffset());
+        p("TIMEZONE: " + db.getUSTimeZone());
+    }
+
+    private static void p(String x) {
+        System.out.println(x);
+    }
+
+
+    public int getEra() {
+        return calendar.get(Calendar.ERA);
+    }
+
+    public String getUSTimeZone() {
+        String[] zones = new String[] {"Hawaii", "Alaskan", "Pacific",
+                                       "Mountain", "Central", "Eastern"};
+
+        return zones[10 + getZoneOffset()];
+    }
+
+    public int getZoneOffset() {
+        return calendar.get(Calendar.ZONE_OFFSET)/(60*60*1000);
+    }
+
+
+    public int getDSTOffset() {
+        return calendar.get(Calendar.DST_OFFSET)/(60*60*1000);
+    }
+
+
+    public int getAMPM() {
+        return calendar.get(Calendar.AM_PM);
+    }
+}
+
diff --git a/tomcat/webapps/examples/WEB-INF/classes/error/Smart.java b/tomcat/webapps/examples/WEB-INF/classes/error/Smart.java
new file mode 100644
index 0000000000000000000000000000000000000000..82c22f6f5218c26b6933fb038b5dc80dbb9c60be
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/error/Smart.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package error;
+
+public class Smart {
+
+    String name = "JSP";
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/examples/ExampleTagBase.java b/tomcat/webapps/examples/WEB-INF/classes/examples/ExampleTagBase.java
new file mode 100644
index 0000000000000000000000000000000000000000..127eddf655b7eab96c9bdf3a28533192e55bed04
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/examples/ExampleTagBase.java
@@ -0,0 +1,74 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package examples;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.BodyContent;
+import javax.servlet.jsp.tagext.BodyTagSupport;
+import javax.servlet.jsp.tagext.Tag;
+
+public abstract class ExampleTagBase extends BodyTagSupport {
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public void setParent(Tag parent) {
+        this.parent = parent;
+    }
+
+    @Override
+    public void setBodyContent(BodyContent bodyOut) {
+        this.bodyOut = bodyOut;
+    }
+
+    @Override
+    public Tag getParent() {
+        return this.parent;
+    }
+
+    @Override
+    public int doStartTag() throws JspException {
+        return SKIP_BODY;
+    }
+
+    @Override
+    public int doEndTag() throws JspException {
+        return EVAL_PAGE;
+    }
+
+
+    @Override
+    public void doInitBody() throws JspException {
+        // Default implementations for BodyTag methods as well
+        // just in case a tag decides to implement BodyTag.
+    }
+
+    @Override
+    public int doAfterBody() throws JspException {
+        return SKIP_BODY;
+    }
+
+    @Override
+    public void release() {
+        bodyOut = null;
+        pageContext = null;
+        parent = null;
+    }
+
+    protected BodyContent bodyOut;
+    protected Tag parent;
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/examples/FooTag.java b/tomcat/webapps/examples/WEB-INF/classes/examples/FooTag.java
new file mode 100644
index 0000000000000000000000000000000000000000..f4f3050efd85f0bbd1552ab6631181d5b7784339
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/examples/FooTag.java
@@ -0,0 +1,87 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package examples;
+
+import java.io.IOException;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspTagException;
+
+/**
+ * Example1: the simplest tag
+ * Collect attributes and call into some actions
+ *
+ * <foo att1="..." att2="...." att3="...." />
+ */
+
+public class FooTag extends ExampleTagBase {
+
+    private static final long serialVersionUID = 1L;
+
+    private final String atts[] = new String[3];
+    int i = 0;
+
+    private final void setAtt(int index, String value) {
+        atts[index] = value;
+    }
+
+    public void setAtt1(String value) {
+        setAtt(0, value);
+    }
+
+    public void setAtt2(String value) {
+        setAtt(1, value);
+    }
+
+    public void setAtt3(String value) {
+        setAtt(2, value);
+    }
+
+    /**
+     * Process start tag
+     *
+     * @return EVAL_BODY_INCLUDE
+     */
+    @Override
+    public int doStartTag() throws JspException {
+        i = 0;
+        return EVAL_BODY_BUFFERED;
+    }
+
+    @Override
+    public void doInitBody() throws JspException {
+        pageContext.setAttribute("member", atts[i]);
+        i++;
+    }
+
+    @Override
+    public int doAfterBody() throws JspException {
+        try {
+            if (i == 3) {
+                bodyOut.writeOut(bodyOut.getEnclosingWriter());
+                return SKIP_BODY;
+            }
+
+            pageContext.setAttribute("member", atts[i]);
+            i++;
+            return EVAL_BODY_BUFFERED;
+        } catch (IOException ex) {
+            throw new JspTagException(ex.toString());
+        }
+    }
+}
+
diff --git a/tomcat/webapps/examples/WEB-INF/classes/examples/FooTagExtraInfo.java b/tomcat/webapps/examples/WEB-INF/classes/examples/FooTagExtraInfo.java
new file mode 100644
index 0000000000000000000000000000000000000000..e3fe37118b90b88b10e9c4c2a29ad9006969f67b
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/examples/FooTagExtraInfo.java
@@ -0,0 +1,36 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package examples;
+
+import javax.servlet.jsp.tagext.TagData;
+import javax.servlet.jsp.tagext.TagExtraInfo;
+import javax.servlet.jsp.tagext.VariableInfo;
+
+public class FooTagExtraInfo extends TagExtraInfo {
+    @Override
+    public VariableInfo[] getVariableInfo(TagData data) {
+        return new VariableInfo[]
+            {
+                new VariableInfo("member",
+                                 "String",
+                                 true,
+                                 VariableInfo.NESTED)
+            };
+    }
+}
+
+
diff --git a/tomcat/webapps/examples/WEB-INF/classes/examples/LogTag.java b/tomcat/webapps/examples/WEB-INF/classes/examples/LogTag.java
new file mode 100644
index 0000000000000000000000000000000000000000..0f382804f32b52952972feac641ebb570096321c
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/examples/LogTag.java
@@ -0,0 +1,61 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package examples;
+
+import java.io.IOException;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspTagException;
+
+/**
+ * Log the contents of the body. Could be used to handle errors etc.
+ */
+public class LogTag extends ExampleTagBase {
+
+    private static final long serialVersionUID = 1L;
+
+    boolean toBrowser = false;
+
+    public void setToBrowser(String value) {
+        if (value == null)
+            toBrowser = false;
+        else if (value.equalsIgnoreCase("true"))
+            toBrowser = true;
+        else
+            toBrowser = false;
+    }
+
+    @Override
+    public int doStartTag() throws JspException {
+        return EVAL_BODY_BUFFERED;
+    }
+
+    @Override
+    public int doAfterBody() throws JspException {
+        try {
+            String s = bodyOut.getString();
+            System.err.println(s);
+            if (toBrowser)
+                bodyOut.writeOut(bodyOut.getEnclosingWriter());
+            return SKIP_BODY;
+        } catch (IOException ex) {
+            throw new JspTagException(ex.toString());
+        }
+    }
+}
+
+
diff --git a/tomcat/webapps/examples/WEB-INF/classes/examples/ShowSource.java b/tomcat/webapps/examples/WEB-INF/classes/examples/ShowSource.java
new file mode 100644
index 0000000000000000000000000000000000000000..2337d7c2f892ff09b88222cf8cfd5f3a7e655e09
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/examples/ShowSource.java
@@ -0,0 +1,76 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package examples;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Locale;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspTagException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.TagSupport;
+
+/**
+ * Display the sources of the JSP file.
+ */
+public class ShowSource extends TagSupport {
+
+    private static final long serialVersionUID = 1L;
+
+    String jspFile;
+
+    public void setJspFile(String jspFile) {
+        this.jspFile = jspFile;
+    }
+
+    @Override
+    public int doEndTag() throws JspException {
+        if ((jspFile.indexOf( ".." ) >= 0) ||
+            (jspFile.toUpperCase(Locale.ENGLISH).indexOf("/WEB-INF/") != 0) ||
+            (jspFile.toUpperCase(Locale.ENGLISH).indexOf("/META-INF/") != 0))
+            throw new JspTagException("Invalid JSP file " + jspFile);
+
+        try (InputStream in
+            = pageContext.getServletContext().getResourceAsStream(jspFile)) {
+
+            if (in == null)
+                throw new JspTagException("Unable to find JSP file: " + jspFile);
+
+            JspWriter out = pageContext.getOut();
+
+            try {
+                out.println("<body>");
+                out.println("<pre>");
+                for (int ch = in.read(); ch != -1; ch = in.read())
+                    if (ch == '<')
+                        out.print("&lt;");
+                    else
+                        out.print((char) ch);
+                out.println("</pre>");
+                out.println("</body>");
+            } catch (IOException ex) {
+                throw new JspTagException("IOException: " + ex.toString());
+            }
+        } catch (IOException ex2) {
+            throw new JspTagException("IOException: " + ex2.toString());
+        }
+        return super.doEndTag();
+    }
+}
+
+
diff --git a/tomcat/webapps/examples/WEB-INF/classes/examples/ValuesTag.java b/tomcat/webapps/examples/WEB-INF/classes/examples/ValuesTag.java
new file mode 100644
index 0000000000000000000000000000000000000000..b33586059d78d1b0dadeb03560f407b5b63b5435
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/examples/ValuesTag.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package examples;
+
+import java.io.IOException;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspTagException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.TagSupport;
+
+/**
+ * Accept and display a value.
+ */
+public class ValuesTag extends TagSupport {
+
+    private static final long serialVersionUID = 1L;
+
+    // Using "-1" as the default value,
+    // in the assumption that it won't be used as the value.
+    // Cannot use null here, because null is an important case
+    // that should be present in the tests.
+    private Object objectValue = "-1";
+    private String stringValue = "-1";
+    private long longValue = -1;
+    private double doubleValue = -1;
+
+    public void setObject(Object objectValue) {
+        this.objectValue = objectValue;
+    }
+
+    public void setString(String stringValue) {
+        this.stringValue = stringValue;
+    }
+
+    public void setLong(long longValue) {
+        this.longValue = longValue;
+    }
+
+    public void setDouble(double doubleValue) {
+        this.doubleValue = doubleValue;
+    }
+
+    @Override
+    public int doEndTag() throws JspException {
+        JspWriter out = pageContext.getOut();
+
+        try {
+            if (!"-1".equals(objectValue)) {
+                out.print(objectValue);
+            } else if (!"-1".equals(stringValue)) {
+                out.print(stringValue);
+            } else if (longValue != -1) {
+                out.print(longValue);
+            } else if (doubleValue != -1) {
+                out.print(doubleValue);
+            } else {
+                out.print("-1");
+            }
+        } catch (IOException ex) {
+            throw new JspTagException("IOException: " + ex.toString(), ex);
+        }
+        return super.doEndTag();
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/filters/ExampleFilter.java b/tomcat/webapps/examples/WEB-INF/classes/filters/ExampleFilter.java
new file mode 100644
index 0000000000000000000000000000000000000000..3e0123b92099a0db3b795e0f4e4835fa7174c093
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/filters/ExampleFilter.java
@@ -0,0 +1,102 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package filters;
+
+
+import java.io.IOException;
+
+import javax.servlet.FilterChain;
+import javax.servlet.GenericFilter;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+
+/**
+ * Example filter that can be attached to either an individual servlet
+ * or to a URL pattern.  This filter performs the following functions:
+ * <ul>
+ * <li>Attaches itself as a request attribute, under the attribute name
+ *     defined by the value of the <code>attribute</code> initialization
+ *     parameter.</li>
+ * <li>Calculates the number of milliseconds required to perform the
+ *     servlet processing required by this request, including any
+ *     subsequently defined filters, and logs the result to the servlet
+ *     context log for this application.
+ * </ul>
+ *
+ * @author Craig McClanahan
+ */
+public final class ExampleFilter extends GenericFilter {
+
+
+    private static final long serialVersionUID = 1L;
+
+
+    /**
+     * The request attribute name under which we store a reference to ourself.
+     */
+    private String attribute = null;
+
+
+    /**
+     * Time the processing that is performed by all subsequent filters in the
+     * current filter stack, including the ultimately invoked servlet.
+     *
+     * @param request The servlet request we are processing
+     * @param response The servlet response we are creating
+     * @param chain The filter chain we are processing
+     *
+     * @exception IOException if an input/output error occurs
+     * @exception ServletException if a servlet error occurs
+     */
+    @Override
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
+            throws IOException, ServletException {
+
+        // Store ourselves as a request attribute (if requested)
+        if (attribute != null)
+            request.setAttribute(attribute, this);
+
+        // Time and log the subsequent processing
+        long startTime = System.currentTimeMillis();
+        chain.doFilter(request, response);
+        long stopTime = System.currentTimeMillis();
+        getServletContext().log(this.toString() + ": " + (stopTime - startTime) +
+             " milliseconds");
+    }
+
+
+    @Override
+    public void init() throws ServletException {
+        this.attribute = getInitParameter("attribute");
+    }
+
+
+    /**
+     * Return a String representation of this object.
+     */
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("TimingFilter(");
+        sb.append(getFilterConfig());
+        sb.append(")");
+        return sb.toString();
+    }
+}
+
diff --git a/tomcat/webapps/examples/WEB-INF/classes/http2/SimpleImagePush.java b/tomcat/webapps/examples/WEB-INF/classes/http2/SimpleImagePush.java
new file mode 100644
index 0000000000000000000000000000000000000000..edfee522bda64b2bab3c842ac0c49bff948c1a1f
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/http2/SimpleImagePush.java
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package http2;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.PushBuilder;
+
+public class SimpleImagePush extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+            throws ServletException, IOException {
+
+        resp.setCharacterEncoding("UTF-8");
+        resp.setContentType("text/html");
+        PrintWriter pw = resp.getWriter();
+
+        PushBuilder pb = req.newPushBuilder();
+        if (pb != null) {
+            pb.path("servlets/images/code.gif");
+            pb.push();
+            pw.println("<html>");
+            pw.println("<body>");
+            pw.println("<p>The following image was provided via a push request.</p>");
+            pw.println("<img src=\"" + req.getContextPath() + "/servlets/images/code.gif\"/>");
+            pw.println("</body>");
+            pw.println("</html>");
+            pw.flush();
+        } else {
+            pw.println("<html>");
+            pw.println("<body>");
+            pw.println("<p>Server push requests are not supported by this protocol.</p>");
+            pw.println("</body>");
+            pw.println("</html>");
+        }
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/BookBean.java b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/BookBean.java
new file mode 100644
index 0000000000000000000000000000000000000000..ff6a55de1a8fe038a63d16a12b53b45fb2afc09c
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/BookBean.java
@@ -0,0 +1,44 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples;
+
+public class BookBean {
+    private final String title;
+    private final String author;
+    private final String isbn;
+
+    public BookBean( String title, String author, String isbn ) {
+        this.title = title;
+        this.author = author;
+        this.isbn = isbn;
+    }
+
+    public String getTitle() {
+        return this.title;
+    }
+
+    public String getAuthor() {
+        return this.author;
+    }
+
+    public String getIsbn() {
+        return this.isbn;
+    }
+
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/FooBean.java b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/FooBean.java
new file mode 100644
index 0000000000000000000000000000000000000000..4dc0a780306b286af6f4929f19d31eef93cc6034
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/FooBean.java
@@ -0,0 +1,36 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples;
+
+public class FooBean {
+    private String bar;
+
+    public FooBean() {
+        bar = "Initial value";
+    }
+
+    public String getBar() {
+        return this.bar;
+    }
+
+    public void setBar(String bar) {
+        this.bar = bar;
+    }
+
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/ValuesBean.java b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/ValuesBean.java
new file mode 100644
index 0000000000000000000000000000000000000000..686039c7d7fd7c1d3f220f3eb57dd4970d958baf
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/ValuesBean.java
@@ -0,0 +1,52 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples;
+
+/**
+ * Accept and display a value.
+ */
+public class ValuesBean {
+    private String string;
+    private double doubleValue;
+    private long longValue;
+
+    public String getStringValue() {
+        return this.string;
+    }
+
+    public void setStringValue(String string) {
+        this.string = string;
+    }
+
+    public double getDoubleValue() {
+        return doubleValue;
+    }
+
+    public void setDoubleValue(double doubleValue) {
+        this.doubleValue = doubleValue;
+    }
+
+    public long getLongValue() {
+        return longValue;
+    }
+
+    public void setLongValue(long longValue) {
+        this.longValue = longValue;
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/el/Functions.java b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/el/Functions.java
new file mode 100644
index 0000000000000000000000000000000000000000..77fdb9cff71a84542e1bdcc62bd87497bf006118
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/el/Functions.java
@@ -0,0 +1,45 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package jsp2.examples.el;
+
+import java.util.Locale;
+
+/**
+ * Defines the functions for the jsp2 example tag library.
+ *
+ * <p>Each function is defined as a static method.</p>
+ */
+public class Functions {
+    public static String reverse( String text ) {
+        return new StringBuilder( text ).reverse().toString();
+    }
+
+    public static int numVowels( String text ) {
+        String vowels = "aeiouAEIOU";
+        int result = 0;
+        for( int i = 0; i < text.length(); i++ ) {
+            if( vowels.indexOf( text.charAt( i ) ) != -1 ) {
+                result++;
+            }
+        }
+        return result;
+    }
+
+    public static String caps( String text ) {
+        return text.toUpperCase(Locale.ENGLISH);
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/EchoAttributesTag.java b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/EchoAttributesTag.java
new file mode 100644
index 0000000000000000000000000000000000000000..c34237d6706fd02bbde0aef35f9ebb4beb650050
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/EchoAttributesTag.java
@@ -0,0 +1,58 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples.simpletag;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.DynamicAttributes;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+
+/**
+ * SimpleTag handler that echoes all its attributes
+ */
+public class EchoAttributesTag
+    extends SimpleTagSupport
+    implements DynamicAttributes
+{
+    private final List<String> keys = new ArrayList<>();
+    private final List<Object> values = new ArrayList<>();
+
+    @Override
+    public void doTag() throws JspException, IOException {
+        JspWriter out = getJspContext().getOut();
+        for( int i = 0; i < keys.size(); i++ ) {
+            String key = keys.get( i );
+            Object value = values.get( i );
+            out.println( "<li>" + key + " = " + value + "</li>" );
+        }
+    }
+
+    @Override
+    public void setDynamicAttribute( String uri, String localName,
+        Object value )
+        throws JspException
+    {
+        keys.add( localName );
+        values.add( value );
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/FindBookSimpleTag.java b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/FindBookSimpleTag.java
new file mode 100644
index 0000000000000000000000000000000000000000..e44d4e2fd8dee1552d5849c3f97fd80b64b8e6ea
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/FindBookSimpleTag.java
@@ -0,0 +1,46 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples.simpletag;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+
+import jsp2.examples.BookBean;
+
+/**
+ * SimpleTag handler that pretends to search for a book, and stores
+ * the result in a scoped variable.
+ */
+public class FindBookSimpleTag extends SimpleTagSupport {
+    private String var;
+
+    private static final String BOOK_TITLE = "The Lord of the Rings";
+    private static final String BOOK_AUTHOR = "J. R. R. Tolkein";
+    private static final String BOOK_ISBN = "0618002251";
+
+    @Override
+    public void doTag() throws JspException {
+        BookBean book = new BookBean( BOOK_TITLE, BOOK_AUTHOR, BOOK_ISBN );
+        getJspContext().setAttribute( this.var, book );
+    }
+
+    public void setVar( String var ) {
+        this.var = var;
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/HelloWorldSimpleTag.java b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/HelloWorldSimpleTag.java
new file mode 100644
index 0000000000000000000000000000000000000000..f87736f9b7690620c39ecaf443a9d5b16d247f57
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/HelloWorldSimpleTag.java
@@ -0,0 +1,34 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples.simpletag;
+
+import java.io.IOException;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+
+/**
+ * SimpleTag handler that prints "Hello, world!"
+ */
+public class HelloWorldSimpleTag extends SimpleTagSupport {
+    @Override
+    public void doTag() throws JspException, IOException {
+        getJspContext().getOut().write( "Hello, world!" );
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/RepeatSimpleTag.java b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/RepeatSimpleTag.java
new file mode 100644
index 0000000000000000000000000000000000000000..41a9f3c72a6a5fb8b31dea8e63d4fe90cf8b279b
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/RepeatSimpleTag.java
@@ -0,0 +1,44 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples.simpletag;
+
+import java.io.IOException;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+
+/**
+ * SimpleTag handler that accepts a num attribute and
+ * invokes its body 'num' times.
+ */
+public class RepeatSimpleTag extends SimpleTagSupport {
+    private int num;
+
+    @Override
+    public void doTag() throws JspException, IOException {
+        for (int i=0; i<num; i++) {
+            getJspContext().setAttribute("count", String.valueOf( i + 1 ) );
+            getJspBody().invoke(null);
+        }
+    }
+
+    public void setNum(int num) {
+        this.num = num;
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/ShuffleSimpleTag.java b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/ShuffleSimpleTag.java
new file mode 100644
index 0000000000000000000000000000000000000000..a39e5081683582a7aeea6dc7248f92d1bd075e14
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/ShuffleSimpleTag.java
@@ -0,0 +1,87 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples.simpletag;
+
+import java.io.IOException;
+import java.util.Random;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.JspFragment;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+
+/**
+ * SimpleTag handler that accepts takes three attributes of type
+ * JspFragment and invokes then in a random order.
+ */
+public class ShuffleSimpleTag extends SimpleTagSupport {
+    // No need for this to use SecureRandom
+    private static final Random random = new Random();
+
+    private JspFragment fragment1;
+    private JspFragment fragment2;
+    private JspFragment fragment3;
+
+    @Override
+    public void doTag() throws JspException, IOException {
+        switch(random.nextInt(6)) {
+            case 0:
+                fragment1.invoke( null );
+                fragment2.invoke( null );
+                fragment3.invoke( null );
+                break;
+            case 1:
+                fragment1.invoke( null );
+                fragment3.invoke( null );
+                fragment2.invoke( null );
+                break;
+            case 2:
+                fragment2.invoke( null );
+                fragment1.invoke( null );
+                fragment3.invoke( null );
+                break;
+            case 3:
+                fragment2.invoke( null );
+                fragment3.invoke( null );
+                fragment1.invoke( null );
+                break;
+            case 4:
+                fragment3.invoke( null );
+                fragment1.invoke( null );
+                fragment2.invoke( null );
+                break;
+            case 5:
+                fragment3.invoke( null );
+                fragment2.invoke( null );
+                fragment1.invoke( null );
+                break;
+        }
+    }
+
+    public void setFragment1( JspFragment fragment1 ) {
+        this.fragment1 = fragment1;
+    }
+
+    public void setFragment2( JspFragment fragment2 ) {
+        this.fragment2 = fragment2;
+    }
+
+    public void setFragment3( JspFragment fragment3 ) {
+        this.fragment3 = fragment3;
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/TileSimpleTag.java b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/TileSimpleTag.java
new file mode 100644
index 0000000000000000000000000000000000000000..2d5db92bac348b8ff7857dcc5e5acd5127989ba0
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/TileSimpleTag.java
@@ -0,0 +1,48 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples.simpletag;
+
+import java.io.IOException;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+
+/**
+ * Displays a tile as a single cell in a table.
+ */
+public class TileSimpleTag extends SimpleTagSupport {
+    private String color;
+    private String label;
+
+    @Override
+    public void doTag() throws JspException, IOException {
+        getJspContext().getOut().write(
+                "<td width=\"32\" height=\"32\" bgcolor=\"" + this.color +
+                "\"><font color=\"#ffffff\"><center>" + this.label +
+                "</center></font></td>" );
+    }
+
+    public void setColor( String color ) {
+        this.color = color;
+    }
+
+    public void setLabel( String label ) {
+        this.label = label;
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/listeners/ContextListener.java b/tomcat/webapps/examples/WEB-INF/classes/listeners/ContextListener.java
new file mode 100644
index 0000000000000000000000000000000000000000..31f55452f96a830fcae154f69a19ed2f2416bafb
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/listeners/ContextListener.java
@@ -0,0 +1,138 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package listeners;
+
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextAttributeEvent;
+import javax.servlet.ServletContextAttributeListener;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+
+/**
+ * Example listener for context-related application events, which were
+ * introduced in the 2.3 version of the Servlet API.  This listener
+ * merely documents the occurrence of such events in the application log
+ * associated with our servlet context.
+ *
+ * @author Craig R. McClanahan
+ */
+public final class ContextListener
+    implements ServletContextAttributeListener, ServletContextListener {
+
+
+    // ----------------------------------------------------- Instance Variables
+
+
+    /**
+     * The servlet context with which we are associated.
+     */
+    private ServletContext context = null;
+
+
+    // --------------------------------------------------------- Public Methods
+
+
+    /**
+     * Record the fact that a servlet context attribute was added.
+     *
+     * @param event The servlet context attribute event
+     */
+    @Override
+    public void attributeAdded(ServletContextAttributeEvent event) {
+
+        log("attributeAdded('" + event.getName() + "', '" +
+                event.getValue() + "')");
+
+    }
+
+
+    /**
+     * Record the fact that a servlet context attribute was removed.
+     *
+     * @param event The servlet context attribute event
+     */
+    @Override
+    public void attributeRemoved(ServletContextAttributeEvent event) {
+
+        log("attributeRemoved('" + event.getName() + "', '" +
+                event.getValue() + "')");
+
+    }
+
+
+    /**
+     * Record the fact that a servlet context attribute was replaced.
+     *
+     * @param event The servlet context attribute event
+     */
+    @Override
+    public void attributeReplaced(ServletContextAttributeEvent event) {
+
+        log("attributeReplaced('" + event.getName() + "', '" +
+                event.getValue() + "')");
+
+    }
+
+
+    /**
+     * Record the fact that this web application has been destroyed.
+     *
+     * @param event The servlet context event
+     */
+    @Override
+    public void contextDestroyed(ServletContextEvent event) {
+
+        log("contextDestroyed()");
+        this.context = null;
+
+    }
+
+
+    /**
+     * Record the fact that this web application has been initialized.
+     *
+     * @param event The servlet context event
+     */
+    @Override
+    public void contextInitialized(ServletContextEvent event) {
+
+        this.context = event.getServletContext();
+        log("contextInitialized()");
+
+    }
+
+
+    // -------------------------------------------------------- Private Methods
+
+
+    /**
+     * Log a message to the servlet context application log.
+     *
+     * @param message Message to be logged
+     */
+    private void log(String message) {
+
+        if (context != null)
+            context.log("ContextListener: " + message);
+        else
+            System.out.println("ContextListener: " + message);
+
+    }
+
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/listeners/SessionListener.java b/tomcat/webapps/examples/WEB-INF/classes/listeners/SessionListener.java
new file mode 100644
index 0000000000000000000000000000000000000000..f03e48fcb2cdcc7b830624a7deb964fbba37e95b
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/listeners/SessionListener.java
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package listeners;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.http.HttpSessionAttributeListener;
+import javax.servlet.http.HttpSessionBindingEvent;
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
+
+/**
+ * Example listener for context-related application events, which were
+ * introduced in the 2.3 version of the Servlet API. This listener merely
+ * documents the occurrence of such events in the application log associated
+ * with our servlet context.
+ *
+ * @author Craig R. McClanahan
+ */
+public final class SessionListener implements ServletContextListener,
+        HttpSessionAttributeListener, HttpSessionListener {
+
+    // ----------------------------------------------------- Instance Variables
+
+    /**
+     * The servlet context with which we are associated.
+     */
+    private ServletContext context = null;
+
+    // --------------------------------------------------------- Public Methods
+
+    /**
+     * Record the fact that a servlet context attribute was added.
+     *
+     * @param event
+     *            The session attribute event
+     */
+    @Override
+    public void attributeAdded(HttpSessionBindingEvent event) {
+
+        log("attributeAdded('" + event.getSession().getId() + "', '"
+                + event.getName() + "', '" + event.getValue() + "')");
+
+    }
+
+    /**
+     * Record the fact that a servlet context attribute was removed.
+     *
+     * @param event
+     *            The session attribute event
+     */
+    @Override
+    public void attributeRemoved(HttpSessionBindingEvent event) {
+
+        log("attributeRemoved('" + event.getSession().getId() + "', '"
+                + event.getName() + "', '" + event.getValue() + "')");
+
+    }
+
+    /**
+     * Record the fact that a servlet context attribute was replaced.
+     *
+     * @param event
+     *            The session attribute event
+     */
+    @Override
+    public void attributeReplaced(HttpSessionBindingEvent event) {
+
+        log("attributeReplaced('" + event.getSession().getId() + "', '"
+                + event.getName() + "', '" + event.getValue() + "')");
+
+    }
+
+    /**
+     * Record the fact that this web application has been destroyed.
+     *
+     * @param event
+     *            The servlet context event
+     */
+    @Override
+    public void contextDestroyed(ServletContextEvent event) {
+
+        log("contextDestroyed()");
+        this.context = null;
+
+    }
+
+    /**
+     * Record the fact that this web application has been initialized.
+     *
+     * @param event
+     *            The servlet context event
+     */
+    @Override
+    public void contextInitialized(ServletContextEvent event) {
+
+        this.context = event.getServletContext();
+        log("contextInitialized()");
+
+    }
+
+    /**
+     * Record the fact that a session has been created.
+     *
+     * @param event
+     *            The session event
+     */
+    @Override
+    public void sessionCreated(HttpSessionEvent event) {
+
+        log("sessionCreated('" + event.getSession().getId() + "')");
+
+    }
+
+    /**
+     * Record the fact that a session has been destroyed.
+     *
+     * @param event
+     *            The session event
+     */
+    @Override
+    public void sessionDestroyed(HttpSessionEvent event) {
+
+        log("sessionDestroyed('" + event.getSession().getId() + "')");
+
+    }
+
+    // -------------------------------------------------------- Private Methods
+
+    /**
+     * Log a message to the servlet context application log.
+     *
+     * @param message
+     *            Message to be logged
+     */
+    private void log(String message) {
+
+        if (context != null)
+            context.log("SessionListener: " + message);
+        else
+            System.out.println("SessionListener: " + message);
+
+    }
+
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/nonblocking/ByteCounter.java b/tomcat/webapps/examples/WEB-INF/classes/nonblocking/ByteCounter.java
new file mode 100644
index 0000000000000000000000000000000000000000..3923780216ef0a5a8b644320798ad29296c5313f
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/nonblocking/ByteCounter.java
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package nonblocking;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+import javax.servlet.AsyncContext;
+import javax.servlet.ReadListener;
+import javax.servlet.ServletException;
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * This doesn't do anything particularly useful - it just counts the total
+ * number of bytes in a request body while demonstrating how to perform
+ * non-blocking reads.
+ */
+public class ByteCounter extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+            throws ServletException, IOException {
+
+        resp.setContentType("text/plain");
+        resp.setCharacterEncoding("UTF-8");
+
+        resp.getWriter().println("Try again using a POST request.");
+    }
+
+    @Override
+    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
+            throws ServletException, IOException {
+
+        resp.setContentType("text/plain");
+        resp.setCharacterEncoding("UTF-8");
+
+        // Non-blocking IO requires async
+        AsyncContext ac = req.startAsync();
+
+        // Use a single listener for read and write. Listeners often need to
+        // share state to coordinate reads and writes and this is much easier as
+        // a single object.
+        @SuppressWarnings("unused")
+        CounterListener listener = new CounterListener(
+                ac, req.getInputStream(), resp.getOutputStream());
+    }
+
+
+    /**
+     * Keep in mind that each call may well be on a different thread to the
+     * previous call. Ensure that changes in values will be visible across
+     * threads. There should only ever be one container thread at a time calling
+     * the listener.
+     */
+    private static class CounterListener implements ReadListener, WriteListener {
+
+        private final AsyncContext ac;
+        private final ServletInputStream sis;
+        private final ServletOutputStream sos;
+
+        private volatile boolean readFinished = false;
+        private volatile long totalBytesRead = 0;
+        private byte[] buffer = new byte[8192];
+
+        private CounterListener(AsyncContext ac, ServletInputStream sis,
+                ServletOutputStream sos) {
+            this.ac = ac;
+            this.sis = sis;
+            this.sos = sos;
+
+            // In Tomcat, the order the listeners are set controls the order
+            // that the first calls are made. In this case, the read listener
+            // will be called before the write listener.
+            sis.setReadListener(this);
+            sos.setWriteListener(this);
+        }
+
+        @Override
+        public void onDataAvailable() throws IOException {
+            int read = 0;
+            // Loop as long as there is data to read. If isReady() returns false
+            // the socket will be added to the poller and onDataAvailable() will
+            // be called again as soon as there is more data to read.
+            while (sis.isReady() && read > -1) {
+                read = sis.read(buffer);
+                if (read > 0) {
+                    totalBytesRead += read;
+                }
+            }
+        }
+
+        @Override
+        public void onAllDataRead() throws IOException {
+            readFinished = true;
+
+            // If sos is not ready to write data, the call to isReady() will
+            // register the socket with the poller which will trigger a call to
+            // onWritePossible() when the socket is ready to have data written
+            // to it.
+            if (sos.isReady()) {
+                onWritePossible();
+            }
+        }
+
+        @Override
+        public void onWritePossible() throws IOException {
+            if (readFinished) {
+                // Must be ready to write data if onWritePossible was called
+                String msg = "Total bytes written = [" + totalBytesRead + "]";
+                sos.write(msg.getBytes(StandardCharsets.UTF_8));
+                ac.complete();
+            }
+        }
+
+        @Override
+        public void onError(Throwable throwable) {
+            // Should probably log the throwable
+            ac.complete();
+        }
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/nonblocking/NumberWriter.java b/tomcat/webapps/examples/WEB-INF/classes/nonblocking/NumberWriter.java
new file mode 100644
index 0000000000000000000000000000000000000000..d7a6680a58441bc8c13e55b5c0262a9df2db3c76
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/nonblocking/NumberWriter.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package nonblocking;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.servlet.AsyncContext;
+import javax.servlet.ReadListener;
+import javax.servlet.ServletException;
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * This doesn't do anything particularly useful - it just writes a series of
+ * numbers to the response body while demonstrating how to perform non-blocking
+ * writes.
+ */
+public class NumberWriter extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+            throws ServletException, IOException {
+
+        resp.setContentType("text/plain");
+        resp.setCharacterEncoding("UTF-8");
+
+        // Non-blocking IO requires async
+        AsyncContext ac = req.startAsync();
+
+        // Use a single listener for read and write. Listeners often need to
+        // share state to coordinate reads and writes and this is much easier as
+        // a single object.
+        @SuppressWarnings("unused")
+        NumberWriterListener listener = new NumberWriterListener(
+                ac, req.getInputStream(), resp.getOutputStream());
+
+    }
+
+
+    /**
+     * Keep in mind that each call may well be on a different thread to the
+     * previous call. Ensure that changes in values will be visible across
+     * threads. There should only ever be one container thread at a time calling
+     * the listener.
+     */
+    private static class NumberWriterListener implements ReadListener,
+            WriteListener {
+
+        private static final int LIMIT =  10000;
+
+        private final AsyncContext ac;
+        private final ServletInputStream sis;
+        private final ServletOutputStream sos;
+        private final AtomicInteger counter = new AtomicInteger(0);
+
+        private volatile boolean readFinished = false;
+        private byte[] buffer = new byte[8192];
+
+        private NumberWriterListener(AsyncContext ac, ServletInputStream sis,
+                ServletOutputStream sos) {
+            this.ac = ac;
+            this.sis = sis;
+            this.sos = sos;
+
+            // In Tomcat, the order the listeners are set controls the order
+            // that the first calls are made. In this case, the read listener
+            // will be called before the write listener.
+            sis.setReadListener(this);
+            sos.setWriteListener(this);
+        }
+
+        @Override
+        public void onDataAvailable() throws IOException {
+
+            // There should be no data to read
+
+            int read = 0;
+            // Loop as long as there is data to read. If isReady() returns false
+            // the socket will be added to the poller and onDataAvailable() will
+            // be called again as soon as there is more data to read.
+            while (sis.isReady() && read > -1) {
+                read = sis.read(buffer);
+                if (read > 0) {
+                    throw new IOException("Data was present in input stream");
+                }
+            }
+        }
+
+        @Override
+        public void onAllDataRead() throws IOException {
+            readFinished = true;
+
+            // If sos is not ready to write data, the call to isReady() will
+            // register the socket with the poller which will trigger a call to
+            // onWritePossible() when the socket is ready to have data written
+            // to it.
+            if (sos.isReady()) {
+                onWritePossible();
+            }
+        }
+
+        @Override
+        public void onWritePossible() throws IOException {
+            if (readFinished) {
+                int i = counter.get();
+                boolean ready = true;
+                while (i < LIMIT && ready) {
+                    i = counter.incrementAndGet();
+                    String msg = String.format("%1$020d\n", Integer.valueOf(i));
+                    sos.write(msg.getBytes(StandardCharsets.UTF_8));
+                    ready = sos.isReady();
+                }
+
+                if (i == LIMIT) {
+                    ac.complete();
+                }
+            }
+        }
+
+        @Override
+        public void onError(Throwable throwable) {
+            // Should probably log the throwable
+            ac.complete();
+        }
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/num/NumberGuessBean.java b/tomcat/webapps/examples/WEB-INF/classes/num/NumberGuessBean.java
new file mode 100644
index 0000000000000000000000000000000000000000..b78bd0535827f93df8beb6ba0a381222466e9efb
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/num/NumberGuessBean.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Originally written by Jason Hunter, http://www.servlets.com.
+ */
+
+package num;
+
+import java.io.Serializable;
+import java.util.Random;
+
+public class NumberGuessBean implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private int answer;
+    private String hint;
+    private int numGuesses;
+    private boolean success;
+    private final Random random = new Random();
+
+    public NumberGuessBean() {
+        reset();
+    }
+
+    public int getAnswer() {
+        return answer;
+    }
+
+    public void setAnswer(int answer) {
+        this.answer = answer;
+    }
+
+    public String getHint() {
+        return "" + hint;
+    }
+
+    public void setHint(String hint) {
+        this.hint = hint;
+    }
+
+    public void setNumGuesses(int numGuesses) {
+        this.numGuesses = numGuesses;
+    }
+
+    public int getNumGuesses() {
+        return numGuesses;
+    }
+
+    public boolean getSuccess() {
+        return success;
+    }
+
+    public void setSuccess(boolean success) {
+        this.success = success;
+    }
+
+    public void setGuess(String guess) {
+        numGuesses++;
+
+        int g;
+        try {
+            g = Integer.parseInt(guess);
+        } catch (NumberFormatException e) {
+            g = -1;
+        }
+
+        if (g == answer) {
+            success = true;
+        } else if (g == -1) {
+            hint = "a number next time";
+        } else if (g < answer) {
+            hint = "higher";
+        } else if (g > answer) {
+            hint = "lower";
+        }
+    }
+
+    public void reset() {
+        answer = Math.abs(random.nextInt() % 100) + 1;
+        success = false;
+        numGuesses = 0;
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/sessions/DummyCart.java b/tomcat/webapps/examples/WEB-INF/classes/sessions/DummyCart.java
new file mode 100644
index 0000000000000000000000000000000000000000..bad0cb9c2bb744000b0e9186b899c564b18b00ea
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/sessions/DummyCart.java
@@ -0,0 +1,65 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package sessions;
+
+import java.util.Vector;
+
+public class DummyCart {
+    final Vector<String> v = new Vector<>();
+    String submit = null;
+    String item = null;
+
+    private void addItem(String name) {
+        v.addElement(name);
+    }
+
+    private void removeItem(String name) {
+        v.removeElement(name);
+    }
+
+    public void setItem(String name) {
+        item = name;
+    }
+
+    public void setSubmit(String s) {
+        submit = s;
+    }
+
+    public String[] getItems() {
+        String[] s = new String[v.size()];
+        v.copyInto(s);
+        return s;
+    }
+
+    public void processRequest() {
+        // null value for submit - user hit enter instead of clicking on
+        // "add" or "remove"
+        if (submit == null || submit.equals("add"))
+            addItem(item);
+        else if (submit.equals("remove"))
+            removeItem(item);
+
+        // reset at the end of the request
+        reset();
+    }
+
+    // reset
+    private void reset() {
+        submit = null;
+        item = null;
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/trailers/ResponseTrailers.java b/tomcat/webapps/examples/WEB-INF/classes/trailers/ResponseTrailers.java
new file mode 100644
index 0000000000000000000000000000000000000000..437fb7c8d495f830aad035a96d466646c2dc9835
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/trailers/ResponseTrailers.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package trailers;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Supplier;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * This example writes some trailer fields to the HTTP response.
+ */
+public class ResponseTrailers extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+    private static final Supplier<Map<String,String>> TRAILER_FIELD_SUPPLIER =
+            new TrailerFieldSupplier();
+
+
+    @Override
+    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+            throws ServletException, IOException {
+
+        resp.setTrailerFields(TRAILER_FIELD_SUPPLIER);
+        resp.setContentType("text/plain");
+        resp.setCharacterEncoding("UTF-8");
+
+        PrintWriter pw  = resp.getWriter();
+
+        pw.print("This response should include trailer fields.");
+    }
+
+
+    private static class TrailerFieldSupplier implements Supplier<Map<String,String>> {
+
+        private static final Map<String,String> trailerFields = new HashMap<>();
+
+        static {
+            trailerFields.put("x-trailer-1", "Trailer value one");
+            trailerFields.put("x-trailer-2", "Trailer value two");
+        }
+
+        @Override
+        public Map<String, String> get() {
+            return trailerFields;
+        }
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/util/CookieFilter.java b/tomcat/webapps/examples/WEB-INF/classes/util/CookieFilter.java
new file mode 100644
index 0000000000000000000000000000000000000000..19243eeb636ecad55830de54484b02dc7a39834c
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/util/CookieFilter.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package util;
+
+import java.util.Locale;
+import java.util.StringTokenizer;
+
+/**
+ * Processes a cookie header and attempts to obfuscate any cookie values that
+ * represent session IDs from other web applications. Since session cookie names
+ * are configurable, as are session ID lengths, this filter is not expected to
+ * be 100% effective.
+ *
+ * It is required that the examples web application is removed in security
+ * conscious environments as documented in the Security How-To. This filter is
+ * intended to reduce the impact of failing to follow that advice. A failure by
+ * this filter to obfuscate a session ID or similar value is not a security
+ * vulnerability. In such instances the vulnerability is the failure to remove
+ * the examples web application.
+ */
+public class CookieFilter {
+
+    private static final String OBFUSCATED = "[obfuscated]";
+
+    private CookieFilter() {
+        // Hide default constructor
+    }
+
+    public static String filter(String cookieHeader, String sessionId) {
+
+        StringBuilder sb = new StringBuilder(cookieHeader.length());
+
+        // Cookie name value pairs are ';' separated.
+        // Session IDs don't use ; in the value so don't worry about quoted
+        // values that contain ;
+        StringTokenizer st = new StringTokenizer(cookieHeader, ";");
+
+        boolean first = true;
+        while (st.hasMoreTokens()) {
+            if (first) {
+                first = false;
+            } else {
+                sb.append(';');
+            }
+            sb.append(filterNameValuePair(st.nextToken(), sessionId));
+        }
+
+
+        return sb.toString();
+    }
+
+    private static String filterNameValuePair(String input, String sessionId) {
+        int i = input.indexOf('=');
+        if (i == -1) {
+            return input;
+        }
+        String name = input.substring(0, i);
+        String value = input.substring(i + 1, input.length());
+
+        return name + "=" + filter(name, value, sessionId);
+    }
+
+    public static String filter(String cookieName, String cookieValue, String sessionId) {
+        if (cookieName.toLowerCase(Locale.ENGLISH).contains("jsessionid") &&
+                (sessionId == null || !cookieValue.contains(sessionId))) {
+            cookieValue = OBFUSCATED;
+        }
+
+        return cookieValue;
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/util/HTMLFilter.java b/tomcat/webapps/examples/WEB-INF/classes/util/HTMLFilter.java
new file mode 100644
index 0000000000000000000000000000000000000000..29463fb56ea0f06d088726d966e201a0e80c3bcd
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/util/HTMLFilter.java
@@ -0,0 +1,68 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package util;
+
+/**
+ * HTML filter utility.
+ *
+ * @author Craig R. McClanahan
+ * @author Tim Tye
+ */
+public final class HTMLFilter {
+
+
+    /**
+     * Filter the specified message string for characters that are sensitive
+     * in HTML.  This avoids potential attacks caused by including JavaScript
+     * codes in the request URL that is often reported in error messages.
+     *
+     * @param message The message string to be filtered
+     *
+     * @return the filtered version of the message
+     */
+    public static String filter(String message) {
+
+        if (message == null)
+            return null;
+
+        char content[] = new char[message.length()];
+        message.getChars(0, message.length(), content, 0);
+        StringBuilder result = new StringBuilder(content.length + 50);
+        for (int i = 0; i < content.length; i++) {
+            switch (content[i]) {
+            case '<':
+                result.append("&lt;");
+                break;
+            case '>':
+                result.append("&gt;");
+                break;
+            case '&':
+                result.append("&amp;");
+                break;
+            case '"':
+                result.append("&quot;");
+                break;
+            default:
+                result.append(content[i]);
+            }
+        }
+        return result.toString();
+    }
+
+
+}
+
diff --git a/tomcat/webapps/examples/WEB-INF/classes/validators/DebugValidator.java b/tomcat/webapps/examples/WEB-INF/classes/validators/DebugValidator.java
new file mode 100644
index 0000000000000000000000000000000000000000..596065b55300d640f94f99b5712b7debad7b7b07
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/validators/DebugValidator.java
@@ -0,0 +1,84 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package validators;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.servlet.jsp.tagext.PageData;
+import javax.servlet.jsp.tagext.TagLibraryValidator;
+import javax.servlet.jsp.tagext.ValidationMessage;
+
+
+/**
+ * Example tag library validator that simply dumps the XML version of each
+ * page to standard output (which will typically be sent to the file
+ * <code>$CATALINA_HOME/logs/catalina.out</code>).  To utilize it, simply
+ * include a <code>taglib</code> directive for this tag library at the top
+ * of your JSP page.
+ *
+ * @author Craig McClanahan
+ */
+public class DebugValidator extends TagLibraryValidator {
+
+
+    // ----------------------------------------------------- Instance Variables
+
+
+    // --------------------------------------------------------- Public Methods
+
+
+    /**
+     * Validate a JSP page.  This will get invoked once per directive in the
+     * JSP page.  This method will return <code>null</code> if the page is
+     * valid; otherwise the method should return an array of
+     * <code>ValidationMessage</code> objects.  An array of length zero is
+     * also interpreted as no errors.
+     *
+     * @param prefix The value of the prefix argument in this directive
+     * @param uri The value of the URI argument in this directive
+     * @param page The page data for this page
+     */
+    @Override
+    public ValidationMessage[] validate(String prefix, String uri,
+                                        PageData page) {
+
+        System.out.println("---------- Prefix=" + prefix + " URI=" + uri +
+                           "----------");
+
+        InputStream is = page.getInputStream();
+        while (true) {
+            try {
+                int ch = is.read();
+                if (ch < 0)
+                    break;
+                System.out.print((char) ch);
+            } catch (IOException e) {
+                break;
+            }
+        }
+        System.out.println();
+        System.out.println("-----------------------------------------------");
+        return null;
+
+    }
+
+
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/ExamplesConfig.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/ExamplesConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..ba8c60bda32ebb8b31adbd3b7cf63d59eb07dd70
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/ExamplesConfig.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package websocket;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.websocket.Endpoint;
+import javax.websocket.server.ServerApplicationConfig;
+import javax.websocket.server.ServerEndpointConfig;
+
+import websocket.drawboard.DrawboardEndpoint;
+import websocket.echo.EchoEndpoint;
+
+public class ExamplesConfig implements ServerApplicationConfig {
+
+    @Override
+    public Set<ServerEndpointConfig> getEndpointConfigs(
+            Set<Class<? extends Endpoint>> scanned) {
+
+        Set<ServerEndpointConfig> result = new HashSet<>();
+
+        if (scanned.contains(EchoEndpoint.class)) {
+            result.add(ServerEndpointConfig.Builder.create(
+                    EchoEndpoint.class,
+                    "/websocket/echoProgrammatic").build());
+        }
+
+        if (scanned.contains(DrawboardEndpoint.class)) {
+            result.add(ServerEndpointConfig.Builder.create(
+                    DrawboardEndpoint.class,
+                    "/websocket/drawboard").build());
+        }
+
+        return result;
+    }
+
+
+    @Override
+    public Set<Class<?>> getAnnotatedEndpointClasses(Set<Class<?>> scanned) {
+        // Deploy all WebSocket endpoints defined by annotations in the examples
+        // web application. Filter out all others to avoid issues when running
+        // tests on Gump
+        Set<Class<?>> results = new HashSet<>();
+        for (Class<?> clazz : scanned) {
+            if (clazz.getPackage().getName().startsWith("websocket.")) {
+                results.add(clazz);
+            }
+        }
+        return results;
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/chat/ChatAnnotation.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/chat/ChatAnnotation.java
new file mode 100644
index 0000000000000000000000000000000000000000..d1d55234da871e234ee89c608989616690527dc9
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/chat/ChatAnnotation.java
@@ -0,0 +1,109 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package websocket.chat;
+
+import java.io.IOException;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.websocket.OnClose;
+import javax.websocket.OnError;
+import javax.websocket.OnMessage;
+import javax.websocket.OnOpen;
+import javax.websocket.Session;
+import javax.websocket.server.ServerEndpoint;
+
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+
+import util.HTMLFilter;
+
+@ServerEndpoint(value = "/websocket/chat")
+public class ChatAnnotation {
+
+    private static final Log log = LogFactory.getLog(ChatAnnotation.class);
+
+    private static final String GUEST_PREFIX = "Guest";
+    private static final AtomicInteger connectionIds = new AtomicInteger(0);
+    private static final Set<ChatAnnotation> connections =
+            new CopyOnWriteArraySet<>();
+
+    private final String nickname;
+    private Session session;
+
+    public ChatAnnotation() {
+        nickname = GUEST_PREFIX + connectionIds.getAndIncrement();
+    }
+
+
+    @OnOpen
+    public void start(Session session) {
+        this.session = session;
+        connections.add(this);
+        String message = String.format("* %s %s", nickname, "has joined.");
+        broadcast(message);
+    }
+
+
+    @OnClose
+    public void end() {
+        connections.remove(this);
+        String message = String.format("* %s %s",
+                nickname, "has disconnected.");
+        broadcast(message);
+    }
+
+
+    @OnMessage
+    public void incoming(String message) {
+        // Never trust the client
+        String filteredMessage = String.format("%s: %s",
+                nickname, HTMLFilter.filter(message.toString()));
+        broadcast(filteredMessage);
+    }
+
+
+
+
+    @OnError
+    public void onError(Throwable t) throws Throwable {
+        log.error("Chat Error: " + t.toString(), t);
+    }
+
+
+    private static void broadcast(String msg) {
+        for (ChatAnnotation client : connections) {
+            try {
+                synchronized (client) {
+                    client.session.getBasicRemote().sendText(msg);
+                }
+            } catch (IOException e) {
+                log.debug("Chat Error: Failed to send message to client", e);
+                connections.remove(client);
+                try {
+                    client.session.close();
+                } catch (IOException e1) {
+                    // Ignore
+                }
+                String message = String.format("* %s %s",
+                        client.nickname, "has been disconnected.");
+                broadcast(message);
+            }
+        }
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java
new file mode 100644
index 0000000000000000000000000000000000000000..8026bf2957deb190942f49bba779d99c289d466e
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java
@@ -0,0 +1,230 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package websocket.drawboard;
+
+import java.io.IOException;
+import java.util.LinkedList;
+
+import javax.websocket.CloseReason;
+import javax.websocket.CloseReason.CloseCodes;
+import javax.websocket.RemoteEndpoint.Async;
+import javax.websocket.SendHandler;
+import javax.websocket.SendResult;
+import javax.websocket.Session;
+
+import websocket.drawboard.wsmessages.AbstractWebsocketMessage;
+import websocket.drawboard.wsmessages.BinaryWebsocketMessage;
+import websocket.drawboard.wsmessages.CloseWebsocketMessage;
+import websocket.drawboard.wsmessages.StringWebsocketMessage;
+
+/**
+ * Represents a client with methods to send messages asynchronously.
+ */
+public class Client {
+
+    private final Session session;
+    private final Async async;
+
+    /**
+     * Contains the messages wich are buffered until the previous
+     * send operation has finished.
+     */
+    private final LinkedList<AbstractWebsocketMessage> messagesToSend =
+            new LinkedList<>();
+    /**
+     * If this client is currently sending a messages asynchronously.
+     */
+    private volatile boolean isSendingMessage = false;
+    /**
+     * If this client is closing. If <code>true</code>, new messages to
+     * send will be ignored.
+     */
+    private volatile boolean isClosing = false;
+    /**
+     * The length of all current buffered messages, to avoid iterating
+     * over a linked list.
+     */
+    private volatile long messagesToSendLength = 0;
+
+    public Client(Session session) {
+        this.session = session;
+        this.async = session.getAsyncRemote();
+    }
+
+    /**
+     * Asynchronously closes the Websocket session. This will wait until all
+     * remaining messages have been sent to the Client and then close
+     * the Websocket session.
+     */
+    public void close() {
+        sendMessage(new CloseWebsocketMessage());
+    }
+
+    /**
+     * Sends the given message asynchronously to the client.
+     * If there is already a async sending in progress, then the message
+     * will be buffered and sent when possible.<br><br>
+     *
+     * This method can be called from multiple threads.
+     *
+     * @param msg The message to send
+     */
+    public void sendMessage(AbstractWebsocketMessage msg) {
+        synchronized (messagesToSend) {
+            if (!isClosing) {
+                // Check if we have a Close message
+                if (msg instanceof CloseWebsocketMessage) {
+                    isClosing = true;
+                }
+
+                if (isSendingMessage) {
+                    // Check if the buffered messages exceed
+                    // a specific amount - in that case, disconnect the client
+                    // to prevent DoS.
+                    // In this case we check if there are >= 1000 messages
+                    // or length(of all messages) >= 1000000 bytes.
+                    if (messagesToSend.size() >= 1000
+                            || messagesToSendLength >= 1000000) {
+                        isClosing = true;
+
+                        // Discard the new message and close the session immediately.
+                        CloseReason cr = new CloseReason(
+                                CloseCodes.VIOLATED_POLICY,
+                                "Send Buffer exceeded");
+                        try {
+                            // TODO: close() may block if the remote endpoint doesn't read the data
+                            // (eventually there will be a TimeoutException). However, this method
+                            // (sendMessage) is intended to run asynchronous code and shouldn't
+                            // block. Otherwise it would temporarily stop processing of messages
+                            // from other clients.
+                            // Maybe call this method on another thread.
+                            // Note that when this method is called, the RemoteEndpoint.Async
+                            // is still in the process of sending data, so there probably should
+                            // be another way to abort the Websocket connection.
+                            // Ideally, there should be some abort() method that cancels the
+                            // connection immediately...
+                            session.close(cr);
+                        } catch (IOException e) {
+                            // Ignore
+                        }
+
+                    } else {
+
+                        // Check if the last message and the new message are
+                        // String messages - in that case we concatenate them
+                        // to reduce TCP overhead (using ";" as separator).
+                        if (msg instanceof StringWebsocketMessage
+                                && !messagesToSend.isEmpty()
+                                && messagesToSend.getLast()
+                                instanceof StringWebsocketMessage) {
+
+                            StringWebsocketMessage ms =
+                                    (StringWebsocketMessage) messagesToSend.removeLast();
+                            messagesToSendLength -= calculateMessageLength(ms);
+
+                            String concatenated = ms.getString() + ";" +
+                                    ((StringWebsocketMessage) msg).getString();
+                            msg = new StringWebsocketMessage(concatenated);
+                        }
+
+                        messagesToSend.add(msg);
+                        messagesToSendLength += calculateMessageLength(msg);
+                    }
+                } else {
+                    isSendingMessage = true;
+                    internalSendMessageAsync(msg);
+                }
+            }
+
+        }
+    }
+
+    private long calculateMessageLength(AbstractWebsocketMessage msg) {
+        if (msg instanceof BinaryWebsocketMessage) {
+            return ((BinaryWebsocketMessage) msg).getBytes().capacity();
+        } else if (msg instanceof StringWebsocketMessage) {
+            return ((StringWebsocketMessage) msg).getString().length() * 2;
+        }
+
+        return 0;
+    }
+
+    /**
+     * Internally sends the messages asynchronously.
+     * @param msg
+     */
+    private void internalSendMessageAsync(AbstractWebsocketMessage msg) {
+        try {
+            if (msg instanceof StringWebsocketMessage) {
+                StringWebsocketMessage sMsg = (StringWebsocketMessage) msg;
+                async.sendText(sMsg.getString(), sendHandler);
+
+            } else if (msg instanceof BinaryWebsocketMessage) {
+                BinaryWebsocketMessage bMsg = (BinaryWebsocketMessage) msg;
+                async.sendBinary(bMsg.getBytes(), sendHandler);
+
+            } else if (msg instanceof CloseWebsocketMessage) {
+                // Close the session.
+                session.close();
+            }
+        } catch (IllegalStateException|IOException ex) {
+            // Trying to write to the client when the session has
+            // already been closed.
+            // Ignore
+        }
+    }
+
+
+
+    /**
+     * SendHandler that will continue to send buffered messages.
+     */
+    private final SendHandler sendHandler = new SendHandler() {
+        @Override
+        public void onResult(SendResult result) {
+            if (!result.isOK()) {
+                // Message could not be sent. In this case, we don't
+                // set isSendingMessage to false because we must assume the connection
+                // broke (and onClose will be called), so we don't try to send
+                // other messages.
+                // As a precaution, we close the session (e.g. if a send timeout occured).
+                // TODO: session.close() blocks, while this handler shouldn't block.
+                // Ideally, there should be some abort() method that cancels the
+                // connection immediately...
+                try {
+                    session.close();
+                } catch (IOException ex) {
+                    // Ignore
+                }
+            }
+            synchronized (messagesToSend) {
+
+                if (!messagesToSend.isEmpty()) {
+                    AbstractWebsocketMessage msg = messagesToSend.remove();
+                    messagesToSendLength -= calculateMessageLength(msg);
+
+                    internalSendMessageAsync(msg);
+
+                } else {
+                    isSendingMessage = false;
+                }
+
+            }
+        }
+    };
+
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java
new file mode 100644
index 0000000000000000000000000000000000000000..8dceabae078b1bc283faea8a800e30728ecc7c37
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java
@@ -0,0 +1,250 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package websocket.drawboard;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.geom.Arc2D;
+import java.awt.geom.Line2D;
+import java.awt.geom.Rectangle2D;
+
+/**
+ * A message that represents a drawing action.
+ * Note that we use primitive types instead of Point, Color etc.
+ * to reduce object allocation.<br><br>
+ *
+ * TODO: But a Color objects needs to be created anyway for drawing this
+ * onto a Graphics2D object, so this probably does not save much.
+ */
+public final class DrawMessage {
+
+    private int type;
+    private byte colorR, colorG, colorB, colorA;
+    private double thickness;
+    private double x1, y1, x2, y2;
+
+    /**
+     * The type.
+     *
+     * @return 1: Brush<br>2: Line<br>3: Rectangle<br>4: Ellipse
+     */
+    public int getType() {
+        return type;
+    }
+    public void setType(int type) {
+        this.type = type;
+    }
+
+    public double getThickness() {
+        return thickness;
+    }
+    public void setThickness(double thickness) {
+        this.thickness = thickness;
+    }
+
+    public byte getColorR() {
+        return colorR;
+    }
+    public void setColorR(byte colorR) {
+        this.colorR = colorR;
+    }
+    public byte getColorG() {
+        return colorG;
+    }
+    public void setColorG(byte colorG) {
+        this.colorG = colorG;
+    }
+    public byte getColorB() {
+        return colorB;
+    }
+    public void setColorB(byte colorB) {
+        this.colorB = colorB;
+    }
+    public byte getColorA() {
+        return colorA;
+    }
+    public void setColorA(byte colorA) {
+        this.colorA = colorA;
+    }
+
+    public double getX1() {
+        return x1;
+    }
+    public void setX1(double x1) {
+        this.x1 = x1;
+    }
+    public double getX2() {
+        return x2;
+    }
+    public void setX2(double x2) {
+        this.x2 = x2;
+    }
+    public double getY1() {
+        return y1;
+    }
+    public void setY1(double y1) {
+        this.y1 = y1;
+    }
+    public double getY2() {
+        return y2;
+    }
+    public void setY2(double y2) {
+        this.y2 = y2;
+    }
+
+
+    public DrawMessage(int type, byte colorR, byte colorG, byte colorB,
+            byte colorA, double thickness, double x1, double x2, double y1,
+            double y2) {
+
+        this.type = type;
+        this.colorR = colorR;
+        this.colorG = colorG;
+        this.colorB = colorB;
+        this.colorA = colorA;
+        this.thickness = thickness;
+        this.x1 = x1;
+        this.x2 = x2;
+        this.y1 = y1;
+        this.y2 = y2;
+    }
+
+
+    /**
+     * Draws this DrawMessage onto the given Graphics2D.
+     *
+     * @param g The target for the DrawMessage
+     */
+    public void draw(Graphics2D g) {
+
+        g.setStroke(new BasicStroke((float) thickness,
+                BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER));
+        g.setColor(new Color(colorR & 0xFF, colorG & 0xFF, colorB & 0xFF,
+                colorA & 0xFF));
+
+        if (x1 == x2 && y1 == y2) {
+            // Always draw as arc to meet the behavior in the HTML5 Canvas.
+            Arc2D arc = new Arc2D.Double(x1, y1, 0, 0,
+                    0d, 360d, Arc2D.OPEN);
+            g.draw(arc);
+
+        } else if (type == 1 || type == 2) {
+            // Draw a line.
+            Line2D line = new Line2D.Double(x1, y1, x2, y2);
+            g.draw(line);
+
+        } else if (type == 3 || type == 4) {
+            double x1 = this.x1, x2 = this.x2,
+                    y1 = this.y1, y2 = this.y2;
+            if (x1 > x2) {
+                x1 = this.x2;
+                x2 = this.x1;
+            }
+            if (y1 > y2) {
+                y1 = this.y2;
+                y2 = this.y1;
+            }
+
+            // TODO: If (x1 == x2 || y1 == y2) draw as line.
+
+            if (type == 3) {
+                // Draw a rectangle.
+                Rectangle2D rect = new Rectangle2D.Double(x1, y1,
+                        x2 - x1, y2 - y1);
+                g.draw(rect);
+
+            } else if (type == 4) {
+                // Draw an ellipse.
+                Arc2D arc = new Arc2D.Double(x1, y1, x2 - x1, y2 - y1,
+                        0d, 360d, Arc2D.OPEN);
+                g.draw(arc);
+
+            }
+        }
+    }
+
+    /**
+     * Converts this message into a String representation that
+     * can be sent over WebSocket.<br>
+     * Since a DrawMessage consists only of numbers,
+     * we concatenate those numbers with a ",".
+     */
+    @Override
+    public String toString() {
+
+        return type + "," + (colorR & 0xFF) + "," + (colorG & 0xFF) + ","
+                + (colorB & 0xFF) + "," + (colorA & 0xFF) + "," + thickness
+                + "," + x1 + "," + y1 + "," + x2 + "," + y2;
+    }
+
+    public static DrawMessage parseFromString(String str)
+            throws ParseException {
+
+        int type;
+        byte[] colors = new byte[4];
+        double thickness;
+        double[] coords = new double[4];
+
+        try {
+            String[] elements = str.split(",");
+
+            type = Integer.parseInt(elements[0]);
+            if (!(type >= 1 && type <= 4))
+                throw new ParseException("Invalid type: " + type);
+
+            for (int i = 0; i < colors.length; i++) {
+                colors[i] = (byte) Integer.parseInt(elements[1 + i]);
+            }
+
+            thickness = Double.parseDouble(elements[5]);
+            if (Double.isNaN(thickness) || thickness < 0 || thickness > 100)
+                throw new ParseException("Invalid thickness: " + thickness);
+
+            for (int i = 0; i < coords.length; i++) {
+                coords[i] = Double.parseDouble(elements[6 + i]);
+                if (Double.isNaN(coords[i]))
+                    throw new ParseException("Invalid coordinate: "
+                            + coords[i]);
+            }
+
+        } catch (RuntimeException ex) {
+            throw new ParseException(ex);
+        }
+
+        DrawMessage m = new DrawMessage(type, colors[0], colors[1],
+                colors[2], colors[3], thickness, coords[0], coords[2],
+                coords[1], coords[3]);
+
+        return m;
+    }
+
+    public static class ParseException extends Exception {
+        private static final long serialVersionUID = -6651972769789842960L;
+
+        public ParseException(Throwable root) {
+            super(root);
+        }
+
+        public ParseException(String message) {
+            super(message);
+        }
+    }
+
+
+
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardContextListener.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardContextListener.java
new file mode 100644
index 0000000000000000000000000000000000000000..ef909e8aa881c4f1d5f3c27d1b36d020449cc0b9
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardContextListener.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package websocket.drawboard;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+public final class DrawboardContextListener implements ServletContextListener {
+
+    @Override
+    public void contextDestroyed(ServletContextEvent sce) {
+        // Shutdown our room.
+        Room room = DrawboardEndpoint.getRoom(false);
+        if (room != null) {
+            room.shutdown();
+        }
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
new file mode 100644
index 0000000000000000000000000000000000000000..cd99f495761bb015ae215e614ebf29ec9eecf83c
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
@@ -0,0 +1,236 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package websocket.drawboard;
+
+import java.io.EOFException;
+import java.io.IOException;
+
+import javax.websocket.CloseReason;
+import javax.websocket.Endpoint;
+import javax.websocket.EndpointConfig;
+import javax.websocket.MessageHandler;
+import javax.websocket.Session;
+
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+
+import websocket.drawboard.DrawMessage.ParseException;
+import websocket.drawboard.wsmessages.StringWebsocketMessage;
+
+
+public final class DrawboardEndpoint extends Endpoint {
+
+    private static final Log log =
+            LogFactory.getLog(DrawboardEndpoint.class);
+
+
+    /**
+     * Our room where players can join.
+     */
+    private static volatile Room room = null;
+    private static final Object roomLock = new Object();
+
+    public static Room getRoom(boolean create) {
+        if (create) {
+            if (room == null) {
+                synchronized (roomLock) {
+                    if (room == null) {
+                        room = new Room();
+                    }
+                }
+            }
+            return room;
+        } else {
+            return room;
+        }
+    }
+
+    /**
+     * The player that is associated with this Endpoint and the current room.
+     * Note that this variable is only accessed from the Room Thread.<br><br>
+     *
+     * TODO: Currently, Tomcat uses an Endpoint instance once - however
+     * the java doc of endpoint says:
+     * "Each instance of a websocket endpoint is guaranteed not to be called by
+     * more than one thread at a time per active connection."
+     * This could mean that after calling onClose(), the instance
+     * could be reused for another connection so onOpen() will get called
+     * (possibly from another thread).<br>
+     * If this is the case, we would need a variable holder for the variables
+     * that are accessed by the Room thread, and read the reference to the holder
+     * at the beginning of onOpen, onMessage, onClose methods to ensure the room
+     * thread always gets the correct instance of the variable holder.
+     */
+    private Room.Player player;
+
+
+    @Override
+    public void onOpen(Session session, EndpointConfig config) {
+        // Set maximum messages size to 10.000 bytes.
+        session.setMaxTextMessageBufferSize(10000);
+        session.addMessageHandler(stringHandler);
+        final Client client = new Client(session);
+
+        final Room room = getRoom(true);
+        room.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                try {
+
+                    // Create a new Player and add it to the room.
+                    try {
+                        player = room.createAndAddPlayer(client);
+                    } catch (IllegalStateException ex) {
+                        // Probably the max. number of players has been
+                        // reached.
+                        client.sendMessage(new StringWebsocketMessage(
+                                "0" + ex.getLocalizedMessage()));
+                        // Close the connection.
+                        client.close();
+                    }
+
+                } catch (RuntimeException ex) {
+                    log.error("Unexpected exception: " + ex.toString(), ex);
+                }
+            }
+        });
+
+    }
+
+
+    @Override
+    public void onClose(Session session, CloseReason closeReason) {
+        Room room = getRoom(false);
+        if (room != null) {
+            room.invokeAndWait(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        // Player can be null if it couldn't enter the room
+                        if (player != null) {
+                            // Remove this player from the room.
+                            player.removeFromRoom();
+
+                            // Set player to null to prevent NPEs when onMessage events
+                            // are processed (from other threads) after onClose has been
+                            // called from different thread which closed the Websocket session.
+                            player = null;
+                        }
+                    } catch (RuntimeException ex) {
+                        log.error("Unexpected exception: " + ex.toString(), ex);
+                    }
+                }
+            });
+        }
+    }
+
+
+
+    @Override
+    public void onError(Session session, Throwable t) {
+        // Most likely cause is a user closing their browser. Check to see if
+        // the root cause is EOF and if it is ignore it.
+        // Protect against infinite loops.
+        int count = 0;
+        Throwable root = t;
+        while (root.getCause() != null && count < 20) {
+            root = root.getCause();
+            count ++;
+        }
+        if (root instanceof EOFException) {
+            // Assume this is triggered by the user closing their browser and
+            // ignore it.
+        } else if (!session.isOpen() && root instanceof IOException) {
+            // IOException after close. Assume this is a variation of the user
+            // closing their browser (or refreshing very quickly) and ignore it.
+        } else {
+            log.error("onError: " + t.toString(), t);
+        }
+    }
+
+
+
+    private final MessageHandler.Whole<String> stringHandler =
+            new MessageHandler.Whole<String>() {
+
+        @Override
+        public void onMessage(final String message) {
+            // Invoke handling of the message in the room.
+            room.invokeAndWait(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+
+                        // Currently, the only types of messages the client will send
+                        // are draw messages prefixed by a Message ID
+                        // (starting with char '1'), and pong messages (starting
+                        // with char '0').
+                        // Draw messages should look like this:
+                        // ID|type,colR,colB,colG,colA,thickness,x1,y1,x2,y2,lastInChain
+
+                        boolean dontSwallowException = false;
+                        try {
+                            char messageType = message.charAt(0);
+                            String messageContent = message.substring(1);
+                            switch (messageType) {
+                            case '0':
+                                // Pong message.
+                                // Do nothing.
+                                break;
+
+                            case '1':
+                                // Draw message
+                                int indexOfChar = messageContent.indexOf('|');
+                                long msgId = Long.parseLong(
+                                        messageContent.substring(0, indexOfChar));
+
+                                DrawMessage msg = DrawMessage.parseFromString(
+                                        messageContent.substring(indexOfChar + 1));
+
+                                // Don't ignore RuntimeExceptions thrown by
+                                // this method
+                                // TODO: Find a better solution than this variable
+                                dontSwallowException = true;
+                                if (player != null) {
+                                    player.handleDrawMessage(msg, msgId);
+                                }
+                                dontSwallowException = false;
+
+                                break;
+                            }
+                        } catch (ParseException e) {
+                            // Client sent invalid data
+                            // Ignore, TODO: maybe close connection
+                        } catch (RuntimeException e) {
+                            // Client sent invalid data.
+                            // Ignore, TODO: maybe close connection
+                            if (dontSwallowException) {
+                                throw e;
+                            }
+                        }
+
+                    } catch (RuntimeException ex) {
+                        log.error("Unexpected exception: " + ex.toString(), ex);
+                    }
+                }
+            });
+
+        }
+    };
+
+
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java
new file mode 100644
index 0000000000000000000000000000000000000000..558273f841006bafc74ef19c46e1a879958ce162
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java
@@ -0,0 +1,496 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package websocket.drawboard;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.locks.ReentrantLock;
+
+import javax.imageio.ImageIO;
+
+import websocket.drawboard.wsmessages.BinaryWebsocketMessage;
+import websocket.drawboard.wsmessages.StringWebsocketMessage;
+
+/**
+ * A Room represents a drawboard where a number of
+ * users participate.<br><br>
+ *
+ * Note: Instance methods should only be invoked by calling
+ * {@link #invokeAndWait(Runnable)} to ensure access is correctly synchronized.
+ */
+public final class Room {
+
+    /**
+     * Specifies the type of a room message that is sent to a client.<br>
+     * Note: Currently we are sending simple string messages - for production
+     * apps, a JSON lib should be used for object-level messages.<br><br>
+     *
+     * The number (single char) will be prefixed to the string when sending
+     * the message.
+     */
+    public static enum MessageType {
+        /**
+         * '0': Error: contains error message.
+         */
+        ERROR('0'),
+        /**
+         * '1': DrawMessage: contains serialized DrawMessage(s) prefixed
+         *      with the current Player's {@link Player#lastReceivedMessageId}
+         *      and ",".<br>
+         *      Multiple draw messages are concatenated with "|" as separator.
+         */
+        DRAW_MESSAGE('1'),
+        /**
+         * '2': ImageMessage: Contains number of current players in this room.
+         *      After this message a Binary Websocket message will follow,
+         *      containing the current Room image as PNG.<br>
+         *      This is the first message that a Room sends to a new Player.
+         */
+        IMAGE_MESSAGE('2'),
+        /**
+         * '3': PlayerChanged: contains "+" or "-" which indicate a player
+         *      was added or removed to this Room.
+         */
+        PLAYER_CHANGED('3');
+
+        private final char flag;
+
+        private MessageType(char flag) {
+            this.flag = flag;
+        }
+
+    }
+
+
+    /**
+     * The lock used to synchronize access to this Room.
+     */
+    private final ReentrantLock roomLock = new ReentrantLock();
+
+    /**
+     * Indicates if this room has already been shutdown.
+     */
+    private volatile boolean closed = false;
+
+    /**
+     * If <code>true</code>, outgoing DrawMessages will be buffered until the
+     * drawmessageBroadcastTimer ticks. Otherwise they will be sent
+     * immediately.
+     */
+    private static final boolean BUFFER_DRAW_MESSAGES = true;
+
+    /**
+     * A timer which sends buffered drawmessages to the client at once
+     * at a regular interval, to avoid sending a lot of very small
+     * messages which would cause TCP overhead and high CPU usage.
+     */
+    private final Timer drawmessageBroadcastTimer = new Timer();
+
+    private static final int TIMER_DELAY = 30;
+
+    /**
+     * The current active broadcast timer task. If null, then no Broadcast task is scheduled.
+     * The Task will be scheduled if the first player enters the Room, and
+     * cancelled if the last player exits the Room, to avoid unnecessary timer executions.
+     */
+    private TimerTask activeBroadcastTimerTask;
+
+
+    /**
+     * The current image of the room drawboard. DrawMessages that are
+     * received from Players will be drawn onto this image.
+     */
+    private final BufferedImage roomImage =
+            new BufferedImage(900, 600, BufferedImage.TYPE_INT_RGB);
+    private final Graphics2D roomGraphics = roomImage.createGraphics();
+
+
+    /**
+     * The maximum number of players that can join this room.
+     */
+    private static final int MAX_PLAYER_COUNT = 100;
+
+    /**
+     * List of all currently joined players.
+     */
+    private final List<Player> players = new ArrayList<>();
+
+
+
+    public Room() {
+        roomGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                RenderingHints.VALUE_ANTIALIAS_ON);
+
+        // Clear the image with white background.
+        roomGraphics.setBackground(Color.WHITE);
+        roomGraphics.clearRect(0, 0, roomImage.getWidth(),
+                roomImage.getHeight());
+    }
+
+    private TimerTask createBroadcastTimerTask() {
+        return new TimerTask() {
+            @Override
+            public void run() {
+                invokeAndWait(new Runnable() {
+                    @Override
+                    public void run() {
+                        broadcastTimerTick();
+                    }
+                });
+            }
+        };
+    }
+
+    /**
+     * Creates a Player from the given Client and adds it to this room.
+     *
+     * @param client the client
+     *
+     * @return The newly created player
+     */
+    public Player createAndAddPlayer(Client client) {
+        if (players.size() >= MAX_PLAYER_COUNT) {
+            throw new IllegalStateException("Maximum player count ("
+                    + MAX_PLAYER_COUNT + ") has been reached.");
+        }
+
+        Player p = new Player(this, client);
+
+        // Broadcast to the other players that one player joined.
+        broadcastRoomMessage(MessageType.PLAYER_CHANGED, "+");
+
+        // Add the new player to the list.
+        players.add(p);
+
+        // If currently no Broadcast Timer Task is scheduled, then we need to create one.
+        if (activeBroadcastTimerTask == null) {
+            activeBroadcastTimerTask = createBroadcastTimerTask();
+            drawmessageBroadcastTimer.schedule(activeBroadcastTimerTask,
+                    TIMER_DELAY, TIMER_DELAY);
+        }
+
+        // Send him the current number of players and the current room image.
+        String content = String.valueOf(players.size());
+        p.sendRoomMessage(MessageType.IMAGE_MESSAGE, content);
+
+        // Store image as PNG
+        ByteArrayOutputStream bout = new ByteArrayOutputStream();
+        try {
+            ImageIO.write(roomImage, "PNG", bout);
+        } catch (IOException e) { /* Should never happen */ }
+
+
+        // Send the image as binary message.
+        BinaryWebsocketMessage msg = new BinaryWebsocketMessage(
+                ByteBuffer.wrap(bout.toByteArray()));
+        p.getClient().sendMessage(msg);
+
+        return p;
+
+    }
+
+    /**
+     * @see Player#removeFromRoom()
+     * @param p
+     */
+    private void internalRemovePlayer(Player p) {
+        boolean removed = players.remove(p);
+        assert removed;
+
+        // If the last player left the Room, we need to cancel the Broadcast Timer Task.
+        if (players.size() == 0) {
+            // Cancel the task.
+            // Note that it can happen that the TimerTask is just about to execute (from
+            // the Timer thread) but waits until all players are gone (or even until a new
+            // player is added to the list), and then executes. This is OK. To prevent it,
+            // a TimerTask subclass would need to have some boolean "cancel" instance variable and
+            // query it in the invocation of Room#invokeAndWait.
+            activeBroadcastTimerTask.cancel();
+            activeBroadcastTimerTask = null;
+        }
+
+        // Broadcast that one player is removed.
+        broadcastRoomMessage(MessageType.PLAYER_CHANGED, "-");
+    }
+
+    /**
+     * @see Player#handleDrawMessage(DrawMessage, long)
+     * @param p
+     * @param msg
+     * @param msgId
+     */
+    private void internalHandleDrawMessage(Player p, DrawMessage msg,
+            long msgId) {
+        p.setLastReceivedMessageId(msgId);
+
+        // Draw the RoomMessage onto our Room Image.
+        msg.draw(roomGraphics);
+
+        // Broadcast the Draw Message.
+        broadcastDrawMessage(msg);
+    }
+
+
+    /**
+     * Broadcasts the given drawboard message to all connected players.<br>
+     * Note: For DrawMessages, please use
+     * {@link #broadcastDrawMessage(DrawMessage)}
+     * as this method will buffer them and prefix them with the correct
+     * last received Message ID.
+     * @param type
+     * @param content
+     */
+    private void broadcastRoomMessage(MessageType type, String content) {
+        for (Player p : players) {
+            p.sendRoomMessage(type, content);
+        }
+    }
+
+
+    /**
+     * Broadcast the given DrawMessage. This will buffer the message
+     * and the {@link #drawmessageBroadcastTimer} will broadcast them
+     * at a regular interval, prefixing them with the player's current
+     * {@link Player#lastReceivedMessageId}.
+     * @param msg
+     */
+    private void broadcastDrawMessage(DrawMessage msg) {
+        if (!BUFFER_DRAW_MESSAGES) {
+            String msgStr = msg.toString();
+
+            for (Player p : players) {
+                String s = String.valueOf(p.getLastReceivedMessageId())
+                        + "," + msgStr;
+                p.sendRoomMessage(MessageType.DRAW_MESSAGE, s);
+            }
+        } else {
+            for (Player p : players) {
+                p.getBufferedDrawMessages().add(msg);
+            }
+        }
+    }
+
+
+    /**
+     * Tick handler for the broadcastTimer.
+     */
+    private void broadcastTimerTick() {
+        // For each Player, send all per Player buffered
+        // DrawMessages, prefixing each DrawMessage with the player's
+        // lastReceivedMessageId.
+        // Multiple messages are concatenated with "|".
+
+        for (Player p : players) {
+
+            StringBuilder sb = new StringBuilder();
+            List<DrawMessage> drawMessages = p.getBufferedDrawMessages();
+
+            if (drawMessages.size() > 0) {
+                for (int i = 0; i < drawMessages.size(); i++) {
+                    DrawMessage msg = drawMessages.get(i);
+
+                    String s = String.valueOf(p.getLastReceivedMessageId())
+                            + "," + msg.toString();
+                    if (i > 0)
+                        sb.append("|");
+
+                    sb.append(s);
+                }
+                drawMessages.clear();
+
+                p.sendRoomMessage(MessageType.DRAW_MESSAGE, sb.toString());
+            }
+        }
+    }
+
+    /**
+     * A list of cached {@link Runnable}s to prevent recursive invocation of Runnables
+     * by one thread. This variable is only used by one thread at a time and then
+     * set to <code>null</code>.
+     */
+    private List<Runnable> cachedRunnables = null;
+
+    /**
+     * Submits the given Runnable to the Room Executor and waits until it
+     * has been executed. Currently, this simply means that the Runnable
+     * will be run directly inside of a synchronized() block.<br>
+     * Note that if a runnable recursively calls invokeAndWait() with another
+     * runnable on this Room, it will not be executed recursively, but instead
+     * cached until the original runnable is finished, to keep the behavior of
+     * using a Executor.
+     *
+     * @param task The task to be executed
+     */
+    public void invokeAndWait(Runnable task)  {
+
+        // Check if the current thread already holds a lock on this room.
+        // If yes, then we must not directly execute the Runnable but instead
+        // cache it until the original invokeAndWait() has finished.
+        if (roomLock.isHeldByCurrentThread()) {
+
+            if (cachedRunnables == null) {
+                cachedRunnables = new ArrayList<>();
+            }
+            cachedRunnables.add(task);
+
+        } else {
+
+            roomLock.lock();
+            try {
+                // Explicitly overwrite value to ensure data consistency in
+                // current thread
+                cachedRunnables = null;
+
+                if (!closed) {
+                    task.run();
+                }
+
+                // Run the cached runnables.
+                if (cachedRunnables != null) {
+                    for (int i = 0; i < cachedRunnables.size(); i++) {
+                        if (!closed) {
+                            cachedRunnables.get(i).run();
+                        }
+                    }
+                    cachedRunnables = null;
+                }
+
+            } finally {
+                roomLock.unlock();
+            }
+
+        }
+
+    }
+
+    /**
+     * Shuts down the roomExecutor and the drawmessageBroadcastTimer.
+     */
+    public void shutdown() {
+        invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                closed = true;
+                drawmessageBroadcastTimer.cancel();
+                roomGraphics.dispose();
+            }
+        });
+    }
+
+
+    /**
+     * A Player participates in a Room. It is the interface between the
+     * {@link Room} and the {@link Client}.<br><br>
+     *
+     * Note: This means a player object is actually a join between Room and
+     * Client.
+     */
+    public final class Player {
+
+        /**
+         * The room to which this player belongs.
+         */
+        private Room room;
+
+        /**
+         * The room buffers the last draw message ID that was received from
+         * this player.
+         */
+        private long lastReceivedMessageId = 0;
+
+        private final Client client;
+
+        /**
+         * Buffered DrawMessages that will be sent by a Timer.
+         */
+        private final List<DrawMessage> bufferedDrawMessages =
+                new ArrayList<>();
+
+        private List<DrawMessage> getBufferedDrawMessages() {
+            return bufferedDrawMessages;
+        }
+
+        private Player(Room room, Client client) {
+            this.room = room;
+            this.client = client;
+        }
+
+        public Room getRoom() {
+            return room;
+        }
+
+        public Client getClient() {
+            return client;
+        }
+
+        /**
+         * Removes this player from its room, e.g. when
+         * the client disconnects.
+         */
+        public void removeFromRoom() {
+            if (room != null) {
+                room.internalRemovePlayer(this);
+                room = null;
+            }
+        }
+
+
+        private long getLastReceivedMessageId() {
+            return lastReceivedMessageId;
+        }
+        private void setLastReceivedMessageId(long value) {
+            lastReceivedMessageId = value;
+        }
+
+
+        /**
+         * Handles the given DrawMessage by drawing it onto this Room's
+         * image and by broadcasting it to the connected players.
+         *
+         * @param msg   The draw message received
+         * @param msgId The ID for the draw message received
+         */
+        public void handleDrawMessage(DrawMessage msg, long msgId) {
+            room.internalHandleDrawMessage(this, msg, msgId);
+        }
+
+
+        /**
+         * Sends the given room message.
+         * @param type
+         * @param content
+         */
+        private void sendRoomMessage(MessageType type, String content) {
+            Objects.requireNonNull(content);
+            Objects.requireNonNull(type);
+
+            String completeMsg = String.valueOf(type.flag) + content;
+
+            client.sendMessage(new StringWebsocketMessage(completeMsg));
+        }
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/AbstractWebsocketMessage.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/AbstractWebsocketMessage.java
new file mode 100644
index 0000000000000000000000000000000000000000..d42539372f4cb33143ee9f3a796623cba4fc2331
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/AbstractWebsocketMessage.java
@@ -0,0 +1,25 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package websocket.drawboard.wsmessages;
+
+/**
+ * Abstract base class for Websocket Messages (binary or string)
+ * that can be buffered.
+ */
+public abstract class AbstractWebsocketMessage {
+
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/BinaryWebsocketMessage.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/BinaryWebsocketMessage.java
new file mode 100644
index 0000000000000000000000000000000000000000..b16e1aede6de633ed48ebedc3c84d732465f4ffa
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/BinaryWebsocketMessage.java
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package websocket.drawboard.wsmessages;
+
+import java.nio.ByteBuffer;
+
+/**
+ * Represents a binary websocket message.
+ */
+public final class BinaryWebsocketMessage extends AbstractWebsocketMessage {
+    private final ByteBuffer bytes;
+
+    public BinaryWebsocketMessage(ByteBuffer bytes) {
+        this.bytes = bytes;
+    }
+
+    public ByteBuffer getBytes() {
+        return bytes;
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/CloseWebsocketMessage.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/CloseWebsocketMessage.java
new file mode 100644
index 0000000000000000000000000000000000000000..44f48adb748dd51253a3cb73cf461dc5778c0213
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/CloseWebsocketMessage.java
@@ -0,0 +1,24 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package websocket.drawboard.wsmessages;
+
+/**
+ * Represents a "close" message that closes the session.
+ */
+public class CloseWebsocketMessage extends AbstractWebsocketMessage {
+
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/StringWebsocketMessage.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/StringWebsocketMessage.java
new file mode 100644
index 0000000000000000000000000000000000000000..49be36935b20eae995149fe27b95d849cf82aefc
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/StringWebsocketMessage.java
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package websocket.drawboard.wsmessages;
+
+/**
+ * Represents a string websocket message.
+ *
+ */
+public final class StringWebsocketMessage extends AbstractWebsocketMessage {
+    private final String string;
+
+    public StringWebsocketMessage(String string) {
+        this.string = string;
+    }
+
+    public String getString() {
+        return string;
+    }
+
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/echo/EchoAnnotation.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/echo/EchoAnnotation.java
new file mode 100644
index 0000000000000000000000000000000000000000..34f0de2c1b410226ca40574fd9ce1eb145a937e1
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/echo/EchoAnnotation.java
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package websocket.echo;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import javax.websocket.OnMessage;
+import javax.websocket.PongMessage;
+import javax.websocket.Session;
+import javax.websocket.server.ServerEndpoint;
+
+/**
+ * The three annotated echo endpoints can be used to test with Autobahn and
+ * the following command "wstest -m fuzzingclient -s servers.json". See the
+ * Autobahn documentation for setup and general information.
+ */
+@ServerEndpoint("/websocket/echoAnnotation")
+public class EchoAnnotation {
+
+    @OnMessage
+    public void echoTextMessage(Session session, String msg, boolean last) {
+        try {
+            if (session.isOpen()) {
+                session.getBasicRemote().sendText(msg, last);
+            }
+        } catch (IOException e) {
+            try {
+                session.close();
+            } catch (IOException e1) {
+                // Ignore
+            }
+        }
+    }
+
+    @OnMessage
+    public void echoBinaryMessage(Session session, ByteBuffer bb,
+            boolean last) {
+        try {
+            if (session.isOpen()) {
+                session.getBasicRemote().sendBinary(bb, last);
+            }
+        } catch (IOException e) {
+            try {
+                session.close();
+            } catch (IOException e1) {
+                // Ignore
+            }
+        }
+    }
+
+    /**
+     * Process a received pong. This is a NO-OP.
+     *
+     * @param pm    Ignored.
+     */
+    @OnMessage
+    public void echoPongMessage(PongMessage pm) {
+        // NO-OP
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/echo/EchoAsyncAnnotation.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/echo/EchoAsyncAnnotation.java
new file mode 100644
index 0000000000000000000000000000000000000000..39df783b721e0bc23aa70f9fdf8e8aa6951ddd99
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/echo/EchoAsyncAnnotation.java
@@ -0,0 +1,128 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package websocket.echo;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import javax.websocket.OnMessage;
+import javax.websocket.PongMessage;
+import javax.websocket.Session;
+
+/**
+ * The three annotated echo endpoints can be used to test with Autobahn and
+ * the following command "wstest -m fuzzingclient -s servers.json". See the
+ * Autobahn documentation for setup and general information.
+ *
+ * Note: This one is disabled by default since it allocates memory, and needs
+ * to be enabled back.
+ */
+//@javax.websocket.server.ServerEndpoint("/websocket/echoAsyncAnnotation")
+public class EchoAsyncAnnotation {
+
+    private static final Future<Void> COMPLETED = new CompletedFuture();
+
+    Future<Void> f = COMPLETED;
+    StringBuilder sb = null;
+    ByteArrayOutputStream bytes = null;
+
+    @OnMessage
+    public void echoTextMessage(Session session, String msg, boolean last) {
+        if (sb == null) {
+            sb = new StringBuilder();
+        }
+        sb.append(msg);
+        if (last) {
+            // Before we send the next message, have to wait for the previous
+            // message to complete
+            try {
+                f.get();
+            } catch (InterruptedException | ExecutionException e) {
+                // Let the container deal with it
+                throw new RuntimeException(e);
+            }
+            f = session.getAsyncRemote().sendText(sb.toString());
+            sb = null;
+        }
+    }
+
+    @OnMessage
+    public void echoBinaryMessage(byte[] msg, Session session, boolean last)
+            throws IOException {
+        if (bytes == null) {
+            bytes = new ByteArrayOutputStream();
+        }
+        bytes.write(msg);
+        if (last) {
+            // Before we send the next message, have to wait for the previous
+            // message to complete
+            try {
+                f.get();
+            } catch (InterruptedException | ExecutionException e) {
+                // Let the container deal with it
+                throw new RuntimeException(e);
+            }
+            f = session.getAsyncRemote().sendBinary(ByteBuffer.wrap(bytes.toByteArray()));
+            bytes = null;
+        }
+    }
+
+    /**
+     * Process a received pong. This is a NO-OP.
+     *
+     * @param pm    Ignored.
+     */
+    @OnMessage
+    public void echoPongMessage(PongMessage pm) {
+        // NO-OP
+    }
+
+    private static class CompletedFuture implements Future<Void> {
+
+        @Override
+        public boolean cancel(boolean mayInterruptIfRunning) {
+            return false;
+        }
+
+        @Override
+        public boolean isCancelled() {
+            return false;
+        }
+
+        @Override
+        public boolean isDone() {
+            return true;
+        }
+
+        @Override
+        public Void get() throws InterruptedException, ExecutionException {
+            return null;
+        }
+
+        @Override
+        public Void get(long timeout, TimeUnit unit)
+                throws InterruptedException, ExecutionException,
+                TimeoutException {
+            return null;
+        }
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/echo/EchoEndpoint.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/echo/EchoEndpoint.java
new file mode 100644
index 0000000000000000000000000000000000000000..362023829825b06df934ae0afa0b95101eced649
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/echo/EchoEndpoint.java
@@ -0,0 +1,80 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package websocket.echo;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import javax.websocket.Endpoint;
+import javax.websocket.EndpointConfig;
+import javax.websocket.MessageHandler;
+import javax.websocket.RemoteEndpoint;
+import javax.websocket.Session;
+
+public class EchoEndpoint extends Endpoint {
+
+    @Override
+    public void onOpen(Session session, EndpointConfig endpointConfig) {
+        RemoteEndpoint.Basic remoteEndpointBasic = session.getBasicRemote();
+        session.addMessageHandler(new EchoMessageHandlerText(remoteEndpointBasic));
+        session.addMessageHandler(new EchoMessageHandlerBinary(remoteEndpointBasic));
+    }
+
+    private static class EchoMessageHandlerText
+            implements MessageHandler.Partial<String> {
+
+        private final RemoteEndpoint.Basic remoteEndpointBasic;
+
+        private EchoMessageHandlerText(RemoteEndpoint.Basic remoteEndpointBasic) {
+            this.remoteEndpointBasic = remoteEndpointBasic;
+        }
+
+        @Override
+        public void onMessage(String message, boolean last) {
+            try {
+                if (remoteEndpointBasic != null) {
+                    remoteEndpointBasic.sendText(message, last);
+                }
+            } catch (IOException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+        }
+    }
+
+    private static class EchoMessageHandlerBinary
+            implements MessageHandler.Partial<ByteBuffer> {
+
+        private final RemoteEndpoint.Basic remoteEndpointBasic;
+
+        private EchoMessageHandlerBinary(RemoteEndpoint.Basic remoteEndpointBasic) {
+            this.remoteEndpointBasic = remoteEndpointBasic;
+        }
+
+        @Override
+        public void onMessage(ByteBuffer message, boolean last) {
+            try {
+                if (remoteEndpointBasic != null) {
+                    remoteEndpointBasic.sendBinary(message, last);
+                }
+            } catch (IOException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+        }
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/echo/EchoStreamAnnotation.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/echo/EchoStreamAnnotation.java
new file mode 100644
index 0000000000000000000000000000000000000000..7aef82110cf8bc5b698c02ecd8cc36755e420fa4
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/echo/EchoStreamAnnotation.java
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package websocket.echo;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+
+import javax.websocket.OnMessage;
+import javax.websocket.PongMessage;
+import javax.websocket.Session;
+import javax.websocket.server.ServerEndpoint;
+
+/**
+ * The three annotated echo endpoints can be used to test with Autobahn and
+ * the following command "wstest -m fuzzingclient -s servers.json". See the
+ * Autobahn documentation for setup and general information.
+ */
+@ServerEndpoint("/websocket/echoStreamAnnotation")
+public class EchoStreamAnnotation {
+
+    Writer writer;
+    OutputStream stream;
+
+    @OnMessage
+    public void echoTextMessage(Session session, String msg, boolean last)
+            throws IOException {
+        if (writer == null) {
+            writer = session.getBasicRemote().getSendWriter();
+        }
+        writer.write(msg);
+        if (last) {
+            writer.close();
+            writer = null;
+        }
+    }
+
+    @OnMessage
+    public void echoBinaryMessage(byte[] msg, Session session, boolean last)
+            throws IOException {
+        if (stream == null) {
+            stream = session.getBasicRemote().getSendStream();
+        }
+        stream.write(msg);
+        stream.flush();
+        if (last) {
+            stream.close();
+            stream = null;
+        }
+    }
+
+    /**
+     * Process a received pong. This is a NO-OP.
+     *
+     * @param pm    Ignored.
+     */
+    @OnMessage
+    public void echoPongMessage(PongMessage pm) {
+        // NO-OP
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/echo/servers.json b/tomcat/webapps/examples/WEB-INF/classes/websocket/echo/servers.json
new file mode 100644
index 0000000000000000000000000000000000000000..c816a7d9e82b059221664164f5f39cafb6d9e57b
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/echo/servers.json
@@ -0,0 +1,20 @@
+{
+   "options": {"failByDrop": false},
+   "outdir": "./reports/servers",
+
+   "servers": [
+                {"agent": "Basic",
+                 "url": "ws://localhost:8080/examples/websocket/echoAnnotation",
+                 "options": {"version": 18}},
+                {"agent": "Stream",
+                 "url": "ws://localhost:8080/examples/websocket/echoStreamAnnotation",
+                 "options": {"version": 18}},
+                {"agent": "Async",
+                 "url": "ws://localhost:8080/examples/websocket/echoAsyncAnnotation",
+                 "options": {"version": 18}}
+              ],
+
+   "cases": ["*"],
+   "exclude-cases": [],
+   "exclude-agent-cases": {}
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/snake/Direction.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/snake/Direction.java
new file mode 100644
index 0000000000000000000000000000000000000000..4440c9ded517728e3d332883fb4d450bdcfe5892
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/snake/Direction.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package websocket.snake;
+
+public enum Direction {
+    NONE, NORTH, SOUTH, EAST, WEST
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/snake/Location.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/snake/Location.java
new file mode 100644
index 0000000000000000000000000000000000000000..acbfeb779ea2df8b070d14ee6a388bd51b5a4cf9
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/snake/Location.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package websocket.snake;
+
+public class Location {
+
+    public int x;
+    public int y;
+
+    public Location(int x, int y) {
+        this.x = x;
+        this.y = y;
+    }
+
+    public Location getAdjacentLocation(Direction direction) {
+        switch (direction) {
+            case NORTH:
+                return new Location(x, y - SnakeAnnotation.GRID_SIZE);
+            case SOUTH:
+                return new Location(x, y + SnakeAnnotation.GRID_SIZE);
+            case EAST:
+                return new Location(x + SnakeAnnotation.GRID_SIZE, y);
+            case WEST:
+                return new Location(x - SnakeAnnotation.GRID_SIZE, y);
+            case NONE:
+                // fall through
+            default:
+                return this;
+        }
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        Location location = (Location) o;
+
+        if (x != location.x) return false;
+        if (y != location.y) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = x;
+        result = 31 * result + y;
+        return result;
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/snake/Snake.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/snake/Snake.java
new file mode 100644
index 0000000000000000000000000000000000000000..7a112220c57d573b59c9654bd0f1819d7b52a055
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/snake/Snake.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package websocket.snake;
+
+import java.io.IOException;
+import java.util.ArrayDeque;
+import java.util.Collection;
+import java.util.Deque;
+
+import javax.websocket.CloseReason;
+import javax.websocket.CloseReason.CloseCodes;
+import javax.websocket.Session;
+
+public class Snake {
+
+    private static final int DEFAULT_LENGTH = 5;
+
+    private final int id;
+    private final Session session;
+
+    private Direction direction;
+    private int length = DEFAULT_LENGTH;
+    private Location head;
+    private final Deque<Location> tail = new ArrayDeque<>();
+    private final String hexColor;
+
+    public Snake(int id, Session session) {
+        this.id = id;
+        this.session = session;
+        this.hexColor = SnakeAnnotation.getRandomHexColor();
+        resetState();
+    }
+
+    private void resetState() {
+        this.direction = Direction.NONE;
+        this.head = SnakeAnnotation.getRandomLocation();
+        this.tail.clear();
+        this.length = DEFAULT_LENGTH;
+    }
+
+    private synchronized void kill() {
+        resetState();
+        sendMessage("{\"type\": \"dead\"}");
+    }
+
+    private synchronized void reward() {
+        length++;
+        sendMessage("{\"type\": \"kill\"}");
+    }
+
+
+    protected void sendMessage(String msg) {
+        try {
+            session.getBasicRemote().sendText(msg);
+        } catch (IOException ioe) {
+            CloseReason cr =
+                    new CloseReason(CloseCodes.CLOSED_ABNORMALLY, ioe.getMessage());
+            try {
+                session.close(cr);
+            } catch (IOException ioe2) {
+                // Ignore
+            }
+        }
+    }
+
+    public synchronized void update(Collection<Snake> snakes) {
+        Location nextLocation = head.getAdjacentLocation(direction);
+        if (nextLocation.x >= SnakeAnnotation.PLAYFIELD_WIDTH) {
+            nextLocation.x = 0;
+        }
+        if (nextLocation.y >= SnakeAnnotation.PLAYFIELD_HEIGHT) {
+            nextLocation.y = 0;
+        }
+        if (nextLocation.x < 0) {
+            nextLocation.x = SnakeAnnotation.PLAYFIELD_WIDTH;
+        }
+        if (nextLocation.y < 0) {
+            nextLocation.y = SnakeAnnotation.PLAYFIELD_HEIGHT;
+        }
+        if (direction != Direction.NONE) {
+            tail.addFirst(head);
+            if (tail.size() > length) {
+                tail.removeLast();
+            }
+            head = nextLocation;
+        }
+
+        handleCollisions(snakes);
+    }
+
+    private void handleCollisions(Collection<Snake> snakes) {
+        for (Snake snake : snakes) {
+            boolean headCollision = id != snake.id && snake.getHead().equals(head);
+            boolean tailCollision = snake.getTail().contains(head);
+            if (headCollision || tailCollision) {
+                kill();
+                if (id != snake.id) {
+                    snake.reward();
+                }
+            }
+        }
+    }
+
+    public synchronized Location getHead() {
+        return head;
+    }
+
+    public synchronized Collection<Location> getTail() {
+        return tail;
+    }
+
+    public synchronized void setDirection(Direction direction) {
+        this.direction = direction;
+    }
+
+    public synchronized String getLocationsJson() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(String.format("{\"x\": %d, \"y\": %d}",
+                Integer.valueOf(head.x), Integer.valueOf(head.y)));
+        for (Location location : tail) {
+            sb.append(',');
+            sb.append(String.format("{\"x\": %d, \"y\": %d}",
+                    Integer.valueOf(location.x), Integer.valueOf(location.y)));
+        }
+        return String.format("{\"id\":%d,\"body\":[%s]}",
+                Integer.valueOf(id), sb.toString());
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public String getHexColor() {
+        return hexColor;
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/snake/SnakeAnnotation.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/snake/SnakeAnnotation.java
new file mode 100644
index 0000000000000000000000000000000000000000..c030dbcabe04ef0c92b14809fede9db1bc2b927c
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/snake/SnakeAnnotation.java
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package websocket.snake;
+
+import java.awt.Color;
+import java.io.EOFException;
+import java.util.Iterator;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.websocket.OnClose;
+import javax.websocket.OnError;
+import javax.websocket.OnMessage;
+import javax.websocket.OnOpen;
+import javax.websocket.Session;
+import javax.websocket.server.ServerEndpoint;
+
+@ServerEndpoint(value = "/websocket/snake")
+public class SnakeAnnotation {
+
+    public static final int PLAYFIELD_WIDTH = 640;
+    public static final int PLAYFIELD_HEIGHT = 480;
+    public static final int GRID_SIZE = 10;
+
+    private static final AtomicInteger snakeIds = new AtomicInteger(0);
+    private static final Random random = new Random();
+
+
+    private final int id;
+    private Snake snake;
+
+    public static String getRandomHexColor() {
+        float hue = random.nextFloat();
+        // sat between 0.1 and 0.3
+        float saturation = (random.nextInt(2000) + 1000) / 10000f;
+        float luminance = 0.9f;
+        Color color = Color.getHSBColor(hue, saturation, luminance);
+        return '#' + Integer.toHexString(
+                (color.getRGB() & 0xffffff) | 0x1000000).substring(1);
+    }
+
+
+    public static Location getRandomLocation() {
+        int x = roundByGridSize(random.nextInt(PLAYFIELD_WIDTH));
+        int y = roundByGridSize(random.nextInt(PLAYFIELD_HEIGHT));
+        return new Location(x, y);
+    }
+
+
+    private static int roundByGridSize(int value) {
+        value = value + (GRID_SIZE / 2);
+        value = value / GRID_SIZE;
+        value = value * GRID_SIZE;
+        return value;
+    }
+
+    public SnakeAnnotation() {
+        this.id = snakeIds.getAndIncrement();
+    }
+
+
+    @OnOpen
+    public void onOpen(Session session) {
+        this.snake = new Snake(id, session);
+        SnakeTimer.addSnake(snake);
+        StringBuilder sb = new StringBuilder();
+        for (Iterator<Snake> iterator = SnakeTimer.getSnakes().iterator();
+                iterator.hasNext();) {
+            Snake snake = iterator.next();
+            sb.append(String.format("{\"id\": %d, \"color\": \"%s\"}",
+                    Integer.valueOf(snake.getId()), snake.getHexColor()));
+            if (iterator.hasNext()) {
+                sb.append(',');
+            }
+        }
+        SnakeTimer.broadcast(String.format("{\"type\": \"join\",\"data\":[%s]}",
+                sb.toString()));
+    }
+
+
+    @OnMessage
+    public void onTextMessage(String message) {
+        if ("west".equals(message)) {
+            snake.setDirection(Direction.WEST);
+        } else if ("north".equals(message)) {
+            snake.setDirection(Direction.NORTH);
+        } else if ("east".equals(message)) {
+            snake.setDirection(Direction.EAST);
+        } else if ("south".equals(message)) {
+            snake.setDirection(Direction.SOUTH);
+        }
+    }
+
+
+    @OnClose
+    public void onClose() {
+        SnakeTimer.removeSnake(snake);
+        SnakeTimer.broadcast(String.format("{\"type\": \"leave\", \"id\": %d}",
+                Integer.valueOf(id)));
+    }
+
+
+    @OnError
+    public void onError(Throwable t) throws Throwable {
+        // Most likely cause is a user closing their browser. Check to see if
+        // the root cause is EOF and if it is ignore it.
+        // Protect against infinite loops.
+        int count = 0;
+        Throwable root = t;
+        while (root.getCause() != null && count < 20) {
+            root = root.getCause();
+            count ++;
+        }
+        if (root instanceof EOFException) {
+            // Assume this is triggered by the user closing their browser and
+            // ignore it.
+        } else {
+            throw t;
+        }
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/classes/websocket/snake/SnakeTimer.java b/tomcat/webapps/examples/WEB-INF/classes/websocket/snake/SnakeTimer.java
new file mode 100644
index 0000000000000000000000000000000000000000..011541399e1962e485dee873a5f3d60af017ba29
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/classes/websocket/snake/SnakeTimer.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package websocket.snake;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+
+/**
+ * Sets up the timer for the multi-player snake game WebSocket example.
+ */
+public class SnakeTimer {
+
+    private static final Log log =
+            LogFactory.getLog(SnakeTimer.class);
+
+    private static Timer gameTimer = null;
+
+    private static final long TICK_DELAY = 100;
+
+    private static final ConcurrentHashMap<Integer, Snake> snakes =
+            new ConcurrentHashMap<>();
+
+    protected static synchronized void addSnake(Snake snake) {
+        if (snakes.size() == 0) {
+            startTimer();
+        }
+        snakes.put(Integer.valueOf(snake.getId()), snake);
+    }
+
+
+    protected static Collection<Snake> getSnakes() {
+        return Collections.unmodifiableCollection(snakes.values());
+    }
+
+
+    protected static synchronized void removeSnake(Snake snake) {
+        snakes.remove(Integer.valueOf(snake.getId()));
+        if (snakes.size() == 0) {
+            stopTimer();
+        }
+    }
+
+
+    protected static void tick() {
+        StringBuilder sb = new StringBuilder();
+        for (Iterator<Snake> iterator = SnakeTimer.getSnakes().iterator();
+                iterator.hasNext();) {
+            Snake snake = iterator.next();
+            snake.update(SnakeTimer.getSnakes());
+            sb.append(snake.getLocationsJson());
+            if (iterator.hasNext()) {
+                sb.append(',');
+            }
+        }
+        broadcast(String.format("{\"type\": \"update\", \"data\" : [%s]}",
+                sb.toString()));
+    }
+
+    protected static void broadcast(String message) {
+        for (Snake snake : SnakeTimer.getSnakes()) {
+            try {
+                snake.sendMessage(message);
+            } catch (IllegalStateException ise) {
+                // An ISE can occur if an attempt is made to write to a
+                // WebSocket connection after it has been closed. The
+                // alternative to catching this exception is to synchronise
+                // the writes to the clients along with the addSnake() and
+                // removeSnake() methods that are already synchronised.
+            }
+        }
+    }
+
+
+    public static void startTimer() {
+        gameTimer = new Timer(SnakeTimer.class.getSimpleName() + " Timer");
+        gameTimer.scheduleAtFixedRate(new TimerTask() {
+            @Override
+            public void run() {
+                try {
+                    tick();
+                } catch (RuntimeException e) {
+                    log.error("Caught to prevent timer from shutting down", e);
+                }
+            }
+        }, TICK_DELAY, TICK_DELAY);
+    }
+
+
+    public static void stopTimer() {
+        if (gameTimer != null) {
+            gameTimer.cancel();
+        }
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/jsp/applet/Clock2.java b/tomcat/webapps/examples/WEB-INF/jsp/applet/Clock2.java
new file mode 100644
index 0000000000000000000000000000000000000000..c745815601441b27a7626a1b3b039f6d0f8058a8
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/jsp/applet/Clock2.java
@@ -0,0 +1,230 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import java.applet.Applet;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ * Time!
+ *
+ * @author Rachel Gollub
+ */
+
+public class Clock2 extends Applet implements Runnable {
+    private static final long serialVersionUID = 1L;
+    Thread timer;                // The thread that displays clock
+    int lastxs, lastys, lastxm,
+        lastym, lastxh, lastyh;  // Dimensions used to draw hands
+    SimpleDateFormat formatter;  // Formats the date displayed
+    String lastdate;             // String to hold date displayed
+    Font clockFaceFont;          // Font for number display on clock
+    Date currentDate;            // Used to get date to display
+    Color handColor;             // Color of main hands and dial
+    Color numberColor;           // Color of second hand and numbers
+
+    @Override
+    public void init() {
+        lastxs = lastys = lastxm = lastym = lastxh = lastyh = 0;
+        formatter = new SimpleDateFormat ("EEE MMM dd hh:mm:ss yyyy", Locale.getDefault());
+        currentDate = new Date();
+        lastdate = formatter.format(currentDate);
+        clockFaceFont = new Font("Serif", Font.PLAIN, 14);
+        handColor = Color.blue;
+        numberColor = Color.darkGray;
+
+        try {
+            setBackground(new Color(Integer.parseInt(getParameter("bgcolor"),16)));
+        } catch (Exception e) {
+            // Ignore
+        }
+        try {
+            handColor = new Color(Integer.parseInt(getParameter("fgcolor1"),16));
+        } catch (Exception e) {
+            // Ignore
+        }
+        try {
+            numberColor = new Color(Integer.parseInt(getParameter("fgcolor2"),16));
+        } catch (Exception e) {
+            // Ignore
+        }
+        resize(300,300);              // Set clock window size
+    }
+
+    // Plotpoints allows calculation to only cover 45 degrees of the circle,
+    // and then mirror
+    public void plotpoints(int x0, int y0, int x, int y, Graphics g) {
+        g.drawLine(x0+x,y0+y,x0+x,y0+y);
+        g.drawLine(x0+y,y0+x,x0+y,y0+x);
+        g.drawLine(x0+y,y0-x,x0+y,y0-x);
+        g.drawLine(x0+x,y0-y,x0+x,y0-y);
+        g.drawLine(x0-x,y0-y,x0-x,y0-y);
+        g.drawLine(x0-y,y0-x,x0-y,y0-x);
+        g.drawLine(x0-y,y0+x,x0-y,y0+x);
+        g.drawLine(x0-x,y0+y,x0-x,y0+y);
+    }
+
+    // Circle is just Bresenham's algorithm for a scan converted circle
+    public void circle(int x0, int y0, int r, Graphics g) {
+        int x,y;
+        float d;
+        x=0;
+        y=r;
+        d=5/4-r;
+        plotpoints(x0,y0,x,y,g);
+
+        while (y>x){
+            if (d<0) {
+                d=d+2*x+3;
+                x++;
+            }
+            else {
+                d=d+2*(x-y)+5;
+                x++;
+                y--;
+            }
+            plotpoints(x0,y0,x,y,g);
+        }
+    }
+
+    // Paint is the main part of the program
+    @Override
+    public void paint(Graphics g) {
+        int xh, yh, xm, ym, xs, ys, s = 0, m = 10, h = 10, xcenter, ycenter;
+        String today;
+
+        currentDate = new Date();
+        SimpleDateFormat formatter = new SimpleDateFormat("s",Locale.getDefault());
+        try {
+            s = Integer.parseInt(formatter.format(currentDate));
+        } catch (NumberFormatException n) {
+            s = 0;
+        }
+        formatter.applyPattern("m");
+        try {
+            m = Integer.parseInt(formatter.format(currentDate));
+        } catch (NumberFormatException n) {
+            m = 10;
+        }
+        formatter.applyPattern("h");
+        try {
+            h = Integer.parseInt(formatter.format(currentDate));
+        } catch (NumberFormatException n) {
+            h = 10;
+        }
+        formatter.applyPattern("EEE MMM dd HH:mm:ss yyyy");
+        today = formatter.format(currentDate);
+        xcenter=80;
+        ycenter=55;
+
+    // a= s* pi/2 - pi/2 (to switch 0,0 from 3:00 to 12:00)
+    // x = r(cos a) + xcenter, y = r(sin a) + ycenter
+
+        xs = (int)(Math.cos(s * Math.PI/30 - Math.PI/2) * 45 + xcenter);
+        ys = (int)(Math.sin(s * Math.PI/30 - Math.PI/2) * 45 + ycenter);
+        xm = (int)(Math.cos(m * Math.PI/30 - Math.PI/2) * 40 + xcenter);
+        ym = (int)(Math.sin(m * Math.PI/30 - Math.PI/2) * 40 + ycenter);
+        xh = (int)(Math.cos((h*30 + m/2) * Math.PI/180 - Math.PI/2) * 30 + xcenter);
+        yh = (int)(Math.sin((h*30 + m/2) * Math.PI/180 - Math.PI/2) * 30 + ycenter);
+
+    // Draw the circle and numbers
+
+        g.setFont(clockFaceFont);
+        g.setColor(handColor);
+        circle(xcenter,ycenter,50,g);
+        g.setColor(numberColor);
+        g.drawString("9",xcenter-45,ycenter+3);
+        g.drawString("3",xcenter+40,ycenter+3);
+        g.drawString("12",xcenter-5,ycenter-37);
+        g.drawString("6",xcenter-3,ycenter+45);
+
+    // Erase if necessary, and redraw
+
+        g.setColor(getBackground());
+        if (xs != lastxs || ys != lastys) {
+            g.drawLine(xcenter, ycenter, lastxs, lastys);
+            g.drawString(lastdate, 5, 125);
+        }
+        if (xm != lastxm || ym != lastym) {
+            g.drawLine(xcenter, ycenter-1, lastxm, lastym);
+            g.drawLine(xcenter-1, ycenter, lastxm, lastym); }
+        if (xh != lastxh || yh != lastyh) {
+            g.drawLine(xcenter, ycenter-1, lastxh, lastyh);
+            g.drawLine(xcenter-1, ycenter, lastxh, lastyh); }
+        g.setColor(numberColor);
+        g.drawString("", 5, 125);
+        g.drawString(today, 5, 125);
+        g.drawLine(xcenter, ycenter, xs, ys);
+        g.setColor(handColor);
+        g.drawLine(xcenter, ycenter-1, xm, ym);
+        g.drawLine(xcenter-1, ycenter, xm, ym);
+        g.drawLine(xcenter, ycenter-1, xh, yh);
+        g.drawLine(xcenter-1, ycenter, xh, yh);
+        lastxs=xs; lastys=ys;
+        lastxm=xm; lastym=ym;
+        lastxh=xh; lastyh=yh;
+        lastdate = today;
+        currentDate=null;
+    }
+
+    @Override
+    public void start() {
+        timer = new Thread(this);
+        timer.start();
+    }
+
+    @Override
+    public void stop() {
+        timer = null;
+    }
+
+    @Override
+    public void run() {
+        Thread me = Thread.currentThread();
+        while (timer == me) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+            }
+            repaint();
+        }
+    }
+
+    @Override
+    public void update(Graphics g) {
+        paint(g);
+    }
+
+    @Override
+    public String getAppletInfo() {
+        return "Title: A Clock \nAuthor: Rachel Gollub, 1995 \nAn analog clock.";
+    }
+
+    @Override
+    public String[][] getParameterInfo() {
+        String[][] info = {
+            {"bgcolor", "hexadecimal RGB number", "The background color. Default is the color of your browser."},
+            {"fgcolor1", "hexadecimal RGB number", "The color of the hands and dial. Default is blue."},
+            {"fgcolor2", "hexadecimal RGB number", "The color of the seconds hand and numbers. Default is dark gray."}
+        };
+        return info;
+    }
+}
diff --git a/tomcat/webapps/examples/WEB-INF/jsp/debug-taglib.tld b/tomcat/webapps/examples/WEB-INF/jsp/debug-taglib.tld
new file mode 100644
index 0000000000000000000000000000000000000000..8f082d310350eeca5bd9b5f824a4947622a4f6c1
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/jsp/debug-taglib.tld
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!DOCTYPE taglib
+        PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
+        "http://java.sun.com/j2ee/dtd/web-jsptaglibrary_1_2.dtd">
+
+<!-- a tag library descriptor -->
+
+<taglib>
+  <tlib-version>1.0</tlib-version>
+  <jsp-version>1.2</jsp-version>
+  <short-name>debug</short-name>
+  <uri>http://tomcat.apache.org/debug-taglib</uri>
+  <description>
+    This tag library defines no tags.  Instead, its purpose is encapsulated
+    in the TagLibraryValidator implementation that simply outputs the XML
+    version of a JSP page to standard output, whenever this tag library is
+    referenced in a "taglib" directive in a JSP page.
+  </description>
+  <validator>
+    <validator-class>validators.DebugValidator</validator-class>
+  </validator>
+
+  <!-- This is a dummy tag solely to satisfy DTD requirements -->
+  <tag>
+    <name>log</name>
+    <tag-class>examples.LogTag</tag-class>
+    <body-content>TAGDEPENDENT</body-content>
+    <description>
+        Perform a server side action; Log the message.
+    </description>
+    <attribute>
+        <name>toBrowser</name>
+        <required>false</required>
+    </attribute>
+  </tag>
+
+
+</taglib>
diff --git a/tomcat/webapps/examples/WEB-INF/jsp/example-taglib.tld b/tomcat/webapps/examples/WEB-INF/jsp/example-taglib.tld
new file mode 100644
index 0000000000000000000000000000000000000000..442868ef939235f1c8e60865322d32e649a47d33
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/jsp/example-taglib.tld
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!DOCTYPE taglib
+        PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
+        "http://java.sun.com/j2ee/dtd/web-jsptaglibrary_1_2.dtd">
+
+<taglib>
+
+  <tlib-version>1.0</tlib-version>
+  <jsp-version>1.2</jsp-version>
+  <short-name>simple</short-name>
+  <uri>http://tomcat.apache.org/example-taglib</uri>
+  <description>
+    A simple tab library for the examples
+  </description>
+
+  <tag>
+    <name>ShowSource</name>
+    <tag-class>examples.ShowSource</tag-class>
+    <description> Display JSP sources </description>
+    <attribute>
+       <name>jspFile</name>
+       <required>true</required>
+       <rtexprvalue>true</rtexprvalue>
+    </attribute>
+  </tag>
+
+  <!-- A simple Tag -->
+  <!-- foo tag -->
+  <tag>
+    <name>foo</name>
+    <tag-class>examples.FooTag</tag-class>
+    <tei-class>examples.FooTagExtraInfo</tei-class>
+    <body-content>JSP</body-content>
+    <description>
+      Perform a server side action; uses 3 mandatory attributes
+    </description>
+
+    <attribute>
+      <name>att1</name>
+      <required>true</required>
+    </attribute>
+    <attribute>
+      <name>att2</name>
+      <required>true</required>
+    </attribute>
+    <attribute>
+      <name>att3</name>
+      <required>true</required>
+    </attribute>
+  </tag>
+
+  <!-- Another simple tag -->
+  <!-- log tag -->
+  <tag>
+    <name>log</name>
+    <tag-class>examples.LogTag</tag-class>
+    <body-content>TAGDEPENDENT</body-content>
+    <description>
+      Perform a server side action; Log the message.
+    </description>
+    <attribute>
+      <name>toBrowser</name>
+      <required>false</required>
+    </attribute>
+  </tag>
+
+  <!-- Another simple Tag -->
+  <!-- values tag -->
+  <tag>
+    <name>values</name>
+    <tag-class>examples.ValuesTag</tag-class>
+    <body-content>empty</body-content>
+    <description>
+        Accept and return values of different types. This tag is used
+        to illustrate type coercions.
+    </description>
+    <attribute>
+      <name>object</name>
+      <required>false</required>
+      <rtexprvalue>true</rtexprvalue>
+      <type>java.lang.Object</type>
+    </attribute>
+    <attribute>
+      <name>string</name>
+      <required>false</required>
+      <rtexprvalue>true</rtexprvalue>
+      <type>java.lang.String</type>
+    </attribute>
+    <attribute>
+      <name>long</name>
+      <required>false</required>
+      <rtexprvalue>true</rtexprvalue>
+      <type>long</type>
+    </attribute>
+    <attribute>
+      <name>double</name>
+      <required>false</required>
+      <rtexprvalue>true</rtexprvalue>
+      <type>double</type>
+    </attribute>
+  </tag>
+</taglib>
diff --git a/tomcat/webapps/examples/WEB-INF/jsp2/jsp2-example-taglib.tld b/tomcat/webapps/examples/WEB-INF/jsp2/jsp2-example-taglib.tld
new file mode 100644
index 0000000000000000000000000000000000000000..73173bdafd292911c4334ff505eb7f2c811fe56d
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/jsp2/jsp2-example-taglib.tld
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+    version="2.0">
+    <description>A tag library exercising SimpleTag handlers.</description>
+    <tlib-version>1.0</tlib-version>
+    <short-name>SimpleTagLibrary</short-name>
+    <uri>http://tomcat.apache.org/jsp2-example-taglib</uri>
+    <tag>
+        <description>Outputs Hello, World</description>
+        <name>helloWorld</name>
+        <tag-class>jsp2.examples.simpletag.HelloWorldSimpleTag</tag-class>
+        <body-content>empty</body-content>
+    </tag>
+    <tag>
+        <description>Repeats the body of the tag 'num' times</description>
+        <name>repeat</name>
+        <tag-class>jsp2.examples.simpletag.RepeatSimpleTag</tag-class>
+        <body-content>scriptless</body-content>
+        <variable>
+            <description>Current invocation count (1 to num)</description>
+            <name-given>count</name-given>
+        </variable>
+        <attribute>
+            <name>num</name>
+            <required>true</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+    <tag>
+        <description>Populates the page context with a BookBean</description>
+        <name>findBook</name>
+        <tag-class>jsp2.examples.simpletag.FindBookSimpleTag</tag-class>
+        <body-content>empty</body-content>
+        <attribute>
+            <name>var</name>
+            <required>true</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+    <tag>
+        <description>
+            Takes 3 fragments and invokes them in a random order
+        </description>
+        <name>shuffle</name>
+        <tag-class>jsp2.examples.simpletag.ShuffleSimpleTag</tag-class>
+        <body-content>empty</body-content>
+        <attribute>
+            <name>fragment1</name>
+            <required>true</required>
+            <fragment>true</fragment>
+        </attribute>
+        <attribute>
+            <name>fragment2</name>
+            <required>true</required>
+            <fragment>true</fragment>
+        </attribute>
+        <attribute>
+            <name>fragment3</name>
+            <required>true</required>
+            <fragment>true</fragment>
+        </attribute>
+    </tag>
+    <tag>
+        <description>Outputs a colored tile</description>
+        <name>tile</name>
+        <tag-class>jsp2.examples.simpletag.TileSimpleTag</tag-class>
+        <body-content>empty</body-content>
+        <attribute>
+            <name>color</name>
+            <required>true</required>
+        </attribute>
+        <attribute>
+            <name>label</name>
+            <required>true</required>
+        </attribute>
+    </tag>
+    <tag>
+        <description>
+          Tag that echoes all its attributes and body content
+        </description>
+        <name>echoAttributes</name>
+        <tag-class>jsp2.examples.simpletag.EchoAttributesTag</tag-class>
+        <body-content>empty</body-content>
+        <dynamic-attributes>true</dynamic-attributes>
+    </tag>
+    <function>
+        <description>Reverses the characters in the given String</description>
+        <name>reverse</name>
+        <function-class>jsp2.examples.el.Functions</function-class>
+        <function-signature>java.lang.String reverse( java.lang.String )</function-signature>
+    </function>
+    <function>
+        <description>Counts the number of vowels (a,e,i,o,u) in the given String</description>
+        <name>countVowels</name>
+        <function-class>jsp2.examples.el.Functions</function-class>
+        <function-signature>java.lang.String numVowels( java.lang.String )</function-signature>
+    </function>
+    <function>
+        <description>Converts the string to all caps</description>
+        <name>caps</name>
+        <function-class>jsp2.examples.el.Functions</function-class>
+        <function-signature>java.lang.String caps( java.lang.String )</function-signature>
+    </function>
+</taglib>
+
diff --git a/tomcat/webapps/examples/WEB-INF/lib/taglibs-standard-impl-1.2.5.jar b/tomcat/webapps/examples/WEB-INF/lib/taglibs-standard-impl-1.2.5.jar
new file mode 100644
index 0000000000000000000000000000000000000000..9176777787e57984e2a6451fe52f80147bb1830e
Binary files /dev/null and b/tomcat/webapps/examples/WEB-INF/lib/taglibs-standard-impl-1.2.5.jar differ
diff --git a/tomcat/webapps/examples/WEB-INF/lib/taglibs-standard-spec-1.2.5.jar b/tomcat/webapps/examples/WEB-INF/lib/taglibs-standard-spec-1.2.5.jar
new file mode 100644
index 0000000000000000000000000000000000000000..d54786732bcb5c48f907f5ce1436502aeb48ddef
Binary files /dev/null and b/tomcat/webapps/examples/WEB-INF/lib/taglibs-standard-spec-1.2.5.jar differ
diff --git a/tomcat/webapps/examples/WEB-INF/tags/displayProducts.tag b/tomcat/webapps/examples/WEB-INF/tags/displayProducts.tag
new file mode 100644
index 0000000000000000000000000000000000000000..41e8c353db7040ad5124f7613a1f0e64a2cd95f8
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/tags/displayProducts.tag
@@ -0,0 +1,55 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ attribute name="normalPrice" fragment="true" %>
+<%@ attribute name="onSale" fragment="true" %>
+<%@ variable name-given="name" %>
+<%@ variable name-given="price" %>
+<%@ variable name-given="origPrice" %>
+<%@ variable name-given="salePrice" %>
+
+<table border="1">
+  <tr>
+    <td>
+      <c:set var="name" value="Hand-held Color PDA"/>
+      <c:set var="price" value="$298.86"/>
+      <jsp:invoke fragment="normalPrice"/>
+    </td>
+    <td>
+      <c:set var="name" value="4-Pack 150 Watt Light Bulbs"/>
+      <c:set var="origPrice" value="$2.98"/>
+      <c:set var="salePrice" value="$2.32"/>
+      <jsp:invoke fragment="onSale"/>
+    </td>
+    <td>
+      <c:set var="name" value="Digital Cellular Phone"/>
+      <c:set var="price" value="$68.74"/>
+      <jsp:invoke fragment="normalPrice"/>
+    </td>
+    <td>
+      <c:set var="name" value="Baby Grand Piano"/>
+      <c:set var="price" value="$10,800.00"/>
+      <jsp:invoke fragment="normalPrice"/>
+    </td>
+    <td>
+      <c:set var="name" value="Luxury Car w/ Leather Seats"/>
+      <c:set var="origPrice" value="$23,980.00"/>
+      <c:set var="salePrice" value="$21,070.00"/>
+      <jsp:invoke fragment="onSale"/>
+    </td>
+  </tr>
+</table>
diff --git a/tomcat/webapps/examples/WEB-INF/tags/helloWorld.tag b/tomcat/webapps/examples/WEB-INF/tags/helloWorld.tag
new file mode 100644
index 0000000000000000000000000000000000000000..192bf53cc466c1df947aae17efc304e535c26c39
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/tags/helloWorld.tag
@@ -0,0 +1,17 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+Hello, world!
diff --git a/tomcat/webapps/examples/WEB-INF/tags/panel.tag b/tomcat/webapps/examples/WEB-INF/tags/panel.tag
new file mode 100644
index 0000000000000000000000000000000000000000..f4f30d0244e425dad93f90cf240c4e979d2f65e4
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/tags/panel.tag
@@ -0,0 +1,29 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<%@ attribute name="color" %>
+<%@ attribute name="bgcolor" %>
+<%@ attribute name="title" %>
+<table border="1" bgcolor="${color}">
+  <tr>
+    <td><b>${title}</b></td>
+  </tr>
+  <tr>
+    <td bgcolor="${bgcolor}">
+      <jsp:doBody/>
+    </td>
+  </tr>
+</table>
diff --git a/tomcat/webapps/examples/WEB-INF/web.xml b/tomcat/webapps/examples/WEB-INF/web.xml
new file mode 100644
index 0000000000000000000000000000000000000000..4fb4d16ac95b3929ceb5418e14c1f4ee48f69cf1
--- /dev/null
+++ b/tomcat/webapps/examples/WEB-INF/web.xml
@@ -0,0 +1,399 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
+                      http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
+  version="4.0"
+  metadata-complete="true">
+
+    <description>
+      Servlet and JSP Examples.
+    </description>
+    <display-name>Servlet and JSP Examples</display-name>
+
+    <request-character-encoding>UTF-8</request-character-encoding>
+
+    <!-- Define example filters -->
+    <filter>
+        <filter-name>Timing Filter</filter-name>
+        <filter-class>filters.ExampleFilter</filter-class>
+        <init-param>
+            <param-name>attribute</param-name>
+            <param-value>filters.ExampleFilter</param-value>
+        </init-param>
+    </filter>
+
+    <filter>
+        <filter-name>Request Dumper Filter</filter-name>
+        <filter-class>org.apache.catalina.filters.RequestDumperFilter</filter-class>
+    </filter>
+
+    <filter>
+        <filter-name>Compression Filter</filter-name>
+        <filter-class>compressionFilters.CompressionFilter</filter-class>
+        <init-param>
+            <param-name>compressionThreshold</param-name>
+            <param-value>128</param-value>
+        </init-param>
+        <init-param>
+            <param-name>compressionBuffer</param-name>
+            <param-value>8192</param-value>
+        </init-param>
+        <init-param>
+            <param-name>compressionMimeTypes</param-name>
+            <param-value>text/html,text/plain,text/xml</param-value>
+        </init-param>
+        <init-param>
+          <param-name>debug</param-name>
+          <param-value>0</param-value>
+        </init-param>
+    </filter>
+
+    <!-- Define filter mappings for the timing filters -->
+    <!--
+    <filter-mapping>
+        <filter-name>Timing Filter</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+    -->
+
+<!--
+    <filter-mapping>
+      <filter-name>Compression Filter</filter-name>
+      <url-pattern>/CompressionTest</url-pattern>
+    </filter-mapping>
+-->
+
+<!--
+    <filter-mapping>
+        <filter-name>Request Dumper Filter</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+-->
+
+    <!-- Define example application events listeners -->
+    <listener>
+        <listener-class>listeners.ContextListener</listener-class>
+    </listener>
+    <listener>
+        <listener-class>listeners.SessionListener</listener-class>
+    </listener>
+
+    <!-- Define listeners required by examples -->
+    <listener>
+        <listener-class>async.AsyncStockContextListener</listener-class>
+    </listener>
+
+    <!-- Define servlets that are included in the example application -->
+
+    <servlet>
+      <servlet-name>ServletToJsp</servlet-name>
+      <servlet-class>ServletToJsp</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>CompressionFilterTestServlet</servlet-name>
+        <servlet-class>compressionFilters.CompressionFilterTestServlet</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>HelloWorldExample</servlet-name>
+        <servlet-class>HelloWorldExample</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>RequestInfoExample</servlet-name>
+        <servlet-class>RequestInfoExample</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>RequestHeaderExample</servlet-name>
+        <servlet-class>RequestHeaderExample</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>RequestParamExample</servlet-name>
+        <servlet-class>RequestParamExample</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>CookieExample</servlet-name>
+        <servlet-class>CookieExample</servlet-class>
+    </servlet>
+    <servlet>
+        <servlet-name>SessionExample</servlet-name>
+        <servlet-class>SessionExample</servlet-class>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>CompressionFilterTestServlet</servlet-name>
+        <url-pattern>/CompressionTest</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>HelloWorldExample</servlet-name>
+        <url-pattern>/servlets/servlet/HelloWorldExample</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>RequestInfoExample</servlet-name>
+        <url-pattern>/servlets/servlet/RequestInfoExample/*</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>RequestHeaderExample</servlet-name>
+        <url-pattern>/servlets/servlet/RequestHeaderExample</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>RequestParamExample</servlet-name>
+        <url-pattern>/servlets/servlet/RequestParamExample</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>CookieExample</servlet-name>
+        <url-pattern>/servlets/servlet/CookieExample</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>SessionExample</servlet-name>
+        <url-pattern>/servlets/servlet/SessionExample</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>ServletToJsp</servlet-name>
+        <url-pattern>/servletToJsp</url-pattern>
+    </servlet-mapping>
+
+    <jsp-config>
+        <taglib>
+            <taglib-uri>
+               http://tomcat.apache.org/debug-taglib
+            </taglib-uri>
+            <taglib-location>
+               /WEB-INF/jsp/debug-taglib.tld
+            </taglib-location>
+        </taglib>
+
+        <taglib>
+            <taglib-uri>
+               http://tomcat.apache.org/example-taglib
+            </taglib-uri>
+            <taglib-location>
+               /WEB-INF/jsp/example-taglib.tld
+            </taglib-location>
+        </taglib>
+
+        <taglib>
+            <taglib-uri>
+               http://tomcat.apache.org/jsp2-example-taglib
+            </taglib-uri>
+            <taglib-location>
+               /WEB-INF/jsp2/jsp2-example-taglib.tld
+            </taglib-location>
+        </taglib>
+
+        <jsp-property-group>
+            <description>
+                Special property group for JSP Configuration JSP example.
+            </description>
+            <display-name>JSPConfiguration</display-name>
+            <url-pattern>/jsp/jsp2/misc/config.jsp</url-pattern>
+            <el-ignored>true</el-ignored>
+            <page-encoding>ISO-8859-1</page-encoding>
+            <scripting-invalid>true</scripting-invalid>
+            <include-prelude>/jsp/jsp2/misc/prelude.jspf</include-prelude>
+            <include-coda>/jsp/jsp2/misc/coda.jspf</include-coda>
+        </jsp-property-group>
+    </jsp-config>
+
+   <security-constraint>
+      <display-name>Example Security Constraint - part 1</display-name>
+      <web-resource-collection>
+         <web-resource-name>Protected Area - Allow methods</web-resource-name>
+         <!-- Define the context-relative URL(s) to be protected -->
+         <url-pattern>/jsp/security/protected/*</url-pattern>
+         <!-- If you list http methods, only those methods are protected so -->
+         <!-- the constraint below ensures all other methods are denied     -->
+         <http-method>DELETE</http-method>
+         <http-method>GET</http-method>
+         <http-method>POST</http-method>
+         <http-method>PUT</http-method>
+      </web-resource-collection>
+      <auth-constraint>
+         <!-- Anyone with one of the listed roles may access this area -->
+         <role-name>tomcat</role-name>
+         <role-name>role1</role-name>
+      </auth-constraint>
+    </security-constraint>
+   <security-constraint>
+      <display-name>Example Security Constraint - part 2</display-name>
+      <web-resource-collection>
+         <web-resource-name>Protected Area - Deny methods</web-resource-name>
+         <!-- Define the context-relative URL(s) to be protected -->
+         <url-pattern>/jsp/security/protected/*</url-pattern>
+         <http-method-omission>DELETE</http-method-omission>
+         <http-method-omission>GET</http-method-omission>
+         <http-method-omission>POST</http-method-omission>
+         <http-method-omission>PUT</http-method-omission>
+      </web-resource-collection>
+      <!-- An empty auth constraint denies access -->
+      <auth-constraint />
+    </security-constraint>
+
+    <!-- Default login configuration uses form-based authentication -->
+    <login-config>
+      <auth-method>FORM</auth-method>
+      <realm-name>Example Form-Based Authentication Area</realm-name>
+      <form-login-config>
+        <form-login-page>/jsp/security/protected/login.jsp</form-login-page>
+        <form-error-page>/jsp/security/protected/error.jsp</form-error-page>
+      </form-login-config>
+    </login-config>
+
+    <!-- Security roles referenced by this web application -->
+    <security-role>
+      <role-name>role1</role-name>
+    </security-role>
+    <security-role>
+      <role-name>tomcat</role-name>
+    </security-role>
+
+    <!-- Environment entry examples -->
+    <!--env-entry>
+      <env-entry-description>
+         The maximum number of tax exemptions allowed to be set.
+      </env-entry-description>
+      <env-entry-name>maxExemptions</env-entry-name>
+      <env-entry-type>java.lang.Integer</env-entry-type>
+      <env-entry-value>15</env-entry-value>
+    </env-entry-->
+    <env-entry>
+      <env-entry-name>minExemptions</env-entry-name>
+      <env-entry-type>java.lang.Integer</env-entry-type>
+      <env-entry-value>1</env-entry-value>
+    </env-entry>
+    <env-entry>
+      <env-entry-name>foo/name1</env-entry-name>
+      <env-entry-type>java.lang.String</env-entry-type>
+      <env-entry-value>value1</env-entry-value>
+    </env-entry>
+    <env-entry>
+      <env-entry-name>foo/bar/name2</env-entry-name>
+      <env-entry-type>java.lang.Boolean</env-entry-type>
+      <env-entry-value>true</env-entry-value>
+    </env-entry>
+    <env-entry>
+      <env-entry-name>name3</env-entry-name>
+      <env-entry-type>java.lang.Integer</env-entry-type>
+      <env-entry-value>1</env-entry-value>
+    </env-entry>
+    <env-entry>
+      <env-entry-name>foo/name4</env-entry-name>
+      <env-entry-type>java.lang.Integer</env-entry-type>
+      <env-entry-value>10</env-entry-value>
+    </env-entry>
+
+    <!-- Async examples -->
+    <servlet>
+      <servlet-name>async0</servlet-name>
+      <servlet-class>async.Async0</servlet-class>
+      <async-supported>true</async-supported>
+    </servlet>
+    <servlet-mapping>
+      <servlet-name>async0</servlet-name>
+      <url-pattern>/async/async0</url-pattern>
+    </servlet-mapping>
+    <servlet>
+      <servlet-name>async1</servlet-name>
+      <servlet-class>async.Async1</servlet-class>
+      <async-supported>true</async-supported>
+    </servlet>
+    <servlet-mapping>
+      <servlet-name>async1</servlet-name>
+      <url-pattern>/async/async1</url-pattern>
+    </servlet-mapping>
+    <servlet>
+      <servlet-name>async2</servlet-name>
+      <servlet-class>async.Async2</servlet-class>
+      <async-supported>true</async-supported>
+    </servlet>
+    <servlet-mapping>
+      <servlet-name>async2</servlet-name>
+      <url-pattern>/async/async2</url-pattern>
+    </servlet-mapping>
+    <servlet>
+      <servlet-name>async3</servlet-name>
+      <servlet-class>async.Async3</servlet-class>
+      <async-supported>true</async-supported>
+    </servlet>
+    <servlet-mapping>
+      <servlet-name>async3</servlet-name>
+      <url-pattern>/async/async3</url-pattern>
+    </servlet-mapping>
+    <servlet>
+      <servlet-name>stock</servlet-name>
+      <servlet-class>async.AsyncStockServlet</servlet-class>
+      <async-supported>true</async-supported>
+    </servlet>
+    <servlet-mapping>
+      <servlet-name>stock</servlet-name>
+      <url-pattern>/async/stockticker</url-pattern>
+    </servlet-mapping>
+
+    <!-- Non-blocking IO examples -->
+    <servlet>
+      <servlet-name>bytecounter</servlet-name>
+      <servlet-class>nonblocking.ByteCounter</servlet-class>
+      <async-supported>true</async-supported>
+    </servlet>
+    <servlet-mapping>
+      <servlet-name>bytecounter</servlet-name>
+      <url-pattern>/servlets/nonblocking/bytecounter</url-pattern>
+    </servlet-mapping>
+    <servlet>
+      <servlet-name>numberwriter</servlet-name>
+      <servlet-class>nonblocking.NumberWriter</servlet-class>
+      <async-supported>true</async-supported>
+    </servlet>
+    <servlet-mapping>
+      <servlet-name>numberwriter</servlet-name>
+      <url-pattern>/servlets/nonblocking/numberwriter</url-pattern>
+    </servlet-mapping>
+
+    <!-- Server Push examples -->
+    <servlet>
+      <servlet-name>simpleimagepush</servlet-name>
+      <servlet-class>http2.SimpleImagePush</servlet-class>
+    </servlet>
+    <servlet-mapping>
+      <servlet-name>simpleimagepush</servlet-name>
+      <url-pattern>/servlets/serverpush/simpleimage</url-pattern>
+    </servlet-mapping>
+
+    <!-- Trailer examples -->
+    <servlet>
+      <servlet-name>responsetrailer</servlet-name>
+      <servlet-class>trailers.ResponseTrailers</servlet-class>
+    </servlet>
+    <servlet-mapping>
+      <servlet-name>responsetrailer</servlet-name>
+      <url-pattern>/servlets/trailers/response</url-pattern>
+    </servlet-mapping>
+
+    <welcome-file-list>
+        <welcome-file>index.html</welcome-file>
+        <welcome-file>index.xhtml</welcome-file>
+        <welcome-file>index.htm</welcome-file>
+        <welcome-file>index.jsp</welcome-file>
+    </welcome-file-list>
+
+    <!-- Websocket examples -->
+    <listener>
+        <listener-class>websocket.drawboard.DrawboardContextListener</listener-class>
+    </listener>
+
+</web-app>
diff --git a/tomcat/webapps/examples/index.html b/tomcat/webapps/examples/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..0799e10f7227885c731264ffe11c9bcafee11901
--- /dev/null
+++ b/tomcat/webapps/examples/index.html
@@ -0,0 +1,30 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!DOCTYPE HTML><html lang="en"><head>
+<meta charset="UTF-8">
+<title>Apache Tomcat Examples</title>
+</head>
+<body>
+<p>
+<h3>Apache Tomcat Examples</H3>
+<p></p>
+<ul>
+<li><a href="servlets">Servlets examples</a></li>
+<li><a href="jsp">JSP Examples</a></li>
+<li><a href="websocket/index.xhtml">WebSocket Examples</a></li>
+</ul>
+</body></html>
diff --git a/tomcat/webapps/examples/jsp/async/async1.jsp b/tomcat/webapps/examples/jsp/async/async1.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..af88869eaca2839ee55f644a87aab3e4cf856e28
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/async/async1.jsp
@@ -0,0 +1,28 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@page session="false" import="java.util.Date,java.text.SimpleDateFormat"%>
+Output from async1.jsp
+Type is <%=request.getDispatcherType()%>
+<%
+  System.out.println("Inside Async 1");
+  if (request.isAsyncStarted()) {
+    request.getAsyncContext().complete();
+  }
+  Date date = new Date(System.currentTimeMillis());
+  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
+%>
+Completed async request at <%=sdf.format(date)%>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/async/async1.jsp.html b/tomcat/webapps/examples/jsp/async/async1.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..2244765eb11302def78d84b25b580e9061874ef6
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/async/async1.jsp.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@page session="false" import="java.util.Date,java.text.SimpleDateFormat"%>
+Output from async1.jsp
+Type is &lt;%=request.getDispatcherType()%>
+&lt;%
+  System.out.println("Inside Async 1");
+  if (request.isAsyncStarted()) {
+    request.getAsyncContext().complete();
+  }
+  Date date = new Date(System.currentTimeMillis());
+  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
+%>
+Completed async request at &lt;%=sdf.format(date)%>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/async/async3.jsp b/tomcat/webapps/examples/jsp/async/async3.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..9d24e60194e246f537fed0dea425e35e97ba632a
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/async/async3.jsp
@@ -0,0 +1,25 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@page session="false" import="java.util.Date,java.text.SimpleDateFormat"%>
+Output from async3.jsp
+Type is <%=request.getDispatcherType()%>
+<%
+  Date date = new Date(System.currentTimeMillis());
+  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
+%>
+
+Completed async 3 request at <%=sdf.format(date)%>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/async/async3.jsp.html b/tomcat/webapps/examples/jsp/async/async3.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..6deced8523f2a2bdf2575ba10525533e90348c27
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/async/async3.jsp.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@page session="false" import="java.util.Date,java.text.SimpleDateFormat"%>
+Output from async3.jsp
+Type is &lt;%=request.getDispatcherType()%>
+&lt;%
+  Date date = new Date(System.currentTimeMillis());
+  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
+%>
+
+Completed async 3 request at &lt;%=sdf.format(date)%>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/async/index.jsp b/tomcat/webapps/examples/jsp/async/index.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..be2d713639153d9146ca268bdd4bebc604973b6b
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/async/index.jsp
@@ -0,0 +1,69 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@page session="false"%>
+
+<pre>
+Use cases:
+
+1. Simple dispatch
+ - servlet does startAsync()
+ - background thread calls ctx.dispatch()
+   <a href="<%=response.encodeURL("/examples/async/async0")%>"> Async 0 </a>
+
+2. Simple dispatch
+ - servlet does startAsync()
+ - background thread calls dispatch(/path/to/jsp)
+   <a href="<%=response.encodeURL("/examples/async/async1")%>"> Async 1 </a>
+
+3. Simple dispatch
+ - servlet does startAsync()
+ - background thread calls writes and calls complete()
+   <a href="<%=response.encodeURL("/examples/async/async2")%>"> Async 2 </a>
+
+4. Simple dispatch
+ - servlet does a startAsync()
+ - servlet calls dispatch(/path/to/jsp)
+ - servlet calls complete()
+   <a href="<%=response.encodeURL("/examples/async/async3")%>"> Async 3 </a>
+
+3. Timeout s1
+ - servlet does a startAsync()
+ - servlet does a setAsyncTimeout
+ - returns - waits for timeout to happen should return error page
+
+4. Timeout s2
+ - servlet does a startAsync()
+ - servlet does a setAsyncTimeout
+ - servlet does a addAsyncListener
+ - returns - waits for timeout to happen and listener invoked
+
+5. Dispatch to asyncSupported=false servlet
+ - servlet1 does a startAsync()
+ - servlet1 dispatches to dispatch(/servlet2)
+ - the container calls complete() after servlet2 is complete
+ - TODO
+
+6. Chained dispatch
+ - servlet1 does a startAsync
+ - servlet1 does a dispatch to servlet2 (asyncsupported=true)
+ - servlet2 does a dispatch to servlet3 (asyncsupported=true)
+ - servlet3 does a dispatch to servlet4 (asyncsupported=false)
+
+
+7. Stock ticker
+   <a href="<%=response.encodeURL("/examples/async/stockticker")%>"> StockTicker </a>
+</pre>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/async/index.jsp.html b/tomcat/webapps/examples/jsp/async/index.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..778b6434faedb339f99b2f2e3230bf5bd8bb5222
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/async/index.jsp.html
@@ -0,0 +1,70 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@page session="false"%>
+
+&lt;pre>
+Use cases:
+
+1. Simple dispatch
+ - servlet does startAsync()
+ - background thread calls ctx.dispatch()
+   &lt;a href="&lt;%=response.encodeURL("/examples/async/async0")%>"> Async 0 &lt;/a>
+
+2. Simple dispatch
+ - servlet does startAsync()
+ - background thread calls dispatch(/path/to/jsp)
+   &lt;a href="&lt;%=response.encodeURL("/examples/async/async1")%>"> Async 1 &lt;/a>
+
+3. Simple dispatch
+ - servlet does startAsync()
+ - background thread calls writes and calls complete()
+   &lt;a href="&lt;%=response.encodeURL("/examples/async/async2")%>"> Async 2 &lt;/a>
+
+4. Simple dispatch
+ - servlet does a startAsync()
+ - servlet calls dispatch(/path/to/jsp)
+ - servlet calls complete()
+   &lt;a href="&lt;%=response.encodeURL("/examples/async/async3")%>"> Async 3 &lt;/a>
+
+3. Timeout s1
+ - servlet does a startAsync()
+ - servlet does a setAsyncTimeout
+ - returns - waits for timeout to happen should return error page
+
+4. Timeout s2
+ - servlet does a startAsync()
+ - servlet does a setAsyncTimeout
+ - servlet does a addAsyncListener
+ - returns - waits for timeout to happen and listener invoked
+
+5. Dispatch to asyncSupported=false servlet
+ - servlet1 does a startAsync()
+ - servlet1 dispatches to dispatch(/servlet2)
+ - the container calls complete() after servlet2 is complete
+ - TODO
+
+6. Chained dispatch
+ - servlet1 does a startAsync
+ - servlet1 does a dispatch to servlet2 (asyncsupported=true)
+ - servlet2 does a dispatch to servlet3 (asyncsupported=true)
+ - servlet3 does a dispatch to servlet4 (asyncsupported=false)
+
+
+7. Stock ticker
+   &lt;a href="&lt;%=response.encodeURL("/examples/async/stockticker")%>"> StockTicker &lt;/a>
+&lt;/pre>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/cal/Entries.java.html b/tomcat/webapps/examples/jsp/cal/Entries.java.html
new file mode 100644
index 0000000000000000000000000000000000000000..03f9a0c16dc0f8bc940a2283f34cadf58ca18e38
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/cal/Entries.java.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cal;
+
+import java.util.Hashtable;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class Entries {
+
+    private final Hashtable&lt;String, Entry> entries;
+    private static final String[] time = { "8am", "9am", "10am", "11am",
+            "12pm", "1pm", "2pm", "3pm", "4pm", "5pm", "6pm", "7pm", "8pm" };
+    public static final int rows = 12;
+
+    public Entries() {
+        entries = new Hashtable&lt;>(rows);
+        for (int i = 0; i &lt; rows; i++) {
+            entries.put(time[i], new Entry(time[i]));
+        }
+    }
+
+    public int getRows() {
+        return rows;
+    }
+
+    public Entry getEntry(int index) {
+        return this.entries.get(time[index]);
+    }
+
+    public int getIndex(String tm) {
+        for (int i = 0; i &lt; rows; i++)
+            if (tm.equals(time[i]))
+                return i;
+        return -1;
+    }
+
+    public void processRequest(HttpServletRequest request, String tm) {
+        int index = getIndex(tm);
+        if (index >= 0) {
+            String descr = request.getParameter("description");
+            entries.get(time[index]).setDescription(descr);
+        }
+    }
+
+}
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/cal/Entry.java.html b/tomcat/webapps/examples/jsp/cal/Entry.java.html
new file mode 100644
index 0000000000000000000000000000000000000000..7183a0ac26a5ca868126805a26f1c45ea1cf39a8
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/cal/Entry.java.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cal;
+
+public class Entry {
+
+    final String hour;
+    String description;
+
+    public Entry(String hour) {
+        this.hour = hour;
+        this.description = "";
+
+    }
+
+    public String getHour() {
+        return this.hour;
+    }
+
+    public String getColor() {
+        if (description.equals("")) {
+            return "lightblue";
+        }
+        return "red";
+    }
+
+    public String getDescription() {
+        if (description.equals("")) {
+            return "None";
+        }
+        return this.description;
+    }
+
+    public void setDescription(String descr) {
+        description = descr;
+    }
+
+}
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/cal/JspCalendar.java.html b/tomcat/webapps/examples/jsp/cal/JspCalendar.java.html
new file mode 100644
index 0000000000000000000000000000000000000000..118996ee4f9278c2b89c84918728d5f0eefcfda0
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/cal/JspCalendar.java.html
@@ -0,0 +1,152 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package cal;
+
+import java.util.Calendar;
+import java.util.Date;
+
+public class JspCalendar {
+    final Calendar  calendar;
+
+    public JspCalendar() {
+        calendar = Calendar.getInstance();
+        Date trialTime = new Date();
+        calendar.setTime(trialTime);
+    }
+
+
+    public int getYear() {
+        return calendar.get(Calendar.YEAR);
+    }
+
+    public String getMonth() {
+        int m = getMonthInt();
+        String[] months = new String [] { "January", "February", "March",
+                                        "April", "May", "June",
+                                        "July", "August", "September",
+                                        "October", "November", "December" };
+        if (m > 12)
+            return "Unknown to Man";
+
+        return months[m - 1];
+
+    }
+
+    public String getDay() {
+        int x = getDayOfWeek();
+        String[] days = new String[] {"Sunday", "Monday", "Tuesday", "Wednesday",
+                                      "Thursday", "Friday", "Saturday"};
+
+        if (x > 7)
+            return "Unknown to Man";
+
+        return days[x - 1];
+
+    }
+
+    public int getMonthInt() {
+        return 1 + calendar.get(Calendar.MONTH);
+    }
+
+    public String getDate() {
+        return getMonthInt() + "/" + getDayOfMonth() + "/" +  getYear();
+    }
+
+    public String getCurrentDate() {
+        Date dt = new Date ();
+        calendar.setTime (dt);
+        return getMonthInt() + "/" + getDayOfMonth() + "/" +  getYear();
+
+    }
+
+    public String getNextDate() {
+        calendar.set (Calendar.DAY_OF_MONTH, getDayOfMonth() + 1);
+        return getDate ();
+    }
+
+    public String getPrevDate() {
+        calendar.set (Calendar.DAY_OF_MONTH, getDayOfMonth() - 1);
+        return getDate ();
+    }
+
+    public String getTime() {
+        return getHour() + ":" + getMinute() + ":" + getSecond();
+    }
+
+    public int getDayOfMonth() {
+        return calendar.get(Calendar.DAY_OF_MONTH);
+    }
+
+    public int getDayOfYear() {
+        return calendar.get(Calendar.DAY_OF_YEAR);
+    }
+
+    public int getWeekOfYear() {
+        return calendar.get(Calendar.WEEK_OF_YEAR);
+    }
+
+    public int getWeekOfMonth() {
+        return calendar.get(Calendar.WEEK_OF_MONTH);
+    }
+
+    public int getDayOfWeek() {
+        return calendar.get(Calendar.DAY_OF_WEEK);
+    }
+
+    public int getHour() {
+        return calendar.get(Calendar.HOUR_OF_DAY);
+    }
+
+    public int getMinute() {
+        return calendar.get(Calendar.MINUTE);
+    }
+
+
+    public int getSecond() {
+        return calendar.get(Calendar.SECOND);
+    }
+
+
+    public int getEra() {
+        return calendar.get(Calendar.ERA);
+    }
+
+    public String getUSTimeZone() {
+        String[] zones = new String[] {"Hawaii", "Alaskan", "Pacific",
+                                       "Mountain", "Central", "Eastern"};
+
+        return zones[10 + getZoneOffset()];
+    }
+
+    public int getZoneOffset() {
+        return calendar.get(Calendar.ZONE_OFFSET)/(60*60*1000);
+    }
+
+
+    public int getDSTOffset() {
+        return calendar.get(Calendar.DST_OFFSET)/(60*60*1000);
+    }
+
+
+    public int getAMPM() {
+        return calendar.get(Calendar.AM_PM);
+    }
+}
+
+
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/cal/TableBean.java.html b/tomcat/webapps/examples/jsp/cal/TableBean.java.html
new file mode 100644
index 0000000000000000000000000000000000000000..00a8a04a184e4a4f6d85ec316ce0ec455a1ca19f
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/cal/TableBean.java.html
@@ -0,0 +1,102 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cal;
+
+import java.util.Hashtable;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class TableBean {
+
+    final Hashtable&lt;String, Entries> table;
+    final JspCalendar JspCal;
+    Entries entries;
+    String date;
+    String name = null;
+    String email = null;
+    boolean processError = false;
+
+    public TableBean() {
+        this.table = new Hashtable&lt;>(10);
+        this.JspCal = new JspCalendar();
+        this.date = JspCal.getCurrentDate();
+    }
+
+    public void setName(String nm) {
+        this.name = nm;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public void setEmail(String mail) {
+        this.email = mail;
+    }
+
+    public String getEmail() {
+        return this.email;
+    }
+
+    public String getDate() {
+        return this.date;
+    }
+
+    public Entries getEntries() {
+        return this.entries;
+    }
+
+    public void processRequest(HttpServletRequest request) {
+
+        // Get the name and e-mail.
+        this.processError = false;
+        if (name == null || name.equals(""))
+            setName(request.getParameter("name"));
+        if (email == null || email.equals(""))
+            setEmail(request.getParameter("email"));
+        if (name == null || email == null || name.equals("")
+                || email.equals("")) {
+            this.processError = true;
+            return;
+        }
+
+        // Get the date.
+        String dateR = request.getParameter("date");
+        if (dateR == null)
+            date = JspCal.getCurrentDate();
+        else if (dateR.equalsIgnoreCase("next"))
+            date = JspCal.getNextDate();
+        else if (dateR.equalsIgnoreCase("prev"))
+            date = JspCal.getPrevDate();
+
+        entries = table.get(date);
+        if (entries == null) {
+            entries = new Entries();
+            table.put(date, entries);
+        }
+
+        // If time is provided add the event.
+        String time = request.getParameter("time");
+        if (time != null)
+            entries.processRequest(request, time);
+    }
+
+    public boolean getProcessError() {
+        return this.processError;
+    }
+}
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/cal/cal1.jsp b/tomcat/webapps/examples/jsp/cal/cal1.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..e6b8a49d0c9eb169f8a46735f87d7680b6da9140
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/cal/cal1.jsp
@@ -0,0 +1,94 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@page contentType="text/html; charset=UTF-8" %>
+<HTML>
+<HEAD><TITLE>
+    Calendar: A JSP APPLICATION
+</TITLE></HEAD>
+
+
+<BODY BGCOLOR="white">
+
+<%@ page language="java" import="cal.*" %>
+<jsp:useBean id="table" scope="session" class="cal.TableBean" />
+
+<%
+    table.processRequest(request);
+    if (table.getProcessError() == false) {
+%>
+
+<!-- html table goes here -->
+<CENTER>
+<TABLE WIDTH=60% BGCOLOR=yellow CELLPADDING=15>
+<TR>
+<TD ALIGN=CENTER> <A HREF=cal1.jsp?date=prev> prev </A>
+<TD ALIGN=CENTER> Calendar:<%= table.getDate() %></TD>
+<TD ALIGN=CENTER> <A HREF=cal1.jsp?date=next> next </A>
+</TR>
+</TABLE>
+
+<!-- the main table -->
+<TABLE WIDTH=60% BGCOLOR=lightblue BORDER=1 CELLPADDING=10>
+<TR>
+<TH> Time </TH>
+<TH> Appointment </TH>
+</TR>
+<FORM METHOD=POST ACTION=cal1.jsp>
+<%
+    for(int i=0; i<table.getEntries().getRows(); i++) {
+       cal.Entry entr = table.getEntries().getEntry(i);
+%>
+    <TR>
+    <TD>
+    <A HREF=cal2.jsp?time=<%= entr.getHour() %>>
+        <%= entr.getHour() %> </A>
+    </TD>
+    <TD BGCOLOR=<%= entr.getColor() %>>
+    <% out.print(util.HTMLFilter.filter(entr.getDescription())); %>
+    </TD>
+    </TR>
+<%
+    }
+%>
+</FORM>
+</TABLE>
+<BR>
+
+<!-- footer -->
+<TABLE WIDTH=60% BGCOLOR=yellow CELLPADDING=15>
+<TR>
+<TD ALIGN=CENTER>  <% out.print(util.HTMLFilter.filter(table.getName())); %> :
+             <% out.print(util.HTMLFilter.filter(table.getEmail())); %> </TD>
+</TR>
+</TABLE>
+</CENTER>
+
+<%
+    } else {
+%>
+<font size=5>
+    You must enter your name and email address correctly.
+</font>
+<%
+    }
+%>
+
+
+</BODY>
+</HTML>
+
+
diff --git a/tomcat/webapps/examples/jsp/cal/cal1.jsp.html b/tomcat/webapps/examples/jsp/cal/cal1.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..7daddf010de3652aca82e2e7888ae5dcd17283b3
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/cal/cal1.jsp.html
@@ -0,0 +1,95 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@page contentType="text/html; charset=UTF-8" %>
+&lt;HTML>
+&lt;HEAD>&lt;TITLE>
+    Calendar: A JSP APPLICATION
+&lt;/TITLE>&lt;/HEAD>
+
+
+&lt;BODY BGCOLOR="white">
+
+&lt;%@ page language="java" import="cal.*" %>
+&lt;jsp:useBean id="table" scope="session" class="cal.TableBean" />
+
+&lt;%
+    table.processRequest(request);
+    if (table.getProcessError() == false) {
+%>
+
+&lt;!-- html table goes here -->
+&lt;CENTER>
+&lt;TABLE WIDTH=60% BGCOLOR=yellow CELLPADDING=15>
+&lt;TR>
+&lt;TD ALIGN=CENTER> &lt;A HREF=cal1.jsp?date=prev> prev &lt;/A>
+&lt;TD ALIGN=CENTER> Calendar:&lt;%= table.getDate() %>&lt;/TD>
+&lt;TD ALIGN=CENTER> &lt;A HREF=cal1.jsp?date=next> next &lt;/A>
+&lt;/TR>
+&lt;/TABLE>
+
+&lt;!-- the main table -->
+&lt;TABLE WIDTH=60% BGCOLOR=lightblue BORDER=1 CELLPADDING=10>
+&lt;TR>
+&lt;TH> Time &lt;/TH>
+&lt;TH> Appointment &lt;/TH>
+&lt;/TR>
+&lt;FORM METHOD=POST ACTION=cal1.jsp>
+&lt;%
+    for(int i=0; i&lt;table.getEntries().getRows(); i++) {
+       cal.Entry entr = table.getEntries().getEntry(i);
+%>
+    &lt;TR>
+    &lt;TD>
+    &lt;A HREF=cal2.jsp?time=&lt;%= entr.getHour() %>>
+        &lt;%= entr.getHour() %> &lt;/A>
+    &lt;/TD>
+    &lt;TD BGCOLOR=&lt;%= entr.getColor() %>>
+    &lt;% out.print(util.HTMLFilter.filter(entr.getDescription())); %>
+    &lt;/TD>
+    &lt;/TR>
+&lt;%
+    }
+%>
+&lt;/FORM>
+&lt;/TABLE>
+&lt;BR>
+
+&lt;!-- footer -->
+&lt;TABLE WIDTH=60% BGCOLOR=yellow CELLPADDING=15>
+&lt;TR>
+&lt;TD ALIGN=CENTER>  &lt;% out.print(util.HTMLFilter.filter(table.getName())); %> :
+             &lt;% out.print(util.HTMLFilter.filter(table.getEmail())); %> &lt;/TD>
+&lt;/TR>
+&lt;/TABLE>
+&lt;/CENTER>
+
+&lt;%
+    } else {
+%>
+&lt;font size=5>
+    You must enter your name and email address correctly.
+&lt;/font>
+&lt;%
+    }
+%>
+
+
+&lt;/BODY>
+&lt;/HTML>
+
+
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/cal/cal2.jsp b/tomcat/webapps/examples/jsp/cal/cal2.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..e7e14d8e0468825cc23b95a8c332c8990acfd873
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/cal/cal2.jsp
@@ -0,0 +1,45 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@page contentType="text/html; charset=UTF-8" %>
+<HTML>
+<HEAD><TITLE>
+    Calendar: A JSP APPLICATION
+</TITLE></HEAD>
+
+
+<BODY BGCOLOR="white">
+<jsp:useBean id="table" scope="session" class="cal.TableBean" />
+
+<%
+    String time = request.getParameter ("time");
+%>
+
+<FONT SIZE=5> Please add the following event:
+<BR> <h3> Date <%= table.getDate() %>
+<BR> Time <%= util.HTMLFilter.filter(time) %> </h3>
+</FONT>
+<FORM METHOD=POST ACTION=cal1.jsp>
+<BR>
+<BR> <INPUT NAME="date" TYPE=HIDDEN VALUE="current">
+<BR> <INPUT NAME="time" TYPE=HIDDEN VALUE="<%= util.HTMLFilter.filter(time) %>">
+<BR> <h2> Description of the event <INPUT NAME="description" TYPE=TEXT SIZE=20> </h2>
+<BR> <INPUT TYPE=SUBMIT VALUE="submit">
+</FORM>
+
+</BODY>
+</HTML>
+
diff --git a/tomcat/webapps/examples/jsp/cal/cal2.jsp.html b/tomcat/webapps/examples/jsp/cal/cal2.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..2cc191bc35ba4f09dcbfa770e25cc50bd8191a8f
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/cal/cal2.jsp.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@page contentType="text/html; charset=UTF-8" %>
+&lt;HTML>
+&lt;HEAD>&lt;TITLE>
+    Calendar: A JSP APPLICATION
+&lt;/TITLE>&lt;/HEAD>
+
+
+&lt;BODY BGCOLOR="white">
+&lt;jsp:useBean id="table" scope="session" class="cal.TableBean" />
+
+&lt;%
+    String time = request.getParameter ("time");
+%>
+
+&lt;FONT SIZE=5> Please add the following event:
+&lt;BR> &lt;h3> Date &lt;%= table.getDate() %>
+&lt;BR> Time &lt;%= util.HTMLFilter.filter(time) %> &lt;/h3>
+&lt;/FONT>
+&lt;FORM METHOD=POST ACTION=cal1.jsp>
+&lt;BR>
+&lt;BR> &lt;INPUT NAME="date" TYPE=HIDDEN VALUE="current">
+&lt;BR> &lt;INPUT NAME="time" TYPE=HIDDEN VALUE="&lt;%= util.HTMLFilter.filter(time) %>">
+&lt;BR> &lt;h2> Description of the event &lt;INPUT NAME="description" TYPE=TEXT SIZE=20> &lt;/h2>
+&lt;BR> &lt;INPUT TYPE=SUBMIT VALUE="submit">
+&lt;/FORM>
+
+&lt;/BODY>
+&lt;/HTML>
+
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/cal/calendar.html b/tomcat/webapps/examples/jsp/cal/calendar.html
new file mode 100644
index 0000000000000000000000000000000000000000..a0a3ea1841341fbd612d633dc5bed3f0171b1c36
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/cal/calendar.html
@@ -0,0 +1,43 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="login.html"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h2> Source Code for Calendar Example. <br>
+<h3><a href="cal1.jsp.html">cal1.jsp<font color="#0000FF"></a>
+  </font> </h3>
+<h3><a href="cal2.jsp.html">cal2.jsp<font color="#0000FF"></a>
+  </font> </h3>
+
+<br>
+<h2> Beans.
+<h3><a href="TableBean.java.html">TableBean<font color="#0000FF"></a>
+  </font> </h3>
+<h3><a href="Entries.java.html">Entries<font color="#0000FF"></a>
+  </font> </h3>
+<h3><a href="Entry.java.html">Entry<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/cal/login.html b/tomcat/webapps/examples/jsp/cal/login.html
new file mode 100644
index 0000000000000000000000000000000000000000..2c4aa55e0f7c4db170cf4586cc107a523cdc2942
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/cal/login.html
@@ -0,0 +1,47 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<head>
+    <title> Login page for the calendar. </title>
+</head>
+
+<body bgcolor="white">
+<center>
+
+    <font size=7 color="red"> Please Enter the following information: </font>
+
+<br>
+    <form method=GET action=cal1.jsp>
+
+        <font size=5> Name <input type=text name="name" size=20>
+        </font>
+        <br>
+        <font size=5> Email <input type=text name="email" size=20>
+        </font>
+        <br>
+        <input type=submit name=action value="Submit">
+
+    </form>
+<hr>
+<font size=3 color="red"> Note: This application does not implement the complete
+functionality of a typical calendar application. It demonstrates a way JSP can
+be used with html tables and forms.</font>
+
+</center>
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/checkbox/CheckTest.html b/tomcat/webapps/examples/jsp/checkbox/CheckTest.html
new file mode 100644
index 0000000000000000000000000000000000000000..284d9ec3bce21f36e67d6eb2691c73eb22aa55e6
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/checkbox/CheckTest.html
@@ -0,0 +1,56 @@
+<HTML>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<HEAD>
+<title>
+checkbox.CheckTest Bean Properties
+</title>
+<BODY BGCOLOR="white">
+<H2>
+checkbox.CheckTest Bean Properties
+</H2>
+<HR>
+<DL>
+<DT>public class <B>CheckTest</B><DT>extends Object</DL>
+
+<P>
+<HR>
+
+<P>
+
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0">
+<TR BGCOLOR="#EEEEFF">
+<TD COLSPAN=3><FONT SIZE="+2">
+<B>Properties Summary</B></FONT></TD>
+</TR>
+<TR BGCOLOR="white">
+<td align="right" valign="top" width="1%">
+<FONT SIZE="-1">
+String
+</FONT></TD>
+<TD><B>CheckTest:fruit</B>
+<BR>
+       </TD>
+<td width="1%">
+<FONT SIZE="-1">
+Multi
+</FONT></TD>
+</TABLE>
+<HR>
+</BODY>
+</HTML>
diff --git a/tomcat/webapps/examples/jsp/checkbox/check.html b/tomcat/webapps/examples/jsp/checkbox/check.html
new file mode 100644
index 0000000000000000000000000000000000000000..b6d6b3bc1b3c09d8db7c8474c24861eb6fdd8cf7
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/checkbox/check.html
@@ -0,0 +1,38 @@
+<HTML>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<BODY bgcolor="white">
+
+
+<FORM TYPE=POST ACTION=checkresult.jsp>
+<BR>
+<font size=5 color="red">
+Check all Favorite fruits: <br>
+
+<input TYPE=checkbox name=fruit VALUE=apples> Apples <BR>
+<input TYPE=checkbox name=fruit VALUE=grapes> Grapes <BR>
+<input TYPE=checkbox name=fruit VALUE=oranges> Oranges <BR>
+<input TYPE=checkbox name=fruit VALUE=melons> Melons <BR>
+
+
+<br> <INPUT TYPE=submit name=submit Value="Submit">
+
+</font>
+</FORM>
+</BODY>
+</HTML>
diff --git a/tomcat/webapps/examples/jsp/checkbox/checkresult.jsp b/tomcat/webapps/examples/jsp/checkbox/checkresult.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..a8400e9944032f870559a81ae01f9c05262b4269
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/checkbox/checkresult.jsp
@@ -0,0 +1,63 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+<body bgcolor="white">
+<font size=5 color="red">
+<%! String[] fruits; %>
+<jsp:useBean id="foo" scope="page" class="checkbox.CheckTest" />
+
+<jsp:setProperty name="foo" property="fruit" param="fruit" />
+<hr>
+The checked fruits (got using request) are: <br>
+<%
+    fruits = request.getParameterValues("fruit");
+%>
+<ul>
+<%
+    if (fruits != null) {
+      for (int i = 0; i < fruits.length; i++) {
+%>
+<li>
+<%
+          out.println (util.HTMLFilter.filter(fruits[i]));
+      }
+    } else out.println ("none selected");
+%>
+</ul>
+<br>
+<hr>
+
+The checked fruits (got using beans) are <br>
+
+<%
+        fruits = foo.getFruit();
+%>
+<ul>
+<%
+    if (!fruits[0].equals("1")) {
+      for (int i = 0; i < fruits.length; i++) {
+%>
+<li>
+<%
+          out.println (util.HTMLFilter.filter(fruits[i]));
+      }
+    } else out.println ("none selected");
+%>
+</ul>
+</font>
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/checkbox/checkresult.jsp.html b/tomcat/webapps/examples/jsp/checkbox/checkresult.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..4dd0d9ba0e9b4b372823b7e4f8b4fa5fd2ce11aa
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/checkbox/checkresult.jsp.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+&lt;body bgcolor="white">
+&lt;font size=5 color="red">
+&lt;%! String[] fruits; %>
+&lt;jsp:useBean id="foo" scope="page" class="checkbox.CheckTest" />
+
+&lt;jsp:setProperty name="foo" property="fruit" param="fruit" />
+&lt;hr>
+The checked fruits (got using request) are: &lt;br>
+&lt;%
+    fruits = request.getParameterValues("fruit");
+%>
+&lt;ul>
+&lt;%
+    if (fruits != null) {
+      for (int i = 0; i &lt; fruits.length; i++) {
+%>
+&lt;li>
+&lt;%
+          out.println (util.HTMLFilter.filter(fruits[i]));
+      }
+    } else out.println ("none selected");
+%>
+&lt;/ul>
+&lt;br>
+&lt;hr>
+
+The checked fruits (got using beans) are &lt;br>
+
+&lt;%
+        fruits = foo.getFruit();
+%>
+&lt;ul>
+&lt;%
+    if (!fruits[0].equals("1")) {
+      for (int i = 0; i &lt; fruits.length; i++) {
+%>
+&lt;li>
+&lt;%
+          out.println (util.HTMLFilter.filter(fruits[i]));
+      }
+    } else out.println ("none selected");
+%>
+&lt;/ul>
+&lt;/font>
+&lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/checkbox/cresult.html b/tomcat/webapps/examples/jsp/checkbox/cresult.html
new file mode 100644
index 0000000000000000000000000000000000000000..b6a28d6645fcbaedc7666e9e88d068fbd1fdaa09
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/checkbox/cresult.html
@@ -0,0 +1,34 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="check.html"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="checkresult.jsp.html">Source Code for Checkbox Example<font color="#0000FF"></a>
+  </font> </h3>
+
+<h3><a href="CheckTest.html">Property Sheet for CheckTest
+<font color="#0000FF"></a> </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/colors/ColorGameBean.html b/tomcat/webapps/examples/jsp/colors/ColorGameBean.html
new file mode 100644
index 0000000000000000000000000000000000000000..172bc6646b2664e88fdce6c17607d4acede0a6ca
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/colors/ColorGameBean.html
@@ -0,0 +1,116 @@
+<HTML>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<HEAD>
+<title>
+colors.ColorGameBean Bean Properties
+</title>
+<BODY BGCOLOR="white">
+<H2>
+colors.ColorGameBean Bean Properties
+</H2>
+<HR>
+<DL>
+<DT>public class <B>ColorGameBean</B><DT>extends Object</DL>
+
+<P>
+<HR>
+
+<P>
+
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0">
+<TR BGCOLOR="#EEEEFF">
+<TD COLSPAN=3><FONT SIZE="+2">
+<B>Properties Summary</B></FONT></TD>
+</TR>
+<TR BGCOLOR="white">
+<td align="right" valign="top" width="1%">
+<FONT SIZE="-1">
+String
+</FONT></TD>
+<TD><B>ColorGameBean:color2</B>
+<BR>
+       </TD>
+<td width="1%">
+<FONT SIZE="-1">
+Single
+</FONT></TD>
+<TR BGCOLOR="white">
+<td align="right" valign="top" width="1%">
+<FONT SIZE="-1">
+String
+</FONT></TD>
+<TD><B>ColorGameBean:color1</B>
+<BR>
+       </TD>
+<td width="1%">
+<FONT SIZE="-1">
+Single
+</FONT></TD>
+<TR BGCOLOR="white">
+<td align="right" valign="top" width="1%">
+<FONT SIZE="-1">
+int
+</FONT></TD>
+<TD><B>ColorGameBean:attempts</B>
+<BR>
+       </TD>
+<td width="1%">
+<FONT SIZE="-1">
+Single
+</FONT></TD>
+<TR BGCOLOR="white">
+<td align="right" valign="top" width="1%">
+<FONT SIZE="-1">
+boolean
+</FONT></TD>
+<TD><B>ColorGameBean:hint</B>
+<BR>
+       </TD>
+<td width="1%">
+<FONT SIZE="-1">
+Single
+</FONT></TD>
+<TR BGCOLOR="white">
+<td align="right" valign="top" width="1%">
+<FONT SIZE="-1">
+boolean
+</FONT></TD>
+<TD><B>ColorGameBean:success</B>
+<BR>
+       </TD>
+<td width="1%">
+<FONT SIZE="-1">
+Single
+</FONT></TD>
+<TR BGCOLOR="white">
+<td align="right" valign="top" width="1%">
+<FONT SIZE="-1">
+boolean
+</FONT></TD>
+<TD><B>ColorGameBean:hintTaken</B>
+<BR>
+       </TD>
+<td width="1%">
+<FONT SIZE="-1">
+Single
+</FONT></TD>
+</TABLE>
+<HR>
+</BODY>
+</HTML>
diff --git a/tomcat/webapps/examples/jsp/colors/clr.html b/tomcat/webapps/examples/jsp/colors/clr.html
new file mode 100644
index 0000000000000000000000000000000000000000..e411f597d22d86c6d9919ab19ebddef30da7cbee
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/colors/clr.html
@@ -0,0 +1,34 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="colors.html"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="colrs.jsp.html">Source Code for Color Example<font color="#0000FF"></a>
+  </font> </h3>
+
+<h3><a href="ColorGameBean.html">Property Sheet for ColorGameBean
+<font color="#0000FF"></a> </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/colors/colors.html b/tomcat/webapps/examples/jsp/colors/colors.html
new file mode 100644
index 0000000000000000000000000000000000000000..900651e2c6db1a40892cad4562404b37f60167c1
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/colors/colors.html
@@ -0,0 +1,47 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<body bgcolor= white>
+<font size=6 color=red>
+
+<hr>
+This web page is an example using JSP and BEANs.
+<p>
+Guess my favorite two colors
+
+<p> If you fail to guess both of them - you get yellow on red.
+
+<p> If you guess one of them right, either your foreground or
+    your background will change to the color that was guessed right.
+
+<p> Guess them both right and your browser foreground/background
+    will change to my two favorite colors to display this page.
+
+<hr>
+<form method=GET action=colrs.jsp>
+Color #1: <input type=text name= color1 size=16>
+<br>
+Color #2: <input type=text name= color2 size=16>
+<p>
+<input type=submit name=action value="Submit">
+<input type=submit name=action value="Hint">
+</form>
+
+</font>
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/colors/colrs.jsp b/tomcat/webapps/examples/jsp/colors/colrs.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..ec3af887c4fd3f744c6c99f48caf250621855b5d
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/colors/colrs.jsp
@@ -0,0 +1,70 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+
+<jsp:useBean id="cb" scope="session" class="colors.ColorGameBean" />
+<jsp:setProperty name="cb" property="*" />
+
+<%
+    cb.processRequest();
+%>
+
+<body bgcolor=<%= cb.getColor1() %>>
+<font size=6 color=<%= cb.getColor2() %>>
+<p>
+
+<% if (cb.getHint()==true) { %>
+
+    <p> Hint #1: Vampires prey at night!
+    <p>  <p> Hint #2: Nancy without the n.
+
+<% } %>
+
+<% if  (cb.getSuccess()==true) { %>
+
+    <p> CONGRATULATIONS!!
+    <% if  (cb.getHintTaken()==true) { %>
+
+        <p> ( although I know you cheated and peeked into the hints)
+
+    <% } %>
+
+<% } %>
+
+<p> Total attempts so far: <%= cb.getAttempts() %>
+<p>
+
+<p>
+
+<form method=POST action=colrs.jsp>
+
+Color #1: <input type=text name= color1 size=16>
+
+<br>
+
+Color #2: <input type=text name= color2 size=16>
+
+<p>
+
+<input type=submit name=action value="Submit">
+<input type=submit name=action value="Hint">
+
+</form>
+
+</font>
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/colors/colrs.jsp.html b/tomcat/webapps/examples/jsp/colors/colrs.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..7ef38aecfd57850129d9e469d2943ab001e0424b
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/colors/colrs.jsp.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+
+&lt;jsp:useBean id="cb" scope="session" class="colors.ColorGameBean" />
+&lt;jsp:setProperty name="cb" property="*" />
+
+&lt;%
+    cb.processRequest();
+%>
+
+&lt;body bgcolor=&lt;%= cb.getColor1() %>>
+&lt;font size=6 color=&lt;%= cb.getColor2() %>>
+&lt;p>
+
+&lt;% if (cb.getHint()==true) { %>
+
+    &lt;p> Hint #1: Vampires prey at night!
+    &lt;p>  &lt;p> Hint #2: Nancy without the n.
+
+&lt;% } %>
+
+&lt;% if  (cb.getSuccess()==true) { %>
+
+    &lt;p> CONGRATULATIONS!!
+    &lt;% if  (cb.getHintTaken()==true) { %>
+
+        &lt;p> ( although I know you cheated and peeked into the hints)
+
+    &lt;% } %>
+
+&lt;% } %>
+
+&lt;p> Total attempts so far: &lt;%= cb.getAttempts() %>
+&lt;p>
+
+&lt;p>
+
+&lt;form method=POST action=colrs.jsp>
+
+Color #1: &lt;input type=text name= color1 size=16>
+
+&lt;br>
+
+Color #2: &lt;input type=text name= color2 size=16>
+
+&lt;p>
+
+&lt;input type=submit name=action value="Submit">
+&lt;input type=submit name=action value="Hint">
+
+&lt;/form>
+
+&lt;/font>
+&lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/dates/date.html b/tomcat/webapps/examples/jsp/dates/date.html
new file mode 100644
index 0000000000000000000000000000000000000000..683ab4d2a06a2f57a0b7e04d5b664bda562e4116
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/dates/date.html
@@ -0,0 +1,31 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="date.jsp"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="date.jsp.html">Source Code for Date Example<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/dates/date.jsp b/tomcat/webapps/examples/jsp/dates/date.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..d6c6b8664ce35671e5e9ad0867b5a0b2e34b065f
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/dates/date.jsp
@@ -0,0 +1,41 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+
+<%@ page session="false"%>
+
+<body bgcolor="white">
+<jsp:useBean id='clock' scope='page' class='dates.JspCalendar' type="dates.JspCalendar" />
+
+<font size=4>
+<ul>
+<li>    Day of month: is  <jsp:getProperty name="clock" property="dayOfMonth"/>
+<li>    Year: is  <jsp:getProperty name="clock" property="year"/>
+<li>    Month: is  <jsp:getProperty name="clock" property="month"/>
+<li>    Time: is  <jsp:getProperty name="clock" property="time"/>
+<li>    Date: is  <jsp:getProperty name="clock" property="date"/>
+<li>    Day: is  <jsp:getProperty name="clock" property="day"/>
+<li>    Day Of Year: is  <jsp:getProperty name="clock" property="dayOfYear"/>
+<li>    Week Of Year: is  <jsp:getProperty name="clock" property="weekOfYear"/>
+<li>    era: is  <jsp:getProperty name="clock" property="era"/>
+<li>    DST Offset: is  <jsp:getProperty name="clock" property="DSTOffset"/>
+<li>    Zone Offset: is  <jsp:getProperty name="clock" property="zoneOffset"/>
+</ul>
+</font>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/dates/date.jsp.html b/tomcat/webapps/examples/jsp/dates/date.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..3f2abfc4c7596d8d5484e43b22127420473896af
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/dates/date.jsp.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+
+&lt;%@ page session="false"%>
+
+&lt;body bgcolor="white">
+&lt;jsp:useBean id='clock' scope='page' class='dates.JspCalendar' type="dates.JspCalendar" />
+
+&lt;font size=4>
+&lt;ul>
+&lt;li>    Day of month: is  &lt;jsp:getProperty name="clock" property="dayOfMonth"/>
+&lt;li>    Year: is  &lt;jsp:getProperty name="clock" property="year"/>
+&lt;li>    Month: is  &lt;jsp:getProperty name="clock" property="month"/>
+&lt;li>    Time: is  &lt;jsp:getProperty name="clock" property="time"/>
+&lt;li>    Date: is  &lt;jsp:getProperty name="clock" property="date"/>
+&lt;li>    Day: is  &lt;jsp:getProperty name="clock" property="day"/>
+&lt;li>    Day Of Year: is  &lt;jsp:getProperty name="clock" property="dayOfYear"/>
+&lt;li>    Week Of Year: is  &lt;jsp:getProperty name="clock" property="weekOfYear"/>
+&lt;li>    era: is  &lt;jsp:getProperty name="clock" property="era"/>
+&lt;li>    DST Offset: is  &lt;jsp:getProperty name="clock" property="DSTOffset"/>
+&lt;li>    Zone Offset: is  &lt;jsp:getProperty name="clock" property="zoneOffset"/>
+&lt;/ul>
+&lt;/font>
+
+&lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/error/er.html b/tomcat/webapps/examples/jsp/error/er.html
new file mode 100644
index 0000000000000000000000000000000000000000..af78159dda604e48e62fc803f324ca8b787fd7d9
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/error/er.html
@@ -0,0 +1,31 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="error.html"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="err.jsp.html">Source Code for Error Example<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/error/err.jsp b/tomcat/webapps/examples/jsp/error/err.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..d188456b30403024e670b3e125d4446afdfda22e
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/error/err.jsp
@@ -0,0 +1,44 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+<body bgcolor="lightblue">
+
+    <%@ page errorPage="errorpge.jsp" %>
+    <jsp:useBean id="foo" scope="request" class="error.Smart" />
+    <%
+        String name = null;
+
+        if (request.getParameter("name") == null) {
+    %>
+    <%@ include file="error.html" %>
+    <%
+        } else {
+          foo.setName(request.getParameter("name"));
+          if (foo.getName().equalsIgnoreCase("integra"))
+              name = "acura";
+          if (name.equalsIgnoreCase("acura")) {
+    %>
+
+    <H1> Yes!!! <a href="http://www.acura.com">Acura</a> is my favorite car.
+
+    <%
+          }
+        }
+    %>
+</body>
+</html>
+
diff --git a/tomcat/webapps/examples/jsp/error/err.jsp.html b/tomcat/webapps/examples/jsp/error/err.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..3d607a5c90131afc389176e59a0071aab68fdf5c
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/error/err.jsp.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+&lt;body bgcolor="lightblue">
+
+    &lt;%@ page errorPage="errorpge.jsp" %>
+    &lt;jsp:useBean id="foo" scope="request" class="error.Smart" />
+    &lt;%
+        String name = null;
+
+        if (request.getParameter("name") == null) {
+    %>
+    &lt;%@ include file="error.html" %>
+    &lt;%
+        } else {
+          foo.setName(request.getParameter("name"));
+          if (foo.getName().equalsIgnoreCase("integra"))
+              name = "acura";
+          if (name.equalsIgnoreCase("acura")) {
+    %>
+
+    &lt;H1> Yes!!! &lt;a href="http://www.acura.com">Acura&lt;/a> is my favorite car.
+
+    &lt;%
+          }
+        }
+    %>
+&lt;/body>
+&lt;/html>
+
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/error/error.html b/tomcat/webapps/examples/jsp/error/error.html
new file mode 100644
index 0000000000000000000000000000000000000000..b1b029c90a8ac8fdeb4d4353a02012b052f727ae
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/error/error.html
@@ -0,0 +1,37 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<body bgcolor="white">
+
+<h1> This example uses <b>errorpage</b> directive </h1>
+<br>
+<h3> Select my favourite car.</h3>
+<form method=get action=err.jsp>
+<!-- <br> Make a guess: -->
+<SELECT NAME="name" SIZE=5>
+<OPTION VALUE="integra"> Acura Integra <BR>
+<OPTION VALUE="bmw328i"> BMW 328I <BR>
+<OPTION VALUE="z3"> BMW Z3 <BR>
+<OPTION VALUE="infiniti"> InfinitiQ3 <BR>
+<OPTION VALUE="audi"> Audi A8 <BR>
+</SELECT>
+<br> <INPUT TYPE=submit name=submit Value="Submit">
+</form>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/error/errorpge.jsp b/tomcat/webapps/examples/jsp/error/errorpge.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..5c6eb0a38718b7eb4e2b359fbc0e19d4f1cb069a
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/error/errorpge.jsp
@@ -0,0 +1,25 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+
+<body bgcolor="red">
+
+    <%@ page isErrorPage="true" %>
+    <h1> The exception <%= exception.getMessage() %> tells me you
+         made a wrong choice.
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/error/errorpge.jsp.html b/tomcat/webapps/examples/jsp/error/errorpge.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..3d690dc96df6098eeebfd05878d0f736822fee59
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/error/errorpge.jsp.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+
+&lt;body bgcolor="red">
+
+    &lt;%@ page isErrorPage="true" %>
+    &lt;h1> The exception &lt;%= exception.getMessage() %> tells me you
+         made a wrong choice.
+&lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/forward/forward.jsp b/tomcat/webapps/examples/jsp/forward/forward.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..092d9b4c73a29de06f023d5c66fff343862494cd
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/forward/forward.jsp
@@ -0,0 +1,33 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+<%
+   double freeMem = Runtime.getRuntime().freeMemory();
+   double totlMem = Runtime.getRuntime().totalMemory();
+   double percent = freeMem/totlMem;
+   if (percent < 0.5) {
+%>
+
+<jsp:forward page="one.jsp"/>
+
+<% } else { %>
+
+<jsp:forward page="two.html"/>
+
+<% } %>
+
+</html>
diff --git a/tomcat/webapps/examples/jsp/forward/forward.jsp.html b/tomcat/webapps/examples/jsp/forward/forward.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..32f8bf72903c9a6657eeda670da4d93f5d03bbdc
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/forward/forward.jsp.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+&lt;%
+   double freeMem = Runtime.getRuntime().freeMemory();
+   double totlMem = Runtime.getRuntime().totalMemory();
+   double percent = freeMem/totlMem;
+   if (percent &lt; 0.5) {
+%>
+
+&lt;jsp:forward page="one.jsp"/>
+
+&lt;% } else { %>
+
+&lt;jsp:forward page="two.html"/>
+
+&lt;% } %>
+
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/forward/fwd.html b/tomcat/webapps/examples/jsp/forward/fwd.html
new file mode 100644
index 0000000000000000000000000000000000000000..b3b0219fc903c6fc9423b5c32bc89b38cdf92b26
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/forward/fwd.html
@@ -0,0 +1,30 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="forward.jsp"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="forward.jsp.html">Source Code for Forward Example<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/forward/one.jsp b/tomcat/webapps/examples/jsp/forward/one.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..c7f0004aa6f9164429ee276cbaf7892705a59777
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/forward/one.jsp
@@ -0,0 +1,23 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+
+<body bgcolor="white">
+<font color="red">
+
+VM Memory usage &lt; 50%.
+</html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/forward/one.jsp.html b/tomcat/webapps/examples/jsp/forward/one.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..af185012c332fdfa180b218ddfa3db08eea22b4a
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/forward/one.jsp.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+
+&lt;body bgcolor="white">
+&lt;font color="red">
+
+VM Memory usage &amp;lt; 50%.
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/forward/two.html b/tomcat/webapps/examples/jsp/forward/two.html
new file mode 100644
index 0000000000000000000000000000000000000000..24f4c08f041e57b6b94fff0603edb7e32b0c3581
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/forward/two.html
@@ -0,0 +1,23 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<body bgcolor="white">
+<font color="red">
+
+VM Memory usage &gt; 50%.
+</html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/images/code.gif b/tomcat/webapps/examples/jsp/images/code.gif
new file mode 100644
index 0000000000000000000000000000000000000000..93af2cd130aa61cb2f235cdd6f0e75ab444819ef
Binary files /dev/null and b/tomcat/webapps/examples/jsp/images/code.gif differ
diff --git a/tomcat/webapps/examples/jsp/images/execute.gif b/tomcat/webapps/examples/jsp/images/execute.gif
new file mode 100644
index 0000000000000000000000000000000000000000..f64d70fd233d6fb3fcbdeedc02061871984f8fb5
Binary files /dev/null and b/tomcat/webapps/examples/jsp/images/execute.gif differ
diff --git a/tomcat/webapps/examples/jsp/images/return.gif b/tomcat/webapps/examples/jsp/images/return.gif
new file mode 100644
index 0000000000000000000000000000000000000000..af4f68f4a3a13e0ef1dc0045b04c2c93354cdf40
Binary files /dev/null and b/tomcat/webapps/examples/jsp/images/return.gif differ
diff --git a/tomcat/webapps/examples/jsp/include/foo.html b/tomcat/webapps/examples/jsp/include/foo.html
new file mode 100644
index 0000000000000000000000000000000000000000..168c8c852f19cb367ec37e05a41c34dfee6ae293
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/include/foo.html
@@ -0,0 +1,17 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+To get the current time in ms
diff --git a/tomcat/webapps/examples/jsp/include/foo.jsp b/tomcat/webapps/examples/jsp/include/foo.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..bb476c78e9341fa292c27b00157d93ae6a1092b0
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/include/foo.jsp
@@ -0,0 +1,17 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+--%><%= System.currentTimeMillis() %>
diff --git a/tomcat/webapps/examples/jsp/include/foo.jsp.html b/tomcat/webapps/examples/jsp/include/foo.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..2a1ac7b04ba8b20b7f9b6f345244b959572db9cb
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/include/foo.jsp.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+--%>&lt;%= System.currentTimeMillis() %>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/include/inc.html b/tomcat/webapps/examples/jsp/include/inc.html
new file mode 100644
index 0000000000000000000000000000000000000000..fedaed0918e41fecca0b2b69823cf31bf7d8bcbe
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/include/inc.html
@@ -0,0 +1,30 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="include.jsp"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="include.jsp.html">Source Code for Include Example<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/include/include.jsp b/tomcat/webapps/examples/jsp/include/include.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..62a8c2247177c00b63c9beadee74d39db38fadbb
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/include/include.jsp
@@ -0,0 +1,30 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+
+<body bgcolor="white">
+
+<font color="red">
+
+<%@ page buffer="5kb" autoFlush="false" %>
+
+<p>In place evaluation of another JSP which gives you the current time: <%@ include file="foo.jsp" %>
+
+<p> <jsp:include page="foo.html" flush="true"/> by including the output of another JSP: <jsp:include page="foo.jsp" flush="true"/>
+:-)
+
+</html>
diff --git a/tomcat/webapps/examples/jsp/include/include.jsp.html b/tomcat/webapps/examples/jsp/include/include.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..4f529c16d8f0bb4cca3cb20e6b39c6505891d677
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/include/include.jsp.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+
+&lt;body bgcolor="white">
+
+&lt;font color="red">
+
+&lt;%@ page buffer="5kb" autoFlush="false" %>
+
+&lt;p>In place evaluation of another JSP which gives you the current time: &lt;%@ include file="foo.jsp" %>
+
+&lt;p> &lt;jsp:include page="foo.html" flush="true"/> by including the output of another JSP: &lt;jsp:include page="foo.jsp" flush="true"/>
+:-)
+
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/index.html b/tomcat/webapps/examples/jsp/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..27d53a197e13cc5264f4f4c2b76350578c6ff406
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/index.html
@@ -0,0 +1,369 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!DOCTYPE html><html lang="en">
+<head>
+   <meta charset="UTF-8"/>
+   <meta name="Author" content="Anil K. Vijendran" />
+   <title>JSP Examples</title>
+   <style type="text/css">
+   img { border: 0; }
+   th { text-align: left; }
+   tr { vertical-align: top; }
+   </style>
+</head>
+<body>
+<h1>JSP
+Samples</h1>
+<p>This is a collection of samples demonstrating the usage of different
+parts of the Java Server Pages (JSP) specification.  Both JSP 2.0 and
+JSP 1.2 examples are presented below.
+<p>These examples will only work when these pages are being served by a
+servlet engine; of course, we recommend
+<a href="http://tomcat.apache.org/">Tomcat</a>.
+They will not work if you are viewing these pages via a
+"file://..." URL.
+<p>To navigate your way through the examples, the following icons will
+help:</p>
+<ul style="list-style-type: none; padding-left: 0;">
+<li><img src="images/execute.gif" alt=""> Execute the example</li>
+<li><img src="images/code.gif" alt=""> Look at the source code for the example</li>
+<li><img src="images/return.gif" alt=""> Return to this screen</li>
+</ul>
+
+<p>Tip: For session scoped beans to work, the cookies must be enabled.
+This can be done using browser options.</p>
+<h2>JSP 2.0 Examples</h2>
+
+<table style="width: 85%;">
+<tr>
+<th colspan="3">Expression Language</th>
+</tr>
+
+<tr>
+<td>Basic Arithmetic</td>
+<td style="width: 30%;"><a href="jsp2/el/basic-arithmetic.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/el/basic-arithmetic.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="jsp2/el/basic-arithmetic.html"><img src="images/code.gif" alt=""></a><a href="jsp2/el/basic-arithmetic.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Basic Comparisons</td>
+<td style="width: 30%;"><a href="jsp2/el/basic-comparisons.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/el/basic-comparisons.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="jsp2/el/basic-comparisons.html"><img src="images/code.gif" alt=""></a><a href="jsp2/el/basic-comparisons.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Implicit Objects</td>
+<td style="width: 30%;"><a href="jsp2/el/implicit-objects.jsp?foo=bar"><img src="images/execute.gif" alt=""></a><a href="jsp2/el/implicit-objects.jsp?foo=bar">Execute</a></td>
+
+<td style="width: 30%;"><a href="jsp2/el/implicit-objects.html"><img src="images/code.gif" alt=""></a><a href="jsp2/el/implicit-objects.html">Source</a></td>
+</tr>
+<tr>
+
+<td>Functions</td>
+<td style="width: 30%;"><a href="jsp2/el/functions.jsp?foo=JSP+2.0"><img src="images/execute.gif" alt=""></a><a href="jsp2/el/functions.jsp?foo=JSP+2.0">Execute</a></td>
+
+<td style="width: 30%;"><a href="jsp2/el/functions.html"><img src="images/code.gif" alt=""></a><a href="jsp2/el/functions.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Composite Expressions</td>
+<td style="width: 30%;"><a href="jsp2/el/composite.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/el/composite.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="jsp2/el/composite.html"><img src="images/code.gif" alt=""></a><a href="jsp2/el/composite.html">Source</a></td>
+</tr>
+
+
+<tr>
+<th colspan="3"><br />SimpleTag Handlers and JSP Fragments</th>
+</tr>
+
+<tr>
+<td>Hello World Tag</td>
+<td style="width: 30%;"><a href="jsp2/simpletag/hello.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/simpletag/hello.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="jsp2/simpletag/hello.html"><img src="images/code.gif" alt=""></a><a href="jsp2/simpletag/hello.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Repeat Tag</td>
+<td style="width: 30%;"><a href="jsp2/simpletag/repeat.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/simpletag/repeat.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="jsp2/simpletag/repeat.html"><img src="images/code.gif" alt=""></a><a href="jsp2/simpletag/repeat.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Book Example</td>
+<td style="width: 30%;"><a href="jsp2/simpletag/book.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/simpletag/book.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="jsp2/simpletag/book.html"><img src="images/code.gif" alt=""></a><a href="jsp2/simpletag/book.html">Source</a></td>
+</tr>
+
+<tr>
+<th colspan="3"><br />Tag Files</th>
+</tr>
+
+<tr>
+<td>Hello World Tag File</td>
+<td style="width: 30%;"><a href="jsp2/tagfiles/hello.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/tagfiles/hello.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="jsp2/tagfiles/hello.html"><img src="images/code.gif" alt=""></a><a href="jsp2/tagfiles/hello.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Panel Tag File</td>
+<td style="width: 30%;"><a href="jsp2/tagfiles/panel.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/tagfiles/panel.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="jsp2/tagfiles/panel.html"><img src="images/code.gif" alt=""></a><a href="jsp2/tagfiles/panel.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Display Products Example</td>
+<td style="width: 30%;"><a href="jsp2/tagfiles/products.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/tagfiles/products.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="jsp2/tagfiles/products.html"><img src="images/code.gif" alt=""></a><a href="jsp2/tagfiles/products.html">Source</a></td>
+</tr>
+
+<tr>
+<th colspan="3"><br />New JSP XML Syntax (.jspx)</th>
+</tr>
+
+<tr>
+<td>XHTML Basic Example</td>
+<td style="width: 30%;"><a href="jsp2/jspx/basic.jspx"><img src="images/execute.gif" alt=""></a><a href="jsp2/jspx/basic.jspx">Execute</a></td>
+
+<td style="width: 30%;"><a href="jsp2/jspx/basic.html"><img src="images/code.gif" alt=""></a><a href="jsp2/jspx/basic.html">Source</a></td>
+</tr>
+
+<tr>
+<td>SVG (Scalable Vector Graphics)</td>
+<td style="width: 30%;"><a href="jsp2/jspx/svgexample.html"><img src="images/execute.gif" alt=""></a><a href="jsp2/jspx/svgexample.html">Execute</a></td>
+
+<td style="width: 30%;"><a href="jsp2/jspx/textRotate.html"><img src="images/code.gif" alt=""></a><a href="jsp2/jspx/textRotate.html">Source</a></td>
+</tr>
+
+<tr>
+<th colspan="3"><br />Other JSP 2.0 Features</th>
+</tr>
+
+<tr>
+<td>&lt;jsp:attribute&gt; and &lt;jsp:body&gt;</td>
+<td style="width: 30%;"><a href="jsp2/jspattribute/jspattribute.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/jspattribute/jspattribute.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="jsp2/jspattribute/jspattribute.html"><img src="images/code.gif" alt=""></a><a href="jsp2/jspattribute/jspattribute.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Shuffle Example</td>
+<td style="width: 30%;"><a href="jsp2/jspattribute/shuffle.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/jspattribute/shuffle.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="jsp2/jspattribute/shuffle.html"><img src="images/code.gif" alt=""></a><a href="jsp2/jspattribute/shuffle.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Attributes With Dynamic Names</td>
+<td style="width: 30%;"><a href="jsp2/misc/dynamicattrs.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/misc/dynamicattrs.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="jsp2/misc/dynamicattrs.html"><img src="images/code.gif" alt=""></a><a href="jsp2/misc/dynamicattrs.html">Source</a></td>
+</tr>
+
+<tr>
+<td>JSP Configuration</td>
+<td style="width: 30%;"><a href="jsp2/misc/config.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/misc/config.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="jsp2/misc/config.html"><img src="images/code.gif" alt=""></a><a href="jsp2/misc/config.html">Source</a></td>
+</tr>
+
+</table>
+
+<h2>JSP 1.2 Examples</h2>
+<table style="width: 85%;">
+<tr>
+<td>Numberguess</td>
+
+<td style="width: 30%;"><a href="num/numguess.jsp"><img src="images/execute.gif" alt=""></a><a href="num/numguess.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="num/numguess.html"><img src="images/code.gif" alt=""></a><a href="num/numguess.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Date</td>
+
+<td style="width: 30%;"><a href="dates/date.jsp"><img src="images/execute.gif" alt=""></a><a href="dates/date.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="dates/date.html"><img src="images/code.gif" alt=""></a><a href="dates/date.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Snoop</td>
+
+<td style="width: 30%;"><a href="snp/snoop.jsp"><img src="images/execute.gif" alt=""></a><a href="snp/snoop.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="snp/snoop.html"><img src="images/code.gif" alt=""></a><a href="snp/snoop.html">Source</a></td>
+</tr>
+
+<tr>
+<td>ErrorPage</td>
+
+<td style="width: 30%;"><a href="error/error.html"><img src="images/execute.gif" alt=""></a><a href="error/error.html">Execute</a></td>
+
+<td style="width: 30%;"><a href="error/er.html"><img src="images/code.gif" alt=""></a><a href="error/er.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Carts</td>
+
+<td style="width: 30%;"><a href="sessions/carts.html"><img src="images/execute.gif" alt=""></a><a href="sessions/carts.html">Execute</a></td>
+
+<td style="width: 30%;"><a href="sessions/crt.html"><img src="images/code.gif" alt=""></a><a href="sessions/crt.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Checkbox</td>
+
+<td style="width: 30%;"><a href="checkbox/check.html"><img src="images/execute.gif" alt=""></a><a href="checkbox/check.html">Execute</a></td>
+
+<td style="width: 30%;"><a href="checkbox/cresult.html"><img src="images/code.gif" alt=""></a><a href="checkbox/cresult.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Color</td>
+
+<td style="width: 30%;"><a href="colors/colors.html"><img src="images/execute.gif" alt=""></a><a href="colors/colors.html">Execute</a></td>
+
+<td style="width: 30%;"><a href="colors/clr.html"><img src="images/code.gif" alt=""></a><a href="colors/clr.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Calendar</td>
+
+<td style="width: 30%;"><a href="cal/login.html"><img src="images/execute.gif" alt=""></a><a href="cal/login.html">Execute</a></td>
+
+<td style="width: 30%;"><a href="cal/calendar.html"><img src="images/code.gif" alt=""></a><a href="cal/calendar.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Include</td>
+
+<td style="width: 30%;"><a href="include/include.jsp"><img src="images/execute.gif" alt=""></a><a href="include/include.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="include/inc.html"><img src="images/code.gif" alt=""></a><a href="include/inc.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Forward</td>
+
+<td style="width: 30%;"><a href="forward/forward.jsp"><img src="images/execute.gif" alt=""></a><a href="forward/forward.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="forward/fwd.html"><img src="images/code.gif" alt=""></a><a href="forward/fwd.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Plugin</td>
+
+<td style="width: 30%;"><a href="plugin/plugin.jsp"><img src="images/execute.gif" alt=""></a><a href="plugin/plugin.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="plugin/plugin.html"><img src="images/code.gif" alt=""></a><a href="plugin/plugin.html">Source</a></td>
+</tr>
+
+<tr>
+<td>JSP-Servlet-JSP</td>
+
+<td style="width: 30%;"><a href="jsptoserv/jsptoservlet.jsp"><img src="images/execute.gif" alt=""></a><a href="jsptoserv/jsptoservlet.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="jsptoserv/jts.html"><img src="images/code.gif" alt=""></a><a href="jsptoserv/jts.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Custom tag example</td>
+
+<td style="width: 30%;"><a href="simpletag/foo.jsp"><img src="images/execute.gif" alt=""></a><a href="simpletag/foo.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="simpletag/foo.html"><img src="images/code.gif" alt=""></a><a href="simpletag/foo.html">Source</a></td>
+</tr>
+
+<tr>
+<td>XML syntax example</td>
+<td style="width: 30%;"><a href="xml/xml.jsp"><img src="images/execute.gif" alt=""></a><a href="xml/xml.jsp">Execute</a></td>
+
+<td style="width: 30%;"><a href="xml/xml.html"><img src="images/code.gif" alt=""></a><a href="xml/xml.html">Source</a></td>
+</tr>
+
+</table>
+
+<h2>Tag Plugins</h2>
+<table style="width: 85%;">
+
+<tr>
+  <td>If</td>
+  <td style="width: 30%;">
+    <a href="tagplugin/if.jsp"><img src="images/execute.gif" alt=""></a>
+    <a href="tagplugin/if.jsp">Execute</a>
+  </td>
+  <td style="width: 30%;">
+    <a href="tagplugin/if.html"><img src="images/code.gif" alt=""></a>
+    <a href="tagplugin/if.html">Source</a>
+  </td>
+</tr>
+
+<tr>
+  <td>ForEach</td>
+  <td style="width: 30%;">
+    <a href="tagplugin/foreach.jsp"><img src="images/execute.gif" alt=""></a>
+    <a href="tagplugin/foreach.jsp">Execute</a>
+  </td>
+  <td style="width: 30%;">
+    <a href="tagplugin/foreach.html"><img src="images/code.gif" alt=""></a>
+    <a href="tagplugin/foreach.html">Source</a>
+  </td>
+</tr>
+
+<tr>
+  <td>Choose</td>
+  <td style="width: 30%;">
+    <a href="tagplugin/choose.jsp"><img src="images/execute.gif" alt=""></a>
+    <a href="tagplugin/choose.jsp">Execute</a>
+  </td>
+  <td style="width: 30%;">
+    <a href="tagplugin/choose.html"><img src="images/code.gif" alt=""></a>
+    <a href="tagplugin/choose.html">Source</a>
+  </td>
+</tr>
+
+</table>
+
+<h2>Other Examples</h2>
+<table style="width: 85%;">
+
+<tr>
+  <td>FORM Authentication</td>
+  <td style="width: 30%;">
+    <a href="security/protected/index.jsp"><img src="images/execute.gif" alt=""> Execute</a>
+  </td>
+  <td style="width: 30%;"></td>
+</tr>
+<tr>
+  <td colspan="3">Example that demonstrates protecting a resource and
+    using Form-Based authentication. To access the page the user must
+    have role of either "tomcat" or "role1". By default no user
+    is configured to have these roles.</td>
+</tr>
+
+</table>
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/el/Functions.java.html b/tomcat/webapps/examples/jsp/jsp2/el/Functions.java.html
new file mode 100644
index 0000000000000000000000000000000000000000..aa84cccc46dd097cad8b43b9f1e8e1b2398e847c
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/el/Functions.java.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package jsp2.examples.el;
+
+import java.util.Locale;
+
+/**
+ * Defines the functions for the jsp2 example tag library.
+ *
+ * &lt;p>Each function is defined as a static method.&lt;/p>
+ */
+public class Functions {
+    public static String reverse( String text ) {
+        return new StringBuilder( text ).reverse().toString();
+    }
+
+    public static int numVowels( String text ) {
+        String vowels = "aeiouAEIOU";
+        int result = 0;
+        for( int i = 0; i &lt; text.length(); i++ ) {
+            if( vowels.indexOf( text.charAt( i ) ) != -1 ) {
+                result++;
+            }
+        }
+        return result;
+    }
+
+    public static String caps( String text ) {
+        return text.toUpperCase(Locale.ENGLISH);
+    }
+}
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/el/ValuesBean.java.html b/tomcat/webapps/examples/jsp/jsp2/el/ValuesBean.java.html
new file mode 100644
index 0000000000000000000000000000000000000000..3744236491f837aaaa856d7282ce51257cb0b02d
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/el/ValuesBean.java.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples;
+
+/**
+ * Accept and display a value.
+ */
+public class ValuesBean {
+    private String string;
+    private double doubleValue;
+    private long longValue;
+
+    public String getStringValue() {
+        return this.string;
+    }
+
+    public void setStringValue(String string) {
+        this.string = string;
+    }
+
+    public double getDoubleValue() {
+        return doubleValue;
+    }
+
+    public void setDoubleValue(double doubleValue) {
+        this.doubleValue = doubleValue;
+    }
+
+    public long getLongValue() {
+        return longValue;
+    }
+
+    public void setLongValue(long longValue) {
+        this.longValue = longValue;
+    }
+}
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/el/ValuesTag.java.html b/tomcat/webapps/examples/jsp/jsp2/el/ValuesTag.java.html
new file mode 100644
index 0000000000000000000000000000000000000000..490d2123be7995778694fab07fe51352fb114ad4
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/el/ValuesTag.java.html
@@ -0,0 +1,80 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package examples;
+
+import java.io.IOException;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspTagException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.TagSupport;
+
+/**
+ * Accept and display a value.
+ */
+public class ValuesTag extends TagSupport {
+
+    private static final long serialVersionUID = 1L;
+
+    // Using "-1" as the default value,
+    // in the assumption that it won't be used as the value.
+    // Cannot use null here, because null is an important case
+    // that should be present in the tests.
+    private Object objectValue = "-1";
+    private String stringValue = "-1";
+    private long longValue = -1;
+    private double doubleValue = -1;
+
+    public void setObject(Object objectValue) {
+        this.objectValue = objectValue;
+    }
+
+    public void setString(String stringValue) {
+        this.stringValue = stringValue;
+    }
+
+    public void setLong(long longValue) {
+        this.longValue = longValue;
+    }
+
+    public void setDouble(double doubleValue) {
+        this.doubleValue = doubleValue;
+    }
+
+    @Override
+    public int doEndTag() throws JspException {
+        JspWriter out = pageContext.getOut();
+
+        try {
+            if (!"-1".equals(objectValue)) {
+                out.print(objectValue);
+            } else if (!"-1".equals(stringValue)) {
+                out.print(stringValue);
+            } else if (longValue != -1) {
+                out.print(longValue);
+            } else if (doubleValue != -1) {
+                out.print(doubleValue);
+            } else {
+                out.print("-1");
+            }
+        } catch (IOException ex) {
+            throw new JspTagException("IOException: " + ex.toString(), ex);
+        }
+        return super.doEndTag();
+    }
+}
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/el/basic-arithmetic.html b/tomcat/webapps/examples/jsp/jsp2/el/basic-arithmetic.html
new file mode 100644
index 0000000000000000000000000000000000000000..8a2f0a61dbb02b070dd63d7a3df501cd980f2432
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/el/basic-arithmetic.html
@@ -0,0 +1,30 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>View Source Code</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="basic-arithmetic.jsp"><img src="../../images/execute.gif" align="right" border="0"></a><a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="basic-arithmetic.jsp.html">Source Code for Basic Arithmetic Example<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/el/basic-arithmetic.jsp b/tomcat/webapps/examples/jsp/jsp2/el/basic-arithmetic.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..757e809f15a3d0a8d030f94632ae221474560e7d
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/el/basic-arithmetic.jsp
@@ -0,0 +1,88 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+  <head>
+    <title>JSP 2.0 Expression Language - Basic Arithmetic</title>
+  </head>
+  <body>
+    <h1>JSP 2.0 Expression Language - Basic Arithmetic</h1>
+    <hr>
+    This example illustrates basic Expression Language arithmetic.
+    Addition (+), subtraction (-), multiplication (*), division (/ or div),
+    and modulus (% or mod) are all supported.  Error conditions, like
+    division by zero, are handled gracefully.
+    <br>
+    <blockquote>
+      <code>
+        <table border="1">
+          <thead>
+        <td><b>EL Expression</b></td>
+        <td><b>Result</b></td>
+      </thead>
+      <tr>
+        <td>\${1}</td>
+        <td>${1}</td>
+      </tr>
+      <tr>
+        <td>\${1 + 2}</td>
+        <td>${1 + 2}</td>
+      </tr>
+      <tr>
+        <td>\${1.2 + 2.3}</td>
+        <td>${1.2 + 2.3}</td>
+      </tr>
+      <tr>
+        <td>\${1.2E4 + 1.4}</td>
+        <td>${1.2E4 + 1.4}</td>
+      </tr>
+      <tr>
+        <td>\${-4 - 2}</td>
+        <td>${-4 - 2}</td>
+      </tr>
+      <tr>
+        <td>\${21 * 2}</td>
+        <td>${21 * 2}</td>
+      </tr>
+      <tr>
+        <td>\${3/4}</td>
+        <td>${3/4}</td>
+      </tr>
+      <tr>
+        <td>\${3 div 4}</td>
+        <td>${3 div 4}</td>
+      </tr>
+      <tr>
+        <td>\${3/0}</td>
+        <td>${3/0}</td>
+      </tr>
+      <tr>
+        <td>\${10%4}</td>
+        <td>${10%4}</td>
+      </tr>
+      <tr>
+        <td>\${10 mod 4}</td>
+        <td>${10 mod 4}</td>
+      </tr>
+    <tr>
+      <td>\${(1==2) ? 3 : 4}</td>
+      <td>${(1==2) ? 3 : 4}</td>
+    </tr>
+    </table>
+      </code>
+    </blockquote>
+  </body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/el/basic-arithmetic.jsp.html b/tomcat/webapps/examples/jsp/jsp2/el/basic-arithmetic.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..b8e1a69635856731752a70dde2f4570dd9c00a9c
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/el/basic-arithmetic.jsp.html
@@ -0,0 +1,89 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+  &lt;head>
+    &lt;title>JSP 2.0 Expression Language - Basic Arithmetic&lt;/title>
+  &lt;/head>
+  &lt;body>
+    &lt;h1>JSP 2.0 Expression Language - Basic Arithmetic&lt;/h1>
+    &lt;hr>
+    This example illustrates basic Expression Language arithmetic.
+    Addition (+), subtraction (-), multiplication (*), division (/ or div),
+    and modulus (% or mod) are all supported.  Error conditions, like
+    division by zero, are handled gracefully.
+    &lt;br>
+    &lt;blockquote>
+      &lt;code>
+        &lt;table border="1">
+          &lt;thead>
+        &lt;td>&lt;b>EL Expression&lt;/b>&lt;/td>
+        &lt;td>&lt;b>Result&lt;/b>&lt;/td>
+      &lt;/thead>
+      &lt;tr>
+        &lt;td>\${1}&lt;/td>
+        &lt;td>${1}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${1 + 2}&lt;/td>
+        &lt;td>${1 + 2}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${1.2 + 2.3}&lt;/td>
+        &lt;td>${1.2 + 2.3}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${1.2E4 + 1.4}&lt;/td>
+        &lt;td>${1.2E4 + 1.4}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${-4 - 2}&lt;/td>
+        &lt;td>${-4 - 2}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${21 * 2}&lt;/td>
+        &lt;td>${21 * 2}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${3/4}&lt;/td>
+        &lt;td>${3/4}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${3 div 4}&lt;/td>
+        &lt;td>${3 div 4}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${3/0}&lt;/td>
+        &lt;td>${3/0}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${10%4}&lt;/td>
+        &lt;td>${10%4}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${10 mod 4}&lt;/td>
+        &lt;td>${10 mod 4}&lt;/td>
+      &lt;/tr>
+    &lt;tr>
+      &lt;td>\${(1==2) ? 3 : 4}&lt;/td>
+      &lt;td>${(1==2) ? 3 : 4}&lt;/td>
+    &lt;/tr>
+    &lt;/table>
+      &lt;/code>
+    &lt;/blockquote>
+  &lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/el/basic-comparisons.html b/tomcat/webapps/examples/jsp/jsp2/el/basic-comparisons.html
new file mode 100644
index 0000000000000000000000000000000000000000..60fb40a3bbf90ab293d065a36ebe01dec9a34849
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/el/basic-comparisons.html
@@ -0,0 +1,30 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>View Source Code</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="basic-comparisons.jsp"><img src="../../images/execute.gif" align="right" border="0"></a><a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="basic-comparisons.jsp.html">Source Code for Basic Comparisons Example<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/el/basic-comparisons.jsp b/tomcat/webapps/examples/jsp/jsp2/el/basic-comparisons.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..d72f7245f8cd2fe21be00024f78d6fe5deed5ca0
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/el/basic-comparisons.jsp
@@ -0,0 +1,116 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+  <head>
+    <title>JSP 2.0 Expression Language - Basic Comparisons</title>
+  </head>
+  <body>
+    <h1>JSP 2.0 Expression Language - Basic Comparisons</h1>
+    <hr>
+    This example illustrates basic Expression Language comparisons.
+    The following comparison operators are supported:
+    <ul>
+      <li>Less-than (&lt; or lt)</li>
+      <li>Greater-than (&gt; or gt)</li>
+      <li>Less-than-or-equal (&lt;= or le)</li>
+      <li>Greater-than-or-equal (&gt;= or ge)</li>
+      <li>Equal (== or eq)</li>
+      <li>Not Equal (!= or ne)</li>
+    </ul>
+    <blockquote>
+      <u><b>Numeric</b></u>
+      <code>
+        <table border="1">
+          <thead>
+        <td><b>EL Expression</b></td>
+        <td><b>Result</b></td>
+      </thead>
+      <tr>
+        <td>\${1 &lt; 2}</td>
+        <td>${1 < 2}</td>
+      </tr>
+      <tr>
+        <td>\${1 lt 2}</td>
+        <td>${1 lt 2}</td>
+      </tr>
+      <tr>
+        <td>\${1 &gt; (4/2)}</td>
+        <td>${1 > (4/2)}</td>
+      </tr>
+      <tr>
+        <td>\${1 gt (4/2)}</td>
+        <td>${1 gt (4/2)}</td>
+      </tr>
+      <tr>
+        <td>\${4.0 &gt;= 3}</td>
+        <td>${4.0 >= 3}</td>
+      </tr>
+      <tr>
+        <td>\${4.0 ge 3}</td>
+        <td>${4.0 ge 3}</td>
+      </tr>
+      <tr>
+        <td>\${4 &lt;= 3}</td>
+        <td>${4 <= 3}</td>
+      </tr>
+      <tr>
+        <td>\${4 le 3}</td>
+        <td>${4 le 3}</td>
+      </tr>
+      <tr>
+        <td>\${100.0 == 100}</td>
+        <td>${100.0 == 100}</td>
+      </tr>
+      <tr>
+        <td>\${100.0 eq 100}</td>
+        <td>${100.0 eq 100}</td>
+      </tr>
+      <tr>
+        <td>\${(10*10) != 100}</td>
+        <td>${(10*10) != 100}</td>
+      </tr>
+      <tr>
+        <td>\${(10*10) ne 100}</td>
+        <td>${(10*10) ne 100}</td>
+      </tr>
+    </table>
+      </code>
+      <br>
+      <u><b>Alphabetic</b></u>
+      <code>
+        <table border="1">
+          <thead>
+            <td><b>EL Expression</b></td>
+            <td><b>Result</b></td>
+          </thead>
+          <tr>
+            <td>\${'a' &lt; 'b'}</td>
+            <td>${'a' < 'b'}</td>
+          </tr>
+          <tr>
+            <td>\${'hip' &gt; 'hit'}</td>
+            <td>${'hip' > 'hit'}</td>
+          </tr>
+          <tr>
+            <td>\${'4' &gt; 3}</td>
+            <td>${'4' > 3}</td>
+          </tr>
+        </table>
+      </code>
+    </blockquote>
+  </body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/el/basic-comparisons.jsp.html b/tomcat/webapps/examples/jsp/jsp2/el/basic-comparisons.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..d20471e2070488597d0bf7c7d10e0e21c06a144e
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/el/basic-comparisons.jsp.html
@@ -0,0 +1,117 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+  &lt;head>
+    &lt;title>JSP 2.0 Expression Language - Basic Comparisons&lt;/title>
+  &lt;/head>
+  &lt;body>
+    &lt;h1>JSP 2.0 Expression Language - Basic Comparisons&lt;/h1>
+    &lt;hr>
+    This example illustrates basic Expression Language comparisons.
+    The following comparison operators are supported:
+    &lt;ul>
+      &lt;li>Less-than (&amp;lt; or lt)&lt;/li>
+      &lt;li>Greater-than (&amp;gt; or gt)&lt;/li>
+      &lt;li>Less-than-or-equal (&amp;lt;= or le)&lt;/li>
+      &lt;li>Greater-than-or-equal (&amp;gt;= or ge)&lt;/li>
+      &lt;li>Equal (== or eq)&lt;/li>
+      &lt;li>Not Equal (!= or ne)&lt;/li>
+    &lt;/ul>
+    &lt;blockquote>
+      &lt;u>&lt;b>Numeric&lt;/b>&lt;/u>
+      &lt;code>
+        &lt;table border="1">
+          &lt;thead>
+        &lt;td>&lt;b>EL Expression&lt;/b>&lt;/td>
+        &lt;td>&lt;b>Result&lt;/b>&lt;/td>
+      &lt;/thead>
+      &lt;tr>
+        &lt;td>\${1 &amp;lt; 2}&lt;/td>
+        &lt;td>${1 &lt; 2}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${1 lt 2}&lt;/td>
+        &lt;td>${1 lt 2}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${1 &amp;gt; (4/2)}&lt;/td>
+        &lt;td>${1 > (4/2)}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${1 gt (4/2)}&lt;/td>
+        &lt;td>${1 gt (4/2)}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${4.0 &amp;gt;= 3}&lt;/td>
+        &lt;td>${4.0 >= 3}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${4.0 ge 3}&lt;/td>
+        &lt;td>${4.0 ge 3}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${4 &amp;lt;= 3}&lt;/td>
+        &lt;td>${4 &lt;= 3}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${4 le 3}&lt;/td>
+        &lt;td>${4 le 3}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${100.0 == 100}&lt;/td>
+        &lt;td>${100.0 == 100}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${100.0 eq 100}&lt;/td>
+        &lt;td>${100.0 eq 100}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${(10*10) != 100}&lt;/td>
+        &lt;td>${(10*10) != 100}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${(10*10) ne 100}&lt;/td>
+        &lt;td>${(10*10) ne 100}&lt;/td>
+      &lt;/tr>
+    &lt;/table>
+      &lt;/code>
+      &lt;br>
+      &lt;u>&lt;b>Alphabetic&lt;/b>&lt;/u>
+      &lt;code>
+        &lt;table border="1">
+          &lt;thead>
+            &lt;td>&lt;b>EL Expression&lt;/b>&lt;/td>
+            &lt;td>&lt;b>Result&lt;/b>&lt;/td>
+          &lt;/thead>
+          &lt;tr>
+            &lt;td>\${'a' &amp;lt; 'b'}&lt;/td>
+            &lt;td>${'a' &lt; 'b'}&lt;/td>
+          &lt;/tr>
+          &lt;tr>
+            &lt;td>\${'hip' &amp;gt; 'hit'}&lt;/td>
+            &lt;td>${'hip' > 'hit'}&lt;/td>
+          &lt;/tr>
+          &lt;tr>
+            &lt;td>\${'4' &amp;gt; 3}&lt;/td>
+            &lt;td>${'4' > 3}&lt;/td>
+          &lt;/tr>
+        &lt;/table>
+      &lt;/code>
+    &lt;/blockquote>
+  &lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/el/composite.html b/tomcat/webapps/examples/jsp/jsp2/el/composite.html
new file mode 100644
index 0000000000000000000000000000000000000000..5900008e2dacc5cb0e8ae5917e53432a906492b6
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/el/composite.html
@@ -0,0 +1,31 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>View Source Code</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="composite.jsp"><img src="../../images/execute.gif" align="right" border="0"></a><a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="composite.jsp.html">Source Code for composite.jsp</a></h3>
+<h3><a href="ValuesTag.java.html">Source Code for ValuesTag.java</a></h3>
+<h3><a href="ValuesBean.java.html">Source Code for ValuesBean.java</a></h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/el/composite.jsp b/tomcat/webapps/examples/jsp/jsp2/el/composite.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..ae671d48a78e1fde9e5b7dc584ab007d3b85553c
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/el/composite.jsp
@@ -0,0 +1,110 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ taglib prefix="my" uri="http://tomcat.apache.org/example-taglib" %>
+
+<html>
+  <head>
+    <title>JSP 2.0 Expression Language - Composite Expressions</title>
+  </head>
+  <body>
+    <h1>JSP 2.0 Expression Language - Composite Expressions</h1>
+    <hr>
+    This example illustrates EL composite expressions. Composite expressions
+    are formed by grouping together multiple EL expressions. Each of them is
+    evaluated from left to right, coerced to String, all those strings are
+    concatenated, and the result is coerced to the expected type.
+
+    <jsp:useBean id="values" class="jsp2.examples.ValuesBean" />
+
+    <blockquote>
+      <code>
+        <table border="1">
+          <thead>
+        <td><b>EL Expression</b></td>
+        <td><b>Type</b></td>
+        <td><b>Result</b></td>
+      </thead>
+      <tr>
+        <td>\${'hello'} wo\${'rld'}</td>
+        <td>String</td>
+        <td><jsp:setProperty name="values" property="stringValue" value="${'hello'} wo${'rld'}"/>${values.stringValue}</td>
+      </tr>
+      <tr>
+        <td>\${'hello'} wo\${'rld'}</td>
+        <td>String</td>
+        <td><my:values string="${'hello'} wo${'rld'}"/></td>
+      </tr>
+      <tr>
+        <td>\${1+2}.\${220}</td>
+        <td>Double</td>
+        <td><jsp:setProperty name="values" property="doubleValue" value="${1+2}.${220}"/>${values.doubleValue}</td>
+      </tr>
+      <tr>
+        <td>\${1+2}.\${220}</td>
+        <td>Double</td>
+        <td><my:values double="${1+2}.${220}"/></td>
+      </tr>
+      <tr>
+        <td>000\${1}\${7}</td>
+        <td>Long</td>
+        <td><jsp:setProperty name="values" property="longValue" value="000${1}${7}"/>${values.longValue}</td>
+      </tr>
+      <tr>
+        <td>000\${1}\${7}</td>
+        <td>Long</td>
+        <td><my:values long="000${1}${7}"/></td>
+      </tr>
+      <!--
+         Undefined values are to be coerced to String, to be "",
+         https://bz.apache.org/bugzilla/show_bug.cgi?id=47413
+       -->
+      <tr>
+        <td>\${undefinedFoo}hello world\${undefinedBar}</td>
+        <td>String</td>
+        <td><jsp:setProperty name="values" property="stringValue" value="${undefinedFoo}hello world${undefinedBar}"/>${values.stringValue}</td>
+      </tr>
+      <tr>
+        <td>\${undefinedFoo}hello world\${undefinedBar}</td>
+        <td>String</td>
+        <td><my:values string="${undefinedFoo}hello world${undefinedBar}"/></td>
+      </tr>
+      <tr>
+        <td>\${undefinedFoo}\${undefinedBar}</td>
+        <td>Double</td>
+        <td><jsp:setProperty name="values" property="doubleValue" value="${undefinedFoo}${undefinedBar}"/>${values.doubleValue}</td>
+      </tr>
+      <tr>
+        <td>\${undefinedFoo}\${undefinedBar}</td>
+        <td>Double</td>
+        <td><my:values double="${undefinedFoo}${undefinedBar}"/></td>
+      </tr>
+      <tr>
+        <td>\${undefinedFoo}\${undefinedBar}</td>
+        <td>Long</td>
+        <td><jsp:setProperty name="values" property="longValue" value="${undefinedFoo}${undefinedBar}"/>${values.longValue}</td>
+      </tr>
+      <tr>
+        <td>\${undefinedFoo}\${undefinedBar}</td>
+        <td>Long</td>
+        <td><my:values long="${undefinedFoo}${undefinedBar}"/></td>
+      </tr>
+    </table>
+      </code>
+    </blockquote>
+  </body>
+</html>
+
diff --git a/tomcat/webapps/examples/jsp/jsp2/el/composite.jsp.html b/tomcat/webapps/examples/jsp/jsp2/el/composite.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..375555f8e6fdf9c32b9748b75ef3f8c9a20331db
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/el/composite.jsp.html
@@ -0,0 +1,111 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@ taglib prefix="my" uri="http://tomcat.apache.org/example-taglib" %>
+
+&lt;html>
+  &lt;head>
+    &lt;title>JSP 2.0 Expression Language - Composite Expressions&lt;/title>
+  &lt;/head>
+  &lt;body>
+    &lt;h1>JSP 2.0 Expression Language - Composite Expressions&lt;/h1>
+    &lt;hr>
+    This example illustrates EL composite expressions. Composite expressions
+    are formed by grouping together multiple EL expressions. Each of them is
+    evaluated from left to right, coerced to String, all those strings are
+    concatenated, and the result is coerced to the expected type.
+
+    &lt;jsp:useBean id="values" class="jsp2.examples.ValuesBean" />
+
+    &lt;blockquote>
+      &lt;code>
+        &lt;table border="1">
+          &lt;thead>
+        &lt;td>&lt;b>EL Expression&lt;/b>&lt;/td>
+        &lt;td>&lt;b>Type&lt;/b>&lt;/td>
+        &lt;td>&lt;b>Result&lt;/b>&lt;/td>
+      &lt;/thead>
+      &lt;tr>
+        &lt;td>\${'hello'} wo\${'rld'}&lt;/td>
+        &lt;td>String&lt;/td>
+        &lt;td>&lt;jsp:setProperty name="values" property="stringValue" value="${'hello'} wo${'rld'}"/>${values.stringValue}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${'hello'} wo\${'rld'}&lt;/td>
+        &lt;td>String&lt;/td>
+        &lt;td>&lt;my:values string="${'hello'} wo${'rld'}"/>&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${1+2}.\${220}&lt;/td>
+        &lt;td>Double&lt;/td>
+        &lt;td>&lt;jsp:setProperty name="values" property="doubleValue" value="${1+2}.${220}"/>${values.doubleValue}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${1+2}.\${220}&lt;/td>
+        &lt;td>Double&lt;/td>
+        &lt;td>&lt;my:values double="${1+2}.${220}"/>&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>000\${1}\${7}&lt;/td>
+        &lt;td>Long&lt;/td>
+        &lt;td>&lt;jsp:setProperty name="values" property="longValue" value="000${1}${7}"/>${values.longValue}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>000\${1}\${7}&lt;/td>
+        &lt;td>Long&lt;/td>
+        &lt;td>&lt;my:values long="000${1}${7}"/>&lt;/td>
+      &lt;/tr>
+      &lt;!--
+         Undefined values are to be coerced to String, to be "",
+         https://bz.apache.org/bugzilla/show_bug.cgi?id=47413
+       -->
+      &lt;tr>
+        &lt;td>\${undefinedFoo}hello world\${undefinedBar}&lt;/td>
+        &lt;td>String&lt;/td>
+        &lt;td>&lt;jsp:setProperty name="values" property="stringValue" value="${undefinedFoo}hello world${undefinedBar}"/>${values.stringValue}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${undefinedFoo}hello world\${undefinedBar}&lt;/td>
+        &lt;td>String&lt;/td>
+        &lt;td>&lt;my:values string="${undefinedFoo}hello world${undefinedBar}"/>&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${undefinedFoo}\${undefinedBar}&lt;/td>
+        &lt;td>Double&lt;/td>
+        &lt;td>&lt;jsp:setProperty name="values" property="doubleValue" value="${undefinedFoo}${undefinedBar}"/>${values.doubleValue}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${undefinedFoo}\${undefinedBar}&lt;/td>
+        &lt;td>Double&lt;/td>
+        &lt;td>&lt;my:values double="${undefinedFoo}${undefinedBar}"/>&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${undefinedFoo}\${undefinedBar}&lt;/td>
+        &lt;td>Long&lt;/td>
+        &lt;td>&lt;jsp:setProperty name="values" property="longValue" value="${undefinedFoo}${undefinedBar}"/>${values.longValue}&lt;/td>
+      &lt;/tr>
+      &lt;tr>
+        &lt;td>\${undefinedFoo}\${undefinedBar}&lt;/td>
+        &lt;td>Long&lt;/td>
+        &lt;td>&lt;my:values long="${undefinedFoo}${undefinedBar}"/>&lt;/td>
+      &lt;/tr>
+    &lt;/table>
+      &lt;/code>
+    &lt;/blockquote>
+  &lt;/body>
+&lt;/html>
+
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/el/functions.html b/tomcat/webapps/examples/jsp/jsp2/el/functions.html
new file mode 100644
index 0000000000000000000000000000000000000000..726dda3661cccb3d543c67598742c5b4ee667c72
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/el/functions.html
@@ -0,0 +1,32 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>View Source Code</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="functions.jsp?foo=JSP+2.0"><img src="../../images/execute.gif" align="right" border="0"></a><a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="functions.jsp.html">Source Code for functions.jsp<font color="#0000FF"></a>
+  </font> </h3>
+<h3><a href="Functions.java.html">Source Code for Functions.java<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/el/functions.jsp b/tomcat/webapps/examples/jsp/jsp2/el/functions.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..12b3fa97d7c5c6256fd42e25a799864a7e3fa6dc
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/el/functions.jsp
@@ -0,0 +1,67 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@page contentType="text/html; charset=UTF-8" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+<%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
+
+<html>
+  <head>
+    <title>JSP 2.0 Expression Language - Functions</title>
+  </head>
+  <body>
+    <h1>JSP 2.0 Expression Language - Functions</h1>
+    <hr>
+    An upgrade from the JSTL expression language, the JSP 2.0 EL also
+    allows for simple function invocation.  Functions are defined
+    by tag libraries and are implemented by a Java programmer as
+    static methods.
+
+    <blockquote>
+      <u><b>Change Parameter</b></u>
+      <form action="functions.jsp" method="GET">
+          foo = <input type="text" name="foo" value="${fn:escapeXml(param["foo"])}">
+          <input type="submit">
+      </form>
+      <br>
+      <code>
+        <table border="1">
+          <thead>
+            <td><b>EL Expression</b></td>
+            <td><b>Result</b></td>
+          </thead>
+          <tr>
+            <td>\${param["foo"]}</td>
+            <td>${fn:escapeXml(param["foo"])}&nbsp;</td>
+          </tr>
+          <tr>
+            <td>\${my:reverse(param["foo"])}</td>
+            <td>${my:reverse(fn:escapeXml(param["foo"]))}&nbsp;</td>
+          </tr>
+          <tr>
+            <td>\${my:reverse(my:reverse(param["foo"]))}</td>
+            <td>${my:reverse(my:reverse(fn:escapeXml(param["foo"])))}&nbsp;</td>
+          </tr>
+          <tr>
+            <td>\${my:countVowels(param["foo"])}</td>
+            <td>${my:countVowels(fn:escapeXml(param["foo"]))}&nbsp;</td>
+          </tr>
+        </table>
+      </code>
+    </blockquote>
+  </body>
+</html>
+
diff --git a/tomcat/webapps/examples/jsp/jsp2/el/functions.jsp.html b/tomcat/webapps/examples/jsp/jsp2/el/functions.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..1a3cdb4043c44a172967ea4b454cefb0cd217398
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/el/functions.jsp.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@page contentType="text/html; charset=UTF-8" %>
+&lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+&lt;%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
+
+&lt;html>
+  &lt;head>
+    &lt;title>JSP 2.0 Expression Language - Functions&lt;/title>
+  &lt;/head>
+  &lt;body>
+    &lt;h1>JSP 2.0 Expression Language - Functions&lt;/h1>
+    &lt;hr>
+    An upgrade from the JSTL expression language, the JSP 2.0 EL also
+    allows for simple function invocation.  Functions are defined
+    by tag libraries and are implemented by a Java programmer as
+    static methods.
+
+    &lt;blockquote>
+      &lt;u>&lt;b>Change Parameter&lt;/b>&lt;/u>
+      &lt;form action="functions.jsp" method="GET">
+          foo = &lt;input type="text" name="foo" value="${fn:escapeXml(param["foo"])}">
+          &lt;input type="submit">
+      &lt;/form>
+      &lt;br>
+      &lt;code>
+        &lt;table border="1">
+          &lt;thead>
+            &lt;td>&lt;b>EL Expression&lt;/b>&lt;/td>
+            &lt;td>&lt;b>Result&lt;/b>&lt;/td>
+          &lt;/thead>
+          &lt;tr>
+            &lt;td>\${param["foo"]}&lt;/td>
+            &lt;td>${fn:escapeXml(param["foo"])}&amp;nbsp;&lt;/td>
+          &lt;/tr>
+          &lt;tr>
+            &lt;td>\${my:reverse(param["foo"])}&lt;/td>
+            &lt;td>${my:reverse(fn:escapeXml(param["foo"]))}&amp;nbsp;&lt;/td>
+          &lt;/tr>
+          &lt;tr>
+            &lt;td>\${my:reverse(my:reverse(param["foo"]))}&lt;/td>
+            &lt;td>${my:reverse(my:reverse(fn:escapeXml(param["foo"])))}&amp;nbsp;&lt;/td>
+          &lt;/tr>
+          &lt;tr>
+            &lt;td>\${my:countVowels(param["foo"])}&lt;/td>
+            &lt;td>${my:countVowels(fn:escapeXml(param["foo"]))}&amp;nbsp;&lt;/td>
+          &lt;/tr>
+        &lt;/table>
+      &lt;/code>
+    &lt;/blockquote>
+  &lt;/body>
+&lt;/html>
+
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/el/implicit-objects.html b/tomcat/webapps/examples/jsp/jsp2/el/implicit-objects.html
new file mode 100644
index 0000000000000000000000000000000000000000..15268db59abc8a756e678c50d68368a71137d128
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/el/implicit-objects.html
@@ -0,0 +1,31 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>View Source Code</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="implicit-objects.jsp?foo=bar"><img src="../../images/execute.gif" align="right" border="0"></a><a href="../../index.html">
+<img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="implicit-objects.jsp.html">Source Code for Implicit Objects Example<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/el/implicit-objects.jsp b/tomcat/webapps/examples/jsp/jsp2/el/implicit-objects.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..b5577142189aec9be3b8d09ce9a4372a3dcc0210
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/el/implicit-objects.jsp
@@ -0,0 +1,90 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@page contentType="text/html; charset=UTF-8" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+
+<html>
+  <head>
+    <title>JSP 2.0 Expression Language - Implicit Objects</title>
+  </head>
+  <body>
+    <h1>JSP 2.0 Expression Language - Implicit Objects</h1>
+    <hr>
+    This example illustrates some of the implicit objects available
+    in the Expression Language.  The following implicit objects are
+    available (not all illustrated here):
+    <ul>
+      <li>pageContext - the PageContext object</li>
+      <li>pageScope - a Map that maps page-scoped attribute names to
+          their values</li>
+      <li>requestScope - a Map that maps request-scoped attribute names
+          to their values</li>
+      <li>sessionScope - a Map that maps session-scoped attribute names
+          to their values</li>
+      <li>applicationScope - a Map that maps application-scoped attribute
+          names to their values</li>
+      <li>param - a Map that maps parameter names to a single String
+          parameter value</li>
+      <li>paramValues - a Map that maps parameter names to a String[] of
+          all values for that parameter</li>
+      <li>header - a Map that maps header names to a single String
+          header value</li>
+      <li>headerValues - a Map that maps header names to a String[] of
+          all values for that header</li>
+      <li>initParam - a Map that maps context initialization parameter
+          names to their String parameter value</li>
+      <li>cookie - a Map that maps cookie names to a single Cookie object.</li>
+    </ul>
+
+    <blockquote>
+      <u><b>Change Parameter</b></u>
+      <form action="implicit-objects.jsp" method="GET">
+          foo = <input type="text" name="foo" value="${fn:escapeXml(param["foo"])}">
+          <input type="submit">
+      </form>
+      <br>
+      <code>
+        <table border="1">
+          <thead>
+            <td><b>EL Expression</b></td>
+            <td><b>Result</b></td>
+          </thead>
+          <tr>
+            <td>\${param.foo}</td>
+            <td>${fn:escapeXml(param["foo"])}&nbsp;</td>
+          </tr>
+          <tr>
+            <td>\${param["foo"]}</td>
+            <td>${fn:escapeXml(param["foo"])}&nbsp;</td>
+          </tr>
+          <tr>
+            <td>\${header["host"]}</td>
+            <td>${fn:escapeXml(header["host"])}&nbsp;</td>
+          </tr>
+          <tr>
+            <td>\${header["accept"]}</td>
+            <td>${fn:escapeXml(header["accept"])}&nbsp;</td>
+          </tr>
+          <tr>
+            <td>\${header["user-agent"]}</td>
+            <td>${fn:escapeXml(header["user-agent"])}&nbsp;</td>
+          </tr>
+        </table>
+      </code>
+    </blockquote>
+  </body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/el/implicit-objects.jsp.html b/tomcat/webapps/examples/jsp/jsp2/el/implicit-objects.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..db967e7a91e32752152b38d0dadbe783eb7fe736
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/el/implicit-objects.jsp.html
@@ -0,0 +1,91 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@page contentType="text/html; charset=UTF-8" %>
+&lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+
+&lt;html>
+  &lt;head>
+    &lt;title>JSP 2.0 Expression Language - Implicit Objects&lt;/title>
+  &lt;/head>
+  &lt;body>
+    &lt;h1>JSP 2.0 Expression Language - Implicit Objects&lt;/h1>
+    &lt;hr>
+    This example illustrates some of the implicit objects available
+    in the Expression Language.  The following implicit objects are
+    available (not all illustrated here):
+    &lt;ul>
+      &lt;li>pageContext - the PageContext object&lt;/li>
+      &lt;li>pageScope - a Map that maps page-scoped attribute names to
+          their values&lt;/li>
+      &lt;li>requestScope - a Map that maps request-scoped attribute names
+          to their values&lt;/li>
+      &lt;li>sessionScope - a Map that maps session-scoped attribute names
+          to their values&lt;/li>
+      &lt;li>applicationScope - a Map that maps application-scoped attribute
+          names to their values&lt;/li>
+      &lt;li>param - a Map that maps parameter names to a single String
+          parameter value&lt;/li>
+      &lt;li>paramValues - a Map that maps parameter names to a String[] of
+          all values for that parameter&lt;/li>
+      &lt;li>header - a Map that maps header names to a single String
+          header value&lt;/li>
+      &lt;li>headerValues - a Map that maps header names to a String[] of
+          all values for that header&lt;/li>
+      &lt;li>initParam - a Map that maps context initialization parameter
+          names to their String parameter value&lt;/li>
+      &lt;li>cookie - a Map that maps cookie names to a single Cookie object.&lt;/li>
+    &lt;/ul>
+
+    &lt;blockquote>
+      &lt;u>&lt;b>Change Parameter&lt;/b>&lt;/u>
+      &lt;form action="implicit-objects.jsp" method="GET">
+          foo = &lt;input type="text" name="foo" value="${fn:escapeXml(param["foo"])}">
+          &lt;input type="submit">
+      &lt;/form>
+      &lt;br>
+      &lt;code>
+        &lt;table border="1">
+          &lt;thead>
+            &lt;td>&lt;b>EL Expression&lt;/b>&lt;/td>
+            &lt;td>&lt;b>Result&lt;/b>&lt;/td>
+          &lt;/thead>
+          &lt;tr>
+            &lt;td>\${param.foo}&lt;/td>
+            &lt;td>${fn:escapeXml(param["foo"])}&amp;nbsp;&lt;/td>
+          &lt;/tr>
+          &lt;tr>
+            &lt;td>\${param["foo"]}&lt;/td>
+            &lt;td>${fn:escapeXml(param["foo"])}&amp;nbsp;&lt;/td>
+          &lt;/tr>
+          &lt;tr>
+            &lt;td>\${header["host"]}&lt;/td>
+            &lt;td>${fn:escapeXml(header["host"])}&amp;nbsp;&lt;/td>
+          &lt;/tr>
+          &lt;tr>
+            &lt;td>\${header["accept"]}&lt;/td>
+            &lt;td>${fn:escapeXml(header["accept"])}&amp;nbsp;&lt;/td>
+          &lt;/tr>
+          &lt;tr>
+            &lt;td>\${header["user-agent"]}&lt;/td>
+            &lt;td>${fn:escapeXml(header["user-agent"])}&amp;nbsp;&lt;/td>
+          &lt;/tr>
+        &lt;/table>
+      &lt;/code>
+    &lt;/blockquote>
+  &lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/jspattribute/FooBean.java.html b/tomcat/webapps/examples/jsp/jsp2/jspattribute/FooBean.java.html
new file mode 100644
index 0000000000000000000000000000000000000000..a5ddf411b8060f6b495e120efdb6f8a2a33f5000
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/jspattribute/FooBean.java.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples;
+
+public class FooBean {
+    private String bar;
+
+    public FooBean() {
+        bar = "Initial value";
+    }
+
+    public String getBar() {
+        return this.bar;
+    }
+
+    public void setBar(String bar) {
+        this.bar = bar;
+    }
+
+}
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/jspattribute/HelloWorldSimpleTag.java.html b/tomcat/webapps/examples/jsp/jsp2/jspattribute/HelloWorldSimpleTag.java.html
new file mode 100644
index 0000000000000000000000000000000000000000..8c0bd4dc49c18e67a7a750bd46312cb633d3ca72
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/jspattribute/HelloWorldSimpleTag.java.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples.simpletag;
+
+import java.io.IOException;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+
+/**
+ * SimpleTag handler that prints "Hello, world!"
+ */
+public class HelloWorldSimpleTag extends SimpleTagSupport {
+    @Override
+    public void doTag() throws JspException, IOException {
+        getJspContext().getOut().write( "Hello, world!" );
+    }
+}
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/jspattribute/ShuffleSimpleTag.java.html b/tomcat/webapps/examples/jsp/jsp2/jspattribute/ShuffleSimpleTag.java.html
new file mode 100644
index 0000000000000000000000000000000000000000..8d360841325be70cb735a4ba8b36319d401c0a68
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/jspattribute/ShuffleSimpleTag.java.html
@@ -0,0 +1,88 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples.simpletag;
+
+import java.io.IOException;
+import java.util.Random;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.JspFragment;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+
+/**
+ * SimpleTag handler that accepts takes three attributes of type
+ * JspFragment and invokes then in a random order.
+ */
+public class ShuffleSimpleTag extends SimpleTagSupport {
+    // No need for this to use SecureRandom
+    private static final Random random = new Random();
+
+    private JspFragment fragment1;
+    private JspFragment fragment2;
+    private JspFragment fragment3;
+
+    @Override
+    public void doTag() throws JspException, IOException {
+        switch(random.nextInt(6)) {
+            case 0:
+                fragment1.invoke( null );
+                fragment2.invoke( null );
+                fragment3.invoke( null );
+                break;
+            case 1:
+                fragment1.invoke( null );
+                fragment3.invoke( null );
+                fragment2.invoke( null );
+                break;
+            case 2:
+                fragment2.invoke( null );
+                fragment1.invoke( null );
+                fragment3.invoke( null );
+                break;
+            case 3:
+                fragment2.invoke( null );
+                fragment3.invoke( null );
+                fragment1.invoke( null );
+                break;
+            case 4:
+                fragment3.invoke( null );
+                fragment1.invoke( null );
+                fragment2.invoke( null );
+                break;
+            case 5:
+                fragment3.invoke( null );
+                fragment2.invoke( null );
+                fragment1.invoke( null );
+                break;
+        }
+    }
+
+    public void setFragment1( JspFragment fragment1 ) {
+        this.fragment1 = fragment1;
+    }
+
+    public void setFragment2( JspFragment fragment2 ) {
+        this.fragment2 = fragment2;
+    }
+
+    public void setFragment3( JspFragment fragment3 ) {
+        this.fragment3 = fragment3;
+    }
+}
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/jspattribute/TileSimpleTag.java.html b/tomcat/webapps/examples/jsp/jsp2/jspattribute/TileSimpleTag.java.html
new file mode 100644
index 0000000000000000000000000000000000000000..75d6daf8d4a3bf0360eb024a042f1eab3c2230a9
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/jspattribute/TileSimpleTag.java.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples.simpletag;
+
+import java.io.IOException;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+
+/**
+ * Displays a tile as a single cell in a table.
+ */
+public class TileSimpleTag extends SimpleTagSupport {
+    private String color;
+    private String label;
+
+    @Override
+    public void doTag() throws JspException, IOException {
+        getJspContext().getOut().write(
+                "&lt;td width=\"32\" height=\"32\" bgcolor=\"" + this.color +
+                "\">&lt;font color=\"#ffffff\">&lt;center>" + this.label +
+                "&lt;/center>&lt;/font>&lt;/td>" );
+    }
+
+    public void setColor( String color ) {
+        this.color = color;
+    }
+
+    public void setLabel( String label ) {
+        this.label = label;
+    }
+}
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/jspattribute/jspattribute.html b/tomcat/webapps/examples/jsp/jsp2/jspattribute/jspattribute.html
new file mode 100644
index 0000000000000000000000000000000000000000..df1b6e68c6dd88c1e9e883a46abd9c5227059a06
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/jspattribute/jspattribute.html
@@ -0,0 +1,37 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>View Source Code</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="jspattribute.jsp"><img src="../../images/execute.gif" align="right" border="0"></a>
+<a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="jspattribute.jsp.html">Source Code for jspattribute.jsp<font color="#0000FF"></a>
+  </font> </h3>
+
+<h3><a href="HelloWorldSimpleTag.java.html">Source Code for HelloWorldSimpleTag.java<font color="#0000FF"></a>
+  </font> </h3>
+
+<h3><a href="FooBean.java.html">Source Code for FooBean.java<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/jspattribute/jspattribute.jsp b/tomcat/webapps/examples/jsp/jsp2/jspattribute/jspattribute.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..8050b3420b028404499211be42d88dc637fea819
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/jspattribute/jspattribute.jsp
@@ -0,0 +1,46 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
+
+<html>
+  <head>
+    <title>JSP 2.0 Examples - jsp:attribute and jsp:body</title>
+  </head>
+  <body>
+    <h1>JSP 2.0 Examples - jsp:attribute and jsp:body</h1>
+    <hr>
+    <p>The new &lt;jsp:attribute&gt; and &lt;jsp:body&gt;
+    standard actions can be used to specify the value of any standard
+    action or custom action attribute.</p>
+    <p>This example uses the &lt;jsp:attribute&gt;
+    standard action to use the output of a custom action invocation
+    (one that simply outputs "Hello, World!") to set the value of a
+    bean property.  This would normally require an intermediary
+    step, such as using JSTL's &lt;c:set&gt; action.</p>
+    <br>
+    <jsp:useBean id="foo" class="jsp2.examples.FooBean">
+      Bean created!  Setting foo.bar...<br>
+      <jsp:setProperty name="foo" property="bar">
+        <jsp:attribute name="value">
+          <my:helloWorld/>
+        </jsp:attribute>
+      </jsp:setProperty>
+    </jsp:useBean>
+    <br>
+    Result: ${foo.bar}
+  </body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/jspattribute/jspattribute.jsp.html b/tomcat/webapps/examples/jsp/jsp2/jspattribute/jspattribute.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..959699792169d7e4f758fad04d3dbc4879b0afa8
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/jspattribute/jspattribute.jsp.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
+
+&lt;html>
+  &lt;head>
+    &lt;title>JSP 2.0 Examples - jsp:attribute and jsp:body&lt;/title>
+  &lt;/head>
+  &lt;body>
+    &lt;h1>JSP 2.0 Examples - jsp:attribute and jsp:body&lt;/h1>
+    &lt;hr>
+    &lt;p>The new &amp;lt;jsp:attribute&amp;gt; and &amp;lt;jsp:body&amp;gt;
+    standard actions can be used to specify the value of any standard
+    action or custom action attribute.&lt;/p>
+    &lt;p>This example uses the &amp;lt;jsp:attribute&amp;gt;
+    standard action to use the output of a custom action invocation
+    (one that simply outputs "Hello, World!") to set the value of a
+    bean property.  This would normally require an intermediary
+    step, such as using JSTL's &amp;lt;c:set&amp;gt; action.&lt;/p>
+    &lt;br>
+    &lt;jsp:useBean id="foo" class="jsp2.examples.FooBean">
+      Bean created!  Setting foo.bar...&lt;br>
+      &lt;jsp:setProperty name="foo" property="bar">
+        &lt;jsp:attribute name="value">
+          &lt;my:helloWorld/>
+        &lt;/jsp:attribute>
+      &lt;/jsp:setProperty>
+    &lt;/jsp:useBean>
+    &lt;br>
+    Result: ${foo.bar}
+  &lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/jspattribute/shuffle.html b/tomcat/webapps/examples/jsp/jsp2/jspattribute/shuffle.html
new file mode 100644
index 0000000000000000000000000000000000000000..5711860afe55facdaddfaab9e212855cbb5f48b6
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/jspattribute/shuffle.html
@@ -0,0 +1,37 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>View Source Code</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="shuffle.jsp"><img src="../../images/execute.gif" align="right" border="0"></a>
+<a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="shuffle.jsp.html">Source Code for shuffle.jsp<font color="#0000FF"></a>
+  </font> </h3>
+
+<h3><a href="ShuffleSimpleTag.java.html">Source Code for ShuffleSimpleTag.java<font color="#0000FF"></a>
+  </font> </h3>
+
+<h3><a href="TileSimpleTag.java.html">Source Code for TileSimpleTag.java<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/jspattribute/shuffle.jsp b/tomcat/webapps/examples/jsp/jsp2/jspattribute/shuffle.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..737ff657aff04f5cf13c3692d5051a22d6ed0060
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/jspattribute/shuffle.jsp
@@ -0,0 +1,90 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
+
+<html>
+  <head>
+    <title>JSP 2.0 Examples - Shuffle Example</title>
+  </head>
+  <body>
+    <h1>JSP 2.0 Examples - Shuffle Example</h1>
+    <hr>
+    <p>Try reloading the page a few times.  Both the rows and the columns
+    are shuffled and appear different each time.</p>
+    <p>Here's how the code works.  The SimpleTag handler called
+    &lt;my:shuffle&gt; accepts three attributes.  Each attribute is a
+    JSP Fragment, meaning it is a fragment of JSP code that can be
+    dynamically executed by the shuffle tag handler on demand.  The
+    shuffle tag handler executes the three fragments in a random order.
+    To shuffle both the rows and the columns, the shuffle tag is used
+    with itself as a parameter.</p>
+    <hr>
+    <blockquote>
+     <font color="#ffffff">
+      <table>
+        <my:shuffle>
+          <jsp:attribute name="fragment1">
+            <tr>
+              <my:shuffle>
+                <jsp:attribute name="fragment1">
+                  <my:tile color="#ff0000" label="A"/>
+                </jsp:attribute>
+                <jsp:attribute name="fragment2">
+                  <my:tile color="#00ff00" label="B"/>
+                </jsp:attribute>
+                <jsp:attribute name="fragment3">
+                  <my:tile color="#0000ff" label="C"/>
+                </jsp:attribute>
+              </my:shuffle>
+            </tr>
+          </jsp:attribute>
+          <jsp:attribute name="fragment2">
+            <tr>
+              <my:shuffle>
+                <jsp:attribute name="fragment1">
+                  <my:tile color="#ff0000" label="1"/>
+                </jsp:attribute>
+                <jsp:attribute name="fragment2">
+                  <my:tile color="#00ff00" label="2"/>
+                </jsp:attribute>
+                <jsp:attribute name="fragment3">
+                  <my:tile color="#0000ff" label="3"/>
+                </jsp:attribute>
+              </my:shuffle>
+            </tr>
+          </jsp:attribute>
+          <jsp:attribute name="fragment3">
+            <tr>
+              <my:shuffle>
+                <jsp:attribute name="fragment1">
+                  <my:tile color="#ff0000" label="!"/>
+                </jsp:attribute>
+                <jsp:attribute name="fragment2">
+                  <my:tile color="#00ff00" label="@"/>
+                </jsp:attribute>
+                <jsp:attribute name="fragment3">
+                  <my:tile color="#0000ff" label="#"/>
+                </jsp:attribute>
+              </my:shuffle>
+            </tr>
+          </jsp:attribute>
+        </my:shuffle>
+      </table>
+     </font>
+    </blockquote>
+  </body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/jspattribute/shuffle.jsp.html b/tomcat/webapps/examples/jsp/jsp2/jspattribute/shuffle.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..dcb137d22625d69503633357217fa776fe4fae9d
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/jspattribute/shuffle.jsp.html
@@ -0,0 +1,91 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
+
+&lt;html>
+  &lt;head>
+    &lt;title>JSP 2.0 Examples - Shuffle Example&lt;/title>
+  &lt;/head>
+  &lt;body>
+    &lt;h1>JSP 2.0 Examples - Shuffle Example&lt;/h1>
+    &lt;hr>
+    &lt;p>Try reloading the page a few times.  Both the rows and the columns
+    are shuffled and appear different each time.&lt;/p>
+    &lt;p>Here's how the code works.  The SimpleTag handler called
+    &amp;lt;my:shuffle&amp;gt; accepts three attributes.  Each attribute is a
+    JSP Fragment, meaning it is a fragment of JSP code that can be
+    dynamically executed by the shuffle tag handler on demand.  The
+    shuffle tag handler executes the three fragments in a random order.
+    To shuffle both the rows and the columns, the shuffle tag is used
+    with itself as a parameter.&lt;/p>
+    &lt;hr>
+    &lt;blockquote>
+     &lt;font color="#ffffff">
+      &lt;table>
+        &lt;my:shuffle>
+          &lt;jsp:attribute name="fragment1">
+            &lt;tr>
+              &lt;my:shuffle>
+                &lt;jsp:attribute name="fragment1">
+                  &lt;my:tile color="#ff0000" label="A"/>
+                &lt;/jsp:attribute>
+                &lt;jsp:attribute name="fragment2">
+                  &lt;my:tile color="#00ff00" label="B"/>
+                &lt;/jsp:attribute>
+                &lt;jsp:attribute name="fragment3">
+                  &lt;my:tile color="#0000ff" label="C"/>
+                &lt;/jsp:attribute>
+              &lt;/my:shuffle>
+            &lt;/tr>
+          &lt;/jsp:attribute>
+          &lt;jsp:attribute name="fragment2">
+            &lt;tr>
+              &lt;my:shuffle>
+                &lt;jsp:attribute name="fragment1">
+                  &lt;my:tile color="#ff0000" label="1"/>
+                &lt;/jsp:attribute>
+                &lt;jsp:attribute name="fragment2">
+                  &lt;my:tile color="#00ff00" label="2"/>
+                &lt;/jsp:attribute>
+                &lt;jsp:attribute name="fragment3">
+                  &lt;my:tile color="#0000ff" label="3"/>
+                &lt;/jsp:attribute>
+              &lt;/my:shuffle>
+            &lt;/tr>
+          &lt;/jsp:attribute>
+          &lt;jsp:attribute name="fragment3">
+            &lt;tr>
+              &lt;my:shuffle>
+                &lt;jsp:attribute name="fragment1">
+                  &lt;my:tile color="#ff0000" label="!"/>
+                &lt;/jsp:attribute>
+                &lt;jsp:attribute name="fragment2">
+                  &lt;my:tile color="#00ff00" label="@"/>
+                &lt;/jsp:attribute>
+                &lt;jsp:attribute name="fragment3">
+                  &lt;my:tile color="#0000ff" label="#"/>
+                &lt;/jsp:attribute>
+              &lt;/my:shuffle>
+            &lt;/tr>
+          &lt;/jsp:attribute>
+        &lt;/my:shuffle>
+      &lt;/table>
+     &lt;/font>
+    &lt;/blockquote>
+  &lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/jspx/basic.html b/tomcat/webapps/examples/jsp/jsp2/jspx/basic.html
new file mode 100644
index 0000000000000000000000000000000000000000..f9df6a4a2015cb5eede40fe3e6ddae9d78a683be
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/jspx/basic.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html lang="en">
+<head>
+<meta charset="UTF-8">
+<title>View Source Code</title>
+</head>
+
+<body>
+<p><a href="basic.jspx"><img src="../../images/execute.gif" alt="Execute" style="border: 0;"></a><a
+href="../../index.html"><img src="../../images/return.gif" alt="Return" style="border: 0;"></a></p>
+
+<h3><a href="basic.jspx.html">Source Code for XHTML Basic Example</a></h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/jspx/basic.jspx b/tomcat/webapps/examples/jsp/jsp2/jspx/basic.jspx
new file mode 100644
index 0000000000000000000000000000000000000000..fc1e45f923b48fce4ec05c0030877d800d1d24f0
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/jspx/basic.jspx
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html xmlns:jsp="http://java.sun.com/JSP/Page"
+      xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
+      xmlns="http://www.w3.org/1999/xhtml">
+  <jsp:output doctype-root-element="html"
+              doctype-public="-//W3C//DTD XHTML Basic 1.0//EN"
+              doctype-system="http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"/>
+  <jsp:directive.page contentType="application/xhtml+xml" />
+  <head>
+    <title>JSPX - XHTML Basic Example</title>
+  </head>
+  <body>
+    <h1>JSPX - XHTML Basic Example</h1>
+    This example illustrates how to use JSPX to produce an XHTML basic
+    document suitable for use with mobile phones, televisions,
+    PDAs, vending machines, pagers, car navigation systems,
+    mobile game machines, digital book readers, smart watches, etc.
+    <p/>
+    JSPX lets you create dynamic documents in a pure XML syntax compatible
+    with existing XML tools.  The XML syntax in JSP 1.2 was awkward and
+    required &amp;lt;jsp:root&amp;gt; to be the root element of the document.
+    This is no longer the case in JSP 2.0.
+    <p/>
+    This particular example uses
+    namespace declarations to make the output of this page a valid XHTML
+    document.
+    <p/>
+    Just to prove this is live, here's some dynamic content:
+    <jsp:useBean id="now" class="java.util.Date" />
+    <fmt:formatDate value="${now}" pattern="MMMM d, yyyy, H:mm:ss"/>
+  </body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/jspx/basic.jspx.html b/tomcat/webapps/examples/jsp/jsp2/jspx/basic.jspx.html
new file mode 100644
index 0000000000000000000000000000000000000000..6b38336ba3c485251916c20cc813898132922543
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/jspx/basic.jspx.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;?xml version="1.0" encoding="UTF-8"?>
+&lt;!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+&lt;html xmlns:jsp="http://java.sun.com/JSP/Page"
+      xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
+      xmlns="http://www.w3.org/1999/xhtml">
+  &lt;jsp:output doctype-root-element="html"
+              doctype-public="-//W3C//DTD XHTML Basic 1.0//EN"
+              doctype-system="http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"/>
+  &lt;jsp:directive.page contentType="application/xhtml+xml" />
+  &lt;head>
+    &lt;title>JSPX - XHTML Basic Example&lt;/title>
+  &lt;/head>
+  &lt;body>
+    &lt;h1>JSPX - XHTML Basic Example&lt;/h1>
+    This example illustrates how to use JSPX to produce an XHTML basic
+    document suitable for use with mobile phones, televisions,
+    PDAs, vending machines, pagers, car navigation systems,
+    mobile game machines, digital book readers, smart watches, etc.
+    &lt;p/>
+    JSPX lets you create dynamic documents in a pure XML syntax compatible
+    with existing XML tools.  The XML syntax in JSP 1.2 was awkward and
+    required &amp;amp;lt;jsp:root&amp;amp;gt; to be the root element of the document.
+    This is no longer the case in JSP 2.0.
+    &lt;p/>
+    This particular example uses
+    namespace declarations to make the output of this page a valid XHTML
+    document.
+    &lt;p/>
+    Just to prove this is live, here's some dynamic content:
+    &lt;jsp:useBean id="now" class="java.util.Date" />
+    &lt;fmt:formatDate value="${now}" pattern="MMMM d, yyyy, H:mm:ss"/>
+  &lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/jspx/svgexample.html b/tomcat/webapps/examples/jsp/jsp2/jspx/svgexample.html
new file mode 100644
index 0000000000000000000000000000000000000000..f7d591a58370bc4a2002132444db94373c8e6ef1
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/jspx/svgexample.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html><!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+  <head>
+    <meta charset="UTF-8">
+    <title>JSP 2.0 SVG Example</title>
+  </head>
+  <body>
+    <h1>JSP 2.0 SVG Example</h1>
+    This example uses JSP 2.0's new, simplified JSPX syntax to render a
+    Scalable Vector Graphics (SVG) document.  When you view the source,
+    notice the lack of a &lt;jsp:root&gt; element!  The text to be rendered
+    can be modified by changing the value of the name parameter.
+    <p>
+    SVG has many potential uses, such as searchable images, or images
+    customized with the name of your site's visitor (e.g. a "Susan's Store"
+    tab image).  JSPX is a natural fit for generating dynamic XML content
+    such as SVG.
+    <p>
+    To execute this example you will need a browser with basic SVG support. Any
+    remotely recent browser should have this.
+    <ol>
+      <li>Use this URL:
+      <a href="textRotate.jspx?name=JSPX">textRotate.jspx?name=JSPX</a></li>
+      <li>Customize by changing the name=JSPX parameter</li>
+    </ol>
+    <p style="margin-top: 2em;">
+    The following is a screenshot of the resulting image, for those using a
+    browser without SVG support:<br>
+    <img src="textRotate.jpg" alt="[Screenshot image]" style="border: 1px solid #000;">
+  </body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/jspx/textRotate.html b/tomcat/webapps/examples/jsp/jsp2/jspx/textRotate.html
new file mode 100644
index 0000000000000000000000000000000000000000..5b3befe2e048a379085e2f381a3a23b35a7ab2ea
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/jspx/textRotate.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html lang="en">
+<head>
+<meta charset="UTF-8">
+<title>View Source Code</title>
+</head>
+
+<body>
+<p><a href="textRotate.jspx"><img src="../../images/execute.gif" alt="Execute" style="border: 0;"></a> <a
+href="../../index.html"><img src="../../images/return.gif" alt="Return" style="border: 0;"></a></p>
+
+<h3><a href="textRotate.jspx.html">Source Code for SVG (Scalable Vector Graphics)
+Example</a></h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/jspx/textRotate.jpg b/tomcat/webapps/examples/jsp/jsp2/jspx/textRotate.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..9e987367bc83c25aedf1c7afd76f34de4a229f82
Binary files /dev/null and b/tomcat/webapps/examples/jsp/jsp2/jspx/textRotate.jpg differ
diff --git a/tomcat/webapps/examples/jsp/jsp2/jspx/textRotate.jspx b/tomcat/webapps/examples/jsp/jsp2/jspx/textRotate.jspx
new file mode 100644
index 0000000000000000000000000000000000000000..c543887e6688f863e1382a588d8aa996ed1cef16
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/jspx/textRotate.jspx
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!--
+  - This example is based off the textRotate.svg example that comes
+  - with Apache Batik.  The original example was written by Bill Haneman.
+  - This version by Mark Roth.
+  -->
+<svg xmlns="http://www.w3.org/2000/svg"
+     width="450" height="500" viewBox="0 0 450 500"
+     xmlns:c="http://java.sun.com/jsp/jstl/core"
+     xmlns:fn="http://java.sun.com/jsp/jstl/functions"
+     xmlns:jsp="http://java.sun.com/JSP/Page">
+  <jsp:directive.page contentType="image/svg+xml" />
+  <title>JSP 2.0 JSPX</title>
+  <!-- select name parameter, or default to JSPX -->
+  <c:set var="name" value='${empty fn:escapeXml(param["name"]) ? "JSPX" : fn:escapeXml(param["name"])}'/>
+  <g id="testContent">
+    <text class="title" x="50%" y="10%" font-size="15" text-anchor="middle" >
+            JSP 2.0 XML Syntax (.jspx) Demo</text>
+    <text class="title" x="50%" y="15%" font-size="15" text-anchor="middle" >
+            Try changing the name parameter!</text>
+    <g opacity="1.0" transform="translate(225, 250)" id="rotatedText">
+      <c:forEach var="i" begin="1" end="24">
+        <jsp:text>
+          <![CDATA[<g opacity="0.95" transform="scale(1.05) rotate(15)">]]>
+        </jsp:text>
+        <text x="0" y="0" transform="scale(1.6, 1.6)" fill="DarkSlateBlue"
+              text-anchor="middle" font-size="40" font-family="Serif"
+              id="words">${name}</text>
+      </c:forEach>
+      <c:forEach var="i" begin="1" end="24">
+        <jsp:text><![CDATA[</g>]]></jsp:text>
+      </c:forEach>
+      <text style="font-size:75;font-family:Serif;fill:white"
+            text-anchor="middle">${name}</text>
+    </g>
+  </g>
+</svg>
diff --git a/tomcat/webapps/examples/jsp/jsp2/jspx/textRotate.jspx.html b/tomcat/webapps/examples/jsp/jsp2/jspx/textRotate.jspx.html
new file mode 100644
index 0000000000000000000000000000000000000000..0e6c8208f7189c088af0325e5e8bf527b72ee9a9
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/jspx/textRotate.jspx.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;?xml version="1.0" encoding="UTF-8"?>
+&lt;!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+&lt;!--
+  - This example is based off the textRotate.svg example that comes
+  - with Apache Batik.  The original example was written by Bill Haneman.
+  - This version by Mark Roth.
+  -->
+&lt;svg xmlns="http://www.w3.org/2000/svg"
+     width="450" height="500" viewBox="0 0 450 500"
+     xmlns:c="http://java.sun.com/jsp/jstl/core"
+     xmlns:fn="http://java.sun.com/jsp/jstl/functions"
+     xmlns:jsp="http://java.sun.com/JSP/Page">
+  &lt;jsp:directive.page contentType="image/svg+xml" />
+  &lt;title>JSP 2.0 JSPX&lt;/title>
+  &lt;!-- select name parameter, or default to JSPX -->
+  &lt;c:set var="name" value='${empty fn:escapeXml(param["name"]) ? "JSPX" : fn:escapeXml(param["name"])}'/>
+  &lt;g id="testContent">
+    &lt;text class="title" x="50%" y="10%" font-size="15" text-anchor="middle" >
+            JSP 2.0 XML Syntax (.jspx) Demo&lt;/text>
+    &lt;text class="title" x="50%" y="15%" font-size="15" text-anchor="middle" >
+            Try changing the name parameter!&lt;/text>
+    &lt;g opacity="1.0" transform="translate(225, 250)" id="rotatedText">
+      &lt;c:forEach var="i" begin="1" end="24">
+        &lt;jsp:text>
+          &lt;![CDATA[&lt;g opacity="0.95" transform="scale(1.05) rotate(15)">]]>
+        &lt;/jsp:text>
+        &lt;text x="0" y="0" transform="scale(1.6, 1.6)" fill="DarkSlateBlue"
+              text-anchor="middle" font-size="40" font-family="Serif"
+              id="words">${name}&lt;/text>
+      &lt;/c:forEach>
+      &lt;c:forEach var="i" begin="1" end="24">
+        &lt;jsp:text>&lt;![CDATA[&lt;/g>]]>&lt;/jsp:text>
+      &lt;/c:forEach>
+      &lt;text style="font-size:75;font-family:Serif;fill:white"
+            text-anchor="middle">${name}&lt;/text>
+    &lt;/g>
+  &lt;/g>
+&lt;/svg>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/misc/EchoAttributesTag.java.html b/tomcat/webapps/examples/jsp/jsp2/misc/EchoAttributesTag.java.html
new file mode 100644
index 0000000000000000000000000000000000000000..cab826dc686bb77d274caf1292f49f3433e818ee
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/misc/EchoAttributesTag.java.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples.simpletag;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.DynamicAttributes;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+
+/**
+ * SimpleTag handler that echoes all its attributes
+ */
+public class EchoAttributesTag
+    extends SimpleTagSupport
+    implements DynamicAttributes
+{
+    private final List&lt;String> keys = new ArrayList&lt;>();
+    private final List&lt;Object> values = new ArrayList&lt;>();
+
+    @Override
+    public void doTag() throws JspException, IOException {
+        JspWriter out = getJspContext().getOut();
+        for( int i = 0; i &lt; keys.size(); i++ ) {
+            String key = keys.get( i );
+            Object value = values.get( i );
+            out.println( "&lt;li>" + key + " = " + value + "&lt;/li>" );
+        }
+    }
+
+    @Override
+    public void setDynamicAttribute( String uri, String localName,
+        Object value )
+        throws JspException
+    {
+        keys.add( localName );
+        values.add( value );
+    }
+}
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/misc/coda.jspf b/tomcat/webapps/examples/jsp/jsp2/misc/coda.jspf
new file mode 100644
index 0000000000000000000000000000000000000000..d767de506b8de5aa838bbeb9727c936acc66abd6
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/misc/coda.jspf
@@ -0,0 +1,21 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<hr>
+<center>
+This banner included with &lt;include-coda&gt;
+</center>
+<hr>
diff --git a/tomcat/webapps/examples/jsp/jsp2/misc/coda.jspf.html b/tomcat/webapps/examples/jsp/jsp2/misc/coda.jspf.html
new file mode 100644
index 0000000000000000000000000000000000000000..3a82576c0e6371c1b64f74ab03e21e7d31c0acb4
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/misc/coda.jspf.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+&lt;hr>
+&lt;center>
+This banner included with &amp;lt;include-coda&amp;gt;
+&lt;/center>
+&lt;hr>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/misc/config.html b/tomcat/webapps/examples/jsp/jsp2/misc/config.html
new file mode 100644
index 0000000000000000000000000000000000000000..707d68faf1c71fe57b54d858438da3a2d8531bef
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/misc/config.html
@@ -0,0 +1,35 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>View Source Code</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="config.jsp"><img src="../../images/execute.gif" align="right" border="0"></a>
+<a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="config.jsp.html">Source Code for config.jsp<font color="#0000FF"></a>
+  </font> </h3>
+<h3><a href="prelude.jspf.html">Source Code for prelude.jspf<font color="#0000FF"></a>
+  </font> </h3>
+<h3><a href="coda.jspf.html">Source Code for coda.jspf<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/misc/config.jsp b/tomcat/webapps/examples/jsp/jsp2/misc/config.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..0372889615a9f3fe0ca93918d1df16b6c2cab8a2
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/misc/config.jsp
@@ -0,0 +1,32 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
+    <h1>JSP 2.0 Examples - JSP Configuration</h1>
+    <hr>
+    <p>Using a &lt;jsp-property-group&gt; element in the web.xml
+    deployment descriptor, this JSP page has been configured in the
+    following ways:</p>
+    <ul>
+      <li>Uses &lt;include-prelude&gt; to include the top banner.</li>
+      <li>Uses &lt;include-coda&gt; to include the bottom banner.</li>
+      <li>Uses &lt;scripting-invalid&gt; true to disable
+          &lt;% scripting %&gt; elements</li>
+      <li>Uses &lt;el-ignored&gt; true to disable ${EL} elements</li>
+      <li>Uses &lt;page-encoding&gt; ISO-8859-1 to set the page encoding (though this is the default anyway)</li>
+    </ul>
+    There are various other configuration options that can be used.
+
diff --git a/tomcat/webapps/examples/jsp/jsp2/misc/config.jsp.html b/tomcat/webapps/examples/jsp/jsp2/misc/config.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..6ce33ff5e32b0869758daed41b97501d0457b87e
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/misc/config.jsp.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
+    &lt;h1>JSP 2.0 Examples - JSP Configuration&lt;/h1>
+    &lt;hr>
+    &lt;p>Using a &amp;lt;jsp-property-group&amp;gt; element in the web.xml
+    deployment descriptor, this JSP page has been configured in the
+    following ways:&lt;/p>
+    &lt;ul>
+      &lt;li>Uses &amp;lt;include-prelude&amp;gt; to include the top banner.&lt;/li>
+      &lt;li>Uses &amp;lt;include-coda&amp;gt; to include the bottom banner.&lt;/li>
+      &lt;li>Uses &amp;lt;scripting-invalid&amp;gt; true to disable
+          &amp;lt;% scripting %&amp;gt; elements&lt;/li>
+      &lt;li>Uses &amp;lt;el-ignored&amp;gt; true to disable ${EL} elements&lt;/li>
+      &lt;li>Uses &amp;lt;page-encoding&amp;gt; ISO-8859-1 to set the page encoding (though this is the default anyway)&lt;/li>
+    &lt;/ul>
+    There are various other configuration options that can be used.
+
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/misc/dynamicattrs.html b/tomcat/webapps/examples/jsp/jsp2/misc/dynamicattrs.html
new file mode 100644
index 0000000000000000000000000000000000000000..4fa1bf14e6f834a350d07253b6f7d74f01238fe8
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/misc/dynamicattrs.html
@@ -0,0 +1,33 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>View Source Code</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="dynamicattrs.jsp"><img src="../../images/execute.gif" align="right" border="0"></a>
+<a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="dynamicattrs.jsp.html">Source Code for dynamicattrs.jsp<font color="#0000FF"></a>
+  </font> </h3>
+<h3><a href="EchoAttributesTag.java.html">Source Code for EchoAttributesTag.java<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/misc/dynamicattrs.jsp b/tomcat/webapps/examples/jsp/jsp2/misc/dynamicattrs.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..251c49dbc8e89c6e4b1d45957b3ddbeda1cedb78
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/misc/dynamicattrs.jsp
@@ -0,0 +1,44 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
+<html>
+  <head>
+    <title>JSP 2.0 Examples - Dynamic Attributes</title>
+  </head>
+  <body>
+    <h1>JSP 2.0 Examples - Dynamic Attributes</h1>
+    <hr>
+    <p>This JSP page invokes a custom tag that accepts a dynamic set
+    of attributes.  The tag echoes the name and value of all attributes
+    passed to it.</p>
+    <hr>
+    <h2>Invocation 1 (six attributes)</h2>
+    <ul>
+      <my:echoAttributes x="1" y="2" z="3" r="red" g="green" b="blue"/>
+    </ul>
+    <h2>Invocation 2 (zero attributes)</h2>
+    <ul>
+      <my:echoAttributes/>
+    </ul>
+    <h2>Invocation 3 (three attributes)</h2>
+    <ul>
+      <my:echoAttributes dogName="Scruffy"
+                         catName="Fluffy"
+                         blowfishName="Puffy"/>
+    </ul>
+  </body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/misc/dynamicattrs.jsp.html b/tomcat/webapps/examples/jsp/jsp2/misc/dynamicattrs.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..8f5ee18e7c30e018f1373175c0c9c683a403699f
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/misc/dynamicattrs.jsp.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@ taglib prefix="my" uri="http://tomcat.apache.org/jsp2-example-taglib"%>
+&lt;html>
+  &lt;head>
+    &lt;title>JSP 2.0 Examples - Dynamic Attributes&lt;/title>
+  &lt;/head>
+  &lt;body>
+    &lt;h1>JSP 2.0 Examples - Dynamic Attributes&lt;/h1>
+    &lt;hr>
+    &lt;p>This JSP page invokes a custom tag that accepts a dynamic set
+    of attributes.  The tag echoes the name and value of all attributes
+    passed to it.&lt;/p>
+    &lt;hr>
+    &lt;h2>Invocation 1 (six attributes)&lt;/h2>
+    &lt;ul>
+      &lt;my:echoAttributes x="1" y="2" z="3" r="red" g="green" b="blue"/>
+    &lt;/ul>
+    &lt;h2>Invocation 2 (zero attributes)&lt;/h2>
+    &lt;ul>
+      &lt;my:echoAttributes/>
+    &lt;/ul>
+    &lt;h2>Invocation 3 (three attributes)&lt;/h2>
+    &lt;ul>
+      &lt;my:echoAttributes dogName="Scruffy"
+                         catName="Fluffy"
+                         blowfishName="Puffy"/>
+    &lt;/ul>
+  &lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/misc/prelude.jspf b/tomcat/webapps/examples/jsp/jsp2/misc/prelude.jspf
new file mode 100644
index 0000000000000000000000000000000000000000..05f7c845a1084ee0c9eeb98fad625509bdf87477
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/misc/prelude.jspf
@@ -0,0 +1,21 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<hr>
+<center>
+This banner included with &lt;include-prelude&gt;
+</center>
+<hr>
diff --git a/tomcat/webapps/examples/jsp/jsp2/misc/prelude.jspf.html b/tomcat/webapps/examples/jsp/jsp2/misc/prelude.jspf.html
new file mode 100644
index 0000000000000000000000000000000000000000..8b2bcd056eb3338a80d1549bebc6c1900fd0254e
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/misc/prelude.jspf.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+&lt;hr>
+&lt;center>
+This banner included with &amp;lt;include-prelude&amp;gt;
+&lt;/center>
+&lt;hr>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/simpletag/BookBean.java.html b/tomcat/webapps/examples/jsp/jsp2/simpletag/BookBean.java.html
new file mode 100644
index 0000000000000000000000000000000000000000..5c99dad403f3655d956e59452ba87462aa5f1adf
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/simpletag/BookBean.java.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples;
+
+public class BookBean {
+    private final String title;
+    private final String author;
+    private final String isbn;
+
+    public BookBean( String title, String author, String isbn ) {
+        this.title = title;
+        this.author = author;
+        this.isbn = isbn;
+    }
+
+    public String getTitle() {
+        return this.title;
+    }
+
+    public String getAuthor() {
+        return this.author;
+    }
+
+    public String getIsbn() {
+        return this.isbn;
+    }
+
+}
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/simpletag/FindBookSimpleTag.java.html b/tomcat/webapps/examples/jsp/jsp2/simpletag/FindBookSimpleTag.java.html
new file mode 100644
index 0000000000000000000000000000000000000000..4deafca9fd79dbff589b71ee95a69cd1262a10d2
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/simpletag/FindBookSimpleTag.java.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples.simpletag;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+
+import jsp2.examples.BookBean;
+
+/**
+ * SimpleTag handler that pretends to search for a book, and stores
+ * the result in a scoped variable.
+ */
+public class FindBookSimpleTag extends SimpleTagSupport {
+    private String var;
+
+    private static final String BOOK_TITLE = "The Lord of the Rings";
+    private static final String BOOK_AUTHOR = "J. R. R. Tolkein";
+    private static final String BOOK_ISBN = "0618002251";
+
+    @Override
+    public void doTag() throws JspException {
+        BookBean book = new BookBean( BOOK_TITLE, BOOK_AUTHOR, BOOK_ISBN );
+        getJspContext().setAttribute( this.var, book );
+    }
+
+    public void setVar( String var ) {
+        this.var = var;
+    }
+}
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/simpletag/Functions.java.html b/tomcat/webapps/examples/jsp/jsp2/simpletag/Functions.java.html
new file mode 100644
index 0000000000000000000000000000000000000000..aa84cccc46dd097cad8b43b9f1e8e1b2398e847c
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/simpletag/Functions.java.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package jsp2.examples.el;
+
+import java.util.Locale;
+
+/**
+ * Defines the functions for the jsp2 example tag library.
+ *
+ * &lt;p>Each function is defined as a static method.&lt;/p>
+ */
+public class Functions {
+    public static String reverse( String text ) {
+        return new StringBuilder( text ).reverse().toString();
+    }
+
+    public static int numVowels( String text ) {
+        String vowels = "aeiouAEIOU";
+        int result = 0;
+        for( int i = 0; i &lt; text.length(); i++ ) {
+            if( vowels.indexOf( text.charAt( i ) ) != -1 ) {
+                result++;
+            }
+        }
+        return result;
+    }
+
+    public static String caps( String text ) {
+        return text.toUpperCase(Locale.ENGLISH);
+    }
+}
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/simpletag/HelloWorldSimpleTag.java.html b/tomcat/webapps/examples/jsp/jsp2/simpletag/HelloWorldSimpleTag.java.html
new file mode 100644
index 0000000000000000000000000000000000000000..8c0bd4dc49c18e67a7a750bd46312cb633d3ca72
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/simpletag/HelloWorldSimpleTag.java.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples.simpletag;
+
+import java.io.IOException;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+
+/**
+ * SimpleTag handler that prints "Hello, world!"
+ */
+public class HelloWorldSimpleTag extends SimpleTagSupport {
+    @Override
+    public void doTag() throws JspException, IOException {
+        getJspContext().getOut().write( "Hello, world!" );
+    }
+}
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/simpletag/RepeatSimpleTag.java.html b/tomcat/webapps/examples/jsp/jsp2/simpletag/RepeatSimpleTag.java.html
new file mode 100644
index 0000000000000000000000000000000000000000..12913fcdae1d4d38aac6d976b7b47e4cbf5bef27
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/simpletag/RepeatSimpleTag.java.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package jsp2.examples.simpletag;
+
+import java.io.IOException;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+
+/**
+ * SimpleTag handler that accepts a num attribute and
+ * invokes its body 'num' times.
+ */
+public class RepeatSimpleTag extends SimpleTagSupport {
+    private int num;
+
+    @Override
+    public void doTag() throws JspException, IOException {
+        for (int i=0; i&lt;num; i++) {
+            getJspContext().setAttribute("count", String.valueOf( i + 1 ) );
+            getJspBody().invoke(null);
+        }
+    }
+
+    public void setNum(int num) {
+        this.num = num;
+    }
+}
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/simpletag/book.html b/tomcat/webapps/examples/jsp/jsp2/simpletag/book.html
new file mode 100644
index 0000000000000000000000000000000000000000..2841acf17f8b06afaaa12b1848eb99b71f34b5c8
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/simpletag/book.html
@@ -0,0 +1,37 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>View Source Code</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="book.jsp"><img src="../../images/execute.gif" align="right" border="0"></a>
+<a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="book.jsp.html">Source Code for the Book Example JSP<font color="#0000FF"></a>
+  </font> </h3>
+<h3><a href="FindBookSimpleTag.java.html">Source Code for the FindBook SimpleTag Handler<font color="#0000FF"></a>
+  </font> </h3>
+<h3><a href="BookBean.java.html">Source Code for BookBean<font color="#0000FF"></a>
+  </font> </h3>
+<h3><a href="Functions.java.html">Source Code for the EL Functions<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/simpletag/book.jsp b/tomcat/webapps/examples/jsp/jsp2/simpletag/book.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..ba07cfb64ace92524a587ea9336320e3f1c3b0d0
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/simpletag/book.jsp
@@ -0,0 +1,55 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ taglib prefix="my" uri="/WEB-INF/jsp2/jsp2-example-taglib.tld" %>
+<html>
+  <head>
+    <title>JSP 2.0 Examples - Book SimpleTag Handler</title>
+  </head>
+  <body>
+    <h1>JSP 2.0 Examples - Book SimpleTag Handler</h1>
+    <hr>
+    <p>Illustrates a semi-realistic use of SimpleTag and the Expression
+    Language.  First, a &lt;my:findBook&gt; tag is invoked to populate
+    the page context with a BookBean.  Then, the books fields are printed
+    in all caps.</p>
+    <br>
+    <b><u>Result:</u></b><br>
+    <my:findBook var="book"/>
+    <table border="1">
+        <thead>
+        <td><b>Field</b></td>
+        <td><b>Value</b></td>
+        <td><b>Capitalized</b></td>
+    </thead>
+    <tr>
+        <td>Title</td>
+        <td>${book.title}</td>
+        <td>${my:caps(book.title)}</td>
+    </tr>
+    <tr>
+        <td>Author</td>
+        <td>${book.author}</td>
+        <td>${my:caps(book.author)}</td>
+    </tr>
+    <tr>
+        <td>ISBN</td>
+        <td>${book.isbn}</td>
+        <td>${my:caps(book.isbn)}</td>
+    </tr>
+    </table>
+  </body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/simpletag/book.jsp.html b/tomcat/webapps/examples/jsp/jsp2/simpletag/book.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..51c27a0bd3c357fc3a7fb91549058c58f47bebf0
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/simpletag/book.jsp.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@ taglib prefix="my" uri="/WEB-INF/jsp2/jsp2-example-taglib.tld" %>
+&lt;html>
+  &lt;head>
+    &lt;title>JSP 2.0 Examples - Book SimpleTag Handler&lt;/title>
+  &lt;/head>
+  &lt;body>
+    &lt;h1>JSP 2.0 Examples - Book SimpleTag Handler&lt;/h1>
+    &lt;hr>
+    &lt;p>Illustrates a semi-realistic use of SimpleTag and the Expression
+    Language.  First, a &amp;lt;my:findBook&amp;gt; tag is invoked to populate
+    the page context with a BookBean.  Then, the books fields are printed
+    in all caps.&lt;/p>
+    &lt;br>
+    &lt;b>&lt;u>Result:&lt;/u>&lt;/b>&lt;br>
+    &lt;my:findBook var="book"/>
+    &lt;table border="1">
+        &lt;thead>
+        &lt;td>&lt;b>Field&lt;/b>&lt;/td>
+        &lt;td>&lt;b>Value&lt;/b>&lt;/td>
+        &lt;td>&lt;b>Capitalized&lt;/b>&lt;/td>
+    &lt;/thead>
+    &lt;tr>
+        &lt;td>Title&lt;/td>
+        &lt;td>${book.title}&lt;/td>
+        &lt;td>${my:caps(book.title)}&lt;/td>
+    &lt;/tr>
+    &lt;tr>
+        &lt;td>Author&lt;/td>
+        &lt;td>${book.author}&lt;/td>
+        &lt;td>${my:caps(book.author)}&lt;/td>
+    &lt;/tr>
+    &lt;tr>
+        &lt;td>ISBN&lt;/td>
+        &lt;td>${book.isbn}&lt;/td>
+        &lt;td>${my:caps(book.isbn)}&lt;/td>
+    &lt;/tr>
+    &lt;/table>
+  &lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/simpletag/hello.html b/tomcat/webapps/examples/jsp/jsp2/simpletag/hello.html
new file mode 100644
index 0000000000000000000000000000000000000000..20cadf877c32f2466e53a31fd9d839db7c99d37f
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/simpletag/hello.html
@@ -0,0 +1,33 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>View Source Code</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="hello.jsp"><img src="../../images/execute.gif" align="right" border="0"></a>
+<a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="hello.jsp.html">Source Code for the Hello World Tag Example JSP<font color="#0000FF"></a>
+  </font> </h3>
+<h3><a href="HelloWorldSimpleTag.java.html">Source Code for the Hello World SimpleTag Handler<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/simpletag/hello.jsp b/tomcat/webapps/examples/jsp/jsp2/simpletag/hello.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..d9f22a281a431ee4e00ec4f8fbf0c2cad03aa234
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/simpletag/hello.jsp
@@ -0,0 +1,31 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ taglib prefix="mytag" uri="/WEB-INF/jsp2/jsp2-example-taglib.tld" %>
+<html>
+  <head>
+    <title>JSP 2.0 Examples - Hello World SimpleTag Handler</title>
+  </head>
+  <body>
+    <h1>JSP 2.0 Examples - Hello World SimpleTag Handler</h1>
+    <hr>
+    <p>This tag handler simply echos "Hello, World!"  It's an example of
+    a very basic SimpleTag handler with no body.</p>
+    <br>
+    <b><u>Result:</u></b>
+    <mytag:helloWorld/>
+  </body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/simpletag/hello.jsp.html b/tomcat/webapps/examples/jsp/jsp2/simpletag/hello.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..76f39739560d521670628c991a7e7b2445be562d
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/simpletag/hello.jsp.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@ taglib prefix="mytag" uri="/WEB-INF/jsp2/jsp2-example-taglib.tld" %>
+&lt;html>
+  &lt;head>
+    &lt;title>JSP 2.0 Examples - Hello World SimpleTag Handler&lt;/title>
+  &lt;/head>
+  &lt;body>
+    &lt;h1>JSP 2.0 Examples - Hello World SimpleTag Handler&lt;/h1>
+    &lt;hr>
+    &lt;p>This tag handler simply echos "Hello, World!"  It's an example of
+    a very basic SimpleTag handler with no body.&lt;/p>
+    &lt;br>
+    &lt;b>&lt;u>Result:&lt;/u>&lt;/b>
+    &lt;mytag:helloWorld/>
+  &lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/simpletag/repeat.html b/tomcat/webapps/examples/jsp/jsp2/simpletag/repeat.html
new file mode 100644
index 0000000000000000000000000000000000000000..a56bfcd2e70013cbca35d9b4413fc8033c7160a7
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/simpletag/repeat.html
@@ -0,0 +1,33 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>View Source Code</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="repeat.jsp"><img src="../../images/execute.gif" align="right" border="0"></a>
+<a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="repeat.jsp.html">Source Code for the Repeat Tag Example JSP<font color="#0000FF"></a>
+  </font> </h3>
+<h3><a href="RepeatSimpleTag.java.html">Source Code for the Repeat SimpleTag Handler<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/simpletag/repeat.jsp b/tomcat/webapps/examples/jsp/jsp2/simpletag/repeat.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..b12d0a91d75c51d98a7f04b4d85adb49e628d079
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/simpletag/repeat.jsp
@@ -0,0 +1,39 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ taglib prefix="mytag" uri="/WEB-INF/jsp2/jsp2-example-taglib.tld" %>
+<html>
+  <head>
+    <title>JSP 2.0 Examples - Repeat SimpleTag Handler</title>
+  </head>
+  <body>
+    <h1>JSP 2.0 Examples - Repeat SimpleTag Handler</h1>
+    <hr>
+    <p>This tag handler accepts a "num" parameter and repeats the body of the
+    tag "num" times.  It's a simple example, but the implementation of
+    such a tag in JSP 2.0 is substantially simpler than the equivalent
+    JSP 1.2-style classic tag handler.</p>
+    <p>The body of the tag is encapsulated in a "JSP Fragment" and passed
+    to the tag handler, which then executes it five times, inside a
+    for loop.  The tag handler passes in the current invocation in a
+    scoped variable called count, which can be accessed using the EL.</p>
+    <br>
+    <b><u>Result:</u></b><br>
+    <mytag:repeat num="5">
+      Invocation ${count} of 5<br>
+    </mytag:repeat>
+  </body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/simpletag/repeat.jsp.html b/tomcat/webapps/examples/jsp/jsp2/simpletag/repeat.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..bd40cab6af4fc043de4105c6e30ee9fb45b2ce98
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/simpletag/repeat.jsp.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@ taglib prefix="mytag" uri="/WEB-INF/jsp2/jsp2-example-taglib.tld" %>
+&lt;html>
+  &lt;head>
+    &lt;title>JSP 2.0 Examples - Repeat SimpleTag Handler&lt;/title>
+  &lt;/head>
+  &lt;body>
+    &lt;h1>JSP 2.0 Examples - Repeat SimpleTag Handler&lt;/h1>
+    &lt;hr>
+    &lt;p>This tag handler accepts a "num" parameter and repeats the body of the
+    tag "num" times.  It's a simple example, but the implementation of
+    such a tag in JSP 2.0 is substantially simpler than the equivalent
+    JSP 1.2-style classic tag handler.&lt;/p>
+    &lt;p>The body of the tag is encapsulated in a "JSP Fragment" and passed
+    to the tag handler, which then executes it five times, inside a
+    for loop.  The tag handler passes in the current invocation in a
+    scoped variable called count, which can be accessed using the EL.&lt;/p>
+    &lt;br>
+    &lt;b>&lt;u>Result:&lt;/u>&lt;/b>&lt;br>
+    &lt;mytag:repeat num="5">
+      Invocation ${count} of 5&lt;br>
+    &lt;/mytag:repeat>
+  &lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/tagfiles/displayProducts.tag.html b/tomcat/webapps/examples/jsp/jsp2/tagfiles/displayProducts.tag.html
new file mode 100644
index 0000000000000000000000000000000000000000..dd488f22ca62f1986516bb604ad727e7d99dd6d4
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/tagfiles/displayProducts.tag.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+&lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+&lt;%@ attribute name="normalPrice" fragment="true" %>
+&lt;%@ attribute name="onSale" fragment="true" %>
+&lt;%@ variable name-given="name" %>
+&lt;%@ variable name-given="price" %>
+&lt;%@ variable name-given="origPrice" %>
+&lt;%@ variable name-given="salePrice" %>
+
+&lt;table border="1">
+  &lt;tr>
+    &lt;td>
+      &lt;c:set var="name" value="Hand-held Color PDA"/>
+      &lt;c:set var="price" value="$298.86"/>
+      &lt;jsp:invoke fragment="normalPrice"/>
+    &lt;/td>
+    &lt;td>
+      &lt;c:set var="name" value="4-Pack 150 Watt Light Bulbs"/>
+      &lt;c:set var="origPrice" value="$2.98"/>
+      &lt;c:set var="salePrice" value="$2.32"/>
+      &lt;jsp:invoke fragment="onSale"/>
+    &lt;/td>
+    &lt;td>
+      &lt;c:set var="name" value="Digital Cellular Phone"/>
+      &lt;c:set var="price" value="$68.74"/>
+      &lt;jsp:invoke fragment="normalPrice"/>
+    &lt;/td>
+    &lt;td>
+      &lt;c:set var="name" value="Baby Grand Piano"/>
+      &lt;c:set var="price" value="$10,800.00"/>
+      &lt;jsp:invoke fragment="normalPrice"/>
+    &lt;/td>
+    &lt;td>
+      &lt;c:set var="name" value="Luxury Car w/ Leather Seats"/>
+      &lt;c:set var="origPrice" value="$23,980.00"/>
+      &lt;c:set var="salePrice" value="$21,070.00"/>
+      &lt;jsp:invoke fragment="onSale"/>
+    &lt;/td>
+  &lt;/tr>
+&lt;/table>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/tagfiles/hello.html b/tomcat/webapps/examples/jsp/jsp2/tagfiles/hello.html
new file mode 100644
index 0000000000000000000000000000000000000000..f29a37969b2e4368b1e536d543447a56792f22d4
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/tagfiles/hello.html
@@ -0,0 +1,33 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>View Source Code</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="hello.jsp"><img src="../../images/execute.gif" align="right" border="0"></a>
+<a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="hello.jsp.html">Source Code for hello.jsp<font color="#0000FF"></a>
+  </font> </h3>
+<h3><a href="helloWorld.tag.html">Source Code for helloWorld.tag<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/tagfiles/hello.jsp b/tomcat/webapps/examples/jsp/jsp2/tagfiles/hello.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..9b260f5f2d1bb9e78cb4e9c9e537ac8a66736de8
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/tagfiles/hello.jsp
@@ -0,0 +1,35 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
+<html>
+  <head>
+    <title>JSP 2.0 Examples - Hello World Using a Tag File</title>
+  </head>
+  <body>
+    <h1>JSP 2.0 Examples - Hello World Using a Tag File</h1>
+    <hr>
+    <p>This JSP page invokes a custom tag that simply echos "Hello, World!"
+    The custom tag is generated from a tag file in the /WEB-INF/tags
+    directory.</p>
+    <p>Notice that we did not need to write a TLD for this tag.  We just
+    created /WEB-INF/tags/helloWorld.tag, imported it using the taglib
+    directive, and used it!</p>
+    <br>
+    <b><u>Result:</u></b>
+    <tags:helloWorld/>
+  </body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/tagfiles/hello.jsp.html b/tomcat/webapps/examples/jsp/jsp2/tagfiles/hello.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..b431f30245ead6ddd153df3a2e7cdad68b80e355
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/tagfiles/hello.jsp.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
+&lt;html>
+  &lt;head>
+    &lt;title>JSP 2.0 Examples - Hello World Using a Tag File&lt;/title>
+  &lt;/head>
+  &lt;body>
+    &lt;h1>JSP 2.0 Examples - Hello World Using a Tag File&lt;/h1>
+    &lt;hr>
+    &lt;p>This JSP page invokes a custom tag that simply echos "Hello, World!"
+    The custom tag is generated from a tag file in the /WEB-INF/tags
+    directory.&lt;/p>
+    &lt;p>Notice that we did not need to write a TLD for this tag.  We just
+    created /WEB-INF/tags/helloWorld.tag, imported it using the taglib
+    directive, and used it!&lt;/p>
+    &lt;br>
+    &lt;b>&lt;u>Result:&lt;/u>&lt;/b>
+    &lt;tags:helloWorld/>
+  &lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/tagfiles/helloWorld.tag.html b/tomcat/webapps/examples/jsp/jsp2/tagfiles/helloWorld.tag.html
new file mode 100644
index 0000000000000000000000000000000000000000..f29726f43fcd7a40a87fc4d168308c92dfec9fd8
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/tagfiles/helloWorld.tag.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+Hello, world!
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/tagfiles/panel.html b/tomcat/webapps/examples/jsp/jsp2/tagfiles/panel.html
new file mode 100644
index 0000000000000000000000000000000000000000..1f03b9cab7b29b8faef3aed2cafc1476cc82cb8a
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/tagfiles/panel.html
@@ -0,0 +1,33 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>View Source Code</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="panel.jsp"><img src="../../images/execute.gif" align="right" border="0"></a>
+<a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="panel.jsp.html">Source Code for panel.jsp<font color="#0000FF"></a>
+  </font> </h3>
+<h3><a href="panel.tag.html">Source Code for panel.tag<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/tagfiles/panel.jsp b/tomcat/webapps/examples/jsp/jsp2/tagfiles/panel.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..d96387789ce1b38ab8397dd628761a2f46b2ceeb
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/tagfiles/panel.jsp
@@ -0,0 +1,58 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
+<html>
+  <head>
+    <title>JSP 2.0 Examples - Panels using Tag Files</title>
+  </head>
+  <body>
+    <h1>JSP 2.0 Examples - Panels using Tag Files</h1>
+    <hr>
+    <p>This JSP page invokes a custom tag that draws a
+    panel around the contents of the tag body.  Normally, such a tag
+    implementation would require a Java class with many println() statements,
+    outputting HTML.  Instead, we can use a .tag file as a template,
+    and we don't need to write a single line of Java or even a TLD!</p>
+    <hr>
+    <table border="0">
+      <tr valign="top">
+        <td>
+          <tags:panel color="#ff8080" bgcolor="#ffc0c0" title="Panel 1">
+            First panel.<br/>
+          </tags:panel>
+        </td>
+        <td>
+          <tags:panel color="#80ff80" bgcolor="#c0ffc0" title="Panel 2">
+            Second panel.<br/>
+            Second panel.<br/>
+            Second panel.<br/>
+            Second panel.<br/>
+          </tags:panel>
+        </td>
+        <td>
+          <tags:panel color="#8080ff" bgcolor="#c0c0ff" title="Panel 3">
+            Third panel.<br/>
+            <tags:panel color="#ff80ff" bgcolor="#ffc0ff" title="Inner">
+              A panel in a panel.
+            </tags:panel>
+            Third panel.<br/>
+          </tags:panel>
+        </td>
+      </tr>
+    </table>
+  </body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/tagfiles/panel.jsp.html b/tomcat/webapps/examples/jsp/jsp2/tagfiles/panel.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..584393de2c99d26e0fc10676ff9f6354d350521d
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/tagfiles/panel.jsp.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
+&lt;html>
+  &lt;head>
+    &lt;title>JSP 2.0 Examples - Panels using Tag Files&lt;/title>
+  &lt;/head>
+  &lt;body>
+    &lt;h1>JSP 2.0 Examples - Panels using Tag Files&lt;/h1>
+    &lt;hr>
+    &lt;p>This JSP page invokes a custom tag that draws a
+    panel around the contents of the tag body.  Normally, such a tag
+    implementation would require a Java class with many println() statements,
+    outputting HTML.  Instead, we can use a .tag file as a template,
+    and we don't need to write a single line of Java or even a TLD!&lt;/p>
+    &lt;hr>
+    &lt;table border="0">
+      &lt;tr valign="top">
+        &lt;td>
+          &lt;tags:panel color="#ff8080" bgcolor="#ffc0c0" title="Panel 1">
+            First panel.&lt;br/>
+          &lt;/tags:panel>
+        &lt;/td>
+        &lt;td>
+          &lt;tags:panel color="#80ff80" bgcolor="#c0ffc0" title="Panel 2">
+            Second panel.&lt;br/>
+            Second panel.&lt;br/>
+            Second panel.&lt;br/>
+            Second panel.&lt;br/>
+          &lt;/tags:panel>
+        &lt;/td>
+        &lt;td>
+          &lt;tags:panel color="#8080ff" bgcolor="#c0c0ff" title="Panel 3">
+            Third panel.&lt;br/>
+            &lt;tags:panel color="#ff80ff" bgcolor="#ffc0ff" title="Inner">
+              A panel in a panel.
+            &lt;/tags:panel>
+            Third panel.&lt;br/>
+          &lt;/tags:panel>
+        &lt;/td>
+      &lt;/tr>
+    &lt;/table>
+  &lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/tagfiles/panel.tag.html b/tomcat/webapps/examples/jsp/jsp2/tagfiles/panel.tag.html
new file mode 100644
index 0000000000000000000000000000000000000000..aec91c306f06e10f89a2eafee0e6bdaa1606d2aa
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/tagfiles/panel.tag.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+&lt;%@ attribute name="color" %>
+&lt;%@ attribute name="bgcolor" %>
+&lt;%@ attribute name="title" %>
+&lt;table border="1" bgcolor="${color}">
+  &lt;tr>
+    &lt;td>&lt;b>${title}&lt;/b>&lt;/td>
+  &lt;/tr>
+  &lt;tr>
+    &lt;td bgcolor="${bgcolor}">
+      &lt;jsp:doBody/>
+    &lt;/td>
+  &lt;/tr>
+&lt;/table>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsp2/tagfiles/products.html b/tomcat/webapps/examples/jsp/jsp2/tagfiles/products.html
new file mode 100644
index 0000000000000000000000000000000000000000..72ae49ff2c63139391393119047cfacd2a0b4934
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/tagfiles/products.html
@@ -0,0 +1,33 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>View Source Code</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="products.jsp"><img src="../../images/execute.gif" align="right" border="0"></a>
+<a href="../../index.html"><img src="../../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="products.jsp.html">Source Code for products.jsp<font color="#0000FF"></a>
+  </font> </h3>
+<h3><a href="displayProducts.tag.html">Source Code for displayProducts.tag<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/tagfiles/products.jsp b/tomcat/webapps/examples/jsp/jsp2/tagfiles/products.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..7f32ffb4d6b53c40edfd81f1e7ce485e5afba755
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/tagfiles/products.jsp
@@ -0,0 +1,54 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
+<html>
+  <head>
+    <title>JSP 2.0 Examples - Display Products Tag File</title>
+  </head>
+  <body>
+    <h1>JSP 2.0 Examples - Display Products Tag File</h1>
+    <hr>
+    <p>This JSP page invokes a tag file that displays a listing of
+    products.  The custom tag accepts two fragments that enable
+    customization of appearance.  One for when the product is on sale
+    and one for normal price.</p>
+    <p>The tag is invoked twice, using different styles</p>
+    <hr>
+    <h2>Products</h2>
+    <tags:displayProducts>
+      <jsp:attribute name="normalPrice">
+        Item: ${name}<br/>
+        Price: ${price}
+      </jsp:attribute>
+      <jsp:attribute name="onSale">
+        Item: ${name}<br/>
+        <font color="red"><strike>Was: ${origPrice}</strike></font><br/>
+        <b>Now: ${salePrice}</b>
+      </jsp:attribute>
+    </tags:displayProducts>
+    <hr>
+    <h2>Products (Same tag, alternate style)</h2>
+    <tags:displayProducts>
+      <jsp:attribute name="normalPrice">
+        <b>${name}</b> @ ${price} ea.
+      </jsp:attribute>
+      <jsp:attribute name="onSale">
+        <b>${name}</b> @ ${salePrice} ea. (was: ${origPrice})
+      </jsp:attribute>
+    </tags:displayProducts>
+  </body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/jsp2/tagfiles/products.jsp.html b/tomcat/webapps/examples/jsp/jsp2/tagfiles/products.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..6d6fc10389d954111c43ca7783198b2edac1cd5c
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsp2/tagfiles/products.jsp.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
+&lt;html>
+  &lt;head>
+    &lt;title>JSP 2.0 Examples - Display Products Tag File&lt;/title>
+  &lt;/head>
+  &lt;body>
+    &lt;h1>JSP 2.0 Examples - Display Products Tag File&lt;/h1>
+    &lt;hr>
+    &lt;p>This JSP page invokes a tag file that displays a listing of
+    products.  The custom tag accepts two fragments that enable
+    customization of appearance.  One for when the product is on sale
+    and one for normal price.&lt;/p>
+    &lt;p>The tag is invoked twice, using different styles&lt;/p>
+    &lt;hr>
+    &lt;h2>Products&lt;/h2>
+    &lt;tags:displayProducts>
+      &lt;jsp:attribute name="normalPrice">
+        Item: ${name}&lt;br/>
+        Price: ${price}
+      &lt;/jsp:attribute>
+      &lt;jsp:attribute name="onSale">
+        Item: ${name}&lt;br/>
+        &lt;font color="red">&lt;strike>Was: ${origPrice}&lt;/strike>&lt;/font>&lt;br/>
+        &lt;b>Now: ${salePrice}&lt;/b>
+      &lt;/jsp:attribute>
+    &lt;/tags:displayProducts>
+    &lt;hr>
+    &lt;h2>Products (Same tag, alternate style)&lt;/h2>
+    &lt;tags:displayProducts>
+      &lt;jsp:attribute name="normalPrice">
+        &lt;b>${name}&lt;/b> @ ${price} ea.
+      &lt;/jsp:attribute>
+      &lt;jsp:attribute name="onSale">
+        &lt;b>${name}&lt;/b> @ ${salePrice} ea. (was: ${origPrice})
+      &lt;/jsp:attribute>
+    &lt;/tags:displayProducts>
+  &lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsptoserv/ServletToJsp.java.html b/tomcat/webapps/examples/jsp/jsptoserv/ServletToJsp.java.html
new file mode 100644
index 0000000000000000000000000000000000000000..0a3803705e880323c791ae3b806988c0cf4b7bc0
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsptoserv/ServletToJsp.java.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class ServletToJsp extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public void doGet (HttpServletRequest request,
+            HttpServletResponse response) {
+
+       try {
+           // Set the attribute and Forward to hello.jsp
+           request.setAttribute ("servletName", "servletToJsp");
+           getServletConfig().getServletContext().getRequestDispatcher(
+                   "/jsp/jsptoserv/hello.jsp").forward(request, response);
+       } catch (Exception ex) {
+           ex.printStackTrace ();
+       }
+    }
+}
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsptoserv/hello.jsp b/tomcat/webapps/examples/jsp/jsptoserv/hello.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..8b2a43f555eef356cefeda6074fd810077aa0197
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsptoserv/hello.jsp
@@ -0,0 +1,26 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+<body bgcolor="white">
+
+<h1>
+I have been invoked by
+<% out.print (request.getAttribute("servletName").toString()); %>
+Servlet.
+</h1>
+
+</html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsptoserv/hello.jsp.html b/tomcat/webapps/examples/jsp/jsptoserv/hello.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..6ed71761689ffdbff96bb3b6d3e8d8f509fb07fa
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsptoserv/hello.jsp.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+&lt;body bgcolor="white">
+
+&lt;h1>
+I have been invoked by
+&lt;% out.print (request.getAttribute("servletName").toString()); %>
+Servlet.
+&lt;/h1>
+
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsptoserv/jsptoservlet.jsp b/tomcat/webapps/examples/jsp/jsptoserv/jsptoservlet.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..db68a6ff07b33c57e7a7ae67325d06dfcbb4f393
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsptoserv/jsptoservlet.jsp
@@ -0,0 +1,23 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+<body bgcolor="white">
+
+<!-- Forward to a servlet -->
+<jsp:forward page="/servletToJsp" />
+
+</html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsptoserv/jsptoservlet.jsp.html b/tomcat/webapps/examples/jsp/jsptoserv/jsptoservlet.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..a5dc22cca5217808b55342b1208dc2fe28c3b0f8
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsptoserv/jsptoservlet.jsp.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+&lt;body bgcolor="white">
+
+&lt;!-- Forward to a servlet -->
+&lt;jsp:forward page="/servletToJsp" />
+
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/jsptoserv/jts.html b/tomcat/webapps/examples/jsp/jsptoserv/jts.html
new file mode 100644
index 0000000000000000000000000000000000000000..a4e16794a3af66037a69bbfce717d7efec891800
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/jsptoserv/jts.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+<head>
+<meta charset="UTF-8" />
+<title>Untitled Document</title>
+<style type="text/css">
+img { border: 0; }
+</style>
+</head>
+
+<body>
+<p><a href="jsptoservlet.jsp"><img src="../images/execute.gif" alt=""> Execute</a><br />
+<a href="../index.html"><img src="../images/return.gif" alt=""> Return</a></p>
+
+<p style="font-size: 1.4em;"><a href="jsptoservlet.jsp.html">Source Code for JSP calling servlet</a></p>
+
+<p style="font-size: 1.4em;"><a href="ServletToJsp.java.html">Source Code for Servlet calling JSP</a></p>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/num/numguess.html b/tomcat/webapps/examples/jsp/num/numguess.html
new file mode 100644
index 0000000000000000000000000000000000000000..1c5a4844aa17f4019c1e12d4e427bbe51c54626c
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/num/numguess.html
@@ -0,0 +1,34 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+  Number Guess Game
+  Written by Jason Hunter, CTO, K&A Software
+  http://www.servlets.com
+-->
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="numguess.jsp"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="numguess.jsp.html">Source Code for Numguess Example<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/num/numguess.jsp b/tomcat/webapps/examples/jsp/num/numguess.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..d9c61b912db5e251c9c467bb065b9dc6612e830c
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/num/numguess.jsp
@@ -0,0 +1,69 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+  Number Guess Game
+  Written by Jason Hunter, CTO, K&A Software
+  http://www.servlets.com
+--%>
+
+<%@ page import = "num.NumberGuessBean" %>
+
+<jsp:useBean id="numguess" class="num.NumberGuessBean" scope="session"/>
+<jsp:setProperty name="numguess" property="*"/>
+
+<html>
+<head><title>Number Guess</title></head>
+<body bgcolor="white">
+<font size=4>
+
+<% if (numguess.getSuccess()) { %>
+
+  Congratulations!  You got it.
+  And after just <%= numguess.getNumGuesses() %> tries.<p>
+
+  <% numguess.reset(); %>
+
+  Care to <a href="numguess.jsp">try again</a>?
+
+<% } else if (numguess.getNumGuesses() == 0) { %>
+
+  Welcome to the Number Guess game.<p>
+
+  I'm thinking of a number between 1 and 100.<p>
+
+  <form method=get>
+  What's your guess? <input type=text name=guess>
+  <input type=submit value="Submit">
+  </form>
+
+<% } else { %>
+
+  Good guess, but nope.  Try <b><%= numguess.getHint() %></b>.
+
+  You have made <%= numguess.getNumGuesses() %> guesses.<p>
+
+  I'm thinking of a number between 1 and 100.<p>
+
+  <form method=get>
+  What's your guess? <input type=text name=guess>
+  <input type=submit value="Submit">
+  </form>
+
+<% } %>
+
+</font>
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/num/numguess.jsp.html b/tomcat/webapps/examples/jsp/num/numguess.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..e7640419ae74ab90aab4d4ccff996265f8772f5e
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/num/numguess.jsp.html
@@ -0,0 +1,70 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+  Number Guess Game
+  Written by Jason Hunter, CTO, K&amp;A Software
+  http://www.servlets.com
+--%>
+
+&lt;%@ page import = "num.NumberGuessBean" %>
+
+&lt;jsp:useBean id="numguess" class="num.NumberGuessBean" scope="session"/>
+&lt;jsp:setProperty name="numguess" property="*"/>
+
+&lt;html>
+&lt;head>&lt;title>Number Guess&lt;/title>&lt;/head>
+&lt;body bgcolor="white">
+&lt;font size=4>
+
+&lt;% if (numguess.getSuccess()) { %>
+
+  Congratulations!  You got it.
+  And after just &lt;%= numguess.getNumGuesses() %> tries.&lt;p>
+
+  &lt;% numguess.reset(); %>
+
+  Care to &lt;a href="numguess.jsp">try again&lt;/a>?
+
+&lt;% } else if (numguess.getNumGuesses() == 0) { %>
+
+  Welcome to the Number Guess game.&lt;p>
+
+  I'm thinking of a number between 1 and 100.&lt;p>
+
+  &lt;form method=get>
+  What's your guess? &lt;input type=text name=guess>
+  &lt;input type=submit value="Submit">
+  &lt;/form>
+
+&lt;% } else { %>
+
+  Good guess, but nope.  Try &lt;b>&lt;%= numguess.getHint() %>&lt;/b>.
+
+  You have made &lt;%= numguess.getNumGuesses() %> guesses.&lt;p>
+
+  I'm thinking of a number between 1 and 100.&lt;p>
+
+  &lt;form method=get>
+  What's your guess? &lt;input type=text name=guess>
+  &lt;input type=submit value="Submit">
+  &lt;/form>
+
+&lt;% } %>
+
+&lt;/font>
+&lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/plugin/applet/Clock2.java b/tomcat/webapps/examples/jsp/plugin/applet/Clock2.java
new file mode 100644
index 0000000000000000000000000000000000000000..4ea737a735275e5efb94519ed09477ea7c87987a
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/plugin/applet/Clock2.java
@@ -0,0 +1,230 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import java.applet.Applet;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ * Time!
+ *
+ * @author Rachel Gollub
+ */
+
+public class Clock2 extends Applet implements Runnable {
+    private static final long serialVersionUID = 1L;
+    Thread timer;                // The thread that displays clock
+    int lastxs, lastys, lastxm,
+        lastym, lastxh, lastyh;  // Dimensions used to draw hands
+    SimpleDateFormat formatter;  // Formats the date displayed
+    String lastdate;             // String to hold date displayed
+    Font clockFaceFont;          // Font for number display on clock
+    Date currentDate;            // Used to get date to display
+    Color handColor;             // Color of main hands and dial
+    Color numberColor;           // Color of second hand and numbers
+
+    @Override
+    public void init() {
+        lastxs = lastys = lastxm = lastym = lastxh = lastyh = 0;
+        formatter = new SimpleDateFormat ("EEE MMM dd hh:mm:ss yyyy", Locale.getDefault());
+        currentDate = new Date();
+        lastdate = formatter.format(currentDate);
+        clockFaceFont = new Font("Serif", Font.PLAIN, 14);
+        handColor = Color.blue;
+        numberColor = Color.darkGray;
+
+        try {
+            setBackground(new Color(Integer.parseInt(getParameter("bgcolor"),16)));
+        } catch (Exception e) {
+            // Ignored
+        }
+        try {
+            handColor = new Color(Integer.parseInt(getParameter("fgcolor1"),16));
+        } catch (Exception e) {
+            // Ignored
+        }
+        try {
+            numberColor = new Color(Integer.parseInt(getParameter("fgcolor2"),16));
+        } catch (Exception e) {
+            // Ignored
+        }
+        resize(300,300);              // Set clock window size
+    }
+
+    // Plotpoints allows calculation to only cover 45 degrees of the circle,
+    // and then mirror
+    public void plotpoints(int x0, int y0, int x, int y, Graphics g) {
+        g.drawLine(x0+x,y0+y,x0+x,y0+y);
+        g.drawLine(x0+y,y0+x,x0+y,y0+x);
+        g.drawLine(x0+y,y0-x,x0+y,y0-x);
+        g.drawLine(x0+x,y0-y,x0+x,y0-y);
+        g.drawLine(x0-x,y0-y,x0-x,y0-y);
+        g.drawLine(x0-y,y0-x,x0-y,y0-x);
+        g.drawLine(x0-y,y0+x,x0-y,y0+x);
+        g.drawLine(x0-x,y0+y,x0-x,y0+y);
+    }
+
+    // Circle is just Bresenham's algorithm for a scan converted circle
+    public void circle(int x0, int y0, int r, Graphics g) {
+        int x,y;
+        float d;
+        x=0;
+        y=r;
+        d=5/4-r;
+        plotpoints(x0,y0,x,y,g);
+
+        while (y>x){
+            if (d<0) {
+                d=d+2*x+3;
+                x++;
+            }
+            else {
+                d=d+2*(x-y)+5;
+                x++;
+                y--;
+            }
+            plotpoints(x0,y0,x,y,g);
+        }
+    }
+
+    // Paint is the main part of the program
+    @Override
+    public void paint(Graphics g) {
+        int xh, yh, xm, ym, xs, ys, s = 0, m = 10, h = 10, xcenter, ycenter;
+        String today;
+
+        currentDate = new Date();
+        SimpleDateFormat formatter = new SimpleDateFormat("s",Locale.getDefault());
+        try {
+            s = Integer.parseInt(formatter.format(currentDate));
+        } catch (NumberFormatException n) {
+            s = 0;
+        }
+        formatter.applyPattern("m");
+        try {
+            m = Integer.parseInt(formatter.format(currentDate));
+        } catch (NumberFormatException n) {
+            m = 10;
+        }
+        formatter.applyPattern("h");
+        try {
+            h = Integer.parseInt(formatter.format(currentDate));
+        } catch (NumberFormatException n) {
+            h = 10;
+        }
+        formatter.applyPattern("EEE MMM dd HH:mm:ss yyyy");
+        today = formatter.format(currentDate);
+        xcenter=80;
+        ycenter=55;
+
+    // a= s* pi/2 - pi/2 (to switch 0,0 from 3:00 to 12:00)
+    // x = r(cos a) + xcenter, y = r(sin a) + ycenter
+
+        xs = (int)(Math.cos(s * 3.14f/30 - 3.14f/2) * 45 + xcenter);
+        ys = (int)(Math.sin(s * 3.14f/30 - 3.14f/2) * 45 + ycenter);
+        xm = (int)(Math.cos(m * 3.14f/30 - 3.14f/2) * 40 + xcenter);
+        ym = (int)(Math.sin(m * 3.14f/30 - 3.14f/2) * 40 + ycenter);
+        xh = (int)(Math.cos((h*30 + m/2) * 3.14f/180 - 3.14f/2) * 30 + xcenter);
+        yh = (int)(Math.sin((h*30 + m/2) * 3.14f/180 - 3.14f/2) * 30 + ycenter);
+
+    // Draw the circle and numbers
+
+        g.setFont(clockFaceFont);
+        g.setColor(handColor);
+        circle(xcenter,ycenter,50,g);
+        g.setColor(numberColor);
+        g.drawString("9",xcenter-45,ycenter+3);
+        g.drawString("3",xcenter+40,ycenter+3);
+        g.drawString("12",xcenter-5,ycenter-37);
+        g.drawString("6",xcenter-3,ycenter+45);
+
+    // Erase if necessary, and redraw
+
+        g.setColor(getBackground());
+        if (xs != lastxs || ys != lastys) {
+            g.drawLine(xcenter, ycenter, lastxs, lastys);
+            g.drawString(lastdate, 5, 125);
+        }
+        if (xm != lastxm || ym != lastym) {
+            g.drawLine(xcenter, ycenter-1, lastxm, lastym);
+            g.drawLine(xcenter-1, ycenter, lastxm, lastym); }
+        if (xh != lastxh || yh != lastyh) {
+            g.drawLine(xcenter, ycenter-1, lastxh, lastyh);
+            g.drawLine(xcenter-1, ycenter, lastxh, lastyh); }
+        g.setColor(numberColor);
+        g.drawString("", 5, 125);
+        g.drawString(today, 5, 125);
+        g.drawLine(xcenter, ycenter, xs, ys);
+        g.setColor(handColor);
+        g.drawLine(xcenter, ycenter-1, xm, ym);
+        g.drawLine(xcenter-1, ycenter, xm, ym);
+        g.drawLine(xcenter, ycenter-1, xh, yh);
+        g.drawLine(xcenter-1, ycenter, xh, yh);
+        lastxs=xs; lastys=ys;
+        lastxm=xm; lastym=ym;
+        lastxh=xh; lastyh=yh;
+        lastdate = today;
+        currentDate=null;
+    }
+
+    @Override
+    public void start() {
+        timer = new Thread(this);
+        timer.start();
+    }
+
+    @Override
+    public void stop() {
+        timer = null;
+    }
+
+    @Override
+    public void run() {
+        Thread me = Thread.currentThread();
+        while (timer == me) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+            }
+            repaint();
+        }
+    }
+
+    @Override
+    public void update(Graphics g) {
+        paint(g);
+    }
+
+    @Override
+    public String getAppletInfo() {
+        return "Title: A Clock \nAuthor: Rachel Gollub, 1995 \nAn analog clock.";
+    }
+
+    @Override
+    public String[][] getParameterInfo() {
+        String[][] info = {
+            {"bgcolor", "hexadecimal RGB number", "The background color. Default is the color of your browser."},
+            {"fgcolor1", "hexadecimal RGB number", "The color of the hands and dial. Default is blue."},
+            {"fgcolor2", "hexadecimal RGB number", "The color of the seconds hand and numbers. Default is dark gray."}
+        };
+        return info;
+    }
+}
diff --git a/tomcat/webapps/examples/jsp/plugin/plugin.html b/tomcat/webapps/examples/jsp/plugin/plugin.html
new file mode 100644
index 0000000000000000000000000000000000000000..27bc51b131ff9de2f0503557803b7c5488af1f7b
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/plugin/plugin.html
@@ -0,0 +1,30 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="plugin.jsp"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="plugin.jsp.html">Source Code for Plugin Example<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/plugin/plugin.jsp b/tomcat/webapps/examples/jsp/plugin/plugin.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..a07dda3af5815125dfd50303a838fe015dec310b
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/plugin/plugin.jsp
@@ -0,0 +1,34 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+<title> Plugin example </title>
+<body bgcolor="white">
+<h3> Current time is : </h3>
+<jsp:plugin type="applet" code="Clock2.class" codebase="applet" jreversion="1.2" width="160" height="150" >
+    <jsp:fallback>
+        Plugin tag OBJECT or EMBED not supported by browser.
+    </jsp:fallback>
+</jsp:plugin>
+<p>
+<h4>
+<font color=red>
+The above applet is loaded using the Java Plugin from a jsp page using the
+plugin tag.
+</font>
+</h4>
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/plugin/plugin.jsp.html b/tomcat/webapps/examples/jsp/plugin/plugin.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..710bda762841580b802b8cc55d84bf444d4f25fa
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/plugin/plugin.jsp.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+&lt;title> Plugin example &lt;/title>
+&lt;body bgcolor="white">
+&lt;h3> Current time is : &lt;/h3>
+&lt;jsp:plugin type="applet" code="Clock2.class" codebase="applet" jreversion="1.2" width="160" height="150" >
+    &lt;jsp:fallback>
+        Plugin tag OBJECT or EMBED not supported by browser.
+    &lt;/jsp:fallback>
+&lt;/jsp:plugin>
+&lt;p>
+&lt;h4>
+&lt;font color=red>
+The above applet is loaded using the Java Plugin from a jsp page using the
+plugin tag.
+&lt;/font>
+&lt;/h4>
+&lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/security/protected/error.jsp b/tomcat/webapps/examples/jsp/security/protected/error.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..3ef57434161a94bc32eb8408308832b85adcf787
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/security/protected/error.jsp
@@ -0,0 +1,25 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+<head>
+<title>Error Page For Examples</title>
+</head>
+<body bgcolor="white">
+Invalid username and/or password, please try
+<a href='<%= response.encodeURL("index.jsp") %>'>again</a>.
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/security/protected/error.jsp.html b/tomcat/webapps/examples/jsp/security/protected/error.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..50ec895acf1fb73aef22b0a01c317b08ea0e9f6a
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/security/protected/error.jsp.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+&lt;head>
+&lt;title>Error Page For Examples&lt;/title>
+&lt;/head>
+&lt;body bgcolor="white">
+Invalid username and/or password, please try
+&lt;a href='&lt;%= response.encodeURL("index.jsp") %>'>again&lt;/a>.
+&lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/security/protected/index.jsp b/tomcat/webapps/examples/jsp/security/protected/index.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..eacf27acbc33a46d538609817fe1ca941e51e873
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/security/protected/index.jsp
@@ -0,0 +1,82 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%
+  if (request.getParameter("logoff") != null) {
+    session.invalidate();
+    response.sendRedirect("index.jsp");
+    return;
+  }
+%>
+<html>
+<head>
+<title>Protected Page for Examples</title>
+</head>
+<body bgcolor="white">
+
+You are logged in as remote user
+<b><%= util.HTMLFilter.filter(request.getRemoteUser()) %></b>
+in session <b><%= session.getId() %></b><br><br>
+
+<%
+  if (request.getUserPrincipal() != null) {
+%>
+    Your user principal name is
+    <b><%= util.HTMLFilter.filter(request.getUserPrincipal().getName()) %></b>
+    <br><br>
+<%
+  } else {
+%>
+    No user principal could be identified.<br><br>
+<%
+  }
+%>
+
+<%
+  String role = request.getParameter("role");
+  if (role == null)
+    role = "";
+  if (role.length() > 0) {
+    if (request.isUserInRole(role)) {
+%>
+      You have been granted role
+      <b><%= util.HTMLFilter.filter(role) %></b><br><br>
+<%
+    } else {
+%>
+      You have <i>not</i> been granted role
+      <b><%= util.HTMLFilter.filter(role) %></b><br><br>
+<%
+    }
+  }
+%>
+
+To check whether your user name has been granted a particular role,
+enter it here:
+<form method="GET" action='<%= response.encodeURL("index.jsp") %>'>
+<input type="text" name="role" value="<%= util.HTMLFilter.filter(role) %>">
+<input type="submit" >
+</form>
+<br><br>
+
+If you have configured this application for form-based authentication, you can
+log off by clicking
+<a href='<%= response.encodeURL("index.jsp?logoff=true") %>'>here</a>.
+This should cause you to be returned to the login page after the redirect
+that is performed.
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/security/protected/index.jsp.html b/tomcat/webapps/examples/jsp/security/protected/index.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..cadf810cf888cb4b0b38eb06b0455dfca89a1a44
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/security/protected/index.jsp.html
@@ -0,0 +1,83 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%
+  if (request.getParameter("logoff") != null) {
+    session.invalidate();
+    response.sendRedirect("index.jsp");
+    return;
+  }
+%>
+&lt;html>
+&lt;head>
+&lt;title>Protected Page for Examples&lt;/title>
+&lt;/head>
+&lt;body bgcolor="white">
+
+You are logged in as remote user
+&lt;b>&lt;%= util.HTMLFilter.filter(request.getRemoteUser()) %>&lt;/b>
+in session &lt;b>&lt;%= session.getId() %>&lt;/b>&lt;br>&lt;br>
+
+&lt;%
+  if (request.getUserPrincipal() != null) {
+%>
+    Your user principal name is
+    &lt;b>&lt;%= util.HTMLFilter.filter(request.getUserPrincipal().getName()) %>&lt;/b>
+    &lt;br>&lt;br>
+&lt;%
+  } else {
+%>
+    No user principal could be identified.&lt;br>&lt;br>
+&lt;%
+  }
+%>
+
+&lt;%
+  String role = request.getParameter("role");
+  if (role == null)
+    role = "";
+  if (role.length() > 0) {
+    if (request.isUserInRole(role)) {
+%>
+      You have been granted role
+      &lt;b>&lt;%= util.HTMLFilter.filter(role) %>&lt;/b>&lt;br>&lt;br>
+&lt;%
+    } else {
+%>
+      You have &lt;i>not&lt;/i> been granted role
+      &lt;b>&lt;%= util.HTMLFilter.filter(role) %>&lt;/b>&lt;br>&lt;br>
+&lt;%
+    }
+  }
+%>
+
+To check whether your user name has been granted a particular role,
+enter it here:
+&lt;form method="GET" action='&lt;%= response.encodeURL("index.jsp") %>'>
+&lt;input type="text" name="role" value="&lt;%= util.HTMLFilter.filter(role) %>">
+&lt;input type="submit" >
+&lt;/form>
+&lt;br>&lt;br>
+
+If you have configured this application for form-based authentication, you can
+log off by clicking
+&lt;a href='&lt;%= response.encodeURL("index.jsp?logoff=true") %>'>here&lt;/a>.
+This should cause you to be returned to the login page after the redirect
+that is performed.
+
+&lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/security/protected/login.jsp b/tomcat/webapps/examples/jsp/security/protected/login.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..e11a898c7dbfa8ca8ce4551a786fccf3ec08374c
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/security/protected/login.jsp
@@ -0,0 +1,38 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+<head>
+<title>Login Page for Examples</title>
+<body bgcolor="white">
+<form method="POST" action='<%= response.encodeURL("j_security_check") %>' >
+  <table border="0" cellspacing="5">
+    <tr>
+      <th align="right">Username:</th>
+      <td align="left"><input type="text" name="j_username"></td>
+    </tr>
+    <tr>
+      <th align="right">Password:</th>
+      <td align="left"><input type="password" name="j_password"></td>
+    </tr>
+    <tr>
+      <td align="right"><input type="submit" value="Log In"></td>
+      <td align="left"><input type="reset"></td>
+    </tr>
+  </table>
+</form>
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/security/protected/login.jsp.html b/tomcat/webapps/examples/jsp/security/protected/login.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..5726e3207fb217202658a8eb2efa5aa2df431217
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/security/protected/login.jsp.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+&lt;head>
+&lt;title>Login Page for Examples&lt;/title>
+&lt;body bgcolor="white">
+&lt;form method="POST" action='&lt;%= response.encodeURL("j_security_check") %>' >
+  &lt;table border="0" cellspacing="5">
+    &lt;tr>
+      &lt;th align="right">Username:&lt;/th>
+      &lt;td align="left">&lt;input type="text" name="j_username">&lt;/td>
+    &lt;/tr>
+    &lt;tr>
+      &lt;th align="right">Password:&lt;/th>
+      &lt;td align="left">&lt;input type="password" name="j_password">&lt;/td>
+    &lt;/tr>
+    &lt;tr>
+      &lt;td align="right">&lt;input type="submit" value="Log In">&lt;/td>
+      &lt;td align="left">&lt;input type="reset">&lt;/td>
+    &lt;/tr>
+  &lt;/table>
+&lt;/form>
+&lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/sessions/DummyCart.html b/tomcat/webapps/examples/jsp/sessions/DummyCart.html
new file mode 100644
index 0000000000000000000000000000000000000000..d953fa9209762862c415d10d53337384ec0bb61b
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/sessions/DummyCart.html
@@ -0,0 +1,56 @@
+<HTML>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<HEAD>
+<title>
+sessions.DummyCart Bean Properties
+</title>
+<BODY BGCOLOR="white">
+<H2>
+sessions.DummyCart Bean Properties
+</H2>
+<HR>
+<DL>
+<DT>public class <B>DummyCart</B><DT>extends Object</DL>
+
+<P>
+<HR>
+
+<P>
+
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0">
+<TR BGCOLOR="#EEEEFF">
+<TD COLSPAN=3><FONT SIZE="+2">
+<B>Properties Summary</B></FONT></TD>
+</TR>
+<TR BGCOLOR="white">
+<td align="right" valign="top" width="1%">
+<FONT SIZE="-1">
+String
+</FONT></TD>
+<TD><B>DummyCart:items</B>
+<BR>
+       </TD>
+<td width="1%">
+<FONT SIZE="-1">
+Multi
+</FONT></TD>
+</TABLE>
+<HR>
+</BODY>
+</HTML>
diff --git a/tomcat/webapps/examples/jsp/sessions/carts.html b/tomcat/webapps/examples/jsp/sessions/carts.html
new file mode 100644
index 0000000000000000000000000000000000000000..834ee0a594fd5b2c623a8adc0c5e3af304772a52
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/sessions/carts.html
@@ -0,0 +1,53 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<head>
+    <title>carts</title>
+</head>
+
+ <body bgcolor="white">
+<font size = 5 color="#CC0000">
+
+<form type=POST action=carts.jsp>
+<BR>
+Please enter item to add or remove:
+<br>
+Add Item:
+
+<SELECT NAME="item">
+<OPTION>Beavis & Butt-head Video collection
+<OPTION>X-files movie
+<OPTION>Twin peaks tapes
+<OPTION>NIN CD
+<OPTION>JSP Book
+<OPTION>Concert tickets
+<OPTION>Love life
+<OPTION>Switch blade
+<OPTION>Rex, Rugs & Rock n' Roll
+</SELECT>
+
+
+<br> <br>
+<INPUT TYPE=submit name="submit" value="add">
+<INPUT TYPE=submit name="submit" value="remove">
+
+</form>
+
+</FONT>
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/sessions/carts.jsp b/tomcat/webapps/examples/jsp/sessions/carts.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..6fba47d9fb50d61e20371136c7aefa8ad350e5af
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/sessions/carts.jsp
@@ -0,0 +1,43 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+<jsp:useBean id="cart" scope="session" class="sessions.DummyCart" />
+
+<jsp:setProperty name="cart" property="*" />
+<%
+    cart.processRequest();
+%>
+
+
+<FONT size = 5 COLOR="#CC0000">
+<br> You have the following items in your cart:
+<ol>
+<%
+    String[] items = cart.getItems();
+    for (int i=0; i<items.length; i++) {
+%>
+<li> <% out.print(util.HTMLFilter.filter(items[i])); %>
+<%
+    }
+%>
+</ol>
+
+</FONT>
+
+<hr>
+<%@ include file ="carts.html" %>
+</html>
diff --git a/tomcat/webapps/examples/jsp/sessions/carts.jsp.html b/tomcat/webapps/examples/jsp/sessions/carts.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..cb2325ffa4b90dbddb7738e4a7cf65cd24e713e6
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/sessions/carts.jsp.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+&lt;jsp:useBean id="cart" scope="session" class="sessions.DummyCart" />
+
+&lt;jsp:setProperty name="cart" property="*" />
+&lt;%
+    cart.processRequest();
+%>
+
+
+&lt;FONT size = 5 COLOR="#CC0000">
+&lt;br> You have the following items in your cart:
+&lt;ol>
+&lt;%
+    String[] items = cart.getItems();
+    for (int i=0; i&lt;items.length; i++) {
+%>
+&lt;li> &lt;% out.print(util.HTMLFilter.filter(items[i])); %>
+&lt;%
+    }
+%>
+&lt;/ol>
+
+&lt;/FONT>
+
+&lt;hr>
+&lt;%@ include file ="carts.html" %>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/sessions/crt.html b/tomcat/webapps/examples/jsp/sessions/crt.html
new file mode 100644
index 0000000000000000000000000000000000000000..11e6edafe0e9167a5f573763a888736cedb8310e
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/sessions/crt.html
@@ -0,0 +1,34 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="carts.html"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="carts.jsp.html">Source Code for Cart Example<font color="#0000FF"></a>
+  </font> </h3>
+
+<h3><a href="DummyCart.html">Property Sheet for DummyCart
+<font color="#0000FF"></a> </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/simpletag/foo.html b/tomcat/webapps/examples/jsp/simpletag/foo.html
new file mode 100644
index 0000000000000000000000000000000000000000..e20f840b7b9786e64c52c8fcfa33be70b1fd0a4b
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/simpletag/foo.html
@@ -0,0 +1,30 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="foo.jsp"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="foo.jsp.html">Source Code for the Simple Tag Example<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/simpletag/foo.jsp b/tomcat/webapps/examples/jsp/simpletag/foo.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..2489146033af4be8d36a1c46f032a10da35783a2
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/simpletag/foo.jsp
@@ -0,0 +1,38 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+<body>
+<%@ taglib uri="http://tomcat.apache.org/example-taglib" prefix="eg"%>
+
+Radio stations that rock:
+
+<ul>
+<eg:foo att1="98.5" att2="92.3" att3="107.7">
+<li><%= member %></li>
+</eg:foo>
+</ul>
+
+<eg:log>
+Did you see me on the stderr window?
+</eg:log>
+
+<eg:log toBrowser="true">
+Did you see me on the browser window as well?
+</eg:log>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/simpletag/foo.jsp.html b/tomcat/webapps/examples/jsp/simpletag/foo.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..02693c89c20f3486fac8ec552954c4d6541f013b
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/simpletag/foo.jsp.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+&lt;body>
+&lt;%@ taglib uri="http://tomcat.apache.org/example-taglib" prefix="eg"%>
+
+Radio stations that rock:
+
+&lt;ul>
+&lt;eg:foo att1="98.5" att2="92.3" att3="107.7">
+&lt;li>&lt;%= member %>&lt;/li>
+&lt;/eg:foo>
+&lt;/ul>
+
+&lt;eg:log>
+Did you see me on the stderr window?
+&lt;/eg:log>
+
+&lt;eg:log toBrowser="true">
+Did you see me on the browser window as well?
+&lt;/eg:log>
+
+&lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/snp/snoop.html b/tomcat/webapps/examples/jsp/snp/snoop.html
new file mode 100644
index 0000000000000000000000000000000000000000..e48355b4351d6064ce9e4d882653d8d299c197eb
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/snp/snoop.html
@@ -0,0 +1,31 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="snoop.jsp"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="snoop.jsp.html">Source Code for Request Parameters Example<font color="#0000FF">
+  </font></a></h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/snp/snoop.jsp b/tomcat/webapps/examples/jsp/snp/snoop.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..9bb57a85f119ef20a77109f739470f9ccb5764ea
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/snp/snoop.jsp
@@ -0,0 +1,56 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+<body bgcolor="white">
+<h1> Request Information </h1>
+<font size="4">
+JSP Request Method: <%= util.HTMLFilter.filter(request.getMethod()) %>
+<br>
+Request URI: <%= util.HTMLFilter.filter(request.getRequestURI()) %>
+<br>
+Request Protocol: <%= util.HTMLFilter.filter(request.getProtocol()) %>
+<br>
+Servlet path: <%= util.HTMLFilter.filter(request.getServletPath()) %>
+<br>
+Path info: <%= util.HTMLFilter.filter(request.getPathInfo()) %>
+<br>
+Query string: <%= util.HTMLFilter.filter(request.getQueryString()) %>
+<br>
+Content length: <%= request.getContentLength() %>
+<br>
+Content type: <%= util.HTMLFilter.filter(request.getContentType()) %>
+<br>
+Server name: <%= util.HTMLFilter.filter(request.getServerName()) %>
+<br>
+Server port: <%= request.getServerPort() %>
+<br>
+Remote user: <%= util.HTMLFilter.filter(request.getRemoteUser()) %>
+<br>
+Remote address: <%= util.HTMLFilter.filter(request.getRemoteAddr()) %>
+<br>
+Remote host: <%= util.HTMLFilter.filter(request.getRemoteHost()) %>
+<br>
+Authorization scheme: <%= util.HTMLFilter.filter(request.getAuthType()) %>
+<br>
+Locale: <%= request.getLocale() %>
+<hr>
+The browser you are using is
+<%= util.HTMLFilter.filter(request.getHeader("User-Agent")) %>
+<hr>
+</font>
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/snp/snoop.jsp.html b/tomcat/webapps/examples/jsp/snp/snoop.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..00bf89b4954634dbc302e45634e872e21f035bdf
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/snp/snoop.jsp.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+&lt;body bgcolor="white">
+&lt;h1> Request Information &lt;/h1>
+&lt;font size="4">
+JSP Request Method: &lt;%= util.HTMLFilter.filter(request.getMethod()) %>
+&lt;br>
+Request URI: &lt;%= util.HTMLFilter.filter(request.getRequestURI()) %>
+&lt;br>
+Request Protocol: &lt;%= util.HTMLFilter.filter(request.getProtocol()) %>
+&lt;br>
+Servlet path: &lt;%= util.HTMLFilter.filter(request.getServletPath()) %>
+&lt;br>
+Path info: &lt;%= util.HTMLFilter.filter(request.getPathInfo()) %>
+&lt;br>
+Query string: &lt;%= util.HTMLFilter.filter(request.getQueryString()) %>
+&lt;br>
+Content length: &lt;%= request.getContentLength() %>
+&lt;br>
+Content type: &lt;%= util.HTMLFilter.filter(request.getContentType()) %>
+&lt;br>
+Server name: &lt;%= util.HTMLFilter.filter(request.getServerName()) %>
+&lt;br>
+Server port: &lt;%= request.getServerPort() %>
+&lt;br>
+Remote user: &lt;%= util.HTMLFilter.filter(request.getRemoteUser()) %>
+&lt;br>
+Remote address: &lt;%= util.HTMLFilter.filter(request.getRemoteAddr()) %>
+&lt;br>
+Remote host: &lt;%= util.HTMLFilter.filter(request.getRemoteHost()) %>
+&lt;br>
+Authorization scheme: &lt;%= util.HTMLFilter.filter(request.getAuthType()) %>
+&lt;br>
+Locale: &lt;%= request.getLocale() %>
+&lt;hr>
+The browser you are using is
+&lt;%= util.HTMLFilter.filter(request.getHeader("User-Agent")) %>
+&lt;hr>
+&lt;/font>
+&lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/source.jsp b/tomcat/webapps/examples/jsp/source.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..fb75b588eb196f06c8e13c05d544ebf8dd71db55
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/source.jsp
@@ -0,0 +1,20 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ taglib uri="http://tomcat.apache.org/example-taglib"
+        prefix="eg" %>
+
+<eg:ShowSource jspFile="<%= util.HTMLFilter.filter(request.getQueryString()) %>"/>
diff --git a/tomcat/webapps/examples/jsp/source.jsp.html b/tomcat/webapps/examples/jsp/source.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..66d5a2024f01c9cf501af16762cd3d63d3cf772e
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/source.jsp.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;%@ taglib uri="http://tomcat.apache.org/example-taglib"
+        prefix="eg" %>
+
+&lt;eg:ShowSource jspFile="&lt;%= util.HTMLFilter.filter(request.getQueryString()) %>"/>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/tagplugin/choose.html b/tomcat/webapps/examples/jsp/tagplugin/choose.html
new file mode 100644
index 0000000000000000000000000000000000000000..afe90b2f42ef319e870f2c2600e3eed1a90a714d
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/tagplugin/choose.html
@@ -0,0 +1,36 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+<head>
+<title>View Source Code</title>
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF">
+  <a href="choose.jsp">
+    <img src="../images/execute.gif" align="right" border="0"></a>
+  <a href="../index.html">
+    <img src="../images/return.gif" width="24" height="24" align="right" border="0">
+  </a></font>
+</p>
+
+<h3>
+  <a href="choose.jsp.html">Source Code for choose.jsp<font color="#0000FF"/></a>
+</h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/tagplugin/choose.jsp b/tomcat/webapps/examples/jsp/tagplugin/choose.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..745e5f538d6cdb8b368f0a26cd297c239be78872
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/tagplugin/choose.jsp
@@ -0,0 +1,54 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+  <head>
+    <title>Tag Examples - choose</title>
+  </head>
+  <body>
+    <h1>Tag Plugin Examples - &lt;c:choose></h1>
+
+    <hr/>
+    <br/>
+    <a href="notes.html">Plugin Introductory Notes</a>
+    <br/>
+    <a href="howto.html">Brief Instructions for Writing Plugins</a>
+    <br/> <br/>
+    <hr/>
+
+    <br/>
+
+    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+
+    <c:forEach var="index" begin="0" end="4">
+      # ${index}:
+      <c:choose>
+        <c:when test="${index == 1}">
+          One!<br/>
+        </c:when>
+        <c:when test="${index == 4}">
+          Four!<br/>
+        </c:when>
+        <c:when test="${index == 3}">
+          Three!<br/>
+        </c:when>
+        <c:otherwise>
+          Huh?<br/>
+        </c:otherwise>
+      </c:choose>
+    </c:forEach>
+  </body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/tagplugin/choose.jsp.html b/tomcat/webapps/examples/jsp/tagplugin/choose.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..3f3b7e43d4f2425b0afcefbef1f51247fcdd4c05
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/tagplugin/choose.jsp.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+  &lt;head>
+    &lt;title>Tag Examples - choose&lt;/title>
+  &lt;/head>
+  &lt;body>
+    &lt;h1>Tag Plugin Examples - &amp;lt;c:choose>&lt;/h1>
+
+    &lt;hr/>
+    &lt;br/>
+    &lt;a href="notes.html">Plugin Introductory Notes&lt;/a>
+    &lt;br/>
+    &lt;a href="howto.html">Brief Instructions for Writing Plugins&lt;/a>
+    &lt;br/> &lt;br/>
+    &lt;hr/>
+
+    &lt;br/>
+
+    &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+
+    &lt;c:forEach var="index" begin="0" end="4">
+      # ${index}:
+      &lt;c:choose>
+        &lt;c:when test="${index == 1}">
+          One!&lt;br/>
+        &lt;/c:when>
+        &lt;c:when test="${index == 4}">
+          Four!&lt;br/>
+        &lt;/c:when>
+        &lt;c:when test="${index == 3}">
+          Three!&lt;br/>
+        &lt;/c:when>
+        &lt;c:otherwise>
+          Huh?&lt;br/>
+        &lt;/c:otherwise>
+      &lt;/c:choose>
+    &lt;/c:forEach>
+  &lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/tagplugin/foreach.html b/tomcat/webapps/examples/jsp/tagplugin/foreach.html
new file mode 100644
index 0000000000000000000000000000000000000000..3d2e6082daa0a152f7985994728066b67c3a2a76
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/tagplugin/foreach.html
@@ -0,0 +1,36 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+<head>
+<title>View Source Code</title>
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF">
+  <a href="foreach.jsp">
+    <img src="../images/execute.gif" align="right" border="0"></a>
+  <a href="../index.html">
+    <img src="../images/return.gif" width="24" height="24" align="right" border="0">
+  </a></font>
+</p>
+
+<h3>
+  <a href="foreach.jsp.html">Source Code for foreach.jsp<font color="#0000FF"/></a>
+</h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/tagplugin/foreach.jsp b/tomcat/webapps/examples/jsp/tagplugin/foreach.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..81621cc665e11f97a5a729cbde077b7e35f6d2e3
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/tagplugin/foreach.jsp
@@ -0,0 +1,54 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+  <head>
+    <title>Tag Plugin Examples: forEach</title>
+  </head>
+  <body>
+    <h1>Tag Plugin Examples - &lt;c:forEach></h1>
+
+    <hr/>
+    <br/>
+    <a href="notes.html">Plugin Introductory Notes</a>
+    <br/>
+    <a href="howto.html">Brief Instructions for Writing Plugins</a>
+    <br/> <br/>
+    <hr/>
+
+    <br/>
+
+    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+    <%@ page import="java.util.Vector" %>
+
+    <h3>Iterating over a range</h3>
+    <c:forEach var="item" begin="1" end="10">
+        ${item}
+    </c:forEach>
+
+    <% Vector v = new Vector();
+        v.add("One"); v.add("Two"); v.add("Three"); v.add("Four");
+
+        pageContext.setAttribute("vector", v);
+    %>
+
+    <h3>Iterating over a Vector</h3>
+
+    <c:forEach items="${vector}" var="item" >
+        ${item}
+    </c:forEach>
+  </body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/tagplugin/foreach.jsp.html b/tomcat/webapps/examples/jsp/tagplugin/foreach.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..de4eca916e3e7379ded8a4a28f5cef60a2374225
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/tagplugin/foreach.jsp.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+  &lt;head>
+    &lt;title>Tag Plugin Examples: forEach&lt;/title>
+  &lt;/head>
+  &lt;body>
+    &lt;h1>Tag Plugin Examples - &amp;lt;c:forEach>&lt;/h1>
+
+    &lt;hr/>
+    &lt;br/>
+    &lt;a href="notes.html">Plugin Introductory Notes&lt;/a>
+    &lt;br/>
+    &lt;a href="howto.html">Brief Instructions for Writing Plugins&lt;/a>
+    &lt;br/> &lt;br/>
+    &lt;hr/>
+
+    &lt;br/>
+
+    &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+    &lt;%@ page import="java.util.Vector" %>
+
+    &lt;h3>Iterating over a range&lt;/h3>
+    &lt;c:forEach var="item" begin="1" end="10">
+        ${item}
+    &lt;/c:forEach>
+
+    &lt;% Vector v = new Vector();
+        v.add("One"); v.add("Two"); v.add("Three"); v.add("Four");
+
+        pageContext.setAttribute("vector", v);
+    %>
+
+    &lt;h3>Iterating over a Vector&lt;/h3>
+
+    &lt;c:forEach items="${vector}" var="item" >
+        ${item}
+    &lt;/c:forEach>
+  &lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/tagplugin/howto.html b/tomcat/webapps/examples/jsp/tagplugin/howto.html
new file mode 100644
index 0000000000000000000000000000000000000000..5f1d2234ab8e37f444f0bd04cd237e1da87a2c99
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/tagplugin/howto.html
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+  <head>
+    <title>Tag Plugin Implementation</title>
+  </head>
+  <body>
+    <h2>How to write tag plugins</h2>
+    <p>
+      To write a plugin, you'll need to download the source for Tomcat.
+      There are two steps:
+    <ol>
+      <li>
+        Implement the plugin class.<p/>
+        This class, which implements
+        <tt>org.apache.jasper.compiler.tagplugin.TagPlugin</tt>
+        instructs Jasper what Java codes to generate in place of the tag
+        handler calls.
+        See Javadoc for <tt>org.apache.jasper.compiler.tagplugin.TagPlugin</tt>
+        for details.
+      </li>
+
+      <li>
+        Create the plugin descriptor file <tt> WEB-INF/tagPlugins.xml</tt><p/>
+        This file
+        specifies the plugin classes and their corresponding tag handler
+        classes.
+      </li>
+    </ol>
+  </body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/tagplugin/if.html b/tomcat/webapps/examples/jsp/tagplugin/if.html
new file mode 100644
index 0000000000000000000000000000000000000000..b04ac592b9bc8b0a5acb8fdef1785514df053ab8
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/tagplugin/if.html
@@ -0,0 +1,36 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+<head>
+<title>View Source Code</title>
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF">
+  <a href="if.jsp">
+    <img src="../images/execute.gif" align="right" border="0"></a>
+  <a href="../index.html">
+    <img src="../images/return.gif" width="24" height="24" align="right" border="0">
+  </a></font>
+</p>
+
+<h3>
+  <a href="if.jsp.html">Source Code for if.jsp<font color="#0000FF"/></a>
+</h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/tagplugin/if.jsp b/tomcat/webapps/examples/jsp/tagplugin/if.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..af627bf360340ed32f2ae861d0b437c81cff7366
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/tagplugin/if.jsp
@@ -0,0 +1,47 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<html>
+  <head>
+    <title>Tag Plugin Examples: if</title>
+  </head>
+  <body>
+    <h1>Tag Plugin Examples - &lt;c:if></h1>
+
+    <hr/>
+    <br/>
+    <a href="notes.html">Plugin Introductory Notes</a>
+    <br/>
+    <a href="howto.html">Brief Instructions for Writing Plugins</a>
+    <br/> <br/>
+    <hr/>
+
+    <br/>
+    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+
+    <h3>Set the test result to a variable</h3>
+    <c:if test="${1==1}" var="theTruth" scope="page"/>
+    The result of testing for (1==1) is: ${theTruth}
+
+    <h3>Conditionally execute the body</h3>
+    <c:if test="${2>0}">
+        <p>It's true that (2>0)! Working.</p>
+    </c:if>
+    <c:if test="${0>2}">
+        <p>It's not true that (0>2)! Failed.</p>
+    </c:if>
+  </body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/tagplugin/if.jsp.html b/tomcat/webapps/examples/jsp/tagplugin/if.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..ee126c3eb398adf26f2feb5444a60f6bcad53e78
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/tagplugin/if.jsp.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+&lt;html>
+  &lt;head>
+    &lt;title>Tag Plugin Examples: if&lt;/title>
+  &lt;/head>
+  &lt;body>
+    &lt;h1>Tag Plugin Examples - &amp;lt;c:if>&lt;/h1>
+
+    &lt;hr/>
+    &lt;br/>
+    &lt;a href="notes.html">Plugin Introductory Notes&lt;/a>
+    &lt;br/>
+    &lt;a href="howto.html">Brief Instructions for Writing Plugins&lt;/a>
+    &lt;br/> &lt;br/>
+    &lt;hr/>
+
+    &lt;br/>
+    &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+
+    &lt;h3>Set the test result to a variable&lt;/h3>
+    &lt;c:if test="${1==1}" var="theTruth" scope="page"/>
+    The result of testing for (1==1) is: ${theTruth}
+
+    &lt;h3>Conditionally execute the body&lt;/h3>
+    &lt;c:if test="${2>0}">
+        &lt;p>It's true that (2>0)! Working.&lt;/p>
+    &lt;/c:if>
+    &lt;c:if test="${0>2}">
+        &lt;p>It's not true that (0>2)! Failed.&lt;/p>
+    &lt;/c:if>
+  &lt;/body>
+&lt;/html>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/jsp/tagplugin/notes.html b/tomcat/webapps/examples/jsp/tagplugin/notes.html
new file mode 100644
index 0000000000000000000000000000000000000000..cd326fc2df9befece4d9c46d7cb447f4067bf922
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/tagplugin/notes.html
@@ -0,0 +1,41 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+  <head>
+    <title>Tag Plugin Introduction</title>
+  </head>
+  <body>
+    <h2>Tag Plugins: Introductory Notes</h2>
+    <p>
+      Tomcat provides a framework for implementing tag plugins.  The
+      plugins instruct Jasper, at translation time, to replace tag handler
+      calls with Java scriptlets.
+      The framework allows tag library authors to implement plugins for
+      their tags.
+    </p>
+    <p>
+      Tomcat is released with plugins for several JSTL tags.  Note
+      that these plugins work with JSTL 1.1 as well as JSTL 1.0, though
+      the examples uses JSTL 1.1 and JSP 2.0.
+      These plugins are not complete (for instance, some item types are not
+      handled in &lt;c:if>).
+      They do serve as examples to show plugins in action (just
+      examine the generated Java files), and how they can be implemented.
+    </p>
+  </body>
+</html>
+
diff --git a/tomcat/webapps/examples/jsp/xml/xml.html b/tomcat/webapps/examples/jsp/xml/xml.html
new file mode 100644
index 0000000000000000000000000000000000000000..00121424e98be10f00ae9ba8b6188057238607b8
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/xml/xml.html
@@ -0,0 +1,31 @@
+<html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="xml.jsp"><img src="../images/execute.gif" align="right" border="0"></a><a href="../index.html"><img src="../images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+
+<h3><a href="xml.jsp.html">Source Code for XML syntax Example<font color="#0000FF"></a>
+  </font> </h3>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/jsp/xml/xml.jsp b/tomcat/webapps/examples/jsp/xml/xml.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..840b21f3248ba3f7fe51a538b31e06cc0f07bcda
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/xml/xml.jsp
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
+  version="1.2">
+<jsp:directive.page contentType="text/html"/>
+<jsp:directive.page import="java.util.Date, java.util.Locale"/>
+<jsp:directive.page import="java.text.*"/>
+
+<jsp:declaration>
+  String getDateTimeStr(Locale l) {
+    DateFormat df = SimpleDateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, l);
+    return df.format(new Date());
+  }
+</jsp:declaration>
+
+<html>
+<head>
+  <title>Example JSP in XML format</title>
+</head>
+
+<body>
+This is the output of a simple JSP using XML format.
+<br />
+
+<div>Use a jsp:scriptlet to loop from 1 to 10: </div>
+<jsp:scriptlet>
+// Note we need to declare CDATA because we don't escape the less than symbol
+<![CDATA[
+  for (int i = 1; i<=10; i++) {
+    out.println(i);
+    if (i < 10) {
+      out.println(", ");
+    }
+  }
+]]>
+</jsp:scriptlet>
+
+<!-- Because I omit br's end tag, declare it as CDATA -->
+<![CDATA[
+  <br><br>
+]]>
+
+<div align="left">
+  Use a jsp:expression to write the date and time in the browser's locale:
+  <jsp:expression>getDateTimeStr(request.getLocale())</jsp:expression>
+</div>
+
+
+<jsp:text>
+  &lt;p&gt;This sentence is enclosed in a jsp:text element.&lt;/p&gt;
+</jsp:text>
+
+</body>
+</html>
+</jsp:root>
diff --git a/tomcat/webapps/examples/jsp/xml/xml.jsp.html b/tomcat/webapps/examples/jsp/xml/xml.jsp.html
new file mode 100644
index 0000000000000000000000000000000000000000..b146a971021cdfb260f54d43dbe6cca8d9b1de1a
--- /dev/null
+++ b/tomcat/webapps/examples/jsp/xml/xml.jsp.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Source Code</title></head><body><pre>&lt;?xml version="1.0" encoding="UTF-8"?>
+&lt;!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+&lt;jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
+  version="1.2">
+&lt;jsp:directive.page contentType="text/html"/>
+&lt;jsp:directive.page import="java.util.Date, java.util.Locale"/>
+&lt;jsp:directive.page import="java.text.*"/>
+
+&lt;jsp:declaration>
+  String getDateTimeStr(Locale l) {
+    DateFormat df = SimpleDateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, l);
+    return df.format(new Date());
+  }
+&lt;/jsp:declaration>
+
+&lt;html>
+&lt;head>
+  &lt;title>Example JSP in XML format&lt;/title>
+&lt;/head>
+
+&lt;body>
+This is the output of a simple JSP using XML format.
+&lt;br />
+
+&lt;div>Use a jsp:scriptlet to loop from 1 to 10: &lt;/div>
+&lt;jsp:scriptlet>
+// Note we need to declare CDATA because we don't escape the less than symbol
+&lt;![CDATA[
+  for (int i = 1; i&lt;=10; i++) {
+    out.println(i);
+    if (i &lt; 10) {
+      out.println(", ");
+    }
+  }
+]]>
+&lt;/jsp:scriptlet>
+
+&lt;!-- Because I omit br's end tag, declare it as CDATA -->
+&lt;![CDATA[
+  &lt;br>&lt;br>
+]]>
+
+&lt;div align="left">
+  Use a jsp:expression to write the date and time in the browser's locale:
+  &lt;jsp:expression>getDateTimeStr(request.getLocale())&lt;/jsp:expression>
+&lt;/div>
+
+
+&lt;jsp:text>
+  &amp;lt;p&amp;gt;This sentence is enclosed in a jsp:text element.&amp;lt;/p&amp;gt;
+&lt;/jsp:text>
+
+&lt;/body>
+&lt;/html>
+&lt;/jsp:root>
+</pre></body></html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/servlets/cookies.html b/tomcat/webapps/examples/servlets/cookies.html
new file mode 100644
index 0000000000000000000000000000000000000000..bacee44dbac72ad64e689eb26081a1f8946b86cf
--- /dev/null
+++ b/tomcat/webapps/examples/servlets/cookies.html
@@ -0,0 +1,61 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="servlet/CookieExample"><img src="images/execute.gif" align="right" border="0"></a><a href="index.html"><img src="images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+<h3>Source Code for Cookie Example<font color="#0000FF"><br>
+  </font> </h3>
+<font color="#0000FF"></font>
+<pre><font color="#0000FF">import</font> java.io.*;
+<font color="#0000FF">import</font> javax.servlet.*;
+<font color="#0000FF">import</font> javax.servlet.http.*;
+
+<font color="#0000FF">public class</font> CookieExample <font color="#0000FF">extends</font> HttpServlet {
+
+    <font color="#0000FF">public void</font> doGet(HttpServletRequest request, HttpServletResponse response)
+    <font color="#0000FF">throws</font> IOException, ServletException
+    {
+        response.setContentType(&quot;<font color="#009900">text/html</font>&quot;);
+        PrintWriter out = response.getWriter();
+
+        <font color="#CC0000">// print out cookies</font>
+
+        Cookie[] cookies = request.getCookies();
+        for (int i = 0; i &lt; cookies.length; i++) {
+            Cookie c = cookies[i];
+            String name = c.getName();
+            String value = c.getValue();
+            out.println(name + &quot;<font color="#009900"> = </font>&quot; + value);
+        }
+
+        <font color="#CC0000">// set a cookie</font>
+
+        String name = request.getParameter(&quot;<font color="#009900">cookieName</font>&quot;);
+        if (name != null &amp;&amp; name.length() &gt; 0) {
+            String value = request.getParameter(&quot;<font color="#009900">cookieValue</font>&quot;);
+            Cookie c = new Cookie(name, value);
+            response.addCookie(c);
+        }
+    }
+}</pre>
+</body>
+</html>
diff --git a/tomcat/webapps/examples/servlets/helloworld.html b/tomcat/webapps/examples/servlets/helloworld.html
new file mode 100644
index 0000000000000000000000000000000000000000..c2234467b9f1796363b639b72cbe28664754523a
--- /dev/null
+++ b/tomcat/webapps/examples/servlets/helloworld.html
@@ -0,0 +1,50 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="servlet/HelloWorldExample"><img src="images/execute.gif" align="right" border="0"></a><a href="index.html"><img src="images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+<h3>Source Code for HelloWorld Example<font color="#0000FF"><br>
+  </font> </h3>
+<font color="#0000FF"></font>
+<pre><font color="#0000FF">import</font> java.io.*;
+<font color="#0000FF">import</font> javax.servlet.*;
+<font color="#0000FF">import</font> javax.servlet.http.*;
+
+<font color="#0000FF">public class</font> HelloWorld <font color="#0000FF">extends</font> HttpServlet {
+
+    <font color="#0000FF">public void</font> doGet(HttpServletRequest request, HttpServletResponse response)
+    <font color="#0000FF">throws</font> IOException, ServletException
+    {
+        response.setContentType(&quot;<font color="#009900">text/html</font>&quot;);
+        PrintWriter out = response.getWriter();
+        out.println(&quot;<font color="#009900">&lt;html&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;head&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;title&gt;Hello World!&lt;/title&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;/head&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;body&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;h1&gt;Hello World!&lt;/h1&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;/body&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;/html&gt;</font>&quot;);
+    }
+}</pre>
+</body>
+</html>
diff --git a/tomcat/webapps/examples/servlets/images/code.gif b/tomcat/webapps/examples/servlets/images/code.gif
new file mode 100644
index 0000000000000000000000000000000000000000..93af2cd130aa61cb2f235cdd6f0e75ab444819ef
Binary files /dev/null and b/tomcat/webapps/examples/servlets/images/code.gif differ
diff --git a/tomcat/webapps/examples/servlets/images/execute.gif b/tomcat/webapps/examples/servlets/images/execute.gif
new file mode 100644
index 0000000000000000000000000000000000000000..f64d70fd233d6fb3fcbdeedc02061871984f8fb5
Binary files /dev/null and b/tomcat/webapps/examples/servlets/images/execute.gif differ
diff --git a/tomcat/webapps/examples/servlets/images/return.gif b/tomcat/webapps/examples/servlets/images/return.gif
new file mode 100644
index 0000000000000000000000000000000000000000..af4f68f4a3a13e0ef1dc0045b04c2c93354cdf40
Binary files /dev/null and b/tomcat/webapps/examples/servlets/images/return.gif differ
diff --git a/tomcat/webapps/examples/servlets/index.html b/tomcat/webapps/examples/servlets/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..d07a277e9c85bf62d01fde644c04ce24bafab224
--- /dev/null
+++ b/tomcat/webapps/examples/servlets/index.html
@@ -0,0 +1,193 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!DOCTYPE html><html lang="en">
+<head>
+   <meta charset="UTF-8" />
+   <meta name="Author" content="Anil K. Vijendran" />
+   <title>Servlet Examples</title>
+   <style type="text/css">
+   img { border: 0; }
+   th { text-align: left; }
+   tr { vertical-align: top; }
+   </style>
+</head>
+<body>
+<h1>Servlet
+Examples with Code</h1>
+<p>This is a collection of examples which demonstrate some of the more
+frequently used parts of the Servlet API. Familiarity with the Java(tm)
+Programming Language is assumed.
+<p>These examples will only work when viewed via an http URL. They will
+not work if you are viewing these pages via a "file://..." URL. Please
+refer to the <i>README</i> file provide with this Tomcat release regarding
+how to configure and start the provided web server.
+<p>Wherever you see a form, enter some data and see how the servlet reacts.
+When playing with the Cookie and Session Examples, jump back to the Headers
+Example to see exactly what your browser is sending the server.
+<p>To navigate your way through the examples, the following icons will
+help:</p>
+<ul style="list-style-type: none; padding-left: 0;">
+<li><img src="images/execute.gif" alt=""> Execute the example</li>
+<li><img src="images/code.gif" alt=""> Look at the source code for the example</li>
+<li><img src="images/return.gif" alt=""> Return to this screen</li>
+</ul>
+
+<p>Tip: To see the cookie interactions with your browser, try turning on
+the "notify when setting a cookie" option in your browser preferences.
+This will let you see when a session is created and give some feedback
+when looking at the cookie demo.</p>
+<table style="width: 85%;" >
+<tr>
+<td>Hello World</td>
+
+<td style="width: 30%;"><a href="servlet/HelloWorldExample"><img SRC="images/execute.gif" alt=""></a><a href="servlet/HelloWorldExample">Execute</a></td>
+
+<td style="width: 30%;"><a href="helloworld.html"><img SRC="images/code.gif" alt=""></a><a href="helloworld.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Request Info</td>
+
+<td style="width: 30%;"><a href="servlet/RequestInfoExample"><img SRC="images/execute.gif" alt=""></a><a href="servlet/RequestInfoExample">Execute</a></td>
+
+<td style="width: 30%;"><a href="reqinfo.html"><img SRC="images/code.gif" alt=""></a><a href="reqinfo.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Request Headers</td>
+
+<td style="width: 30%;"><a href="servlet/RequestHeaderExample"><img SRC="images/execute.gif" alt=""></a><a href="servlet/RequestHeaderExample">Execute</a></td>
+
+<td style="width: 30%;"><a href="reqheaders.html"><img SRC="images/code.gif" alt=""></a><a href="reqheaders.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Request Parameters</td>
+
+<td style="width: 30%;"><a href="servlet/RequestParamExample"><img SRC="images/execute.gif" alt=""></a><a href="servlet/RequestParamExample">Execute</a></td>
+
+<td style="width: 30%;"><a href="reqparams.html"><img SRC="images/code.gif" alt=""></a><a href="reqparams.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Cookies</td>
+
+<td style="width: 30%;"><a href="servlet/CookieExample"><img SRC="images/execute.gif" alt=""></a><a href="servlet/CookieExample">Execute</a></td>
+
+<td style="width: 30%;"><a href="cookies.html"><img SRC="images/code.gif" alt=""></a><a href="cookies.html">Source</a></td>
+</tr>
+
+<tr>
+<td>Sessions</td>
+
+<td style="width: 30%;"><a href="servlet/SessionExample"><img SRC="images/execute.gif" alt=""></a><a href="servlet/SessionExample">Execute</a></td>
+
+<td style="width: 30%;"><a href="sessions.html"><img SRC="images/code.gif" alt=""></a><a href="sessions.html">Source</a></td>
+</tr>
+</table>
+
+<p>Note: The source code for these examples does not contain all of the
+source code that is actually in the example, only the important sections
+of code. Code not important to understand the example has been removed
+for clarity.</p>
+
+<h2>Other Examples</h2>
+<table style="width: 85%;" >
+
+<tr>
+  <th colspan="3">Servlet 3.0 Asynchronous processing examples:</th>
+</tr>
+<tr>
+  <td>async0</td>
+  <td style="width: 30%;">
+    <a href="../async/async0"><img SRC="images/execute.gif" alt=""> Execute</a>
+  </td>
+  <td style="width: 30%;"></td>
+</tr>
+<tr>
+  <td>async1</td>
+  <td style="width: 30%;">
+    <a href="../async/async1"><img SRC="images/execute.gif" alt=""> Execute</a>
+  </td>
+  <td style="width: 30%;"></td>
+</tr>
+<tr>
+  <td>async2</td>
+  <td style="width: 30%;">
+    <a href="../async/async2"><img SRC="images/execute.gif" alt=""> Execute</a>
+  </td>
+  <td style="width: 30%;"></td>
+</tr>
+<tr>
+  <td>async3</td>
+  <td style="width: 30%;">
+    <a href="../async/async3"><img SRC="images/execute.gif" alt=""> Execute</a>
+  </td>
+  <td style="width: 30%;"></td>
+</tr>
+<tr>
+  <td>stockticker</td>
+  <td style="width: 30%;">
+    <a href="../async/stockticker"><img SRC="images/execute.gif" alt=""> Execute</a>
+  </td>
+  <td style="width: 30%;"></td>
+</tr>
+
+<tr>
+  <th colspan="3">Servlet 3.1 Non-blocking IO examples</th>
+</tr>
+<tr>
+  <td>Byte counter</td>
+  <td style="width: 30%;">
+    <a href="nonblocking/bytecounter.html"><img src="images/execute.gif" alt=""> Execute</a>
+  </td>
+  <td style="width: 30%;"></td>
+</tr>
+<tr>
+  <td>Number Writer</td>
+  <td style="width: 30%;">
+    <a href="nonblocking/numberwriter"><img src="images/execute.gif" alt=""> Execute</a>
+  </td>
+  <td style="width: 30%;"></td>
+</tr>
+
+<tr>
+  <th colspan="3">Servlet 4.0 Server Push examples</th>
+</tr>
+<tr>
+  <td>Simple image push</td>
+  <td style="width: 30%;">
+    <a href="serverpush/simpleimage"><img src="images/execute.gif" alt=""> Execute</a>
+  </td>
+  <td style="width: 30%;"></td>
+</tr>
+
+<tr>
+  <th colspan="3">Servlet 4.0 Trailer Field examples</th>
+</tr>
+<tr>
+  <td>Response trailer fields</td>
+  <td style="width: 30%;">
+    <a href="trailers/response"><img src="images/execute.gif" alt=""> Execute</a>
+  </td>
+  <td style="width: 30%;"></td>
+</tr>
+
+</table>
+
+</body>
+</html>
diff --git a/tomcat/webapps/examples/servlets/nonblocking/bytecounter.html b/tomcat/webapps/examples/servlets/nonblocking/bytecounter.html
new file mode 100644
index 0000000000000000000000000000000000000000..55d31a21380e172f4a930206b82933fb95891514
--- /dev/null
+++ b/tomcat/webapps/examples/servlets/nonblocking/bytecounter.html
@@ -0,0 +1,32 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+  <head>
+    <title>Servlet 3.1 non-blocking IO examples: Byte counter</title>
+  </head>
+  <body>
+    <h1>Byte counter</h1>
+    <p>Select a file and/or enter some data using the form below and then submit
+       it. The server will read the request body using non-blocking IO and then
+       respond with the total length of the request body in bytes.</p>
+    <form method="POST" enctype="multipart/form-data" action="bytecounter" >
+      <p><textarea name="data" rows="5" cols="60" ></textarea></p>
+      <p><input name="source" type="file" /></p>
+      <p><input type="submit" value="Submit" /></p>
+    </form>
+  </body>
+</html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/servlets/reqheaders.html b/tomcat/webapps/examples/servlets/reqheaders.html
new file mode 100644
index 0000000000000000000000000000000000000000..adda30cefa9460195d7e567c4cdfe0fc0e13fb9c
--- /dev/null
+++ b/tomcat/webapps/examples/servlets/reqheaders.html
@@ -0,0 +1,49 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="servlet/RequestHeaderExample"><img src="images/execute.gif" align="right" border="0"></a><a href="index.html"><img src="images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+<h3>Source Code for RequestHeader Example<font color="#0000FF"><br>
+  </font> </h3>
+<font color="#0000FF"></font>
+<pre><font color="#0000FF">import</font> java.io.*;
+<font color="#0000FF">import</font> java.util.*;
+<font color="#0000FF">import</font> javax.servlet.*;
+<font color="#0000FF">import</font> javax.servlet.http.*;
+
+<font color="#0000FF">public class</font> RequestHeaderExample <font color="#0000FF">extends</font> HttpServlet {
+
+    <font color="#0000FF">public void</font> doGet(HttpServletRequest request, HttpServletResponse response)
+    <font color="#0000FF">throws</font> IOException, ServletException
+    {
+        response.setContentType(&quot;<font color="#009900">text/html</font>&quot;);
+        PrintWriter out = response.getWriter();
+        Enumeration e = request.getHeaderNames();
+        while (e.hasMoreElements()) {
+            String name = (String)e.nextElement();
+            String value = request.getHeader(name);
+            out.println(name + &quot;<font color="#009900"> = </font>&quot; + value);
+        }
+    }
+}</pre>
+</body>
+</html>
diff --git a/tomcat/webapps/examples/servlets/reqinfo.html b/tomcat/webapps/examples/servlets/reqinfo.html
new file mode 100644
index 0000000000000000000000000000000000000000..daf239c181ef4d1fa7091f963536284148efea85
--- /dev/null
+++ b/tomcat/webapps/examples/servlets/reqinfo.html
@@ -0,0 +1,68 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="servlet/RequestInfoExample"><img src="images/execute.gif" align="right" border="0"></a><a href="index.html"><img src="images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+<h3>Source Code for Request Info Example<font color="#0000FF"><br>
+  </font> </h3>
+<font color="#0000FF"></font>
+<pre><font color="#0000FF">import</font> java.io.*;
+<font color="#0000FF">import</font> javax.servlet.*;
+<font color="#0000FF">import</font> javax.servlet.http.*;
+
+<font color="#0000FF">public class</font> RequestInfo <font color="#0000FF">extends</font> HttpServlet {
+
+    <font color="#0000FF">public void</font> doGet(HttpServletRequest request, HttpServletResponse response)
+    <font color="#0000FF">throws</font> IOException, ServletException
+    {
+        response.setContentType(&quot;<font color="#009900">text/html</font>&quot;);
+        PrintWriter out = response.getWriter();
+        out.println(&quot;<font color="#009900">&lt;html&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;body&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;head&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;title&gt;Request Information Example&lt;/title&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;/head&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;body&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;h3&gt;Request Information Example&lt;/h3&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">Method: </font>&quot; + request.getMethod());
+        out.println(&quot;<font color="#009900">Request URI: </font>&quot; + request.getRequestURI());
+        out.println(&quot;<font color="#009900">Protocol: </font>&quot; + request.getProtocol());
+        out.println(&quot;<font color="#009900">PathInfo: </font>&quot; + request.getPathInfo());
+        out.println(&quot;<font color="#009900">Remote Address: </font>&quot; + request.getRemoteAddr());
+        out.println(&quot;<font color="#009900">&lt;/body&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;/html&gt;</font>&quot;);
+    }
+
+<font color="#FF0000">    /**
+     * We are going to perform the same operations for POST requests
+     * as for GET methods, so this method just sends the request to
+     * the doGet method.
+     */</font>
+
+    <font color="#0000FF">public void</font> doPost(HttpServletRequest request, HttpServletResponse response)
+    <font color="#0000FF">throws</font> IOException, ServletException
+    {
+        doGet(request, response);
+    }
+}</pre>
+</body>
+</html>
diff --git a/tomcat/webapps/examples/servlets/reqparams.html b/tomcat/webapps/examples/servlets/reqparams.html
new file mode 100644
index 0000000000000000000000000000000000000000..7128e39e4da7d0b1b3d03e4d8f79200fff3a9a3c
--- /dev/null
+++ b/tomcat/webapps/examples/servlets/reqparams.html
@@ -0,0 +1,78 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="servlet/RequestParamExample"><img src="images/execute.gif" align="right" border="0"></a><a href="index.html"><img src="images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+<h3>Source Code for Request Parameter Example<font color="#0000FF"><br>
+  </font> </h3>
+<font color="#0000FF"></font>
+<pre><font color="#0000FF">import</font> java.io.*;
+<font color="#0000FF">import</font> java.util.*;
+<font color="#0000FF">import</font> javax.servlet.*;
+<font color="#0000FF">import</font> javax.servlet.http.*;
+
+<font color="#0000FF">public class</font> RequestParamExample <font color="#0000FF">extends</font> HttpServlet {
+
+    <font color="#0000FF">public void</font> doGet(HttpServletRequest request, HttpServletResponse response)
+    <font color="#0000FF">throws</font> IOException, ServletException
+    {
+        response.setContentType(&quot;<font color="#009900">text/html</font>&quot;);
+        PrintWriter out = response.getWriter();
+        out.println(&quot;<font color="#009900">&lt;html&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;head&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;title&gt;Request Parameters Example&lt;/title&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;/head&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;body&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;h3&gt;Request Parameters Example&lt;/h3&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">Parameters in this request:&lt;br&gt;</font>&quot;);
+        if (firstName != null || lastName != null) {
+            out.println(&quot;<font color="#009900">First Name:</font>&quot;);
+            out.println(&quot;<font color="#009900"> = </font>&quot; + HTMLFilter.filter(firstName) + &quot;<font color="#009900">&lt;br&gt;</font>&quot;);
+            out.println(&quot;<font color="#009900">Last Name:</font>&quot;);
+            out.println(&quot;<font color="#009900"> = </font>&quot; + HTMLFilter.filter(lastName));
+        } else {
+            out.println(&quot;<font color="#009900">No Parameters, Please enter some</font>&quot;);
+        }
+        out.println(&quot;<font color="#009900">&lt;P&gt;</font>&quot;);
+        out.print(&quot;<font color="#009900">&lt;form action=\"</font>&quot;);
+        out.print(&quot;<font color="#009900">RequestParamExample\" </font>&quot;);
+        out.println(&quot;<font color="#009900">method=POST&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">First Name:</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;input type=text size=20 name=firstname&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;br&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">Last Name:</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;input type=text size=20 name=lastname&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;br&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;input type=submit&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;/form&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;/body&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;/html&gt;</font>&quot;);
+    }
+
+    <font color="#0000FF">public void</font> doPost(HttpServletRequest request, HttpServletResponse res)
+    <font color="#0000FF">throws</font> IOException, ServletException
+    {
+        doGet(request, response);
+    }
+}</pre>
+</body>
+</html>
diff --git a/tomcat/webapps/examples/servlets/sessions.html b/tomcat/webapps/examples/servlets/sessions.html
new file mode 100644
index 0000000000000000000000000000000000000000..99816c22e6e44654c1495c5d76a3ea88560e2f5c
--- /dev/null
+++ b/tomcat/webapps/examples/servlets/sessions.html
@@ -0,0 +1,70 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="servlet/SessionExample"><img src="images/execute.gif" align="right" border="0"></a><a href="index.html"><img src="images/return.gif" width="24" height="24" align="right" border="0"></a></font></p>
+<h3>Source Code for Session Example<font color="#0000FF"><br>
+  </font> </h3>
+<font color="#0000FF"></font>
+<pre><font color="#0000FF">import</font> java.io.*;
+<font color="#0000FF">import</font> java.util.*;
+<font color="#0000FF">import</font> javax.servlet.*;
+<font color="#0000FF">import</font> javax.servlet.http.*;
+
+<font color="#0000FF">public class</font> SessionExample <font color="#0000FF">extends</font> HttpServlet {
+
+    <font color="#0000FF">public void</font> doGet(HttpServletRequest request, HttpServletResponse response)
+    <font color="#0000FF">throws</font> IOException, ServletException
+    {
+        response.setContentType(&quot;<font color="#009900">text/html</font>&quot;);
+        PrintWriter out = response.getWriter();
+
+        HttpSession session = request.getSession(true);
+
+        <font color="#CC0000">// print session info</font>
+
+        Date created = new Date(session.getCreationTime());
+        Date accessed = new Date(session.getLastAccessedTime());
+        out.println(&quot;<font color="#009900">ID </font>&quot; + session.getId());
+        out.println(&quot;<font color="#009900">Created: </font>&quot; + created);
+        out.println(&quot;<font color="#009900">Last Accessed: </font>&quot; + accessed);
+
+        <font color="#CC0000">// set session info if needed</font>
+
+        String dataName = request.getParameter(&quot;<font color="#009900">dataName</font>&quot;);
+        if (dataName != null &amp;&amp; dataName.length() &gt; 0) {
+            String dataValue = request.getParameter(&quot;<font color="#009900">dataValue</font>&quot;);
+            session.setAttribute(dataName, dataValue);
+        }
+
+        // print session contents
+
+        Enumeration e = session.getAttributeNames();
+        while (e.hasMoreElements()) {
+            String name = (String)e.nextElement();
+            String value = session.getAttribute(name).toString();
+            out.println(name + &quot; <font color="#009900">= </font>&quot; + value);
+        }
+    }
+}</pre>
+</body>
+</html>
diff --git a/tomcat/webapps/examples/websocket/chat.xhtml b/tomcat/webapps/examples/websocket/chat.xhtml
new file mode 100644
index 0000000000000000000000000000000000000000..fca748ca98c4c60d8cdbb8f9fbf2d20e91f030ff
--- /dev/null
+++ b/tomcat/webapps/examples/websocket/chat.xhtml
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+    <title>Apache Tomcat WebSocket Examples: Chat</title>
+    <style type="text/css"><![CDATA[
+        input#chat {
+            width: 410px
+        }
+
+        #console-container {
+            width: 400px;
+        }
+
+        #console {
+            border: 1px solid #CCCCCC;
+            border-right-color: #999999;
+            border-bottom-color: #999999;
+            height: 170px;
+            overflow-y: scroll;
+            padding: 5px;
+            width: 100%;
+        }
+
+        #console p {
+            padding: 0;
+            margin: 0;
+        }
+    ]]></style>
+    <script type="application/javascript"><![CDATA[
+        "use strict";
+
+        var Chat = {};
+
+        Chat.socket = null;
+
+        Chat.connect = (function(host) {
+            if ('WebSocket' in window) {
+                Chat.socket = new WebSocket(host);
+            } else if ('MozWebSocket' in window) {
+                Chat.socket = new MozWebSocket(host);
+            } else {
+                Console.log('Error: WebSocket is not supported by this browser.');
+                return;
+            }
+
+            Chat.socket.onopen = function () {
+                Console.log('Info: WebSocket connection opened.');
+                document.getElementById('chat').onkeydown = function(event) {
+                    if (event.keyCode == 13) {
+                        Chat.sendMessage();
+                    }
+                };
+            };
+
+            Chat.socket.onclose = function () {
+                document.getElementById('chat').onkeydown = null;
+                Console.log('Info: WebSocket closed.');
+            };
+
+            Chat.socket.onmessage = function (message) {
+                Console.log(message.data);
+            };
+        });
+
+        Chat.initialize = function() {
+            if (window.location.protocol == 'http:') {
+                Chat.connect('ws://' + window.location.host + '/examples/websocket/chat');
+            } else {
+                Chat.connect('wss://' + window.location.host + '/examples/websocket/chat');
+            }
+        };
+
+        Chat.sendMessage = (function() {
+            var message = document.getElementById('chat').value;
+            if (message != '') {
+                Chat.socket.send(message);
+                document.getElementById('chat').value = '';
+            }
+        });
+
+        var Console = {};
+
+        Console.log = (function(message) {
+            var console = document.getElementById('console');
+            var p = document.createElement('p');
+            p.style.wordWrap = 'break-word';
+            p.innerHTML = message;
+            console.appendChild(p);
+            while (console.childNodes.length > 25) {
+                console.removeChild(console.firstChild);
+            }
+            console.scrollTop = console.scrollHeight;
+        });
+
+        Chat.initialize();
+
+
+        document.addEventListener("DOMContentLoaded", function() {
+            // Remove elements with "noscript" class - <noscript> is not allowed in XHTML
+            var noscripts = document.getElementsByClassName("noscript");
+            for (var i = 0; i < noscripts.length; i++) {
+                noscripts[i].parentNode.removeChild(noscripts[i]);
+            }
+        }, false);
+
+    ]]></script>
+</head>
+<body>
+<div class="noscript"><h2 style="color: #ff0000">Seems your browser doesn't support Javascript! Websockets rely on Javascript being enabled. Please enable
+    Javascript and reload this page!</h2></div>
+<div>
+    <p>
+        <input type="text" placeholder="type and press enter to chat" id="chat" />
+    </p>
+    <div id="console-container">
+        <div id="console"/>
+    </div>
+</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/websocket/drawboard.xhtml b/tomcat/webapps/examples/websocket/drawboard.xhtml
new file mode 100644
index 0000000000000000000000000000000000000000..ff63366484cf386e9cc4d024b56e85685d9af936
--- /dev/null
+++ b/tomcat/webapps/examples/websocket/drawboard.xhtml
@@ -0,0 +1,899 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+    <title>Apache Tomcat WebSocket Examples: Drawboard</title>
+    <style type="text/css"><![CDATA[
+
+        body {
+            font-family: Arial, sans-serif;
+            font-size: 11pt;
+            background-color: #eeeeea;
+            padding: 10px;
+        }
+
+        #console-container {
+            float: left;
+            background-color: #fff;
+            width: 250px;
+        }
+
+        #console {
+            font-size: 10pt;
+            height: 600px;
+            overflow-y: scroll;
+            padding-left: 5px;
+            padding-right: 5px;
+        }
+
+        #console p {
+            padding: 0;
+            margin: 0;
+        }
+
+        #drawContainer {
+            float: left;
+            display: none;
+            margin-right: 25px;
+        }
+
+        #drawContainer canvas {
+            display: block;
+            -ms-touch-action: none;
+            touch-action: none; /* Disable touch behaviors, like pan and zoom */
+            cursor: crosshair;
+        }
+
+        #labelContainer {
+            margin-bottom: 15px;
+        }
+
+        #drawContainer, #console-container {
+            box-shadow: 0px 0px 8px 3px #bbb;
+            border: 1px solid #CCCCCC;
+        }
+
+    ]]></style>
+    <script type="application/javascript"><![CDATA[
+    "use strict";
+
+    (function() {
+
+        document.addEventListener("DOMContentLoaded", function() {
+            // Remove elements with "noscript" class - <noscript> is not
+            // allowed in XHTML
+            var noscripts = document.getElementsByClassName("noscript");
+            for (var i = 0; i < noscripts.length; i++) {
+                noscripts[i].parentNode.removeChild(noscripts[i]);
+            }
+
+            // Add script for expand content.
+            var expandElements = document.getElementsByClassName("expand");
+            for (var ixx = 0; ixx < expandElements.length; ixx++) {
+                (function(el) {
+                    var expandContent = document.getElementById(el.getAttribute("data-content-id"));
+                    expandContent.style.display = "none";
+                    var arrow = document.createTextNode("â—¢ ");
+                    var arrowSpan = document.createElement("span");
+                    arrowSpan.appendChild(arrow);
+
+                    var link = document.createElement("a");
+                    link.setAttribute("href", "#!");
+                    while (el.firstChild != null) {
+                        link.appendChild(el.removeChild(el.firstChild));
+                    }
+                    el.appendChild(arrowSpan);
+                    el.appendChild(link);
+
+                    var textSpan = document.createElement("span");
+                    textSpan.setAttribute("style", "font-weight: normal;");
+                    textSpan.appendChild(document.createTextNode(" (click to expand)"));
+                    el.appendChild(textSpan);
+
+
+                    var visible = true;
+
+                    var switchExpand = function() {
+                        visible = !visible;
+                        expandContent.style.display = visible ? "block" : "none";
+                        arrowSpan.style.color = visible ? "#000" : "#888";
+                        return false;
+                    };
+
+                    link.onclick = switchExpand;
+                    switchExpand();
+
+                })(expandElements[ixx]);
+            }
+
+
+            var Console = {};
+
+            Console.log = (function() {
+                var consoleContainer =
+                    document.getElementById("console-container");
+                var console = document.createElement("div");
+                console.setAttribute("id", "console");
+                consoleContainer.appendChild(console);
+
+                return function(message) {
+                    var p = document.createElement('p');
+                    p.style.wordWrap = "break-word";
+                    p.appendChild(document.createTextNode(message));
+                    console.appendChild(p);
+                    while (console.childNodes.length > 25) {
+                        console.removeChild(console.firstChild);
+                    }
+                    console.scrollTop = console.scrollHeight;
+                }
+            })();
+
+
+            function Room(drawContainer) {
+
+                /* A pausable event forwarder that can be used to pause and
+                 * resume handling of events (e.g. when we need to wait
+                 * for a Image's load event before we can process further
+                 * WebSocket messages).
+                 * The object's callFunction(func) should be called from an
+                 * event handler and give the function to handle the event as
+                 * argument.
+                 * Call pauseProcessing() to suspend event forwarding and
+                 * resumeProcessing() to resume it.
+                 */
+                function PausableEventForwarder() {
+
+                    var pauseProcessing = false;
+                    // Queue for buffering functions to be called.
+                    var functionQueue = [];
+
+                    this.callFunction = function(func) {
+                        // If message processing is paused, we push it
+                        // into the queue - otherwise we process it directly.
+                        if (pauseProcessing) {
+                            functionQueue.push(func);
+                        } else {
+                            func();
+                        }
+                    };
+
+                    this.pauseProcessing = function() {
+                        pauseProcessing = true;
+                    };
+
+                    this.resumeProcessing = function() {
+                        pauseProcessing = false;
+
+                        // Process all queued functions until some handler calls
+                        // pauseProcessing() again.
+                        while (functionQueue.length > 0 && !pauseProcessing) {
+                            var func = functionQueue.pop();
+                            func();
+                        }
+                    };
+                }
+
+                // The WebSocket object.
+                var socket;
+                // ID of the timer which sends ping messages.
+                var pingTimerId;
+
+                var isStarted = false;
+                var playerCount = 0;
+
+                // An array of PathIdContainer objects that the server
+                // did not yet handle.
+                // They are ordered by id (ascending).
+                var pathsNotHandled = [];
+
+                var nextMsgId = 1;
+
+                var canvasDisplay = document.createElement("canvas");
+                var canvasBackground = document.createElement("canvas");
+                var canvasServerImage = document.createElement("canvas");
+                var canvasArray = [canvasDisplay, canvasBackground,
+                    canvasServerImage];
+                canvasDisplay.addEventListener("mousedown", function(e) {
+                    // Prevent default mouse event to prevent browsers from marking text
+                    // (and Chrome from displaying the "text" cursor).
+                    e.preventDefault();
+                }, false);
+
+                var labelPlayerCount = document.createTextNode("0");
+                var optionContainer = document.createElement("div");
+
+
+                var canvasDisplayCtx = canvasDisplay.getContext("2d");
+                var canvasBackgroundCtx = canvasBackground.getContext("2d");
+                var canvasServerImageCtx = canvasServerImage.getContext("2d");
+                var canvasMouseMoveHandler;
+                var canvasMouseDownHandler;
+
+                var isActive = false;
+                var mouseInWindow = false;
+                var mouseDown = false;
+                var currentMouseX = 0, currentMouseY = 0;
+                var currentPreviewPath = null;
+
+                var availableColors = [];
+                var currentColorIndex;
+                var colorContainers;
+                var previewTransparency = 0.65;
+
+                var availableThicknesses = [2, 3, 6, 10, 16, 28, 50];
+                var currentThicknessIndex;
+                var thicknessContainers;
+
+                var availableDrawTypes = [
+                           { name: "Brush", id: 1, continuous: true },
+                           { name: "Line", id: 2, continuous: false },
+                           { name: "Rectangle", id: 3, continuous: false },
+                           { name: "Ellipse", id: 4, continuous: false }
+                ];
+                var currentDrawTypeIndex;
+                var drawTypeContainers;
+
+
+                var labelContainer = document.getElementById("labelContainer");
+                var placeholder = document.createElement("div");
+                placeholder.appendChild(document.createTextNode("Loading... "));
+                var progressElem = document.createElement("progress");
+                placeholder.appendChild(progressElem);
+
+                labelContainer.appendChild(placeholder);
+
+                function rgb(color) {
+                       return "rgba(" + color[0] + "," + color[1] + ","
+                               + color[2] + "," + color[3] + ")";
+                   }
+
+                function PathIdContainer(path, id) {
+                    this.path = path;
+                    this.id = id;
+                }
+
+                function Path(type, color, thickness, x1, y1, x2, y2) {
+                    this.type = type;
+                    this.color = color;
+                    this.thickness = thickness;
+                    this.x1 = x1;
+                    this.y1 = y1;
+                    this.x2 = x2;
+                    this.y2 = y2;
+
+                    function ellipse(ctx, x, y, w, h) {
+                        /* Drawing a ellipse cannot be done directly in a
+                         * CanvasRenderingContext2D - we need to use drawArc()
+                         * in conjunction with scaling the context so that we
+                         * get the needed proportion.
+                         */
+                        ctx.save();
+
+                        // Translate and scale the context so that we can draw
+                        // an arc at (0, 0) with a radius of 1.
+                        ctx.translate(x + w / 2, y + h / 2);
+                        ctx.scale(w / 2, h / 2);
+
+                        ctx.beginPath();
+                        ctx.arc(0, 0, 1, 0, Math.PI * 2, false);
+
+                        ctx.restore();
+                    }
+
+                    this.draw = function(ctx) {
+                        ctx.beginPath();
+                        ctx.lineCap = "round";
+                        ctx.lineWidth = thickness;
+                        var style = rgb(color);
+                        ctx.strokeStyle = style;
+
+                        if (x1 == x2 && y1 == y2) {
+                            // Always draw as arc to meet the behavior
+                            // in Java2D.
+                            ctx.fillStyle = style;
+                            ctx.arc(x1, y1, thickness / 2.0, 0,
+                                    Math.PI * 2.0, false);
+                            ctx.fill();
+                        } else {
+                            if (type == 1 || type == 2) {
+                                // Draw a line.
+                                ctx.moveTo(x1, y1);
+                                ctx.lineTo(x2, y2);
+                                ctx.stroke();
+                            } else if (type == 3) {
+                                // Draw a rectangle.
+                                if (x1 == x2 || y1 == y2) {
+                                    // Draw as line
+                                    ctx.moveTo(x1, y1);
+                                    ctx.lineTo(x2, y2);
+                                    ctx.stroke();
+                                } else {
+                                    ctx.strokeRect(x1, y1, x2 - x1, y2 - y1);
+                                }
+                            } else if (type == 4) {
+                                // Draw a ellipse.
+                                ellipse(ctx, x1, y1, x2 - x1, y2 - y1);
+                                ctx.closePath();
+                                ctx.stroke();
+                            }
+                        }
+                    };
+                }
+
+
+                function connect() {
+                    var host = (window.location.protocol == "https:"
+                            ? "wss://" : "ws://") + window.location.host
+                            + "/examples/websocket/drawboard";
+                    socket = new WebSocket(host);
+
+                    /* Use a pausable event forwarder.
+                     * This is needed when we load an Image object with data
+                     * from a previous message, because we must wait until the
+                     * Image's load event it raised before we can use it (and
+                     * in the meantime the socket.message event could be
+                     * raised).
+                     * Therefore we need this pausable event handler to handle
+                     * e.g. socket.onmessage and socket.onclose.
+                     */
+                    var eventForwarder = new PausableEventForwarder();
+
+                    socket.onopen = function () {
+                        // Socket has opened. Now wait for the server to
+                        // send us the initial packet.
+                        Console.log("WebSocket connection opened.");
+
+                        // Set up a timer for pong messages.
+                        pingTimerId = window.setInterval(function() {
+                            socket.send("0");
+                        }, 30000);
+                    };
+
+                    socket.onclose = function () {
+                        eventForwarder.callFunction(function() {
+                            Console.log("WebSocket connection closed.");
+                            disableControls();
+
+                            // Disable pong timer.
+                            window.clearInterval(pingTimerId);
+                        });
+                    };
+
+                    // Handles an incoming Websocket message.
+                    var handleOnMessage = function(message) {
+
+                        // Split joined message and process them
+                        // individually.
+                        var messages = message.data.split(";");
+                        for (var msgArrIdx = 0; msgArrIdx < messages.length;
+                                msgArrIdx++) {
+                            var msg = messages[msgArrIdx];
+                            var type = msg.substring(0, 1);
+
+                            if (type == "0") {
+                                // Error message.
+                                var error = msg.substring(1);
+                                // Log it to the console and show an alert.
+                                Console.log("Error: " + error);
+                                alert(error);
+
+                            } else {
+                                if (!isStarted) {
+                                    if (type == "2") {
+                                        // Initial message. It contains the
+                                        // number of players.
+                                        // After this message we will receive
+                                        // a binary message containing the current
+                                        // room image as PNG.
+                                        playerCount = parseInt(msg.substring(1));
+
+                                        refreshPlayerCount();
+
+                                        // The next message will be a binary
+                                        // message containing the room images
+                                        // as PNG. Therefore we temporarily swap
+                                        // the message handler.
+                                        var originalHandler = handleOnMessage;
+                                        handleOnMessage = function(message) {
+                                            // First, we restore the original handler.
+                                            handleOnMessage = originalHandler;
+
+                                            // Read the image.
+                                            var blob = message.data;
+                                            // Create new blob with correct MIME type.
+                                            blob = new Blob([blob], {type : "image/png"});
+
+                                            var url = URL.createObjectURL(blob);
+
+                                            var img = new Image();
+
+                                            // We must wait until the onload event is
+                                            // raised until we can draw the image onto
+                                            // the canvas.
+                                            // Therefore we need to pause the event
+                                            // forwarder until the image is loaded.
+                                            eventForwarder.pauseProcessing();
+
+                                            img.onload = function() {
+
+                                                // Release the object URL.
+                                                URL.revokeObjectURL(url);
+
+                                                // Set the canvases to the correct size.
+                                                for (var i = 0; i < canvasArray.length; i++) {
+                                                    canvasArray[i].width = img.width;
+                                                    canvasArray[i].height = img.height;
+                                                }
+
+                                                // Now draw the image on the last canvas.
+                                                canvasServerImageCtx.clearRect(0, 0,
+                                                        canvasServerImage.width,
+                                                        canvasServerImage.height);
+                                                canvasServerImageCtx.drawImage(img, 0, 0);
+
+                                                // Draw it on the background canvas.
+                                                canvasBackgroundCtx.drawImage(canvasServerImage,
+                                                        0, 0);
+
+                                                isStarted = true;
+                                                startControls();
+
+                                                // Refresh the display canvas.
+                                                refreshDisplayCanvas();
+
+
+                                                // Finally, resume the event forwarder.
+                                                eventForwarder.resumeProcessing();
+                                            };
+
+                                            img.src = url;
+                                        };
+                                    }
+                                } else {
+                                    if (type == "3") {
+                                        // The number of players in this room changed.
+                                        var playerAdded = msg.substring(1) == "+";
+                                        playerCount += playerAdded ? 1 : -1;
+                                        refreshPlayerCount();
+
+                                        Console.log("Player " + (playerAdded
+                                                ? "joined." : "left."));
+
+                                    } else if (type == "1") {
+                                        // We received a new DrawMessage.
+                                        var maxLastHandledId = -1;
+                                        var drawMessages = msg.substring(1).split("|");
+                                        for (var i = 0; i < drawMessages.length; i++) {
+                                            var elements = drawMessages[i].split(",");
+                                            var lastHandledId = parseInt(elements[0]);
+                                               maxLastHandledId = Math.max(maxLastHandledId,
+                                                       lastHandledId);
+
+                                            var path = new Path(
+                                                    parseInt(elements[1]),
+                                                    [parseInt(elements[2]),
+                                                    parseInt(elements[3]),
+                                                    parseInt(elements[4]),
+                                                    parseInt(elements[5]) / 255.0],
+                                                    parseFloat(elements[6]),
+                                                    parseFloat(elements[7]),
+                                                    parseFloat(elements[8]),
+                                                    parseFloat(elements[9]),
+                                                    parseFloat(elements[10]));
+
+                                            // Draw the path onto the last canvas.
+                                            path.draw(canvasServerImageCtx);
+                                        }
+
+                                        // Draw the last canvas onto the background one.
+                                        canvasBackgroundCtx.drawImage(canvasServerImage,
+                                                0, 0);
+
+                                        // Now go through the pathsNotHandled array and
+                                        // remove the paths that were already handled by
+                                        // the server.
+                                        while (pathsNotHandled.length > 0
+                                                && pathsNotHandled[0].id <= maxLastHandledId)
+                                            pathsNotHandled.shift();
+
+                                        // Now me must draw the remaining paths onto
+                                        // the background canvas.
+                                        for (var i = 0; i < pathsNotHandled.length; i++) {
+                                            pathsNotHandled[i].path.draw(canvasBackgroundCtx);
+                                        }
+
+                                        refreshDisplayCanvas();
+                                    }
+                                }
+                            }
+                        }
+                    };
+
+                    socket.onmessage = function(message) {
+                        eventForwarder.callFunction(function() {
+                            handleOnMessage(message);
+                        });
+                    };
+
+                }
+
+
+                function refreshPlayerCount() {
+                    labelPlayerCount.nodeValue = String(playerCount);
+                }
+
+                function refreshDisplayCanvas() {
+                    if (!isActive) { // Don't draw a curser when not active.
+                        return;
+                    }
+
+                    canvasDisplayCtx.drawImage(canvasBackground, 0, 0);
+                    if (currentPreviewPath != null) {
+                        // Draw the preview path.
+                        currentPreviewPath.draw(canvasDisplayCtx);
+
+                    } else if (mouseInWindow && !mouseDown) {
+                        canvasDisplayCtx.beginPath();
+                        var color = availableColors[currentColorIndex].slice(0);
+                        color[3] = previewTransparency;
+                        canvasDisplayCtx.fillStyle = rgb(color);
+
+                        canvasDisplayCtx.arc(currentMouseX, currentMouseY,
+                                availableThicknesses[currentThicknessIndex] / 2,
+                                0, Math.PI * 2.0, true);
+                        canvasDisplayCtx.fill();
+                    }
+
+                }
+
+                function startControls() {
+                    isActive = true;
+
+                    labelContainer.removeChild(placeholder);
+                    placeholder = undefined;
+
+                    labelContainer.appendChild(
+                            document.createTextNode("Number of Players: "));
+                    labelContainer.appendChild(labelPlayerCount);
+
+
+                    drawContainer.style.display = "block";
+                    drawContainer.appendChild(canvasDisplay);
+
+                    drawContainer.appendChild(optionContainer);
+
+                    canvasMouseDownHandler = function(e) {
+                        if (e.button == 0) {
+                            currentMouseX = e.pageX - canvasDisplay.offsetLeft;
+                            currentMouseY = e.pageY - canvasDisplay.offsetTop;
+
+                            mouseDown = true;
+                            canvasMouseMoveHandler(e);
+
+                        } else if (mouseDown) {
+                            // Cancel drawing.
+                            mouseDown = false;
+                            currentPreviewPath = null;
+
+                            currentMouseX = e.pageX - canvasDisplay.offsetLeft;
+                            currentMouseY = e.pageY - canvasDisplay.offsetTop;
+
+                            refreshDisplayCanvas();
+                        }
+                    };
+                    canvasDisplay.addEventListener("mousedown", canvasMouseDownHandler, false);
+
+                    canvasMouseMoveHandler = function(e) {
+                        var mouseX = e.pageX - canvasDisplay.offsetLeft;
+                        var mouseY = e.pageY - canvasDisplay.offsetTop;
+
+                        if (mouseDown) {
+                            var drawType = availableDrawTypes[currentDrawTypeIndex];
+
+                            if (drawType.continuous) {
+
+                                var path = new Path(drawType.id,
+                                        availableColors[currentColorIndex],
+                                        availableThicknesses[currentThicknessIndex],
+                                        currentMouseX, currentMouseY, mouseX,
+                                        mouseY);
+                                // Draw it on the background canvas.
+                                path.draw(canvasBackgroundCtx);
+
+                                // Send it to the sever.
+                                pushPath(path);
+
+                                // Refresh old coordinates
+                                currentMouseX = mouseX;
+                                currentMouseY = mouseY;
+
+                            } else {
+                                // Create a new preview path.
+                                var color = availableColors[currentColorIndex].slice(0);
+                                color[3] = previewTransparency;
+                                currentPreviewPath = new Path(drawType.id,
+                                        color,
+                                        availableThicknesses[currentThicknessIndex],
+                                        currentMouseX, currentMouseY, mouseX,
+                                        mouseY, false);
+                            }
+
+                            refreshDisplayCanvas();
+                        } else {
+                            currentMouseX = mouseX;
+                            currentMouseY = mouseY;
+
+                            if (mouseInWindow) {
+                                refreshDisplayCanvas();
+                            }
+                        }
+
+                    };
+                    document.addEventListener("mousemove", canvasMouseMoveHandler, false);
+
+                    document.addEventListener("mouseup", function(e) {
+                        if (e.button == 0) {
+                            if (mouseDown) {
+                                mouseDown = false;
+                                currentPreviewPath = null;
+
+                                var mouseX = e.pageX - canvasDisplay.offsetLeft;
+                                var mouseY = e.pageY - canvasDisplay.offsetTop;
+                                var drawType = availableDrawTypes[currentDrawTypeIndex];
+
+                                // If we are drawing a continuous path and the previous mouse coordinates are the same as
+                                // the new ones, there is no need to construct a new draw message as we don't need to
+                                // "terminate" a path as every path element contains both the start and the end point.
+                                if (!(drawType.continuous && mouseX == currentMouseX && mouseY == currentMouseY)) {
+                                    var path = new Path(drawType.id, availableColors[currentColorIndex],
+                                            availableThicknesses[currentThicknessIndex],
+                                            currentMouseX, currentMouseY, mouseX,
+                                            mouseY);
+                                    // Draw it on the background canvas.
+                                    path.draw(canvasBackgroundCtx);
+
+                                    // Send it to the sever.
+                                    pushPath(path);
+
+                                    // Refresh old coordinates
+                                    currentMouseX = mouseX;
+                                    currentMouseY = mouseY;
+                                }
+
+                                refreshDisplayCanvas();
+                            }
+                        }
+                    }, false);
+
+                    canvasDisplay.addEventListener("mouseout", function(e) {
+                        mouseInWindow = false;
+                        refreshDisplayCanvas();
+                    }, false);
+
+                    canvasDisplay.addEventListener("mousemove", function(e) {
+                        if (!mouseInWindow) {
+                            mouseInWindow = true;
+                            refreshDisplayCanvas();
+                        }
+                    }, false);
+
+
+                    // Create color and thickness controls.
+                    var colorContainersBox = document.createElement("div");
+                    colorContainersBox.setAttribute("style",
+                            "margin: 4px; border: 1px solid #bbb; border-radius: 3px;");
+                    optionContainer.appendChild(colorContainersBox);
+
+                    colorContainers = new Array(3 * 3 * 3);
+                    for (var i = 0; i < colorContainers.length; i++) {
+                        var colorContainer = colorContainers[i] =
+                            document.createElement("div");
+                        var color = availableColors[i] =
+                            [
+                                Math.floor((i % 3) * 255 / 2),
+                                Math.floor((Math.floor(i / 3) % 3) * 255 / 2),
+                                Math.floor((Math.floor(i / (3 * 3)) % 3) * 255 / 2),
+                                1.0
+                            ];
+                        colorContainer.setAttribute("style",
+                                "margin: 3px; width: 18px; height: 18px; "
+                                + "float: left; background-color: " + rgb(color));
+                        colorContainer.style.border = '2px solid #000';
+                        colorContainer.addEventListener("mousedown", (function(ix) {
+                            return function() {
+                                setColor(ix);
+                            };
+                        })(i), false);
+
+                        colorContainersBox.appendChild(colorContainer);
+                    }
+
+                    var divClearLeft = document.createElement("div");
+                    divClearLeft.setAttribute("style", "clear: left;");
+                    colorContainersBox.appendChild(divClearLeft);
+
+
+                    var drawTypeContainersBox = document.createElement("div");
+                    drawTypeContainersBox.setAttribute("style",
+                           "float: right; margin-right: 3px; margin-top: 1px;");
+                    optionContainer.appendChild(drawTypeContainersBox);
+
+                    drawTypeContainers = new Array(availableDrawTypes.length);
+                    for (var i = 0; i < drawTypeContainers.length; i++) {
+                        var drawTypeContainer = drawTypeContainers[i] =
+                            document.createElement("div");
+                        drawTypeContainer.setAttribute("style",
+                                "text-align: center; margin: 3px; padding: 0 3px;"
+                                + "height: 18px; float: left;");
+                        drawTypeContainer.style.border = "2px solid #000";
+                        drawTypeContainer.appendChild(document.createTextNode(
+                                String(availableDrawTypes[i].name)));
+                        drawTypeContainer.addEventListener("mousedown", (function(ix) {
+                            return function() {
+                                setDrawType(ix);
+                            };
+                        })(i), false);
+
+                        drawTypeContainersBox.appendChild(drawTypeContainer);
+                    }
+
+
+                    var thicknessContainersBox = document.createElement("div");
+                    thicknessContainersBox.setAttribute("style",
+                            "margin: 3px; border: 1px solid #bbb; border-radius: 3px;");
+                    optionContainer.appendChild(thicknessContainersBox);
+
+                    thicknessContainers = new Array(availableThicknesses.length);
+                    for (var i = 0; i < thicknessContainers.length; i++) {
+                        var thicknessContainer = thicknessContainers[i] =
+                            document.createElement("div");
+                        thicknessContainer.setAttribute("style",
+                                "text-align: center; margin: 3px; width: 18px; "
+                                + "height: 18px; float: left;");
+                        thicknessContainer.style.border = "2px solid #000";
+                        thicknessContainer.appendChild(document.createTextNode(
+                                String(availableThicknesses[i])));
+                        thicknessContainer.addEventListener("mousedown", (function(ix) {
+                            return function() {
+                                setThickness(ix);
+                            };
+                        })(i), false);
+
+                        thicknessContainersBox.appendChild(thicknessContainer);
+                    }
+
+
+                    divClearLeft = document.createElement("div");
+                    divClearLeft.setAttribute("style", "clear: left;");
+                    thicknessContainersBox.appendChild(divClearLeft);
+
+
+                    setColor(0);
+                    setThickness(0);
+                    setDrawType(0);
+
+                }
+
+                function disableControls() {
+                    document.removeEventListener("mousedown", canvasMouseDownHandler);
+                    document.removeEventListener("mousemove", canvasMouseMoveHandler);
+                    mouseInWindow = false;
+                    refreshDisplayCanvas();
+
+                    isActive = false;
+                }
+
+                function pushPath(path) {
+
+                    // Push it into the pathsNotHandled array.
+                    var container = new PathIdContainer(path, nextMsgId++);
+                    pathsNotHandled.push(container);
+
+                    // Send the path to the server.
+                    var message = container.id + "|" + path.type + ","
+                            + path.color[0] + "," + path.color[1] + ","
+                            + path.color[2] + ","
+                            + Math.round(path.color[3] * 255.0) + ","
+                            + path.thickness + "," + path.x1 + ","
+                            + path.y1 + "," + path.x2 + "," + path.y2;
+
+                    socket.send("1" + message);
+                }
+
+                function setThickness(thicknessIndex) {
+                    if (typeof currentThicknessIndex !== "undefined")
+                        thicknessContainers[currentThicknessIndex]
+                            .style.borderColor = "#000";
+                    currentThicknessIndex = thicknessIndex;
+                    thicknessContainers[currentThicknessIndex]
+                        .style.borderColor = "#d08";
+                }
+
+                function setColor(colorIndex) {
+                    if (typeof currentColorIndex !== "undefined")
+                        colorContainers[currentColorIndex]
+                            .style.borderColor = "#000";
+                    currentColorIndex = colorIndex;
+                    colorContainers[currentColorIndex]
+                        .style.borderColor = "#d08";
+                }
+
+                function setDrawType(drawTypeIndex) {
+                    if (typeof currentDrawTypeIndex !== "undefined")
+                        drawTypeContainers[currentDrawTypeIndex]
+                            .style.borderColor = "#000";
+                    currentDrawTypeIndex = drawTypeIndex;
+                    drawTypeContainers[currentDrawTypeIndex]
+                        .style.borderColor = "#d08";
+                }
+
+
+                connect();
+
+            }
+
+
+            // Initialize the room
+            var room = new Room(document.getElementById("drawContainer"));
+
+
+        }, false);
+
+    })();
+    ]]></script>
+</head>
+<body>
+    <div class="noscript"><div style="color: #ff0000; font-size: 16pt;">Seems your browser doesn't support Javascript! Websockets rely on Javascript being enabled. Please enable
+    Javascript and reload this page!</div></div>
+    <div id="labelContainer"/>
+    <div id="drawContainer"/>
+    <div id="console-container"/>
+    <div style="clear: left;"/>
+
+    <h1 class="expand" data-content-id="expandContent" style="font-size: 1.3em;"
+        >About Drawboard WebSocket Example</h1>
+    <div id="expandContent">
+        <p>
+            This drawboard is a page where you can draw with your mouse or touch input
+            (using different colors) and everybody else which has the page open will
+            <em>immediately</em> see what you are drawing.<br/>
+            If someone opens the page later, they will get the current room image (so they
+            can see what was already drawn by other people).
+        </p>
+        <p>
+            It uses asynchronous sending of messages so that it doesn't need separate threads
+            for each client to send messages.<br/>
+            Each "Room" (where the drawing happens) uses a ReentrantLock to synchronize access
+            (currently, only a single Room is implemented).
+        </p>
+        <p>
+            When you open the page, first you will receive a binary websocket message containing
+            the current room image as PNG image. After that, you will receive string messages
+            that contain the drawing actions (line from x1,y1 to x2,y2).<br/>
+            <small>Note that it currently only uses simple string messages instead of JSON because
+            I did not want to introduce a dependency on a JSON lib.</small>
+        </p>
+        <p>
+            It uses synchronization mechanisms to ensure that the final image will look the same
+            for every user, regardless of what their network latency/speed is – e.g. if two user
+            draw at the same time on the same place, the server will decide which line was the
+            first one, and that will be reflected on every client.
+        </p>
+    </div>
+</body>
+</html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/websocket/echo.xhtml b/tomcat/webapps/examples/websocket/echo.xhtml
new file mode 100644
index 0000000000000000000000000000000000000000..89347bbd2169ba34461df35ee93aa5474b99755d
--- /dev/null
+++ b/tomcat/webapps/examples/websocket/echo.xhtml
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+    <title>Apache Tomcat WebSocket Examples: Echo</title>
+    <style type="text/css"><![CDATA[
+        #connect-container {
+            float: left;
+            width: 400px
+        }
+
+        #connect-container div {
+            padding: 5px;
+        }
+
+        #console-container {
+            float: left;
+            margin-left: 15px;
+            width: 400px;
+        }
+
+        #console {
+            border: 1px solid #CCCCCC;
+            border-right-color: #999999;
+            border-bottom-color: #999999;
+            height: 170px;
+            overflow-y: scroll;
+            padding: 5px;
+            width: 100%;
+        }
+
+        #console p {
+            padding: 0;
+            margin: 0;
+        }
+    ]]></style>
+    <script type="application/javascript"><![CDATA[
+        "use strict";
+
+        var ws = null;
+
+        function setConnected(connected) {
+            document.getElementById('connect').disabled = connected;
+            document.getElementById('disconnect').disabled = !connected;
+            document.getElementById('echo').disabled = !connected;
+        }
+
+        function connect() {
+            var target = document.getElementById('target').value;
+            if (target == '') {
+                alert('Please select server side connection implementation.');
+                return;
+            }
+            if ('WebSocket' in window) {
+                ws = new WebSocket(target);
+            } else if ('MozWebSocket' in window) {
+                ws = new MozWebSocket(target);
+            } else {
+                alert('WebSocket is not supported by this browser.');
+                return;
+            }
+            ws.onopen = function () {
+                setConnected(true);
+                log('Info: WebSocket connection opened.');
+            };
+            ws.onmessage = function (event) {
+                log('Received: ' + event.data);
+            };
+            ws.onclose = function (event) {
+                setConnected(false);
+                log('Info: WebSocket connection closed, Code: ' + event.code + (event.reason == "" ? "" : ", Reason: " + event.reason));
+            };
+        }
+
+        function disconnect() {
+            if (ws != null) {
+                ws.close();
+                ws = null;
+            }
+            setConnected(false);
+        }
+
+        function echo() {
+            if (ws != null) {
+                var message = document.getElementById('message').value;
+                log('Sent: ' + message);
+                ws.send(message);
+            } else {
+                alert('WebSocket connection not established, please connect.');
+            }
+        }
+
+        function updateTarget(target) {
+            if (window.location.protocol == 'http:') {
+                document.getElementById('target').value = 'ws://' + window.location.host + target;
+            } else {
+                document.getElementById('target').value = 'wss://' + window.location.host + target;
+            }
+        }
+
+        function log(message) {
+            var console = document.getElementById('console');
+            var p = document.createElement('p');
+            p.style.wordWrap = 'break-word';
+            p.appendChild(document.createTextNode(message));
+            console.appendChild(p);
+            while (console.childNodes.length > 25) {
+                console.removeChild(console.firstChild);
+            }
+            console.scrollTop = console.scrollHeight;
+        }
+
+
+        document.addEventListener("DOMContentLoaded", function() {
+            // Remove elements with "noscript" class - <noscript> is not allowed in XHTML
+            var noscripts = document.getElementsByClassName("noscript");
+            for (var i = 0; i < noscripts.length; i++) {
+                noscripts[i].parentNode.removeChild(noscripts[i]);
+            }
+        }, false);
+    ]]></script>
+</head>
+<body>
+<div class="noscript"><h2 style="color: #ff0000">Seems your browser doesn't support Javascript! Websockets rely on Javascript being enabled. Please enable
+    Javascript and reload this page!</h2></div>
+<div>
+    <div id="connect-container">
+        <div>
+            <span>Connect to service implemented using:</span>
+            <br/>
+            <!-- echo example using new programmatic API on the server side -->
+            <input id="radio1" type="radio" name="group1" value="/examples/websocket/echoProgrammatic"
+                   onclick="updateTarget(this.value);"/> <label for="radio1">programmatic API</label>
+            <br/>
+            <!-- echo example using new annotation API on the server side -->
+            <input id="radio2" type="radio" name="group1" value="/examples/websocket/echoAnnotation"
+                   onclick="updateTarget(this.value);"/> <label for="radio2">annotation API (basic)</label>
+            <br/>
+            <!-- echo example using new annotation API on the server side -->
+            <input id="radio3" type="radio" name="group1" value="/examples/websocket/echoStreamAnnotation"
+                   onclick="updateTarget(this.value);"/> <label for="radio3">annotation API (stream)</label>
+            <br/>
+            <!-- echo example using new annotation API on the server side -->
+            <!-- Disabled by default -->
+            <!--
+            <input id="radio4" type="radio" name="group1" value="/examples/websocket/echoAsyncAnnotation"
+                   onclick="updateTarget(this.value);"/> <label for="radio4">annotation API (async)</label>
+            -->
+        </div>
+        <div>
+            <input id="target" type="text" size="40" style="width: 350px"/>
+        </div>
+        <div>
+            <button id="connect" onclick="connect();">Connect</button>
+            <button id="disconnect" disabled="disabled" onclick="disconnect();">Disconnect</button>
+        </div>
+        <div>
+            <textarea id="message" style="width: 350px">Here is a message!</textarea>
+        </div>
+        <div>
+            <button id="echo" onclick="echo();" disabled="disabled">Echo message</button>
+        </div>
+    </div>
+    <div id="console-container">
+        <div id="console"/>
+    </div>
+</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/websocket/index.xhtml b/tomcat/webapps/examples/websocket/index.xhtml
new file mode 100644
index 0000000000000000000000000000000000000000..97ee9451b6ca525961d8c71170fd776c16b08265
--- /dev/null
+++ b/tomcat/webapps/examples/websocket/index.xhtml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+    <title>Apache Tomcat WebSocket Examples</title>
+</head>
+<body>
+<h1>Apache Tomcat WebSocket Examples</h1>
+<ul>
+    <li><a href="echo.xhtml">Echo example</a></li>
+    <li><a href="chat.xhtml">Chat example</a></li>
+    <li><a href="snake.xhtml">Multiplayer snake example</a></li>
+    <li><a href="drawboard.xhtml">Multiplayer drawboard example</a></li>
+
+</ul>
+</body>
+</html>
\ No newline at end of file
diff --git a/tomcat/webapps/examples/websocket/snake.xhtml b/tomcat/webapps/examples/websocket/snake.xhtml
new file mode 100644
index 0000000000000000000000000000000000000000..b71077c63a46771def4b35763d749b121f3cbf8c
--- /dev/null
+++ b/tomcat/webapps/examples/websocket/snake.xhtml
@@ -0,0 +1,266 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+    <title>Apache Tomcat WebSocket Examples: Multiplayer Snake</title>
+    <style type="text/css"><![CDATA[
+        #playground {
+            width: 640px;
+            height: 480px;
+            background-color: #000;
+        }
+
+        #console-container {
+            float: left;
+            margin-left: 15px;
+            width: 300px;
+        }
+
+        #console {
+            border: 1px solid #CCCCCC;
+            border-right-color: #999999;
+            border-bottom-color: #999999;
+            height: 480px;
+            overflow-y: scroll;
+            padding-left: 5px;
+            padding-right: 5px;
+            width: 100%;
+        }
+
+        #console p {
+            padding: 0;
+            margin: 0;
+        }
+    ]]></style>
+</head>
+<body>
+    <div class="noscript"><h2 style="color: #ff0000">Seems your browser doesn't support Javascript! Websockets rely on Javascript being enabled. Please enable
+    Javascript and reload this page!</h2></div>
+    <div style="float: left">
+        <canvas id="playground" width="640" height="480"/>
+    </div>
+    <div id="console-container">
+        <div id="console"/>
+    </div>
+    <script type="application/javascript"><![CDATA[
+        "use strict";
+
+        var Game = {};
+
+        Game.fps = 30;
+        Game.socket = null;
+        Game.nextFrame = null;
+        Game.interval = null;
+        Game.direction = 'none';
+        Game.gridSize = 10;
+
+        function Snake() {
+            this.snakeBody = [];
+            this.color = null;
+        }
+
+        Snake.prototype.draw = function(context) {
+            for (var id in this.snakeBody) {
+                context.fillStyle = this.color;
+                context.fillRect(this.snakeBody[id].x, this.snakeBody[id].y, Game.gridSize, Game.gridSize);
+            }
+        };
+
+        Game.initialize = function() {
+            this.entities = [];
+            var canvas = document.getElementById('playground');
+            if (!canvas.getContext) {
+                Console.log('Error: 2d canvas not supported by this browser.');
+                return;
+            }
+            this.context = canvas.getContext('2d');
+            window.addEventListener('keydown', function (e) {
+                var code = e.keyCode;
+                if (code > 36 && code < 41) {
+                    switch (code) {
+                        case 37:
+                            if (Game.direction != 'east') Game.setDirection('west');
+                            break;
+                        case 38:
+                            if (Game.direction != 'south') Game.setDirection('north');
+                            break;
+                        case 39:
+                            if (Game.direction != 'west') Game.setDirection('east');
+                            break;
+                        case 40:
+                            if (Game.direction != 'north') Game.setDirection('south');
+                            break;
+                    }
+                }
+            }, false);
+            if (window.location.protocol == 'http:') {
+                Game.connect('ws://' + window.location.host + '/examples/websocket/snake');
+            } else {
+                Game.connect('wss://' + window.location.host + '/examples/websocket/snake');
+            }
+        };
+
+        Game.setDirection  = function(direction) {
+            Game.direction = direction;
+            Game.socket.send(direction);
+            Console.log('Sent: Direction ' + direction);
+        };
+
+        Game.startGameLoop = function() {
+            if (window.webkitRequestAnimationFrame) {
+                Game.nextFrame = function () {
+                    webkitRequestAnimationFrame(Game.run);
+                };
+            } else if (window.mozRequestAnimationFrame) {
+                Game.nextFrame = function () {
+                    mozRequestAnimationFrame(Game.run);
+                };
+            } else {
+                Game.interval = setInterval(Game.run, 1000 / Game.fps);
+            }
+            if (Game.nextFrame != null) {
+                Game.nextFrame();
+            }
+        };
+
+        Game.stopGameLoop = function () {
+            Game.nextFrame = null;
+            if (Game.interval != null) {
+                clearInterval(Game.interval);
+            }
+        };
+
+        Game.draw = function() {
+            this.context.clearRect(0, 0, 640, 480);
+            for (var id in this.entities) {
+                this.entities[id].draw(this.context);
+            }
+        };
+
+        Game.addSnake = function(id, color) {
+            Game.entities[id] = new Snake();
+            Game.entities[id].color = color;
+        };
+
+        Game.updateSnake = function(id, snakeBody) {
+            if (typeof Game.entities[id] != "undefined") {
+                Game.entities[id].snakeBody = snakeBody;
+            }
+        };
+
+        Game.removeSnake = function(id) {
+            Game.entities[id] = null;
+            // Force GC.
+            delete Game.entities[id];
+        };
+
+        Game.run = (function() {
+            var skipTicks = 1000 / Game.fps, nextGameTick = (new Date).getTime();
+
+            return function() {
+                while ((new Date).getTime() > nextGameTick) {
+                    nextGameTick += skipTicks;
+                }
+                Game.draw();
+                if (Game.nextFrame != null) {
+                    Game.nextFrame();
+                }
+            };
+        })();
+
+        Game.connect = (function(host) {
+            if ('WebSocket' in window) {
+                Game.socket = new WebSocket(host);
+            } else if ('MozWebSocket' in window) {
+                Game.socket = new MozWebSocket(host);
+            } else {
+                Console.log('Error: WebSocket is not supported by this browser.');
+                return;
+            }
+
+            Game.socket.onopen = function () {
+                // Socket open.. start the game loop.
+                Console.log('Info: WebSocket connection opened.');
+                Console.log('Info: Press an arrow key to begin.');
+                Game.startGameLoop();
+                setInterval(function() {
+                    // Prevent server read timeout.
+                    Game.socket.send('ping');
+                }, 5000);
+            };
+
+            Game.socket.onclose = function () {
+                Console.log('Info: WebSocket closed.');
+                Game.stopGameLoop();
+            };
+
+            Game.socket.onmessage = function (message) {
+                var packet = JSON.parse(message.data);
+                switch (packet.type) {
+                    case 'update':
+                        for (var i = 0; i < packet.data.length; i++) {
+                            Game.updateSnake(packet.data[i].id, packet.data[i].body);
+                        }
+                        break;
+                    case 'join':
+                        for (var j = 0; j < packet.data.length; j++) {
+                            Game.addSnake(packet.data[j].id, packet.data[j].color);
+                        }
+                        break;
+                    case 'leave':
+                        Game.removeSnake(packet.id);
+                        break;
+                    case 'dead':
+                        Console.log('Info: Your snake is dead, bad luck!');
+                        Game.direction = 'none';
+                        break;
+                    case 'kill':
+                        Console.log('Info: Head shot!');
+                        break;
+                }
+            };
+        });
+
+        var Console = {};
+
+        Console.log = (function(message) {
+            var console = document.getElementById('console');
+            var p = document.createElement('p');
+            p.style.wordWrap = 'break-word';
+            p.innerHTML = message;
+            console.appendChild(p);
+            while (console.childNodes.length > 25) {
+                console.removeChild(console.firstChild);
+            }
+            console.scrollTop = console.scrollHeight;
+        });
+
+        Game.initialize();
+
+
+        document.addEventListener("DOMContentLoaded", function() {
+            // Remove elements with "noscript" class - <noscript> is not allowed in XHTML
+            var noscripts = document.getElementsByClassName("noscript");
+            for (var i = 0; i < noscripts.length; i++) {
+                noscripts[i].parentNode.removeChild(noscripts[i]);
+            }
+        }, false);
+
+        ]]></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/tomcat/webapps/res/background.jpg b/tomcat/webapps/res/background.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..7285572811a3d407dc73918e0d1faf6d78468f68
Binary files /dev/null and b/tomcat/webapps/res/background.jpg differ
diff --git a/tomcat/webapps/res/background1.jpg b/tomcat/webapps/res/background1.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..b47fb645812870be051efd5258f57e6d4a44819f
Binary files /dev/null and b/tomcat/webapps/res/background1.jpg differ
diff --git a/tomcat/webapps/res/background2-1.jpg b/tomcat/webapps/res/background2-1.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..ffa797b21e7fcbd1f1bb3699ed58c9ee073f6df5
Binary files /dev/null and b/tomcat/webapps/res/background2-1.jpg differ
diff --git a/tomcat/webapps/res/background2-2.jpg b/tomcat/webapps/res/background2-2.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..b4776d9791f15708f77bc7eba8dc2af59da5a5bd
Binary files /dev/null and b/tomcat/webapps/res/background2-2.jpg differ
diff --git a/tomcat/webapps/res/background2.jpg b/tomcat/webapps/res/background2.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..ffa797b21e7fcbd1f1bb3699ed58c9ee073f6df5
Binary files /dev/null and b/tomcat/webapps/res/background2.jpg differ
diff --git a/tomcat/webapps/res/favicon-alpha.ico b/tomcat/webapps/res/favicon-alpha.ico
new file mode 100644
index 0000000000000000000000000000000000000000..a9a663179492f064175d750f89dbf8e127fa796a
Binary files /dev/null and b/tomcat/webapps/res/favicon-alpha.ico differ
diff --git a/tomcat/webapps/res/favicon-alpha.png b/tomcat/webapps/res/favicon-alpha.png
new file mode 100644
index 0000000000000000000000000000000000000000..a9a663179492f064175d750f89dbf8e127fa796a
Binary files /dev/null and b/tomcat/webapps/res/favicon-alpha.png differ
diff --git a/tomcat/webapps/res/favicon-orig.png b/tomcat/webapps/res/favicon-orig.png
new file mode 100644
index 0000000000000000000000000000000000000000..e95cd08bf8fc1e3c0f894b6d35a9e13dd00e5ea0
Binary files /dev/null and b/tomcat/webapps/res/favicon-orig.png differ