|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bristle.javalib.log.LoggerFinder
public class LoggerFinder
This class makes it possible for Java servlets to access an existing Logger that may be stored in the servlet's Session context, the servlet's ServletContext (application context), or as the Logger global singleton.
Usage: - The typical scenario for using this class is: - To find a Logger: LoggerFinder finder = new LoggerFinder(request); Logger logger = finder.find(); - To save a Logger to be found by future calls to find(): finder.saveInSession(logger); finder.saveInServletContext(logger) finder.saveAsGlobalSingleton(logger) Assumptions: Effects: - Can update the servlet's Session context, ServletContext, and/or the Logger global singleton. Anticipated Changes: Notes: Implementation Notes: Portability Issues: Revision History: $Log$
Nested Class Summary | |
---|---|
static class |
LoggerFinder.Tester
Each class contains a Tester inner class with a main() for easier unit testing. |
Field Summary | |
---|---|
private HttpServletRequest |
m_request
|
private String |
strLOGGER_ATTRIBUTE_NAME
|
Constructor Summary | |
---|---|
LoggerFinder(HttpServletRequest request)
Constructor. |
Method Summary | |
---|---|
Logger |
find()
Find an existing Logger, searching first the Session context of the previously specified HttpServletRequest (if any), then the ServletContext (application context) of the servlet associated with that HttpServletRequest (if any), then the Logger global singleton (if any), returning null if no Logger is found in any of those places. |
Logger |
findSafely()
Find an existing Logger, suppressing all possible errors. |
void |
saveAsGlobalSingleton(Logger logger)
Save the specified Logger as the Logger global singleton, to be found by future calls to find(). |
void |
saveInServletContext(Logger logger)
Save the specified Logger in the ServletContext to be found by future calls to find(). |
void |
saveInSession(Logger logger)
Save the specified Logger in the Session to be found by future calls to find(). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private HttpServletRequest m_request
private final String strLOGGER_ATTRIBUTE_NAME
Constructor Detail |
---|
public LoggerFinder(HttpServletRequest request)
request
- The HttpServletRequest used to locate the contexts to
be searched for the Logger.Method Detail |
---|
public Logger find()
public Logger findSafely()
public void saveInSession(Logger logger)
logger
- The Logger.public void saveInServletContext(Logger logger)
logger
- The Logger.public void saveAsGlobalSingleton(Logger logger)
logger
- The Logger.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |