|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.revusky.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 associated with this request |
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 javax.servlet.http.HttpSession |
session
Our session, assuming we have one, and we are using the servlet womb's default session-tracking scheme. |
protected java.lang.String |
sessionID
The session ID. |
protected java.lang.String |
userID
Login ID of the current user. |
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 boolean |
createNewSession()
Method that creates a new session. |
protected void |
deduceAction()
A hook that you might want to override if you want to change the default scheme for how we decide what the current action is. |
protected void |
deduceLocale()
A hook that you might want to override if you want to be more sophisticated about how you decide what the preferred locale for the request is. |
protected void |
deduceSessionInfo()
A hook that you might want to override if you want to change the default scheme for session tracking. |
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". |
void |
execDefault()
A default handler that simply displays the default template, index.nhtml. |
protected void |
exposeActionURL(java.lang.String action)
|
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. wrapper for the ServletRequest's getParameter method returns "" instead of null if the param is not found, avoids annoying glitches. |
java.lang.String |
getURL(java.lang.String action)
Builds the URL that corresponds to a given action. |
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 java.lang.String |
methodNameFromAction(java.lang.String action)
Override this if you want to change the default execXXX naming scheme. |
protected void |
navigationError()
A convenient method to override if you want to handle this kind of condition more gracefully. |
protected void |
output()
Finally output the page as a result of a servlet interaction |
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 convenience method to expose all of the servlet request's parameters as template variables |
protected void |
unauthorized()
default method to tell the user she's not authorized. |
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 javax.servlet.http.HttpSession session
protected java.lang.String sessionID
protected java.lang.String userID
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 |
protected void deduceLocale()
protected void deduceAction()
getURL(java.lang.String)
protected void deduceSessionInfo()
protected java.lang.String methodNameFromAction(java.lang.String action)
public final java.util.Locale getLocale()
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)
public static boolean hasContent(java.lang.String s)
protected void output() throws java.io.IOException
protected boolean createNewSession() throws java.io.IOException
protected boolean checkSessionInfo() throws java.io.IOException
protected void exposeDefaultVariables() throws java.io.IOException
protected void unauthorized() throws java.io.IOException
protected void navigationError() 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 void exposeActionURL(java.lang.String action)
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 |