|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.niggle.servlet.ServletInteraction
An abstract class that encapsulates the various paths of execution involved in fulfilling a servlet request. What is here is meant to be generic to the "typical" web app. Application-specific functionality will be supplied by concrete subclasses.
Field Summary | |
protected java.lang.String |
action
name of the current action being executed by this ServletInteraction instance |
NiggleConfig |
config
The information that contains the niggle servlet config info. |
protected boolean |
hasRedirected
Indicates whether we handled the request by redirecting. |
protected java.util.Locale |
locale
locale of the server, ideally of the user |
protected Page |
page
The Page template object that we are working with. |
javax.servlet.http.HttpServletRequest |
request
|
javax.servlet.http.HttpServletResponse |
response
Our HTML response back to the user. |
protected boolean |
sessionCreated
Did we create a new session? used for logging purposes. |
protected java.lang.String |
sessionID
numeric session id. |
protected java.lang.String |
suppInfoParam
a parameter from the servlet request used to hold supplemental information |
protected java.lang.String |
userID
Login ID of the current user. |
Fields inherited from interface com.niggle.servlet.NiggleConstants |
ACTION_KEY, ERROR_TEMPLATE, LOGIN_TEMPLATE, LOGOUT_CONFIRM_TEMPLATE, MESSAGE_TEMPLATE, PASSWORD_KEY, SESSION_ID_KEY, SESSION_MANAGER_KEY, SESSION_STORE_FILENAME, SUPP_INFO_PARAM_KEY, USER_ID_KEY |
Constructor Summary | |
ServletInteraction(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
NiggleConfig config)
|
Method Summary | |
protected boolean |
checkSessionInfo()
Method to call if a given action requires a valid session. |
protected void |
createNewSession()
|
protected void |
dispatch()
Dispatches the request based on the action This actually delegates to the NiggleConfig object that does some reflective magic to invoke the method this.execFoo() for action "foo". |
protected void |
displayError(java.lang.String nextAction,
java.lang.String title,
java.lang.String message)
|
protected void |
displayLogin()
Throw up the login page template, |
protected void |
displayMessage(java.lang.String nextAction,
java.lang.String title,
java.lang.String message)
|
void |
execDefault()
default handler for requests in which no action is defined. |
void |
execLogin()
default handler for the "login" action. |
void |
execLogout()
default logout handler. |
void |
execStatic()
A default handler for "action=static", which will simply display a static page. |
protected void |
exposeDefaultVariables()
A hook that can be overridden to make sure that certain top-level template variables get exposed. |
java.util.Locale |
getLocale()
|
protected Page |
getPage(java.lang.String template)
|
java.lang.String |
getParameter(java.lang.String s)
Check for presence of data field in CGI input. |
java.lang.String |
getURL(java.lang.String action)
Builds complete URL with query string corresponding to the given action and current context. |
static boolean |
hasContent(java.lang.String s)
check for empty strings. |
boolean |
hasParameter(java.lang.String param)
|
protected boolean |
hasSession()
Indicates whether we have a session. |
protected boolean |
hasValidLoginInfo()
Override this method to check whether the servlet request has the info for a login (thus allowing us to create a new session). |
protected void |
invalidateSession()
|
protected void |
output()
Finally output the page as a result of a servlet interaction We also touch the user's session if there is a sessionID. |
protected void |
recover(java.io.IOException e)
override this method to provide some default exception handling for when an execXXX method fails for whatever reason. |
protected void |
redirectAction(java.lang.String action)
redirects the browser to the URL corresponding to a given action. |
protected void |
reexposeServletParams()
A convenient method that exposes all of the servlet request's parameters as template variables |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public final javax.servlet.http.HttpServletRequest request
public final javax.servlet.http.HttpServletResponse response
public final NiggleConfig config
protected java.lang.String sessionID
protected boolean sessionCreated
protected java.lang.String userID
protected java.lang.String suppInfoParam
protected java.util.Locale locale
protected java.lang.String action
protected Page page
protected boolean hasRedirected
Constructor Detail |
public ServletInteraction(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, NiggleConfig config) throws java.io.IOException
Method Detail |
public final java.util.Locale getLocale()
protected void displayMessage(java.lang.String nextAction, java.lang.String title, java.lang.String message) throws java.io.IOException
protected void displayError(java.lang.String nextAction, java.lang.String title, java.lang.String message) throws java.io.IOException
protected void displayLogin() throws java.io.IOException
public java.lang.String getURL(java.lang.String action)
public java.lang.String getParameter(java.lang.String s)
public boolean hasParameter(java.lang.String param)
protected void invalidateSession() throws java.io.IOException
public static boolean hasContent(java.lang.String s)
protected void output() throws java.io.IOException
protected void createNewSession() throws java.io.IOException
protected boolean checkSessionInfo() throws java.io.IOException
protected void exposeDefaultVariables() throws java.io.IOException
public void execLogin() throws java.io.IOException
public void execLogout() throws java.io.IOException
public void execStatic() throws java.io.IOException
public void execDefault() throws java.io.IOException
protected Page getPage(java.lang.String template) throws java.io.IOException
protected boolean hasSession()
protected void redirectAction(java.lang.String action) throws java.io.IOException
protected void reexposeServletParams()
protected boolean hasValidLoginInfo() throws java.io.IOException
protected void dispatch() throws java.io.IOException
protected void recover(java.io.IOException e) throws java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |