|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectshared.HelperBaseCh4
public abstract class HelperBaseCh4
HelperBase class that is used in Chapter 4. It is also the super class for all the other helper base classes.
| Nested Class Summary | |
|---|---|
protected static class |
HelperBaseCh4.SessionData
Enumeration to describe if the data should be read from the session. |
| Field Summary | |
|---|---|
protected org.apache.log4j.Logger |
logger
Member variable for the logger object |
protected javax.servlet.http.HttpServletRequest |
request
Member variable for the request object |
protected javax.servlet.http.HttpServletResponse |
response
Member variable for the response object |
| Constructor Summary | |
|---|---|
HelperBaseCh4(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Initialise the request, response and logger. |
|
| Method Summary | |
|---|---|
void |
addHelperToSession(java.lang.String name,
boolean checkSession)
Overridden method that accepts a boolean value. |
void |
addHelperToSession(java.lang.String name,
HelperBaseCh4.SessionData state)
Test if the old helper data should be retrieved. |
protected abstract void |
copyFromSession(java.lang.Object helper)
Abstract method that must be defined in the controller helper. |
protected void |
doGet()
Default doGet method that prints a warning message, if called. |
protected void |
doPost()
Default doPost method that prints a warning message, if called. |
protected java.lang.String |
executeButtonMethod()
Find the method associated with a button name. |
protected java.lang.String |
executeButtonMethod(java.lang.Class clazz,
boolean searchForDefault)
Overridden method that accepts the parent class of the class heirarchy for the current object. |
void |
fillBeanFromRequest(java.lang.Object data)
Copy the request data to the bean. |
protected java.lang.String |
invokeButtonMethod(java.lang.reflect.Method buttonMethod)
Execute the found method. |
static void |
writeError(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String title,
java.lang.Exception ex)
Write an error page, instead of calling a JSP. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected javax.servlet.http.HttpServletRequest request
protected javax.servlet.http.HttpServletResponse response
protected org.apache.log4j.Logger logger
| Constructor Detail |
|---|
public HelperBaseCh4(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
request - Request information encapsulated in a Java objectresponse - Response information encapsulated in a Java object| Method Detail |
|---|
protected void doGet()
throws javax.servlet.ServletException,
java.io.IOException
javax.servlet.ServletException
java.io.IOException
protected void doPost()
throws javax.servlet.ServletException,
java.io.IOException
javax.servlet.ServletException
java.io.IOExceptionprotected abstract void copyFromSession(java.lang.Object helper)
helper - The old helper from the session
public void addHelperToSession(java.lang.String name,
HelperBaseCh4.SessionData state)
name - The name to use to store the helper in the sessionstate - Whether to read the old data or to ignore it
public void addHelperToSession(java.lang.String name,
boolean checkSession)
name - The name to use to store the helper in the sessioncheckSession - Whether to read the old data or to ignore it. True
means read, false means ignore
protected java.lang.String executeButtonMethod()
throws javax.servlet.ServletException,
java.io.IOException
javax.servlet.ServletException
java.io.IOException
protected java.lang.String executeButtonMethod(java.lang.Class clazz,
boolean searchForDefault)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException
clazz - The most extended class for this object.searchForDefault - If the default method has not been found, continue
to search for it.
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
protected java.lang.String invokeButtonMethod(java.lang.reflect.Method buttonMethod)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException
buttonMethod - The method to execute
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetExceptionpublic void fillBeanFromRequest(java.lang.Object data)
data - The bean to fill.
public static void writeError(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String title,
java.lang.Exception ex)
throws java.io.IOException,
javax.servlet.ServletException
request - Request information encapsulated in a Java objectresponse - Response information encapsulated in a Java objecttitle - The title of the generated pageex - The exception that caused the error
java.io.IOException
javax.servlet.ServletException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||