This example demonstrates how to deploy a web application with an HTTP session.
The UpdateSessionServlet
is responsible for retrieving request parameters and adding their values to the HttpSession
as session attributes, and the SessionContents.jsp
displays the session attributes and renders two input fields, Name
and Value
for the user to input new session attributes.
The example uses maven as its build tool. It comes with a build script that runs maven automatically. Running the build script with no parameters within the current directory will list all the relevant tasks that can be run with this example.
The available commands are:
Running build.(sh/bat) package
will finalize the processing unit structure under /examples/web-app/web-session/target/HttpSession/
and create a deployment WAR /examples/web-app/web-session/target/HttpSession.war
.
/examples/web-app/web-session/target/HttpSession/
contains the SessionContents.jsp
/examples/web-app/web-session/target/HttpSession/META-INF/spring/
contains pu.properties
and pu.xml
for the session configuration and sla.xml
contains the deployment properties (number of instances and constraints)
/examples/web-app/web-session/target/HttpSession/WEB-INF/
contains the web.xml
referencing the servlet class
In order to deploy the web example onto the Service Grid:
run XAP agent from $XAP_HOME/bin/gs-agent(.sh/bat)
which will start a GSM and 2 GSCs.
run build.(sh/bat) deploy
. The will deploy the /examples/web-app/web-session/target/HttpSession.war
into the running GSM.
The web page of this application is available at http://<host IP>:<web port>/HttpSession/
for example (http://localhost:8080/HttpSession/ and http://localhost:8081/HttpSession/)
For more information, lookup 'First Web Application' under http://docs.gigaspaces.com