From jbossnative-commits at lists.jboss.org Mon Sep 15 02:41:59 2008 Content-Type: multipart/mixed; boundary="===============9001370107972072791==" MIME-Version: 1.0 From: jbossnative-commits at lists.jboss.org To: jbossnative-commits at lists.jboss.org Subject: [jbossnative-commits] JBoss Native SVN: r1824 - trunk/mod_cluster/test/java/org/jboss/mod_cluster. Date: Mon, 15 Sep 2008 02:41:59 -0400 Message-ID: --===============9001370107972072791== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: jfrederic.clere(a)jboss.com Date: 2008-09-15 02:41:59 -0400 (Mon, 15 Sep 2008) New Revision: 1824 Added: trunk/mod_cluster/test/java/org/jboss/mod_cluster/MyCount.java Log: Missing file. (Small servlet). Added: trunk/mod_cluster/test/java/org/jboss/mod_cluster/MyCount.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/mod_cluster/test/java/org/jboss/mod_cluster/MyCount.java = (rev 0) +++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/MyCount.java 2008-09-= 15 06:41:59 UTC (rev 1824) @@ -0,0 +1,140 @@ +/* + * Copyright(c) 2006 Red Hat Middleware, LLC, + * and individual contributors as indicated by the @authors tag. + * See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library in the file COPYING.LIB; + * if not, write to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * @author Jean-Frederic Clere + * @version $Revision: 420067 $, $Date: 2006-07-08 09:16:58 +0200 (sub, 08= srp 2006) $ + */ + +import java.io.*; +import java.text.*; +import java.util.*; +import javax.servlet.*; +import javax.servlet.http.*; + + + +/** + * Example servlet showing cookies handling (counter). + * + */ + +public class MyCount extends HttpServlet { + + public void doGet(HttpServletRequest request, + HttpServletResponse response) + throws IOException, ServletException + { + response.setContentType("text/html"); + + PrintWriter out =3D response.getWriter(); + out.println(""); + out.println(""); + out.println(""); + + String title =3D "sessions.title"; + out.println("" + title + ""); + out.println(""); + out.println(""); + + out.println("

" + title + "

"); + + HttpSession session =3D request.getSession(false); + Integer ii =3D new Integer(0); + if (session =3D=3D null) { + // Create it. + out.println("create"); + session =3D request.getSession(true); + session.setAttribute("count", ii); + } + out.println("sessions.id " + session.getId()); + out.println("
"); + out.println("sessions.created "); + out.println(new Date(session.getCreationTime()) + "
"); + out.println("sessions.lastaccessed "); + out.println(new Date(session.getLastAccessedTime())); + out.println("sessions.count "); + out.println(session.getAttribute("count")); + + ii =3D (Integer) session.getAttribute("count"); + int i =3D 0; + if (ii !=3D null) + i =3D ii.intValue(); + i++; + ii =3D new Integer(i); // JAVA5 : ii.valueOf(i); + session.setAttribute("count", ii); + + out.println("

"); + out.println("sessions.data
"); + Enumeration names =3D session.getAttributeNames(); + while (names.hasMoreElements()) { + String name =3D (String) names.nextElement(); = + String value =3D session.getAttribute(name).toString(); + out.println(name + " =3D " + value + "
"); + // response.addHeader(name, value); + } + + out.println("

"); + out.print("

"); + out.println("sessions.dataname"); + out.println(""); + out.println("
"); + out.println("sessions.datavalue"); + out.println(""); + out.println("
"); + out.println(""); + out.println("
"); + + out.println("

GET based form:
"); + out.print("

"); + out.println("sessions.dataname"); + out.println(""); + out.println("
"); + out.println("sessions.datavalue"); + out.println(""); + out.println("
"); + out.println(""); + out.println("
"); + + out.print("

URL encoded "); + = + out.println(""); + out.println(""); + = + out.println(""); + out.println(""); + } + + public void doPost(HttpServletRequest request, + HttpServletResponse response) + throws IOException, ServletException + { + doGet(request, response); + } + +} Property changes on: trunk/mod_cluster/test/java/org/jboss/mod_cluster/MyCo= unt.java ___________________________________________________________________ Name: svn:executable + * --===============9001370107972072791==--