Added session state example

Co-authored-by: Benjamin Ross <bross@pivotal.io>
Co-authored-by: Ryan McMahon <rmcmahon@pivotal.io>
diff --git a/gradle/rat.gradle b/gradle/rat.gradle
index 142d750..a37298a 100644
--- a/gradle/rat.gradle
+++ b/gradle/rat.gradle
@@ -29,9 +29,9 @@
 
     // gradle
     '**/.gradle/**',
-    'gradlew',
-    'gradlew.bat',
-    'gradle/wrapper/gradle-wrapper.properties',
+    '**/gradlew',
+    '**/gradlew.bat',
+    '**/gradle/wrapper/gradle-wrapper.properties',
     'caches/**',
     'daemon/**',
     'native/**',
@@ -50,7 +50,7 @@
     '**/*.iml',
     '**/*.ipr',
     '**/*.iws',
-    '.idea/**',
+    '**/.idea/**',
     '**/tags',
 
     // text files
diff --git a/sessionState/README.md b/sessionState/README.md
new file mode 100644
index 0000000..0e6488e
--- /dev/null
+++ b/sessionState/README.md
@@ -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.
+-->
+
+# Geode Session State Example using Tomcat
+
+This is a simple example which demonstrates how to setup and use the Session Management Module for Tomcat.
+
+This example assumes you have Geode and Java installed. It also assumes you have local copy of Tomcat Downloaded. 
+It was designed and tested with Geode 1.9.0 and Tomcat 9, and while the session features will work with other combinations
+you may need to make some changes to the setup if you're using other versions.
+
+##Steps
+
+1. Set the environment Variable $CATALINA_HOME to point at the root directory of your local Tomcat installation. This is required by 
+Tomcat, so in some cases this may have already been set.
+
+2. Find the configuration files located at $CATALINA_HOME/conf/. To the server.xml file add the line:
+```
+<Listener className="org.apache.geode.modules.session.catalina.ClientServerCacheLifecycleListener"/>
+```
+
+and to the file context.xml add the line:
+```
+<Manager className="org.apache.geode.modules.session.catalina.Tomcat9DeltaSessionManager"/> 
+```
+3. Run the setup script:
+```
+./scripts/example.sh <root directory of Geode install>
+```
+
+Specify the root directory of your local Geode installation. Make sure you have no local Geode cluster running, as this step will start
+a new local cluster to manage our Session States.
+
+4. Run the tomcat startup script located at $CATALINA_HOME/bin/startup.sh. You should now be able to reach the example webapp by entering
+the following URL into your browser:
+```
+localhost:8080/SessionStateDemo/index
+```
+
+5. You should now be able to see details about your current session on the page. You can add key/value pairs to your session and get them
+back with the available input prompts. 
diff --git a/sessionState/scripts/example-setup.sh b/sessionState/scripts/example-setup.sh
new file mode 100755
index 0000000..5a85f46
--- /dev/null
+++ b/sessionState/scripts/example-setup.sh
@@ -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.
+ #
+
+#!/bin/bash
+
+GEODE_LOCATION=${1%/}
+CATALINA_LOCATION=${CATALINA_HOME%/}
+
+#Copy all nessessary lib files into tomcats lib directory
+cp $GEODE_LOCATION/lib/antlr-2.7.7.jar $CATALINA_LOCATION/lib/
+cp $GEODE_LOCATION/lib/commons-io-2.6.jar $CATALINA_LOCATION/lib/
+cp $GEODE_LOCATION/lib/commons-lang3-3.8.1.jar $CATALINA_LOCATION/lib/
+cp $GEODE_LOCATION/lib/commons-validator-1.6.jar $CATALINA_LOCATION/lib/
+cp $GEODE_LOCATION/lib/fastutil-8.2.2.jar $CATALINA_LOCATION/lib/
+cp $GEODE_LOCATION/lib/geode-core-1.9.0.jar $CATALINA_LOCATION/lib/
+cp $GEODE_LOCATION/lib/javax.transaction-api-1.3.jar $CATALINA_LOCATION/lib/
+cp $GEODE_LOCATION/lib/jgroups-3.6.14.Final.jar $CATALINA_LOCATION/lib/
+cp $GEODE_LOCATION/lib/log4j-api-2.11.1.jar $CATALINA_LOCATION/lib/
+cp $GEODE_LOCATION/lib/log4j-core-2.11.1.jar $CATALINA_LOCATION/lib/
+cp $GEODE_LOCATION/lib/log4j-jul-2.11.1.jar $CATALINA_LOCATION/lib/
+cp $GEODE_LOCATION/lib/shiro-core-1.4.0.jar $CATALINA_LOCATION/lib/
+cp $GEODE_LOCATION/lib/geode-common-1.9.0.jar $CATALINA_LOCATION/lib/
+cp $GEODE_LOCATION/lib/geode-management-1.9.0.jar $CATALINA_LOCATION/lib/
+cp $GEODE_LOCATION/lib/micrometer-core-1.1.3.jar $CATALINA_LOCATION/lib/
+cp $CATALINA_HOME/bin/tomcat-juli.jar $CATALINA_HOME/lib/
+
+#Unzip Tomcat Module conf/lib files into tomcats conf/lib directories
+unzip -o $1/tools/Modules/Apache_Geode_Modules-1.9.0-Tomcat.zip -d $CATALINA_HOME/
+
+GEODE_LOCATION=${1%/}
+CATALINA_LOCATION=${CATALINA_HOME%/}
+
+export CLASSPATH=$CATALINA_HOME/lib/*
+
+sh $GEODE_LOCATION/bin/gfsh "start locator --name=l1"
+
+sh $GEODE_LOCATION/bin/gfsh "start server --name=server1 --locators=localhost[10334] --server-port=0 \
+    --classpath=$CLASSPATH"
+
+#Build sample webapp
+cd ../webapp/
+./gradlew build
+cd ../scripts/
+
+#Place freshly built version of webapp into Tomcats webapps directory
+rm -rf $CATALINA_HOME/webapps/SessionStateDemo*
+cp ../webapp/build/libs/SessionStateDemo-1.0-SNAPSHOT.war $CATALINA_LOCATION/webapps/SessionStateDemo.war
+
diff --git a/sessionState/scripts/example-shutdown.sh b/sessionState/scripts/example-shutdown.sh
new file mode 100755
index 0000000..eccf461
--- /dev/null
+++ b/sessionState/scripts/example-shutdown.sh
@@ -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.
+ #
+
+ #!bin/bash
+
+ #Shutdown server and locator
+$1/bin/gfsh run --file=shutdown-example.gfsh
+
diff --git a/sessionState/scripts/shutdown-example.gfsh b/sessionState/scripts/shutdown-example.gfsh
new file mode 100644
index 0000000..15cd93c
--- /dev/null
+++ b/sessionState/scripts/shutdown-example.gfsh
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+connect --locator=127.0.0.1[10334]
+shutdown --include-locators=true
diff --git a/sessionState/scripts/start.gfsh b/sessionState/scripts/start.gfsh
new file mode 100644
index 0000000..e6cd305
--- /dev/null
+++ b/sessionState/scripts/start.gfsh
@@ -0,0 +1,14 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
diff --git a/sessionState/scripts/stop.gfsh b/sessionState/scripts/stop.gfsh
new file mode 100644
index 0000000..e6cd305
--- /dev/null
+++ b/sessionState/scripts/stop.gfsh
@@ -0,0 +1,14 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
diff --git a/sessionState/src/main/java/org/apache/geode_examples/sessionState/Example.java b/sessionState/src/main/java/org/apache/geode_examples/sessionState/Example.java
new file mode 100644
index 0000000..4e322fc
--- /dev/null
+++ b/sessionState/src/main/java/org/apache/geode_examples/sessionState/Example.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT 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 org.apache.geode_examples.sessionState;
+
+public class Example {
+  public static void main(String[] args) {
+    System.out.println(
+        "Refer to the README.md located in geode_examples/sessionState for info on how to run the session state demo.");
+  }
+}
diff --git a/sessionState/src/main/webapp/index.jsp b/sessionState/src/main/webapp/index.jsp
new file mode 100644
index 0000000..2676f89
--- /dev/null
+++ b/sessionState/src/main/webapp/index.jsp
@@ -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.
+-->
+<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*"
+%>
+<% session=request.getSession();%>
+<html>
+
+<head>
+  <title>
+  </title>
+</head>
+
+<body>
+<div align="center">
+  <table border="1">
+    <tr>
+      <td>
+        Is New Session
+      </td>
+      <td>
+        <% out.print(request.getAttribute("isNew")); %>
+      </td>
+    </tr>
+    <tr>
+      <td>
+        Session Time Out
+      </td>
+      <td>
+        <% out.println(session.getMaxInactiveInterval());%>
+      </td>
+    </tr>
+    <tr>
+      <td>
+        Session Creation Time
+      </td>
+      <td>
+        <% out.print(new Date(session.getCreationTime())); %>
+      </td>
+    </tr>
+    <tr>
+      <td>
+        Session Last Accessed Time
+      </td>
+      <td>
+        <% out.println(new Date(session.getLastAccessedTime())); %>
+      </td>
+    </tr>
+  </table>
+  <form action="" method="get">
+    <table>
+      <tr>
+        <td>
+          key:
+        </td>
+        <td>
+          <input type="text" name="key">
+        </td>
+      </tr>
+      <tr>
+        <td>
+          value:
+        </td>
+        <td>
+          <input type="text" name="value">
+        </td>
+      </tr>
+      <tr>
+        <td>
+          <input type="submit" name="action" value="Set Attribute">
+        </td>
+      </tr>
+    </table>
+  </form>
+  <form action="" method="get">
+    <table>
+      <tr>
+        <td>
+          key:
+        </td>
+        <td>
+          <input type="text" name="key">
+        </td>
+      </tr>
+      <tr>
+        <td>
+          <input type="submit" name="action" value="Get Attribute" />
+        </td>
+        <td>
+          <input type="submit" name="action" value="Delete Attribute" />
+        </td>
+      </tr>
+    </table>
+  </form>
+  <p>
+    result:
+    <%out.println(request.getAttribute("getKey"));%>
+  </p>
+</div>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/sessionState/webapp/build.gradle b/sessionState/webapp/build.gradle
new file mode 100644
index 0000000..c36bd07
--- /dev/null
+++ b/sessionState/webapp/build.gradle
@@ -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.
+ */
+ plugins {
+    id 'java'
+    id 'war'
+}
+
+version '1.0-SNAPSHOT'
+
+sourceCompatibility = 1.8
+
+repositories {
+    mavenCentral()
+}
+
+dependencies {
+    // https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api
+    providedCompile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0'
+
+    testCompile group: 'junit', name: 'junit', version: '4.11'
+    testCompile group: 'junit', name: 'junit', version: '4.12'
+}
diff --git a/sessionState/webapp/gradle/wrapper/gradle-wrapper.jar b/sessionState/webapp/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..28861d2
--- /dev/null
+++ b/sessionState/webapp/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/sessionState/webapp/gradle/wrapper/gradle-wrapper.properties b/sessionState/webapp/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..115e6ac
--- /dev/null
+++ b/sessionState/webapp/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/sessionState/webapp/gradlew b/sessionState/webapp/gradlew
new file mode 100755
index 0000000..cccdd3d
--- /dev/null
+++ b/sessionState/webapp/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+    echo "$*"
+}
+
+die () {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+    JAVACMD=`cygpath --unix "$JAVACMD"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=$((i+1))
+    done
+    case $i in
+        (0) set -- ;;
+        (1) set -- "$args0" ;;
+        (2) set -- "$args0" "$args1" ;;
+        (3) set -- "$args0" "$args1" "$args2" ;;
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Escape application args
+save () {
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+    echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+  cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/sessionState/webapp/gradlew.bat b/sessionState/webapp/gradlew.bat
new file mode 100644
index 0000000..e95643d
--- /dev/null
+++ b/sessionState/webapp/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off

+@rem ##########################################################################

+@rem

+@rem  Gradle startup script for Windows

+@rem

+@rem ##########################################################################

+

+@rem Set local scope for the variables with windows NT shell

+if "%OS%"=="Windows_NT" setlocal

+

+set DIRNAME=%~dp0

+if "%DIRNAME%" == "" set DIRNAME=.

+set APP_BASE_NAME=%~n0

+set APP_HOME=%DIRNAME%

+

+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.

+set DEFAULT_JVM_OPTS=

+

+@rem Find java.exe

+if defined JAVA_HOME goto findJavaFromJavaHome

+

+set JAVA_EXE=java.exe

+%JAVA_EXE% -version >NUL 2>&1

+if "%ERRORLEVEL%" == "0" goto init

+

+echo.

+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

+echo.

+echo Please set the JAVA_HOME variable in your environment to match the

+echo location of your Java installation.

+

+goto fail

+

+:findJavaFromJavaHome

+set JAVA_HOME=%JAVA_HOME:"=%

+set JAVA_EXE=%JAVA_HOME%/bin/java.exe

+

+if exist "%JAVA_EXE%" goto init

+

+echo.

+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%

+echo.

+echo Please set the JAVA_HOME variable in your environment to match the

+echo location of your Java installation.

+

+goto fail

+

+:init

+@rem Get command-line arguments, handling Windows variants

+

+if not "%OS%" == "Windows_NT" goto win9xME_args

+

+:win9xME_args

+@rem Slurp the command line arguments.

+set CMD_LINE_ARGS=

+set _SKIP=2

+

+:win9xME_args_slurp

+if "x%~1" == "x" goto execute

+

+set CMD_LINE_ARGS=%*

+

+:execute

+@rem Setup the command line

+

+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

+

+@rem Execute Gradle

+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

+

+:end

+@rem End local scope for the variables with windows NT shell

+if "%ERRORLEVEL%"=="0" goto mainEnd

+

+:fail

+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of

+rem the _cmd.exe /c_ return code!

+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1

+exit /b 1

+

+:mainEnd

+if "%OS%"=="Windows_NT" endlocal

+

+:omega

diff --git a/sessionState/webapp/settings.gradle b/sessionState/webapp/settings.gradle
new file mode 100644
index 0000000..718258d
--- /dev/null
+++ b/sessionState/webapp/settings.gradle
@@ -0,0 +1,16 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+ rootProject.name = 'SessionStateDemo'
+
diff --git a/sessionState/webapp/src/main/java/GeodeSessionStateServlet.java b/sessionState/webapp/src/main/java/GeodeSessionStateServlet.java
new file mode 100644
index 0000000..b582ff4
--- /dev/null
+++ b/sessionState/webapp/src/main/java/GeodeSessionStateServlet.java
@@ -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.
+ */
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+@WebServlet(name = "GeodeSessionStateServlet", urlPatterns = {"/index"})
+public class GeodeSessionStateServlet extends HttpServlet {
+  protected void doGet(HttpServletRequest request, HttpServletResponse response)
+      throws ServletException, IOException {
+    HttpSession session = request.getSession();
+    if (session.isNew()) {
+      request.setAttribute("isNew", "Session is new.");
+    } else {
+      request.setAttribute("isNew", "Session already existing");
+      session.setMaxInactiveInterval(90);
+    }
+
+    if (request.getParameter("action") != null) {
+      if (request.getParameter("action").equals("Set Attribute")
+          && request.getParameter("key") != null && !request.getParameter("value").equals("null")) {
+        session.setAttribute(request.getParameter("key"), request.getParameter("value"));
+      }
+
+      if (request.getParameter("action").equals("Get Attribute")
+          && request.getParameter("key") != null) {
+        request.setAttribute("getKey", session.getAttribute(request.getParameter("key")));
+      }
+
+      if (request.getParameter("action").equals("Delete Attribute")
+          && request.getParameter("key") != null) {
+        session.removeAttribute(request.getParameter("key"));
+      }
+    }
+
+    request.getRequestDispatcher("/index.jsp").forward(request, response);
+  }
+}
diff --git a/sessionState/webapp/src/main/webapp/index.jsp b/sessionState/webapp/src/main/webapp/index.jsp
new file mode 100644
index 0000000..2676f89
--- /dev/null
+++ b/sessionState/webapp/src/main/webapp/index.jsp
@@ -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.
+-->
+<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*"
+%>
+<% session=request.getSession();%>
+<html>
+
+<head>
+  <title>
+  </title>
+</head>
+
+<body>
+<div align="center">
+  <table border="1">
+    <tr>
+      <td>
+        Is New Session
+      </td>
+      <td>
+        <% out.print(request.getAttribute("isNew")); %>
+      </td>
+    </tr>
+    <tr>
+      <td>
+        Session Time Out
+      </td>
+      <td>
+        <% out.println(session.getMaxInactiveInterval());%>
+      </td>
+    </tr>
+    <tr>
+      <td>
+        Session Creation Time
+      </td>
+      <td>
+        <% out.print(new Date(session.getCreationTime())); %>
+      </td>
+    </tr>
+    <tr>
+      <td>
+        Session Last Accessed Time
+      </td>
+      <td>
+        <% out.println(new Date(session.getLastAccessedTime())); %>
+      </td>
+    </tr>
+  </table>
+  <form action="" method="get">
+    <table>
+      <tr>
+        <td>
+          key:
+        </td>
+        <td>
+          <input type="text" name="key">
+        </td>
+      </tr>
+      <tr>
+        <td>
+          value:
+        </td>
+        <td>
+          <input type="text" name="value">
+        </td>
+      </tr>
+      <tr>
+        <td>
+          <input type="submit" name="action" value="Set Attribute">
+        </td>
+      </tr>
+    </table>
+  </form>
+  <form action="" method="get">
+    <table>
+      <tr>
+        <td>
+          key:
+        </td>
+        <td>
+          <input type="text" name="key">
+        </td>
+      </tr>
+      <tr>
+        <td>
+          <input type="submit" name="action" value="Get Attribute" />
+        </td>
+        <td>
+          <input type="submit" name="action" value="Delete Attribute" />
+        </td>
+      </tr>
+    </table>
+  </form>
+  <p>
+    result:
+    <%out.println(request.getAttribute("getKey"));%>
+  </p>
+</div>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index 09d16a9..d3f35d0 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -38,3 +38,4 @@
 include 'transaction'
 include 'wan'
 include 'jdbc'
+include 'sessionState'