|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.chwf.registry.UserRegistry | +--org.chwf.servlet.ServletData
Utility class that acts as a mechanism to pass the servlet context, request and session to lower level methods without passing them explicitly as parameters. The data is stored in a ThreadLocal variable, allowing it to be retrieved via static methods.
Constructor Summary | |
ServletData()
|
Method Summary | |
static void |
forward(java.lang.String page)
Forward to specified page. |
static void |
forwardError(java.lang.String errorPage,
java.lang.Throwable error)
Cache the error and forward to the error page. |
static javax.servlet.ServletContext |
getApplication()
Return the ServletContext (application in JSP terms). |
static javax.servlet.http.HttpServletRequest |
getRequest()
Return the request. |
static javax.servlet.http.HttpServletResponse |
getResponse()
Return the response. |
static javax.servlet.http.HttpSession |
getSession()
Return the session. |
static void |
init(javax.servlet.ServletContext application,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Initialize the servlet registry with servlet data. |
static void |
redirectError(java.lang.String errorPage,
java.lang.Throwable error)
Cache the error and redirect to the error page. |
static void |
release()
Releases servlet data. |
static void |
retrieveErrorDataFromSession()
Retrieve error data from the session and cache it in the request. |
Methods inherited from class org.chwf.registry.UserRegistry |
getRegistry, getRegistryEntry, getSingleton, getSingleton, initGlobalRegistry, initLocalRegistry, isInitialized, overwriteRegistryEntry, releaseGlobalRegistry, releaseLocalRegistry, releaseSingleton, removeRegistryEntry, setRegistryEntry |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ServletData()
Method Detail |
public static javax.servlet.ServletContext getApplication()
public static javax.servlet.http.HttpSession getSession()
public static javax.servlet.http.HttpServletRequest getRequest()
public static javax.servlet.http.HttpServletResponse getResponse()
public static void forward(java.lang.String page) throws javax.servlet.ServletException, java.io.IOException
page
- The target page.javax.servlet.ServletException
- For servlet exceptions.java.io.IOException
- For IO exceptions.public static void forwardError(java.lang.String errorPage, java.lang.Throwable error) throws javax.servlet.ServletException, java.io.IOException
errorPage
- The target page.error
- The error.javax.servlet.ServletException
- For servlet exceptions.java.io.IOException
- For IO exceptions.public static void redirectError(java.lang.String errorPage, java.lang.Throwable error) throws java.io.IOException
errorPage
- The target page.error
- The error.java.io.IOException
- For IO exceptions.public static void retrieveErrorDataFromSession()
public static void init(javax.servlet.ServletContext application, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
application
- The servlet context.request
- The request.response
- The response.public static void release()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |