fix the servlet mappings in web.xml. make everything uncachable.

This commit is contained in:
Andy Janata 2012-03-13 00:42:07 -07:00
parent 2931fb7492
commit 1b465bad8f
6 changed files with 11 additions and 17 deletions

View File

@ -8,19 +8,19 @@
</welcome-file-list> </welcome-file-list>
<servlet> <servlet>
<servlet-name>TestServlet</servlet-name> <servlet-name>TestServlet</servlet-name>
<servlet-class>net.socialgamer.cah.TestServlet</servlet-class> <servlet-class>net.socialgamer.cah.servlets.TestServlet</servlet-class>
</servlet> </servlet>
<servlet> <servlet>
<servlet-name>LongPollServlet</servlet-name> <servlet-name>LongPollServlet</servlet-name>
<servlet-class>net.socialgamer.cah.LongPollServlet</servlet-class> <servlet-class>net.socialgamer.cah.servlets.LongPollServlet</servlet-class>
</servlet> </servlet>
<servlet> <servlet>
<servlet-name>AjaxServlet</servlet-name> <servlet-name>AjaxServlet</servlet-name>
<servlet-class>net.socialgamer.cah.AjaxServlet</servlet-class> <servlet-class>net.socialgamer.cah.servlets.AjaxServlet</servlet-class>
</servlet> </servlet>
<servlet> <servlet>
<servlet-name>Schema</servlet-name> <servlet-name>Schema</servlet-name>
<servlet-class>net.socialgamer.cah.Schema</servlet-class> <servlet-class>net.socialgamer.cah.servlets.Schema</servlet-class>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>TestServlet</servlet-name> <servlet-name>TestServlet</servlet-name>
@ -47,10 +47,6 @@
</filter> </filter>
<filter-mapping> <filter-mapping>
<filter-name>SetCacheControl</filter-name> <filter-name>SetCacheControl</filter-name>
<url-pattern>/js/*</url-pattern> <url-pattern>/*</url-pattern>
<url-pattern>*.js</url-pattern>
<url-pattern>*.css</url-pattern>
<url-pattern>*.html</url-pattern>
<url-pattern>*.jsp</url-pattern>
</filter-mapping> </filter-mapping>
</web-app> </web-app>

View File

@ -199,7 +199,7 @@ cah.$.LongPollEvent.NEW_PLAYER = "np";
cah.$.LongPollEvent.GAME_PLAYER_JOIN = "gpj"; cah.$.LongPollEvent.GAME_PLAYER_JOIN = "gpj";
cah.$.LongPollEvent.GAME_LIST_REFRESH = "glr"; cah.$.LongPollEvent.GAME_LIST_REFRESH = "glr";
cah.$.LongPollEvent.GAME_ROUND_COMPLETE = "grc"; cah.$.LongPollEvent.GAME_ROUND_COMPLETE = "grc";
cah.$.LongPollEvent.NOOP = "0"; cah.$.LongPollEvent.NOOP = "_";
cah.$.LongPollEvent.GAME_PLAYER_INFO_CHANGE = "gpic"; cah.$.LongPollEvent.GAME_PLAYER_INFO_CHANGE = "gpic";
cah.$.LongPollEvent.GAME_BLACK_RESHUFFLE = "gbr"; cah.$.LongPollEvent.GAME_BLACK_RESHUFFLE = "gbr";
cah.$.LongPollEvent.GAME_WHITE_RESHUFFLE = "gwr"; cah.$.LongPollEvent.GAME_WHITE_RESHUFFLE = "gwr";

View File

@ -61,6 +61,7 @@ cah.longpoll.EventHandlers = {};
cah.longpoll.longPoll = function() { cah.longpoll.longPoll = function() {
cah.log.debug("starting long poll"); cah.log.debug("starting long poll");
$.ajax({ $.ajax({
cache : false,
complete : cah.longpoll.complete, complete : cah.longpoll.complete,
error : cah.longpoll.error, error : cah.longpoll.error,
success : cah.longpoll.done, success : cah.longpoll.done,

View File

@ -20,11 +20,9 @@ public class CacheControlFilter implements Filter {
final HttpServletResponse resp = (HttpServletResponse) response; final HttpServletResponse resp = (HttpServletResponse) response;
// 1 hour resp.setHeader("Expires", "Tue, 03 Jul 2001 06:00:00 GMT");
resp.setHeader("Expires",
new Date(System.currentTimeMillis() + (60L * 60L * 1000L)).toString());
resp.setHeader("Last-Modified", new Date().toString()); resp.setHeader("Last-Modified", new Date().toString());
resp.setHeader("Cache-Control", "must-revalidate, max-age=3600"); resp.setHeader("Cache-Control", "must-revalidate, max-age=0");
chain.doFilter(request, response); chain.doFilter(request, response);
} }

View File

@ -328,7 +328,7 @@ public class Constants {
* There has been no other action to inform the client about in a certain timeframe, so inform * There has been no other action to inform the client about in a certain timeframe, so inform
* the client that we have nothing to inform them so the client doesn't think we went away. * the client that we have nothing to inform them so the client doesn't think we went away.
*/ */
NOOP("0"), NOOP("_"),
PLAYER_LEAVE("pl"); PLAYER_LEAVE("pl");
private final String event; private final String event;

View File

@ -36,14 +36,13 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import net.socialgamer.cah.Constants;
import net.socialgamer.cah.StartupUtils;
import net.socialgamer.cah.Constants.AjaxOperation; import net.socialgamer.cah.Constants.AjaxOperation;
import net.socialgamer.cah.Constants.AjaxRequest; import net.socialgamer.cah.Constants.AjaxRequest;
import net.socialgamer.cah.Constants.AjaxResponse; import net.socialgamer.cah.Constants.AjaxResponse;
import net.socialgamer.cah.Constants.ErrorCode; import net.socialgamer.cah.Constants.ErrorCode;
import net.socialgamer.cah.Constants.ReturnableData; import net.socialgamer.cah.Constants.ReturnableData;
import net.socialgamer.cah.Constants.SessionAttribute; import net.socialgamer.cah.Constants.SessionAttribute;
import net.socialgamer.cah.StartupUtils;
import net.socialgamer.cah.data.User; import net.socialgamer.cah.data.User;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;