You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(16) |
Sep
(10) |
Oct
(1) |
Nov
(2) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(148) |
Feb
(80) |
Mar
(41) |
Apr
(85) |
May
(247) |
Jun
(345) |
Jul
(237) |
Aug
(241) |
Sep
(439) |
Oct
(321) |
Nov
(413) |
Dec
(302) |
2004 |
Jan
(143) |
Feb
(147) |
Mar
(200) |
Apr
(107) |
May
(15) |
Jun
(36) |
Jul
(11) |
Aug
(1) |
Sep
(36) |
Oct
|
Nov
(6) |
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
(115) |
May
(74) |
Jun
(215) |
Jul
(82) |
Aug
(47) |
Sep
(32) |
Oct
(8) |
Nov
(70) |
Dec
(24) |
2006 |
Jan
|
Feb
(1) |
Mar
(4) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <fza...@us...> - 2005-12-05 05:33:35
|
Update of /cvsroot/struts/struts-site/src/documentation/content/xdocs/ajaxchat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21682/src/documentation/content/xdocs/ajaxchat Modified Files: index.xml Log Message: Index: index.xml =================================================================== RCS file: /cvsroot/struts/struts-site/src/documentation/content/xdocs/ajaxchat/index.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** index.xml 1 Dec 2005 20:03:25 -0000 1.3 --- index.xml 5 Dec 2005 05:33:26 -0000 1.4 *************** *** 31,35 **** <title>What's New</title> <section> ! <title>v1.0 Alpha 2 now available.!</title> <p> 11/30/2005 - Hot on the heels of the first release comes the --- 31,47 ---- <title>What's New</title> <section> ! <title>v1.0 now available!</title> ! <p> ! 12/5/2005 - Yep, I skipped beta because it seems to be quite stable ! now, so anyone that is interested should feel free to do so now. ! This should be the last release for a while... although I have a ! number of interesting features I'd like to add, I have a bunch of ! other things on my plate, so I don't know when I'll get to them. ! This release should completely serve its purpose as an example ! though, and hopefully will prove useful too. Enjoy! ! </p> ! </section> ! <section> ! <title>v1.0 Alpha 2 now available!</title> <p> 11/30/2005 - Hot on the heels of the first release comes the |
From: <fza...@us...> - 2005-12-05 04:58:04
|
Update of /cvsroot/struts/ajaxchat/WEB-INF/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13282/WEB-INF/src Modified Files: build.xml history.txt Log Message: Index: build.xml =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/build.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** build.xml 30 Nov 2005 22:04:27 -0000 1.2 --- build.xml 5 Dec 2005 04:57:52 -0000 1.3 *************** *** 10,14 **** <property name="javadocs" value="javadocs" /> <!-- "project_version" is, obviously, the version of the app! --> ! <property name="project_version" value="1.0_alpha2" /> <!-- "proxy_host" is the address of the proxy server that will be --> <!-- used to download dependencies, if a proxy is required on your --> --- 10,14 ---- <property name="javadocs" value="javadocs" /> <!-- "project_version" is, obviously, the version of the app! --> ! <property name="project_version" value="1.0" /> <!-- "proxy_host" is the address of the proxy server that will be --> <!-- used to download dependencies, if a proxy is required on your --> *************** *** 150,154 **** <delete dir="${distro_dir}" /> <mkdir dir="${distro_dir}" /> ! <jar destfile="${distro_dir}/ajaxchat.war" basedir="../" /> <zip destfile="${distro_dir}/ajaxchat_${project_version}.zip" basedir="${distro_dir}"> --- 150,154 ---- <delete dir="${distro_dir}" /> <mkdir dir="${distro_dir}" /> ! <jar destfile="${distro_dir}/ajaxchat.war" basedir="../../" /> <zip destfile="${distro_dir}/ajaxchat_${project_version}.zip" basedir="${distro_dir}"> *************** *** 169,172 **** --- 169,173 ---- <target name="clean"> <echo message="Cleaning up..." /> + <delete dir="../classes/org" /> <delete dir="${javadocs}" /> <delete file="checkstyle_results.xml" /> Index: history.txt =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/history.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** history.txt 1 Dec 2005 05:22:47 -0000 1.2 --- history.txt 5 Dec 2005 04:57:52 -0000 1.3 *************** *** 1,2 **** --- 1,13 ---- + v1.0 + 12/5/2005 + --------- + * This is the official, stable release. Yes, beta was skipped as it didn't + seem to be necessary. + * This version corrects a problem with the WAR file creation that was present + in alpha 2. My bad, had an incorrect path specified in the distro task + in the build script and I didn't notice. + * Modified the clean task to, uhh, completely CLEAN. + + v1.0 alpha 2 11/30/2005 |
From: <fza...@us...> - 2005-12-01 20:03:37
|
Update of /cvsroot/struts/struts-site/src/documentation/skins/default/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25440/src/documentation/skins/default/images Modified Files: menu-left.gif Log Message: Index: menu-left.gif =================================================================== RCS file: /cvsroot/struts/struts-site/src/documentation/skins/default/images/menu-left.gif,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvstzSrfp and /tmp/cvsEMUN2t differ |
From: <fza...@us...> - 2005-12-01 20:03:37
|
Update of /cvsroot/struts/struts-site/src/documentation/content/xdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25440/src/documentation/content/xdocs Modified Files: news.xml site.xml Log Message: Index: news.xml =================================================================== RCS file: /cvsroot/struts/struts-site/src/documentation/content/xdocs/news.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** news.xml 9 Jun 2005 00:27:44 -0000 1.6 --- news.xml 1 Dec 2005 20:03:25 -0000 1.7 *************** *** 14,17 **** --- 14,23 ---- <link href="guidelines.html">guidelines</link>. </p> + <section id="ajaxchat-1.0alpa2"> + <title>AjaxChat v1.0 alpha 2 now available Struts Apps</title> + <p> + Yes, it's alpha, but it's solid as far as I know :) + </p> + </section> <section id="dialogs-1.0"> <title>Struts Dialogs 1.0 added to Struts Apps</title> Index: site.xml =================================================================== RCS file: /cvsroot/struts/struts-site/src/documentation/content/xdocs/site.xml,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** site.xml 9 Jun 2005 00:27:44 -0000 1.13 --- site.xml 1 Dec 2005 20:03:25 -0000 1.14 *************** *** 35,38 **** --- 35,39 ---- <strutsdoc label="StrutsDoc" href="strutsdoc/index.html" /> <AjaxTags label="AjaxTags" href="ajaxtags/index.html" /> + <AjaxTags label="AjaxChat" href="ajaxchat/index.html" /> </projects> |
From: <fza...@us...> - 2005-12-01 20:03:36
|
Update of /cvsroot/struts/struts-site/src/documentation/content/xdocs/ajaxchat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25440/src/documentation/content/xdocs/ajaxchat Modified Files: index.xml Log Message: Index: index.xml =================================================================== RCS file: /cvsroot/struts/struts-site/src/documentation/content/xdocs/ajaxchat/index.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** index.xml 1 Dec 2005 05:55:48 -0000 1.2 --- index.xml 1 Dec 2005 20:03:25 -0000 1.3 *************** *** 25,29 **** <li>Cross-browser (tested in IE 6.0 and FireFox 1.0)</li> <li>The ability to change font sizes and colors (your and theirs)</li> ! <li>Real, live demo available <link href="http://www.omnytex.com/ajaxchat">here</link></li> </ul> </section> --- 25,29 ---- <li>Cross-browser (tested in IE 6.0 and FireFox 1.0)</li> <li>The ability to change font sizes and colors (your and theirs)</li> ! <li>Real, live demo available <link href="http://www.omnytex.com/ajaxchat">here</link> (note that this IS NOT guaranteed to be available, but usually will be)</li> </ul> </section> *************** *** 31,35 **** <title>What's New</title> <section> ! <title>v1.0 Alpha2 now available.!</title> <p> 11/30/2005 - Hot on the heels of the first release comes the --- 31,35 ---- <title>What's New</title> <section> ! <title>v1.0 Alpha 2 now available.!</title> <p> 11/30/2005 - Hot on the heels of the first release comes the |
From: <fza...@us...> - 2005-12-01 05:56:00
|
Update of /cvsroot/struts/struts-site/src/documentation/skins/default/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17211/src/documentation/skins/default/images Modified Files: pdfdoc.gif Log Message: Index: pdfdoc.gif =================================================================== RCS file: /cvsroot/struts/struts-site/src/documentation/skins/default/images/pdfdoc.gif,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 Binary files /tmp/cvsei3z8m and /tmp/cvsLJ9m1q differ |
From: <fza...@us...> - 2005-12-01 05:55:58
|
Update of /cvsroot/struts/struts-site In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17211 Modified Files: README.txt Log Message: Index: README.txt =================================================================== RCS file: /cvsroot/struts/struts-site/README.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** README.txt 29 May 2004 20:27:36 -0000 1.3 --- README.txt 1 Dec 2005 05:55:48 -0000 1.4 *************** *** 1,14 **** ! If you are wanting update the website but don't know where to start, this is for you. A little Forrest (http://xml.apache.org/forrest) knowledge ! is required. ! 1. Update the web page sources in src/documentation/content/xdocs/** ! 2. Install Forrest and put the forrest executable in your path ! 3. Type "forrest site" and the site will be built in build/site ! 4. View the site in your browser to make sure it looks ok ! 5. Check your changes in to CVS ! 6. Zip up the site and copy it to ssh.sf.net using sftp or scp For more about the web site, see Section H of the SourceForge ! docs - http://sourceforge.net/docman/?group_id=1) ! 7. SSH to the server and unzip the site to /home/groups/s/st/struts/htdocs ! 8. Change the permissions to group-writable [ chmod -R g+w . ] --- 1,29 ---- ! If you are wanting to update the website but don't know where to start, this is for you. A little Forrest (http://xml.apache.org/forrest) knowledge ! is required. You should be able to do all of this without ever leaving ! your home directory. ! 1. Update the web page sources in src/documentation/content/xdocs/**. ! Do yourself a favor and open any XML file you edit in a web browser ! to be sure you have a valid XML document. Forrest will of course ! flag such problems, but they tend to be a little easier to spot in ! Internet Explorer. ! 2. Install Forrest and put the forrest executable in your path. ! 3. Type "forrest site" and the site will be built in build/site. ! 4. View the site in your browser to make sure it looks ok. ! 5. Check your changes in to CVS. Please be careful with images! ! Some of them seem to get corrupted easily. Please check them to be ! sure they all open in a browser before checking in (specifically, ! the images under src/documentation/skins/default/images). ! 6. Zip up the site and copy it to ssh.sf.net using sftp or scp. For more about the web site, see Section H of the SourceForge ! docs - http://sourceforge.net/docman/?group_id=1). ! Also, be sure to zip it up starting WITHIN the build/site directory. ! 7. SSH to the server and unzip the site to /home/groups/s/st/struts/htdocs. ! The exact command to use, assuming you zipped up the site into an ! archived named site.zip, is: ! unzip site.zip -d /home/groups/s/st/struts/htdocs ! Be sure to select "A" when prompted to overwrite All files. ! 8. Change the permissions to group-writable by doing [ chmod -R g+w . ] ! The exact command to use is: ! chmod -R g+w /home/groups/s/st/struts/htdocs |
From: <fza...@us...> - 2005-12-01 05:55:58
|
Update of /cvsroot/struts/struts-site/src/documentation/content/xdocs/ajaxchat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17211/src/documentation/content/xdocs/ajaxchat Modified Files: index.xml Log Message: Index: index.xml =================================================================== RCS file: /cvsroot/struts/struts-site/src/documentation/content/xdocs/ajaxchat/index.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** index.xml 29 Nov 2005 23:46:16 -0000 1.1 --- index.xml 1 Dec 2005 05:55:48 -0000 1.2 *************** *** 31,34 **** --- 31,47 ---- <title>What's New</title> <section> + <title>v1.0 Alpha2 now available.!</title> + <p> + 11/30/2005 - Hot on the heels of the first release comes the + second. This addresses some issues that arose when running the + app in Resin (and presumably some others) and accessing the app + with Firefox (the combination of Resin and Firefox specifically + caused some problems). Should be all OK now and I am not + currently aware of any problems with this release. Also + includes some minor enhancements and cleanups. Check the + release notes for full details. + </p> + </section> + <section> <title>AjaxChat initial release!</title> <p> |
From: <fza...@us...> - 2005-12-01 05:30:26
|
Update of /cvsroot/struts/struts-site/src/documentation/content/xdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13009/src/documentation/content/xdocs Modified Files: cvs.xml Log Message: Index: cvs.xml =================================================================== RCS file: /cvsroot/struts/struts-site/src/documentation/content/xdocs/cvs.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** cvs.xml 9 Jun 2005 00:27:44 -0000 1.7 --- cvs.xml 1 Dec 2005 05:30:18 -0000 1.8 *************** *** 45,48 **** --- 45,51 ---- <jump href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/struts/ajaxtags/">AjaxTags</jump> </li> + <li> + <jump href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/struts/ajaxchat/">AjaxChat</jump> + </li> </ul> </section> *************** *** 89,92 **** --- 92,97 ---- <li>struts-spring</li> <li>strutsdoc</li> + <li>ajaxtags</li> + <li>ajaxchat</li> </ul> </section> |
From: <fza...@us...> - 2005-12-01 05:22:55
|
Update of /cvsroot/struts/ajaxchat/WEB-INF/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11754/WEB-INF/src Modified Files: history.txt Log Message: Index: history.txt =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/history.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** history.txt 30 Nov 2005 22:04:27 -0000 1.1 --- history.txt 1 Dec 2005 05:22:47 -0000 1.2 *************** *** 24,27 **** --- 24,30 ---- up, reorganized them, etc.) * Remapped filter to only paths ending in .do. + * Changed all AJAX requests to GET instead of POST to overcome errors that + happened when using the live demo from Firefox. + * Add this history file! |
From: <fza...@us...> - 2005-11-30 22:32:06
|
Update of /cvsroot/struts/ajaxchat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19377 Modified Files: lobby.jsp room.jsp Log Message: Index: lobby.jsp =================================================================== RCS file: /cvsroot/struts/ajaxchat/lobby.jsp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lobby.jsp 30 Nov 2005 22:04:28 -0000 1.2 --- lobby.jsp 30 Nov 2005 22:31:58 -0000 1.3 *************** *** 81,85 **** // One minor problem that if (sendAJAXRequest) { ! xhrLobbyUpdateStats.open("post", target, true); xhrLobbyUpdateStats.send(null); } --- 81,85 ---- // One minor problem that if (sendAJAXRequest) { ! xhrLobbyUpdateStats.open("get", target, true); xhrLobbyUpdateStats.send(null); } Index: room.jsp =================================================================== RCS file: /cvsroot/struts/ajaxchat/room.jsp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** room.jsp 30 Nov 2005 22:04:28 -0000 1.2 --- room.jsp 30 Nov 2005 22:31:58 -0000 1.3 *************** *** 103,107 **** target = "<html:rewrite action="ajaxListUsersInRoom" />"; // Go ahead and fire off the request, no payload to send. ! xhrListUsersInRoom.open("post", target, true); xhrListUsersInRoom.send(null); } catch(e) { --- 103,107 ---- target = "<html:rewrite action="ajaxListUsersInRoom" />"; // Go ahead and fire off the request, no payload to send. ! xhrListUsersInRoom.open("get", target, true); xhrListUsersInRoom.send(null); } catch(e) { *************** *** 172,176 **** target = "<html:rewrite action="ajaxGetMessages" />"; // Go ahead and fire off the request, no payload to send. ! xhrGetMessages.open("post", target, true); xhrGetMessages.send(null); } catch(e) { --- 172,176 ---- target = "<html:rewrite action="ajaxGetMessages" />"; // Go ahead and fire off the request, no payload to send. ! xhrGetMessages.open("get", target, true); xhrGetMessages.send(null); } catch(e) { *************** *** 296,300 **** // technically, the payload was appended to the URI as a query // string. In this case that was probably the easiest way to go. ! xhrPostMessage.open("post", target, true); xhrPostMessage.send(null); // Some UI niceness: clear what was just sent and set focus to the --- 296,300 ---- // technically, the payload was appended to the URI as a query // string. In this case that was probably the easiest way to go. ! xhrPostMessage.open("get", target, true); xhrPostMessage.send(null); // Some UI niceness: clear what was just sent and set focus to the |
From: <fza...@us...> - 2005-11-30 22:27:52
|
Update of /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/listener In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18567/WEB-INF/src/org/apache/struts/apps/ajaxchat/listener Removed Files: SessionListener.java Log Message: --- SessionListener.java DELETED --- |
From: <fza...@us...> - 2005-11-30 22:04:41
|
Update of /cvsroot/struts/ajaxchat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13448 Modified Files: index.jsp lobby.jsp room.jsp Log Message: Index: index.jsp =================================================================== RCS file: /cvsroot/struts/ajaxchat/index.jsp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** index.jsp 29 Nov 2005 23:08:30 -0000 1.1 --- index.jsp 30 Nov 2005 22:04:28 -0000 1.2 *************** *** 14,20 **** --- 14,28 ---- </head> + <!-- Note that inline styles are used here to overcome some problem that was --> + <!-- beating me where the stylesheet linked in here wouldn't get picked up. --> + <!-- It would happen when deployed on Resin, but also started to happen when --> + <!-- viewing the app with Firefox running locally on Tomcat. I have no clue --> + <!-- why it was happening, and if it is ever solved then the inline styles --> + <!-- should be removed in favor of the linked in stylesheet. --> + <body class="cssMain" onLoad="LoginActionForm.username.focus();"> <div class="cssHeading"><fmt:message key="messages.appTitle" /></div> + <div class="cssAppVersion"><fmt:message key="app.version" /></div> <hr/><br/> Index: lobby.jsp =================================================================== RCS file: /cvsroot/struts/ajaxchat/lobby.jsp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lobby.jsp 29 Nov 2005 23:08:30 -0000 1.1 --- lobby.jsp 30 Nov 2005 22:04:28 -0000 1.2 *************** *** 67,70 **** --- 67,71 ---- if (xhrLobbyUpdateStats == null || xhrLobbyUpdateStats.readyState == 0 || xhrLobbyUpdateStats.readyState == 4) { + // Create XMLHttpRequest object instance based on browser type. try { if (window.XMLHttpRequest){ *************** *** 73,78 **** --- 74,83 ---- xhrLobbyUpdateStats = new ActiveXObject('Microsoft.XMLHTTP'); } + // Set the Javascript function that will act as a callback for + // any events the instance fires. xhrLobbyUpdateStats.onreadystatechange = lobbyUpdateStatsHandler; + // Set the target URI for the request. target = "<html:rewrite action="ajaxLobbyUpdateStats" />"; + // One minor problem that if (sendAJAXRequest) { xhrLobbyUpdateStats.open("post", target, true); *************** *** 129,132 **** --- 134,138 ---- <div class="cssHeading"><fmt:message key="messages.appTitle" /></div> + <div class="cssAppVersion"><fmt:message key="app.version" /></div> <hr/><br/> Index: room.jsp =================================================================== RCS file: /cvsroot/struts/ajaxchat/room.jsp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** room.jsp 29 Nov 2005 23:08:30 -0000 1.1 --- room.jsp 30 Nov 2005 22:04:28 -0000 1.2 *************** *** 90,93 **** --- 90,94 ---- if (xhrListUsersInRoom == null || xhrListUsersInRoom.readyState == 0 || xhrListUsersInRoom.readyState == 4) { + // Create XMLHttpRequest object instance based on browser type. try { if (window.XMLHttpRequest){ *************** *** 96,101 **** --- 97,106 ---- xhrListUsersInRoom = new ActiveXObject('Microsoft.XMLHTTP'); } + // Set the Javascript function that will act as a callback for + // any events the instance fires. xhrListUsersInRoom.onreadystatechange = listUsersInRoomHandler; + // Set the target URI for the request. target = "<html:rewrite action="ajaxListUsersInRoom" />"; + // Go ahead and fire off the request, no payload to send. xhrListUsersInRoom.open("post", target, true); xhrListUsersInRoom.send(null); *************** *** 154,157 **** --- 159,163 ---- if (xhrGetMessages == null || xhrGetMessages.readyState == 0 || xhrGetMessages.readyState == 4) { + // Create XMLHttpRequest object instance based on browser type. try { if (window.XMLHttpRequest){ *************** *** 160,165 **** --- 166,175 ---- xhrGetMessages = new ActiveXObject('Microsoft.XMLHTTP'); } + // Set the Javascript function that will act as a callback for + // any events the instance fires. xhrGetMessages.onreadystatechange = getMessagesHandler; + // Set the target URI for the request. target = "<html:rewrite action="ajaxGetMessages" />"; + // Go ahead and fire off the request, no payload to send. xhrGetMessages.open("post", target, true); xhrGetMessages.send(null); *************** *** 186,189 **** --- 196,202 ---- root = msgDOM.getElementsByTagName("messages")[0]; messages = root.getElementsByTagName("message"); + // Now we're going to cycle through all the <message> elements in + // the returns XML and for each we'll pull out the pertinent details + // and construct HTML for it. for (i = 0; i < messages.length; i++) { message = messages[i]; *************** *** 218,222 **** } } ! // Lastly, always scroll to the bottom objChatScroll.scrollTop = 1000000; } else { --- 231,235 ---- } } ! // Lastly, always scroll to the bottom. objChatScroll.scrollTop = 1000000; } else { *************** *** 249,256 **** /** ! * This function trims whitespace from both ends of a string. */ function fullTrim(inString) { return (inString.replace(/^\s*(.*\S|.*)\s*$/, '$1')); } // End fullTrim(). --- 262,271 ---- /** ! * Utility function to trim whitespace from both ends of a string. */ function fullTrim(inString) { + return (inString.replace(/^\s*(.*\S|.*)\s*$/, '$1')); + } // End fullTrim(). *************** *** 265,270 **** --- 280,287 ---- function postMessage() { + // Only try and send if the user entered something. userInputText = document.getElementById("userInput"); if (fullTrim(userInputText.value) != "") { + // Create XMLHttpRequest object instance based on browser type. if (window.XMLHttpRequest){ xhrPostMessage = new XMLHttpRequest(); *************** *** 273,280 **** --- 290,303 ---- } try { + // Set the target URI for the request. target = "<html:rewrite action="ajaxPostMessage" />"; target += "?msgText=" + escape(userInputText.value); + // Go ahead and fire off the request, no payload to send. Well, + // technically, the payload was appended to the URI as a query + // string. In this case that was probably the easiest way to go. xhrPostMessage.open("post", target, true); xhrPostMessage.send(null); + // Some UI niceness: clear what was just sent and set focus to the + // user input box. userInputText.value = ""; userInputText.focus(); *************** *** 287,291 **** --- 310,320 ---- + /** + * This function is called when the increase font size image is clicked. + * It's a simple client-side adjustment, simply setting the font-size + * style attribute of the chat scroll. + */ function increaseChatScrollFontSize() { + cs = document.getElementById("chatScroll"); scrollChatFontSize = scrollChatFontSize + 2; *************** *** 294,301 **** --- 323,337 ---- } cs.style.fontSize = scrollChatFontSize + "pt"; + } + /** + * This function is called when the decrease font size image is clicked. + * It's a simple client-side adjustment, simply setting the font-size + * style attribute of the chat scroll. + */ function decreaseChatScrollFontSize() { + cs = document.getElementById("chatScroll"); scrollChatFontSize = scrollChatFontSize - 2; *************** *** 304,309 **** --- 340,347 ---- } cs.style.fontSize = scrollChatFontSize + "pt"; + } + </script> *************** *** 314,318 **** <table align="center" border="1" bordercolor="#000000" width="100%" height="100%" cellpadding="4" cellspacing="0" class="cssRoomMainTable"> ! <!-- Header section --> <tr> <td colspan="2" class="cssRoomHeader" height="40"> --- 352,357 ---- <table align="center" border="1" bordercolor="#000000" width="100%" height="100%" cellpadding="4" cellspacing="0" class="cssRoomMainTable"> ! ! <!-- ***** Header section ***** --> <tr> <td colspan="2" class="cssRoomHeader" height="40"> *************** *** 321,325 **** </td> </tr> ! <!-- Chat scroll section --> <tr> <td height="100%" valign="top"> --- 360,365 ---- </td> </tr> ! ! <!-- ***** Chat scroll section ***** --> <tr> <td height="100%" valign="top"> *************** *** 331,376 **** </td> </tr> ! <!-- User control section --> <tr> ! <td height="60" valign="middle" id="userControl" class="cssRoomUserControl"> ! <!-- Leave room button --> ! <input type="button" ! value="<fmt:message key="labels.leaveRoomButton" />" ! class="cssButton" onClick="leaveRoom();" /> ! ! <!-- Clear history button --> ! <input type="button" ! value="<fmt:message key="labels.clearHistoryButton" />" ! class="cssButton" onClick="clearHistory();" /> ! ! <!-- Increase/Decrease font size --> ! <fmt:message key="labels.fontSize" /> ! <img src="img/zoomUp.gif" align="absmiddle" ! alt="<fmt:message key="labels.increaseFontSize" />" ! onClick="increaseChatScrollFontSize();" ! onMouseOver="this.style.cursor='hand';" ! onMouseOut="this.style.cursor='';"> ! ! <img src="img/zoomDown.gif" align="absmiddle" ! alt="<fmt:message key="labels.decreaseFontSize" />" ! onClick="decreaseChatScrollFontSize()"; ! onMouseOver="this.style.cursor='hand';" ! onMouseOut="this.style.cursor='';"> ! <br/> ! <!-- Your color --> ! <fmt:message key="labels.yourColor" /> ! <select class="cssSelect" id="yourColor"> ! <%@ include file="/inc/color_options.inc" %> ! </select> ! ! <!-- Their color --> ! <fmt:message key="labels.theirColor" /> ! <select class="cssSelect" id="theirColor"> ! <%@ include file="/inc/color_options.inc" %> ! </select> </td> </tr> ! <!-- User input section --> <tr> <td height="70" valign="middle" class="cssRoomUserInput"> --- 371,430 ---- </td> </tr> ! ! <!-- ***** User control section ***** --> <tr> ! <td height="66" valign="middle" id="userControl" class="cssRoomUserControl"> ! <table border="0" cellpadding="2" cellspacing="0" width="100%" ! height="100%" class="cssRoomUserControl"> ! <tr> ! <td width="50%" ! <!-- Leave room button --> ! <input type="button" ! value="<fmt:message key="labels.leaveRoomButton" />" ! class="cssButton" onClick="leaveRoom();" /> ! ! <!-- Clear history button --> ! <input type="button" ! value="<fmt:message key="labels.clearHistoryButton" />" ! class="cssButton" onClick="clearHistory();" /> ! </td> ! <td width="50%" align="right"> ! <!-- Your color --> ! <fmt:message key="labels.yourColor" /> ! <select class="cssSelect" id="yourColor"> ! <%@ include file="/inc/color_options.inc" %> ! </select> ! </td> ! </tr> ! <tr> ! <td> ! <!-- Increase/Decrease font size --> ! <fmt:message key="labels.fontSize" /> ! ! <img src="img/zoomUp.gif" align="absmiddle" hspace="2" ! alt="<fmt:message key="labels.increaseFontSize" />" ! onClick="increaseChatScrollFontSize();" ! onMouseOver="this.style.cursor='hand';" ! onMouseOut="this.style.cursor='';"> ! <img src="img/zoomDown.gif" align="absmiddle" hspace="8" ! alt="<fmt:message key="labels.decreaseFontSize" />" ! onClick="decreaseChatScrollFontSize()"; ! onMouseOver="this.style.cursor='hand';" ! onMouseOut="this.style.cursor='';"> ! </td> ! <td align="right"> ! <!-- Their color --> ! <fmt:message key="labels.theirColor" /> ! <select class="cssSelect" id="theirColor"> ! <%@ include file="/inc/color_options.inc" %> ! </select> ! </td> ! </tr> ! </table> </td> </tr> ! ! <!-- ***** User input section ***** --> <tr> <td height="70" valign="middle" class="cssRoomUserInput"> *************** *** 382,385 **** --- 436,440 ---- </td> </tr> + </table> |
From: <fza...@us...> - 2005-11-30 22:04:41
|
Update of /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/dao In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13448/WEB-INF/src/org/apache/struts/apps/ajaxchat/dao Modified Files: AjaxChatDAO.java Log Message: Index: AjaxChatDAO.java =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/dao/AjaxChatDAO.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AjaxChatDAO.java 29 Nov 2005 23:08:29 -0000 1.1 --- AjaxChatDAO.java 30 Nov 2005 22:04:28 -0000 1.2 *************** *** 28,31 **** --- 28,32 ---- import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.apache.struts.apps.ajaxchat.AjaxChatConfig; import org.apache.struts.apps.ajaxchat.dto.MessageDTO; import org.apache.struts.apps.ajaxchat.dto.RoomDTO; *************** *** 37,41 **** * This Data Access Object (DAO) is really the heart and soul of the app. All * the real work is done here in terms of recording messages, dealing with ! * users and rooms and most everything else. * * @author <a href="mailto:fza...@om...">Frank W. Zammetti</a>. --- 38,46 ---- * This Data Access Object (DAO) is really the heart and soul of the app. All * the real work is done here in terms of recording messages, dealing with ! * users and rooms and most everything else. I think it's probably a bit more ! * than what a DAO is supposed to generally be, but in this case I don't think ! * it's a big deal. Besides, the idea is that if you want to make this a more ! * robust application, with real message persistance and such, then all you ! * should probably have to mess with is this class. That's the intent anyway. * * @author <a href="mailto:fza...@om...">Frank W. Zammetti</a>. *************** *** 72,76 **** */ private AjaxChatDAO() { ! } --- 77,81 ---- */ private AjaxChatDAO() { ! } // End constructor. *************** *** 83,92 **** public static AjaxChatDAO getInstance() { ! log.info("AjaxChatDAO getInstance()..."); if (instance == null) { instance = new AjaxChatDAO(); instance.init(null); } - log.info("AjaxChatDAO getInstance() Done"); return instance; --- 88,96 ---- public static AjaxChatDAO getInstance() { ! log.debug("getInstance()..."); if (instance == null) { instance = new AjaxChatDAO(); instance.init(null); } return instance; *************** *** 106,110 **** public synchronized void init(InputStream isConfigFile) { ! log.info("AjaxChatDAO init()..."); if (isConfigFile != null) { // Read in rooms config and create beans, hand off to DAO. --- 110,114 ---- public synchronized void init(InputStream isConfigFile) { ! log.debug("init()..."); if (isConfigFile != null) { // Read in rooms config and create beans, hand off to DAO. *************** *** 125,129 **** } } - log.info("AjaxChatDAO init() Done"); } // End init(). --- 129,132 ---- *************** *** 137,144 **** public synchronized void addRoom(RoomDTO inRoom) { ! log.info("AjaxChatDAO addRoom()..."); log.info("Adding room " + inRoom); rooms.put(inRoom.getName(), inRoom); - log.info("AjaxChatDAO addRoom() Done"); } // End addRoom(). --- 140,146 ---- public synchronized void addRoom(RoomDTO inRoom) { ! log.debug("addRoom()..."); log.info("Adding room " + inRoom); rooms.put(inRoom.getName(), inRoom); } // End addRoom(). *************** *** 152,163 **** public synchronized void removeRoom(String inRoomName) { ! log.info("AjaxChatDAO removeRoom()..."); ! log.info("Removing room " + inRoomName); RoomDTO room = (RoomDTO)rooms.get(inRoomName); if (room.getUserList().size() == 0) { rooms.remove(inRoomName); ! log.info("AjaxChatDAO removeRoom() Done"); } else { ! log.info("AjaxChatDAO removeRoom() Room not removed because " + "there are users in it"); } --- 154,164 ---- public synchronized void removeRoom(String inRoomName) { ! log.debug("removeRoom()..."); RoomDTO room = (RoomDTO)rooms.get(inRoomName); if (room.getUserList().size() == 0) { rooms.remove(inRoomName); ! log.info("removeRoom() removed room " + inRoomName); } else { ! log.info("removeRoom() Room not removed because " + "there are users in it"); } *************** *** 174,179 **** public synchronized void postMessage(String inRoom, MessageDTO inMessage) { ! log.info("AjaxChatDAO postMessage() : inRoom = " + inRoom + ! " - inMessage = " + inMessage); RoomDTO room = (RoomDTO)rooms.get(inRoom); room.postMessage(inMessage); --- 175,180 ---- public synchronized void postMessage(String inRoom, MessageDTO inMessage) { ! log.debug("postMessage(): inRoom = " + inRoom + ! " - inMessage = " + inMessage + "..."); RoomDTO room = (RoomDTO)rooms.get(inRoom); room.postMessage(inMessage); *************** *** 192,197 **** public synchronized Vector getMessages(String inRoom, Date inDateTime) { ! log.info("AjaxChatDAO getMessages() : inRoom = " + inRoom + ! " - inDateTime = " + inDateTime); RoomDTO room = (RoomDTO)rooms.get(inRoom); return room.getMessages(inDateTime); --- 193,198 ---- public synchronized Vector getMessages(String inRoom, Date inDateTime) { ! log.debug("getMessages(): inRoom = " + inRoom + ! " - inDateTime = " + inDateTime + "..."); RoomDTO room = (RoomDTO)rooms.get(inRoom); return room.getMessages(inDateTime); *************** *** 208,217 **** public synchronized Vector getRoomList() { ! log.info("AjaxChatDAO getRoomList()"); Vector roomList = new Vector(); for (Iterator it = rooms.keySet().iterator(); it.hasNext();) { roomList.add((String)it.next()); } ! log.info("AjaxChatDAO roomList = " + roomList); return roomList; --- 209,218 ---- public synchronized Vector getRoomList() { ! log.debug("getRoomList()..."); Vector roomList = new Vector(); for (Iterator it = rooms.keySet().iterator(); it.hasNext();) { roomList.add((String)it.next()); } ! log.info("roomList = " + roomList); return roomList; *************** *** 227,231 **** public synchronized LinkedHashMap getRoomUserCounts() { ! log.info("getRoomUserCounts getMessages()"); LinkedHashMap roomList = new LinkedHashMap(); for (Iterator it = rooms.keySet().iterator(); it.hasNext();) { --- 228,232 ---- public synchronized LinkedHashMap getRoomUserCounts() { ! log.debug("getRoomUserCounts()..."); LinkedHashMap roomList = new LinkedHashMap(); for (Iterator it = rooms.keySet().iterator(); it.hasNext();) { *************** *** 234,238 **** new Integer(((RoomDTO)rooms.get(roomName)).getUserList().size())); } ! log.info("getRoomUserCounts roomList = " + roomList); return roomList; --- 235,239 ---- new Integer(((RoomDTO)rooms.get(roomName)).getUserList().size())); } ! log.debug("roomList = " + roomList); return roomList; *************** *** 249,257 **** public synchronized Vector getUserList(String inRoom) { ! log.info("AjaxChatDAO getUserList() : inRoom = " + inRoom); Vector userList = null; RoomDTO room = (RoomDTO)rooms.get(inRoom); userList = room.getUserList(); ! log.info("AjaxChatDAO userList = " + userList); return userList; --- 250,258 ---- public synchronized Vector getUserList(String inRoom) { ! log.debug("getUserList(): inRoom = " + inRoom + "..."); Vector userList = null; RoomDTO room = (RoomDTO)rooms.get(inRoom); userList = room.getUserList(); ! log.info("userList = " + userList); return userList; *************** *** 267,274 **** public synchronized void addUserToRoom(String inRoom, UserDTO inUser) { ! log.info("AjaxChatDAO addUserToRoom()..."); RoomDTO room = (RoomDTO)rooms.get(inRoom); room.addUser(inUser); - log.info("AjaxChatDAO addUserToRoom() Done"); } // End addUserToRoom(). --- 268,274 ---- public synchronized void addUserToRoom(String inRoom, UserDTO inUser) { ! log.info("addUserToRoom()..."); RoomDTO room = (RoomDTO)rooms.get(inRoom); room.addUser(inUser); } // End addUserToRoom(). *************** *** 283,290 **** public synchronized void removeUserFromRoom(String inRoom, UserDTO inUser) { ! log.info("AjaxChatDAO removeUserFromRoom()..."); RoomDTO room = (RoomDTO)rooms.get(inRoom); room.removeUser(inUser); - log.info("AjaxChatDAO removeUserFromRoom() Done"); } // End removeUserFromRoom(). --- 283,289 ---- public synchronized void removeUserFromRoom(String inRoom, UserDTO inUser) { ! log.debug("removeUserFromRoom()..."); RoomDTO room = (RoomDTO)rooms.get(inRoom); room.removeUser(inUser); } // End removeUserFromRoom(). *************** *** 299,303 **** public synchronized void removeUserFromAllRooms(UserDTO inUser) { ! log.info("AjaxChatDAO removeUserFromAllRooms()..."); for (Iterator it = rooms.keySet().iterator(); it.hasNext();) { String roomName = (String)it.next(); --- 298,302 ---- public synchronized void removeUserFromAllRooms(UserDTO inUser) { ! log.debug("removeUserFromAllRooms()..."); for (Iterator it = rooms.keySet().iterator(); it.hasNext();) { String roomName = (String)it.next(); *************** *** 305,309 **** room.removeUser(inUser); } - log.info("AjaxChatDAO removeUserFromAllRooms() Done"); } // End removeUserFromAllRooms(). --- 304,307 ---- *************** *** 317,321 **** public synchronized void logUserIn(UserDTO inUser) { ! log.info("AjaxChatDAO logUserIn()..."); users.add(inUser); log.info(inUser.getUsername() + " logged in"); --- 315,319 ---- public synchronized void logUserIn(UserDTO inUser) { ! log.debug("logUserIn()..."); users.add(inUser); log.info(inUser.getUsername() + " logged in"); *************** *** 331,335 **** public synchronized void logUserOut(UserDTO inUser) { ! log.info("AjaxChatDAO logUserOut()..."); String usernameToLogOut = inUser.getUsername(); int i = 0; --- 329,333 ---- public synchronized void logUserOut(UserDTO inUser) { ! log.debug("logUserOut()..."); String usernameToLogOut = inUser.getUsername(); int i = 0; *************** *** 358,362 **** public synchronized boolean isUsernameInUse(String inUsername) { ! log.info("AjaxChatDAO isUsernameInUse()..."); boolean retVal = false; for (Iterator it = users.iterator(); it.hasNext();) { --- 356,360 ---- public synchronized boolean isUsernameInUse(String inUsername) { ! log.debug("isUsernameInUse()..."); boolean retVal = false; for (Iterator it = users.iterator(); it.hasNext();) { *************** *** 366,370 **** } } ! log.info("AjaxChatDAO isUsernameInUse() Done (" + retVal + ")"); return retVal; --- 364,368 ---- } } ! log.debug("Returning " + retVal); return retVal; *************** *** 372,374 **** --- 370,400 ---- + /** + * This method goes through the collection of users and determines which, if + * any, are inactive. Any that are inactive are removed. This is called + * from the UserClearerDaemon thread. + */ + public synchronized void removeInactiveUsers() { + + log.debug("removeInactiveUsers()..."); + Vector usersToRemove = new Vector(); + for (Iterator it = users.iterator(); it.hasNext();) { + UserDTO user = (UserDTO)it.next(); + long now = new Date().getTime(); + long lastAJAXRequest = user.getLastAJAXRequest().getTime(); + if ((now - lastAJAXRequest) >= + (AjaxChatConfig.getUserInactivitySeconds() * 1000)) { + log.info("User " + user.getUsername() + " will be removed"); + usersToRemove.add(user); + } + } + for (Iterator it = usersToRemove.iterator(); it.hasNext();) { + UserDTO user = (UserDTO)it.next(); + removeUserFromAllRooms(user); + logUserOut(user); + } + + } // End removeInactiveUsers(). + + } // End class. \ No newline at end of file |
From: <fza...@us...> - 2005-11-30 22:04:39
|
Update of /cvsroot/struts/ajaxchat/css In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13448/css Modified Files: styles.css Log Message: Index: styles.css =================================================================== RCS file: /cvsroot/struts/ajaxchat/css/styles.css,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** styles.css 29 Nov 2005 23:08:30 -0000 1.1 --- styles.css 30 Nov 2005 22:04:28 -0000 1.2 *************** *** 5,8 **** --- 5,14 ---- } + .cssAppVersion { + font-family : verdana; + font-size : 10pt; + font-weight : bold; + } + .cssMain { font-family : verdana; *************** *** 18,34 **** } ! .cssUsernameInput { font-family : verdana; font-size : 12pt; font-weight : bold; ! background : url("../img/textBG.gif"); } ! .cssUserInput { font-family : verdana; font-size : 12pt; font-weight : bold; ! width : 92%; ! background : url("../img/textBG.gif"); } --- 24,40 ---- } ! .cssUserInput { font-family : verdana; font-size : 12pt; font-weight : bold; ! width : 92%; ! background : url(../img/textBG.gif); } ! .cssUsernameInput { font-family : verdana; font-size : 12pt; font-weight : bold; ! background : url(../img/textBG.gif); } *************** *** 39,43 **** border-color : #ffffff; background-color : #c0c0c0; ! background-image : url("../img/buttonBG.gif"); color : #000000; } --- 45,49 ---- border-color : #ffffff; background-color : #c0c0c0; ! background : url(../img/buttonBG.gif); color : #000000; } |
From: <fza...@us...> - 2005-11-30 22:04:39
|
Update of /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/dto In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13448/WEB-INF/src/org/apache/struts/apps/ajaxchat/dto Modified Files: RoomDTO.java UserDTO.java Log Message: Index: RoomDTO.java =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/dto/RoomDTO.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RoomDTO.java 29 Nov 2005 23:08:30 -0000 1.1 --- RoomDTO.java 30 Nov 2005 22:04:28 -0000 1.2 *************** *** 32,36 **** * This class is a Data Transfer Object (DTO) that describes a Room. Note that * a few of the methods here do just a tad more than I would generally like in ! * a DAO, but the architecture made sense this way, so I went with it. * * @author <a href="mailto:fza...@om...">Frank W. Zammetti</a>. --- 32,36 ---- * This class is a Data Transfer Object (DTO) that describes a Room. Note that * a few of the methods here do just a tad more than I would generally like in ! * a DTO, but the architecture made sense this way, so I went with it. * * @author <a href="mailto:fza...@om...">Frank W. Zammetti</a>. *************** *** 128,132 **** public void addUser(UserDTO inUser) { ! log.info("RoomDTO addUser()..."); boolean userAlreadyInRoom = false; for (Iterator it = users.iterator(); it.hasNext();) { --- 128,132 ---- public void addUser(UserDTO inUser) { ! log.debug("RoomDTO addUser()..."); boolean userAlreadyInRoom = false; for (Iterator it = users.iterator(); it.hasNext();) { *************** *** 141,145 **** Collections.sort(users); } - log.info("User added to room"); } // End addUser(). --- 141,144 ---- *************** *** 153,157 **** public void removeUser(UserDTO inUser) { ! log.info("RoomDTO removeUser()..."); // Scan through all users until we find the one with the username of the // user passed in and remove the user from the list. --- 152,156 ---- public void removeUser(UserDTO inUser) { ! log.debug("RoomDTO removeUser()..."); // Scan through all users until we find the one with the username of the // user passed in and remove the user from the list. *************** *** 162,166 **** UserDTO user = (UserDTO)it.next(); if (user.getUsername().equalsIgnoreCase(usernameToRemove)) { ! log.info("Found " + usernameToRemove + ", removing..."); indexToRemove = i; } --- 161,165 ---- UserDTO user = (UserDTO)it.next(); if (user.getUsername().equalsIgnoreCase(usernameToRemove)) { ! log.info("Found " + usernameToRemove + ", removing"); indexToRemove = i; } *************** *** 169,175 **** if (indexToRemove != -1) { users.remove(indexToRemove); - log.info(usernameToRemove + " removed"); } - log.info("RoomDTO removeUser() Done"); } // End removeUser(). --- 168,172 ---- *************** *** 185,189 **** public Vector getMessages(Date inDateTime) { ! log.info("RoomDTO getMessages()..."); // Scan through the list of messages for the room and find any that were // posted after the given datetime, add those to a list to return. --- 182,186 ---- public Vector getMessages(Date inDateTime) { ! log.debug("RoomDTO getMessages()..."); // Scan through the list of messages for the room and find any that were // posted after the given datetime, add those to a list to return. *************** *** 192,196 **** MessageDTO message = (MessageDTO)it.next(); if (message.getPostedDateTime().after(inDateTime)) { ! log.info("Returning message : " + message); al.add(message); } --- 189,193 ---- MessageDTO message = (MessageDTO)it.next(); if (message.getPostedDateTime().after(inDateTime)) { ! log.debug("Returning message: " + message); al.add(message); } Index: UserDTO.java =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/dto/UserDTO.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UserDTO.java 29 Nov 2005 23:08:30 -0000 1.1 --- UserDTO.java 30 Nov 2005 22:04:28 -0000 1.2 *************** *** 20,23 **** --- 20,24 ---- import java.lang.reflect.Field; + import java.util.Date; *************** *** 37,40 **** --- 38,52 ---- /** + * This stores the datetime of the last AJAX message received by this user, + * specifically for the getMessages request. When the user enters a room, + * this is set. When they leave the room, it is nulled. The + * UserClearerDaemonThread checks it and if it's not null, it sees if the + * value is older than it's threshold for determining if a user is inactive. + * If it is, the user is removed from all rooms. + */ + private Date lastAJAXRequest; + + + /** * Constructor. * *************** *** 73,76 **** --- 85,112 ---- /** + * Accessor for lastAJAXRequest field. + * + * @return Date Current value of lastAJAXRequest field. + */ + public Date getLastAJAXRequest() { + + return lastAJAXRequest; + + } // End getLastAJAXRequest(). + + + /** + * Mutator for lastAJAXRequest field. + * + * @param inLastAJAXRequest New value of lastAJAXRequest field. + */ + public void setLastAJAXRequest(Date inLastAJAXRequest) { + + lastAJAXRequest = inLastAJAXRequest; + + } // End setLastAJAXRequest(). + + + /** * Used to sort the list of users in the room when a new user joins. * |
From: <fza...@us...> - 2005-11-30 22:04:37
|
Update of /cvsroot/struts/ajaxchat/WEB-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13448/WEB-INF Modified Files: app-config.xml struts-config.xml web.xml Log Message: Index: app-config.xml =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/app-config.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** app-config.xml 29 Nov 2005 23:08:29 -0000 1.1 --- app-config.xml 30 Nov 2005 22:04:25 -0000 1.2 *************** *** 1,3 **** --- 1,4 ---- <config> + <!-- maxMessages is the maximum number of messages that will be stored in --> <!-- the messages collection of each room. Any time a message is posted --> *************** *** 8,10 **** --- 9,23 ---- <!-- efficient too. --> <maxMessages>250</maxMessages> + + <!-- userInactivitySeconds is the maximum number of seconds that can --> + <!-- elapse between AJAX requests before a user is considered inactive. --> + <!-- When a user is considered inactive, they are forcibly removed --> + <!-- from all rooms and from the application. This is to deal with the --> + <!-- case of a user closing the browser window without properly logging --> + <!-- out, or possibly a Javascript error that stops the AJAX request --> + <!-- timers. Note that this was originally done in a SessionListener, --> + <!-- but because of problems seem in some containers, this had to be --> + <!-- done instead. --> + <userInactivitySeconds>15</userInactivitySeconds> + </config> \ No newline at end of file Index: struts-config.xml =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/struts-config.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** struts-config.xml 29 Nov 2005 23:08:29 -0000 1.1 --- struts-config.xml 30 Nov 2005 22:04:25 -0000 1.2 *************** *** 5,8 **** --- 5,9 ---- <struts-config> + <!-- Form Beans --> <form-beans> *************** *** 18,21 **** --- 19,23 ---- </form-beans> + <!-- Mappings --> <action-mappings> *************** *** 66,69 **** --- 68,72 ---- + <!-- Message Resources --> <message-resources parameter="app_resources" /> Index: web.xml =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/web.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** web.xml 29 Nov 2005 23:08:29 -0000 1.1 --- web.xml 30 Nov 2005 22:04:25 -0000 1.2 *************** *** 30,34 **** <filter-mapping> <filter-name>sessionCheckerFilter</filter-name> ! <url-pattern>/*</url-pattern> </filter-mapping> --- 30,34 ---- <filter-mapping> <filter-name>sessionCheckerFilter</filter-name> ! <url-pattern>*.do</url-pattern> </filter-mapping> *************** *** 40,46 **** <listener-class>org.apache.struts.apps.ajaxchat.listener.ContextListener</listener-class> </listener> - <listener> - <listener-class>org.apache.struts.apps.ajaxchat.listener.SessionListener</listener-class> - </listener> <!-- Action Servlet. --> --- 40,43 ---- |
From: <fza...@us...> - 2005-11-30 22:04:37
|
Update of /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/action In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13448/WEB-INF/src/org/apache/struts/apps/ajaxchat/action Modified Files: GetMessagesAction.java JoinRoomAction.java LeaveRoomAction.java ListUsersInRoomAction.java LobbyAction.java LobbyUpdateStatsAction.java LoginAction.java LogoutAction.java PostMessageAction.java Log Message: Index: GetMessagesAction.java =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/action/GetMessagesAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GetMessagesAction.java 29 Nov 2005 23:08:29 -0000 1.1 --- GetMessagesAction.java 30 Nov 2005 22:04:28 -0000 1.2 *************** *** 36,39 **** --- 36,40 ---- import org.apache.struts.apps.ajaxchat.dao.AjaxChatDAO; import org.apache.struts.apps.ajaxchat.dto.MessageDTO; + import org.apache.struts.apps.ajaxchat.dto.UserDTO; *************** *** 67,80 **** HttpServletRequest request, HttpServletResponse response) throws Exception { ! log.info("GetMessagesAction execute()..."); HttpSession session = request.getSession(); synchronized (session) { ! // Get the info from session we need. String roomName = (String)session.getAttribute("roomName"); Date lastDateTime = (Date)session.getAttribute("lastDateTime"); ! log.info("roomName = " + roomName); ! log.info("lastDateTime = " + lastDateTime); // If lastDateTime is null, this is the first request, so we want to --- 68,86 ---- HttpServletRequest request, HttpServletResponse response) throws Exception { ! log.debug("execute()..."); HttpSession session = request.getSession(); synchronized (session) { ! // Record this as the last AJAX request for the user. ! UserDTO user = (UserDTO)session.getAttribute("user"); ! user.setLastAJAXRequest(new Date()); ! session.setAttribute("user", user); ! ! // Get the info we need. String roomName = (String)session.getAttribute("roomName"); Date lastDateTime = (Date)session.getAttribute("lastDateTime"); ! log.debug("roomName = " + roomName); ! log.debug("lastDateTime = " + lastDateTime); // If lastDateTime is null, this is the first request, so we want to *************** *** 86,91 **** // Ask the DAO to get the messages posted subsequent to lastDateTime for // the applicable room. ! AjaxChatDAO dao = AjaxChatDAO.getInstance(); ! Vector messages = dao.getMessages(roomName, lastDateTime); // Now iterate over the collection of messages we got and construct our --- 92,97 ---- // Ask the DAO to get the messages posted subsequent to lastDateTime for // the applicable room. ! AjaxChatDAO dao = AjaxChatDAO.getInstance(); ! Vector messages = dao.getMessages(roomName, lastDateTime); // Now iterate over the collection of messages we got and construct our *************** *** 114,118 **** // Write out XML. ! log.info(xmlOut); response.setContentType("text/xml"); PrintWriter out = response.getWriter(); --- 120,124 ---- // Write out XML. ! log.debug(xmlOut); response.setContentType("text/xml"); PrintWriter out = response.getWriter(); *************** *** 120,125 **** out.flush(); - log.info("GetMessagesAction execute() Done"); - // Response fully formed, nowhere to forward to. return null; --- 126,129 ---- Index: JoinRoomAction.java =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/action/JoinRoomAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JoinRoomAction.java 29 Nov 2005 23:08:29 -0000 1.1 --- JoinRoomAction.java 30 Nov 2005 22:04:28 -0000 1.2 *************** *** 61,65 **** HttpServletRequest request, HttpServletResponse response) throws Exception { ! log.info("JoinRoomAction execute()..."); HttpSession session = request.getSession(); --- 61,65 ---- HttpServletRequest request, HttpServletResponse response) throws Exception { ! log.debug("execute()..."); HttpSession session = request.getSession(); *************** *** 78,83 **** dao.addUserToRoom(roomName, user); - log.info("JoinRoomAction execute() Done"); - return mapping.findForward("showRoom"); --- 78,81 ---- Index: LeaveRoomAction.java =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/action/LeaveRoomAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LeaveRoomAction.java 29 Nov 2005 23:08:29 -0000 1.1 --- LeaveRoomAction.java 30 Nov 2005 22:04:28 -0000 1.2 *************** *** 60,64 **** HttpServletRequest request, HttpServletResponse response) throws Exception { ! log.info("LeaveRoomAction execute()..."); HttpSession session = request.getSession(); --- 60,64 ---- HttpServletRequest request, HttpServletResponse response) throws Exception { ! log.debug("execute()..."); HttpSession session = request.getSession(); *************** *** 71,76 **** dao.removeUserFromRoom(roomName, user); - log.info("LeaveRoomAction execute() Done"); - // Return to the lobby. return mapping.findForward("gotoLobby"); --- 71,74 ---- Index: ListUsersInRoomAction.java =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/action/ListUsersInRoomAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ListUsersInRoomAction.java 29 Nov 2005 23:08:29 -0000 1.1 --- ListUsersInRoomAction.java 30 Nov 2005 22:04:28 -0000 1.2 *************** *** 20,23 **** --- 20,24 ---- import java.io.PrintWriter; + import java.util.Date; import java.util.Iterator; import java.util.Vector; *************** *** 64,91 **** HttpServletRequest request, HttpServletResponse response) throws Exception { ! log.info("ListUsersInRoomAction execute()..."); HttpSession session = request.getSession(); synchronized (session) { // We'll need the name of the room to get a list for. String roomName = (String)request.getSession().getAttribute("roomName"); ! log.info("Getting user list for roomName = " + roomName); // Get user list and create a CSV list from it. AjaxChatDAO dao = AjaxChatDAO.getInstance(); Vector userList = dao.getUserList(roomName); ! log.info("userList = " + userList); StringBuffer xmlOut = new StringBuffer(1024); xmlOut.append("<users>"); for (Iterator it = userList.iterator(); it.hasNext();) { ! UserDTO user = (UserDTO)it.next(); xmlOut.append("<user name=\"" + ! StringEscapeUtils.escapeXml(user.getUsername()) + "\"/>"); } xmlOut.append("</users>"); // Write out XML to response. ! log.info(xmlOut); response.setContentType("text/xml"); PrintWriter out = response.getWriter(); --- 65,97 ---- HttpServletRequest request, HttpServletResponse response) throws Exception { ! log.debug("execute()..."); HttpSession session = request.getSession(); synchronized (session) { + // Record this as the last AJAX request for the user. + UserDTO user = (UserDTO)session.getAttribute("user"); + user.setLastAJAXRequest(new Date()); + session.setAttribute("user", user); + // We'll need the name of the room to get a list for. String roomName = (String)request.getSession().getAttribute("roomName"); ! log.debug("Getting user list for roomName = " + roomName); // Get user list and create a CSV list from it. AjaxChatDAO dao = AjaxChatDAO.getInstance(); Vector userList = dao.getUserList(roomName); ! log.debug("userList = " + userList); StringBuffer xmlOut = new StringBuffer(1024); xmlOut.append("<users>"); for (Iterator it = userList.iterator(); it.hasNext();) { ! UserDTO user1 = (UserDTO)it.next(); xmlOut.append("<user name=\"" + ! StringEscapeUtils.escapeXml(user1.getUsername()) + "\"/>"); } xmlOut.append("</users>"); // Write out XML to response. ! log.debug(xmlOut); response.setContentType("text/xml"); PrintWriter out = response.getWriter(); *************** *** 93,98 **** out.flush(); - log.info("ListUsersInRoomAction execute() Done"); - // Response fully formed, nowhere to forward to. return null; --- 99,102 ---- Index: LobbyAction.java =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/action/LobbyAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LobbyAction.java 29 Nov 2005 23:08:29 -0000 1.1 --- LobbyAction.java 30 Nov 2005 22:04:28 -0000 1.2 *************** *** 62,66 **** HttpServletRequest request, HttpServletResponse response) throws Exception { ! log.info("LobbyAction execute()..."); HttpSession session = request.getSession(); --- 62,66 ---- HttpServletRequest request, HttpServletResponse response) throws Exception { ! log.debug("execute()..."); HttpSession session = request.getSession(); *************** *** 72,77 **** form.setRooms(dao.getRoomList()); - log.info("LobbyAction execute() Done"); - return mapping.findForward("showLobby"); --- 72,75 ---- Index: LobbyUpdateStatsAction.java =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/action/LobbyUpdateStatsAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LobbyUpdateStatsAction.java 29 Nov 2005 23:08:29 -0000 1.1 --- LobbyUpdateStatsAction.java 30 Nov 2005 22:04:28 -0000 1.2 *************** *** 20,23 **** --- 20,24 ---- import java.io.PrintWriter; + import java.util.Date; import java.util.Iterator; import java.util.LinkedHashMap; *************** *** 34,37 **** --- 35,39 ---- import org.apache.struts.apps.ajaxchat.actionform.LobbyActionForm; import org.apache.struts.apps.ajaxchat.dao.AjaxChatDAO; + import org.apache.struts.apps.ajaxchat.dto.UserDTO; *************** *** 68,76 **** HttpServletRequest request, HttpServletResponse response) throws Exception { ! log.info("LobbyAction execute()..."); HttpSession session = request.getSession(); synchronized (session) { // Get the list of rooms. AjaxChatDAO dao = AjaxChatDAO.getInstance(); --- 70,83 ---- HttpServletRequest request, HttpServletResponse response) throws Exception { ! log.debug("execute()..."); HttpSession session = request.getSession(); synchronized (session) { + // Record this as the last AJAX request for the user. + UserDTO user = (UserDTO)session.getAttribute("user"); + user.setLastAJAXRequest(new Date()); + session.setAttribute("user", user); + // Get the list of rooms. AjaxChatDAO dao = AjaxChatDAO.getInstance(); *************** *** 91,95 **** // Write out XML to response. ! log.info(xmlOut); response.setContentType("text/xml"); PrintWriter out = response.getWriter(); --- 98,102 ---- // Write out XML to response. ! log.debug(xmlOut); response.setContentType("text/xml"); PrintWriter out = response.getWriter(); *************** *** 97,102 **** out.flush(); - log.info("LobbyUpdateStatsAction execute() Done"); - return null; --- 104,107 ---- Index: LoginAction.java =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/action/LoginAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LoginAction.java 29 Nov 2005 23:08:29 -0000 1.1 --- LoginAction.java 30 Nov 2005 22:04:28 -0000 1.2 *************** *** 19,22 **** --- 19,23 ---- + import java.util.Date; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; *************** *** 63,73 **** HttpServletRequest request, HttpServletResponse response) throws Exception { ! log.info("LoginAction execute()..."); HttpSession session = request.getSession(); synchronized (session) { // Get the username the user entered. String username = (String)request.getParameter("username"); ActionForward af = null; --- 64,76 ---- HttpServletRequest request, HttpServletResponse response) throws Exception { ! log.debug("execute()..."); HttpSession session = request.getSession(); + log.info("session = " + session); synchronized (session) { // Get the username the user entered. String username = (String)request.getParameter("username"); + log.info("username = " + username); ActionForward af = null; *************** *** 76,80 **** // User is already logged in, they probably hit refresh while in the // lobby, so go there now. ! log.info("User already logged in, going to lobby"); af = mapping.findForward("gotoLobby"); } else { --- 79,93 ---- // User is already logged in, they probably hit refresh while in the // lobby, so go there now. ! log.info("User already logged in"); ! // There is still a minor potential problem... if by chance the user ! // was logged in and the app was restarted and sessions were persisted, ! // the user object in session can be null. So, we'll check for that, ! // and recreate the user if applicable. ! if (session.getAttribute("user") == null) { ! log.info("User object null in session, so recreating"); ! UserDTO user = new UserDTO(username); ! user.setLastAJAXRequest(new Date()); ! session.setAttribute("user", user); ! } af = mapping.findForward("gotoLobby"); } else { *************** *** 90,93 **** --- 103,107 ---- if (AjaxChatDAO.getInstance().isUsernameInUse(username)) { // The username is already in use, so they can't have it. + log.info("Username already in use"); ActionMessages msgs = new ActionMessages(); msgs.add(ActionMessages.GLOBAL_MESSAGE, *************** *** 97,102 **** } else { // Everything is OK, so create a new UserDTO and put it in session. ! log.info("Username entered"); UserDTO user = new UserDTO(username); session.setAttribute("user", user); session.setAttribute("isLoggedIn", "yes"); --- 111,117 ---- } else { // Everything is OK, so create a new UserDTO and put it in session. ! log.info("Username being logged in"); UserDTO user = new UserDTO(username); + user.setLastAJAXRequest(new Date()); session.setAttribute("user", user); session.setAttribute("isLoggedIn", "yes"); *************** *** 108,112 **** } ! log.info("LoginAction execute() Done"); return af; --- 123,127 ---- } ! log.info("LoginAction complete, forwarding to " + af); return af; Index: LogoutAction.java =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/action/LogoutAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LogoutAction.java 29 Nov 2005 23:08:29 -0000 1.1 --- LogoutAction.java 30 Nov 2005 22:04:28 -0000 1.2 *************** *** 62,66 **** HttpServletRequest request, HttpServletResponse response) throws Exception { ! log.info("LogoutAction execute()..."); HttpSession session = request.getSession(); --- 62,66 ---- HttpServletRequest request, HttpServletResponse response) throws Exception { ! log.debug("execute()..."); HttpSession session = request.getSession(); *************** *** 68,74 **** // Not much to do, just invalidate the session and log the user out as far ! // as our DAO goes. ! UserDTO user = (UserDTO)request.getSession().getAttribute("user"); ! AjaxChatDAO.getInstance().logUserOut(user); request.getSession().invalidate(); --- 68,78 ---- // Not much to do, just invalidate the session and log the user out as far ! // as our DAO goes. We'll also make the call to remove the user from ! // all rooms, just to be 100% sure they don't linger (shouldn't be any ! // chance of that at this point, but just call me overly anal!) ! UserDTO user = (UserDTO)request.getSession().getAttribute("user"); ! AjaxChatDAO dao = AjaxChatDAO.getInstance(); ! dao.removeUserFromAllRooms(user); ! dao.logUserOut(user); request.getSession().invalidate(); *************** *** 79,84 **** saveErrors(request, msgs); - log.info("LogoutAction execute() Done"); - return mapping.findForward("gotoWelcome"); --- 83,86 ---- Index: PostMessageAction.java =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/action/PostMessageAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PostMessageAction.java 29 Nov 2005 23:08:29 -0000 1.1 --- PostMessageAction.java 30 Nov 2005 22:04:28 -0000 1.2 *************** *** 29,36 **** import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.apps.ajaxchat.dao.AjaxChatDAO; import org.apache.struts.apps.ajaxchat.dto.MessageDTO; import org.apache.struts.apps.ajaxchat.dto.UserDTO; - import org.apache.struts.action.DynaActionForm; --- 29,36 ---- import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; + import org.apache.struts.action.DynaActionForm; import org.apache.struts.apps.ajaxchat.dao.AjaxChatDAO; import org.apache.struts.apps.ajaxchat.dto.MessageDTO; import org.apache.struts.apps.ajaxchat.dto.UserDTO; *************** *** 63,73 **** HttpServletRequest request, HttpServletResponse response) throws Exception { ! log.info("PostMessageAction execute()..."); HttpSession session = request.getSession(); synchronized (session) { ! // Get the users' name, message text and room they are in. UserDTO user = (UserDTO)session.getAttribute("user"); String username = user.getUsername(); String roomName = (String)session.getAttribute("roomName"); --- 63,76 ---- HttpServletRequest request, HttpServletResponse response) throws Exception { ! log.debug("execute()..."); HttpSession session = request.getSession(); synchronized (session) { ! // Get the users' name, message text and room they are in, and record ! // this as the last AJAX request for the user. UserDTO user = (UserDTO)session.getAttribute("user"); + user.setLastAJAXRequest(new Date()); + session.setAttribute("user", user); String username = user.getUsername(); String roomName = (String)session.getAttribute("roomName"); *************** *** 83,88 **** dao.postMessage(roomName, message); - log.info("PostMessageAction execute() Done"); - // There isn't actually anything to return from this function. return null; --- 86,89 ---- |
From: <fza...@us...> - 2005-11-30 22:04:37
|
Update of /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/daemon In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13448/WEB-INF/src/org/apache/struts/apps/ajaxchat/daemon Added Files: UserClearerDaemonThread.java package.html Log Message: --- NEW FILE: UserClearerDaemonThread.java --- /* * Copyright 2005 Frank W. Zammetti * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT 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.struts.apps.ajaxchat.daemon; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.struts.apps.ajaxchat.AjaxChatConfig; import org.apache.struts.apps.ajaxchat.dao.AjaxChatDAO; /** * This thread executes every X seconds and checks for inactive users. If a * user is found to be inactive, they are removed from any room they are in, * as well as from the app itself. Inactivity is determined by looking at the * lastAJAXRequest field of the user object. If it is more than X seconds old, * the user is considered inactive. * * @author <a href="mailto:fra...@pf...">Frank W. Zammetti</a> */ public class UserClearerDaemonThread extends Thread { /** * Log instance. */ private static Log log = LogFactory.getLog(UserClearerDaemonThread.class); /** * Main thread run method. */ public void run() { while (true) { try { log.info("UserClearerDaemonThread executing next iteration..."); // The DAO actually does all the heavy lifting, so give it a call. AjaxChatDAO dao = AjaxChatDAO.getInstance(); dao.removeInactiveUsers(); // Sleep for X seconds as configured. sleep(AjaxChatConfig.getUserInactivitySeconds() * 1000); } catch (Exception e) { log.error("An exception occurred in UserClearerDaemonThread: " + e); e.printStackTrace(); } // End try } // End while } // End run() } // End Class --- NEW FILE: package.html --- <body> The org.apache.struts.apps.ajaxchat.daemon package contains the UserClearerDaemonThread, which is a background thread that runs to properly clear out users in various situations. </body> |
From: <fza...@us...> - 2005-11-30 22:04:36
|
Update of /cvsroot/struts/ajaxchat/WEB-INF/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13448/WEB-INF/classes Modified Files: app_resources_en.properties Log Message: Index: app_resources_en.properties =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/classes/app_resources_en.properties,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** app_resources_en.properties 29 Nov 2005 23:08:29 -0000 1.1 --- app_resources_en.properties 30 Nov 2005 22:04:26 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- + app.version=1.0 Alpha 2 messages.usernameBlank=There is a problem with the Username you entered - You must enter a Username messages.usernameContainsComma=There is a problem with the Username you entered - Username cannot contain commas (,) |
From: <fza...@us...> - 2005-11-30 22:04:36
|
Update of /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/filter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13448/WEB-INF/src/org/apache/struts/apps/ajaxchat/filter Modified Files: SessionCheckerFilter.java Log Message: Index: SessionCheckerFilter.java =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/filter/SessionCheckerFilter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SessionCheckerFilter.java 29 Nov 2005 23:08:30 -0000 1.1 --- SessionCheckerFilter.java 30 Nov 2005 22:04:28 -0000 1.2 *************** *** 82,88 **** FilterChain filterChain) throws ServletException, IOException { ! log.info("SessionCheckerFilter doFilter()..."); ! String path = ((HttpServletRequest)request).getServletPath(); log.info("path = " + path); if (path.indexOf("index") == -1 && path.indexOf("login") == -1 && --- 82,89 ---- FilterChain filterChain) throws ServletException, IOException { ! log.debug("doFilter()..."); ! String path = ! (((HttpServletRequest)request).getServletPath()).toLowerCase(); log.info("path = " + path); if (path.indexOf("index") == -1 && path.indexOf("login") == -1 && *************** *** 99,109 **** new ActionMessage("messages.sessionTimedOut")); request.setAttribute(Globals.ERROR_KEY, msgs); ! log.info("SessionCheckerFilter Not logged in, " + ! "forwarding to welcome..."); request.getRequestDispatcher("/index.jsp").forward(request, response); return; } else { // User *IS* logged in, so request can continue as usual. ! log.info("SessionCheckerFilter Done (logged in)"); filterChain.doFilter(request, response); } --- 100,109 ---- new ActionMessage("messages.sessionTimedOut")); request.setAttribute(Globals.ERROR_KEY, msgs); ! log.info("Not logged in, forwarding to welcome..."); request.getRequestDispatcher("/index.jsp").forward(request, response); return; } else { // User *IS* logged in, so request can continue as usual. ! log.info("User logged in, request continuing"); filterChain.doFilter(request, response); } *************** *** 111,115 **** // Requested path is one of the ones we need to ignore, so request can // continue as usual, we don't care yet if the user is logged in or not. ! log.info("SessionCheckerFilter Done (ignored path " + path + ")"); filterChain.doFilter(request, response); } --- 111,115 ---- // Requested path is one of the ones we need to ignore, so request can // continue as usual, we don't care yet if the user is logged in or not. ! log.info("Ignored path " + path); filterChain.doFilter(request, response); } |
From: <fza...@us...> - 2005-11-30 22:04:36
|
Update of /cvsroot/struts/ajaxchat/WEB-INF/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13448/WEB-INF/src Modified Files: build.xml Added Files: history.txt Log Message: --- NEW FILE: history.txt --- v1.0 alpha 2 11/30/2005 ------------ * Removed SessionListener and implemented UserClearerDaemonThread. This is to deal with the fact that some servlet containers don't seem to handle SessionListeners in the way we need them to be handled here, and hence they can't be used to deal with inactive users (i.e., users who close their browser without properly logging out). This thread does that. * Removed some superfluous logging and changed log messages to go to proper levels (they were all set to info level before, which was easier during development, but isn't proper now). Also generally cleaned up logging to be more useful throughout. * Added Commons Validator JAR to lib directory. This is needed on some app servers (like Resin, where the live demo runs). * Cleaned up and expanded comments throughout. * Modified build script so distro task works properly. This can now be used to generate a WAR that is ready to deploy (note that the WAR *does* include the src folder). The WAR is then zipped up and appropriately named for distribution on the Struts Apps SourceForge page. Nice and easy for me! :) * Added a version number display to the welcome and lobby screens. This is more for me so that I can tell when Resin has deployed an updated WAR on the server where the live demo runs. * Cleaned up the user controls available in the chat room (i.e., lined things up, reorganized them, etc.) * Remapped filter to only paths ending in .do. v1.0 alpha 11/29/2005 ---------- * Initial release. Index: build.xml =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/build.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** build.xml 29 Nov 2005 23:08:29 -0000 1.1 --- build.xml 30 Nov 2005 22:04:27 -0000 1.2 *************** *** 6,13 **** <!-- ****************************************************************** --> <!-- "javadocs" is the directory where generated javadocs will be --> ! <!-- placed if the javadoc task is executed. --> <property name="javadocs" value="javadocs" /> <!-- "project_version" is, obviously, the version of the app! --> ! <property name="project_version" value="1.0" /> <!-- "proxy_host" is the address of the proxy server that will be --> <!-- used to download dependencies, if a proxy is required on your --> --- 6,14 ---- <!-- ****************************************************************** --> <!-- "javadocs" is the directory where generated javadocs will be --> ! <!-- placed if the javadoc task is executed. This is relative to --> ! <!-- the basedir of this script. --> <property name="javadocs" value="javadocs" /> <!-- "project_version" is, obviously, the version of the app! --> ! <property name="project_version" value="1.0_alpha2" /> <!-- "proxy_host" is the address of the proxy server that will be --> <!-- used to download dependencies, if a proxy is required on your --> *************** *** 21,26 **** <!-- "distro_dir" is the directory where the generated distribution --> <!-- file will be placed as a result of executing the optional distro --> ! <!-- target. --> ! <property name="distro_dir" value="c:\temp" /> --- 22,31 ---- <!-- "distro_dir" is the directory where the generated distribution --> <!-- file will be placed as a result of executing the optional distro --> ! <!-- target. This should be an absolute path, NOT relative to the --> ! <!-- basedir of this script. Note that the directory named here --> ! <!-- WILL BE RECREATED PRIOR TO THE DISTRO BEING BUILT, so don't set --> ! <!-- this to something stupid like c:\windows or something that --> ! <!-- otherwise has content you don't want to lose!! --> ! <property name="distro_dir" value="c:\temp\ajaxchat" /> *************** *** 44,49 **** <get_dependencies /> <antcall target="compile" inheritRefs="true" /> ! <!--<antcall target="checkstyle" inheritRefs="true" />--> ! <!--<antcall target="javadocs" inheritRefs="true" />--> </target> --- 49,54 ---- <get_dependencies /> <antcall target="compile" inheritRefs="true" /> ! <antcall target="checkstyle" inheritRefs="true" /> ! <antcall target="javadocs" inheritRefs="true" /> </target> *************** *** 68,72 **** <dependency group="antlr" version="2.7.5" /> <dependency group="regexp" version="1.3" /> - <dependency group="commons-beanutils" version="1.7.0" /> </dependencies> <echo message="Done" /> --- 73,76 ---- *************** *** 142,153 **** <target name="distro"> <echo message="Making distros..." /> ! <delete file="${distro_dir}/ajaxchat_${project_version_filename}.zip" /> <jar destfile="${distro_dir}/ajaxchat.war" basedir="../" /> ! <zip destfile="${distro_dir}/ajaxchat_${project_version_filename}.zip" basedir="${distro_dir}"> ! <include name="ajaxchat.zip" /> </zip> ! <checksum file="${distro_dir}/ajaxchat_${project_version_filename}.zip" forceOverwrite="yes"/> <echo message="Done" /> </target> --- 146,161 ---- <target name="distro"> <echo message="Making distros..." /> ! <antcall target="clean" inheritRefs="true" /> ! <antcall target="build" inheritRefs="true" /> ! <delete dir="${distro_dir}" /> ! <mkdir dir="${distro_dir}" /> <jar destfile="${distro_dir}/ajaxchat.war" basedir="../" /> ! <zip destfile="${distro_dir}/ajaxchat_${project_version}.zip" basedir="${distro_dir}"> ! <include name="ajaxchat.war" /> </zip> ! <checksum file="${distro_dir}/ajaxchat_${project_version}.zip" forceOverwrite="yes"/> + <delete file="${distro_dir}/ajaxchat.war" /> <echo message="Done" /> </target> |
From: <fza...@us...> - 2005-11-30 22:04:36
|
Update of /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/listener In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13448/WEB-INF/src/org/apache/struts/apps/ajaxchat/listener Modified Files: ContextListener.java Log Message: Index: ContextListener.java =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/listener/ContextListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ContextListener.java 29 Nov 2005 23:08:30 -0000 1.1 --- ContextListener.java 30 Nov 2005 22:04:28 -0000 1.2 *************** *** 25,28 **** --- 25,29 ---- import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.apache.struts.apps.ajaxchat.daemon.UserClearerDaemonThread; import org.apache.struts.apps.ajaxchat.dao.AjaxChatDAO; *************** *** 57,61 **** public void contextInitialized(ServletContextEvent event) { ! log.info("ContextListener contextInitialized()..."); // Initialize DAO. --- 58,62 ---- public void contextInitialized(ServletContextEvent event) { ! log.debug("contextInitialized()..."); // Initialize DAO. *************** *** 68,72 **** dao.init(isConfigFile); ! log.info("ContextListener Done"); } // End contextInitialized(); --- 69,83 ---- dao.init(isConfigFile); ! // Lastly, start a background daemon thread that will periodically clear ! // out inactive users from rooms. This was originally done via ! // SessionListener, but because of some problems seem in some container ! // implementations (Resin, I'm looking at you!), this had to be done ! // instead. ! Thread userClearerDaemonThread = new UserClearerDaemonThread(); ! userClearerDaemonThread.setPriority(Thread.MIN_PRIORITY); ! userClearerDaemonThread.setDaemon(true); ! userClearerDaemonThread.start(); ! ! log.info("AjaxChat configured and ready for use"); } // End contextInitialized(); |
From: <fza...@us...> - 2005-11-30 22:04:36
|
Update of /cvsroot/struts/ajaxchat/WEB-INF/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13448/WEB-INF/lib Added Files: commons-validator-1.0.2.jar Log Message: --- NEW FILE: commons-validator-1.0.2.jar --- (This appears to be a binary file; contents omitted.) |
From: <fza...@us...> - 2005-11-30 22:04:35
|
Update of /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13448/WEB-INF/src/org/apache/struts/apps/ajaxchat Modified Files: AjaxChatConfig.java Log Message: Index: AjaxChatConfig.java =================================================================== RCS file: /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat/AjaxChatConfig.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AjaxChatConfig.java 29 Nov 2005 23:08:29 -0000 1.1 --- AjaxChatConfig.java 30 Nov 2005 22:04:27 -0000 1.2 *************** *** 40,43 **** --- 40,51 ---- /** + * The maximum number of time, in seconds, that can elapse between AJAX + * requests from a given user before they are considered inactive and will be + * forcibly removed. + */ + private static int userInactivitySeconds; + + + /** * Constructor. */ *************** *** 73,76 **** --- 81,110 ---- /** + * Return the userInactivitySeconds field. + * + * @return Max number of seconds that can elapse between AJAX requests + * before a user is considered inactive. + */ + public static int getUserInactivitySeconds() { + + return userInactivitySeconds; + + } // End getUserInactivitySeconds(). + + + /** + * Set the userInactivitySeconds field. + * + * @param inUserInactivitySeconds New value of the userInactivitySeconds + * field. + */ + public void setUserInactivitySeconds(int inUserInactivitySeconds) { + + userInactivitySeconds = inUserInactivitySeconds; + + } // End setUserInactivitySeconds(). + + + /** * Overriden toString method. * |