This week has been going well. I’ve done some updates to the Action superclass that allows for redirecting before we complete the action. There is still work to be done on the Mod Control Panel, but Actions are in a working state again.
The checks we need right now, but not the ones we deserve.
Action now has 2 booleans: showLogin, requiresUser and requiresGame. showLogin is true, and the other two are false by default. These may be changed in the constructor of the given Action.
showLogin is used to format the header JSP on every page. If this flag is unset, it will add a value to the request and the header will not show the login options. Currently, the only place that sets this to false is the Registration Page, all other pages show the login information.
requiresUser and requiresGame are used to check if those values are set in the session. If they are not (or if there is no session at all) then we redirect everything back to the homepage.
Action.act and Action.init
Action.act simply calls Action.init and Action.perform. Action.perform has not been changed. Action.init does the checking for showLogin, requiresUser and requiresGame as well as handles the redirecting
Redirecting like a boss
There was a small issue noticed immediately after implementing the above change. If we had to do a redirect, then the router servlet would still try to redirect to the appropriate JSP for that action, and throw an exception. The response may only be redirected once, and this broke that.
The fix is that Action.init returns a Boolean for whether or not it redirected the page, and then Action.act returns that to the RouterServlet. That way, if it redirected, then we will not run the action or attempt to redirect again.
Things are looking good this week, even though we don’t have many more JSPs yet. The Actions look much sexier. Things I still want to investigate over the weekend include:
– Completing Moderator Control Panel
– Draw diagrams for site navigation by users (both appearance and functionality)
– Research File Uploading more – We still don’t process images that are sent in via the Registration page