01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tctest.webapp.servlets;
05:
06: import java.io.IOException;
07: import java.io.PrintWriter;
08:
09: import javax.servlet.http.HttpServlet;
10: import javax.servlet.http.HttpServletRequest;
11: import javax.servlet.http.HttpServletResponse;
12: import javax.servlet.http.HttpSession;
13:
14: public final class ShutdownNormallyServlet extends HttpServlet {
15: public void doGet(HttpServletRequest request,
16: HttpServletResponse response) throws IOException {
17: HttpSession session = request.getSession(true);
18: response.setContentType("text/html");
19: PrintWriter out = response.getWriter();
20:
21: String cmdParam = request.getParameter("cmd");
22: if ("insert".equals(cmdParam)) {
23: session.setAttribute("hung", "daman");
24: out.println("OK");
25: } else if ("query".equals(cmdParam)) {
26: String data = (String) session.getAttribute("hung");
27: if (data != null && data.equals("daman")) {
28: out.println("OK");
29: } else {
30: out.println("ERROR: " + data);
31: }
32: } else {
33: out.println("unknown cmd");
34: }
35:
36: }
37: }
|