|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.bea.web.ControllerServlet
public class ControllerServlet
A servlet that delegates user input (in the HTTP request object) from an HTML
form to a handler method on a com.bea.web.RequestHandler
instance. The com.bea.web.RequestHandler
is stored in
the session under the key "handler". This class uses reflection to determine
which method to invoke on the request handler. This provides a simple MVC
architecture where this object serves as the controller component and the
request handler serves as the model component. Obviously, the HTML/JSP pages
provide the view.
Prior to invoking the form handling method on the request handler, this
class performs a coarse-grained validation of the input fields.
Constructor Summary | |
---|---|
ControllerServlet()
|
Method Summary | |
---|---|
protected String |
debug(HttpServletRequest request)
|
protected void |
debugCookies(PrintStream stream,
HttpServletRequest request)
|
protected void |
debugRequest(PrintStream stream,
HttpServletRequest request)
|
protected void |
debugRequestHeader(PrintStream stream,
HttpServletRequest request)
|
protected void |
debugRequestInfo(PrintStream stream,
HttpServletRequest request)
|
protected void |
debugRequestParameters(PrintStream stream,
HttpServletRequest request)
|
protected void |
debugSession(PrintStream stream,
HttpSession session)
|
protected void |
doAction(HttpServletRequest request,
HttpServletResponse response)
Used to invoke a method on the request handler |
protected void |
doGet(HttpServletRequest request,
HttpServletResponse response)
|
protected void |
doPost(HttpServletRequest request,
HttpServletResponse response)
|
SecurityException |
findSecurityException(com.bea.util.AbstractExceptionContainer aec)
Locates a nested SecurityException; may return null |
protected String |
getContainedExceptionMessages(com.bea.util.AbstractExceptionContainer aec)
Appends messages from contained exceptions; don't pass null |
protected String |
getExceptionInfo(Throwable t)
|
String |
getExceptionMessage(Throwable t)
Gets an exception message that is suitable for a UI; if there is a SecurityException nested any where in the tree, only its message is returned. |
protected RequestHandler |
getRequestHandler(HttpServletRequest request)
Retrieves a RequestHandler from the session; if one is not
available in the session, a new instance is created. |
void |
init(ServletConfig config)
|
protected void |
loadRequestHandler(HttpServletRequest request)
Used to load the request handler. |
protected String |
processRequest(String strDo,
HttpServletRequest request,
RequestHandler handler,
String strUnvalidatedRequestParameters)
Invokes the strDo method on the handler instance. |
protected boolean |
validateRequest(String strDo,
HttpServletRequest request,
RequestHandler handler,
StringBuffer sbUnvalidatedRequestParameters)
|
Methods inherited from class javax.servlet.http.HttpServlet |
---|
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
---|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ControllerServlet()
Method Detail |
---|
public void init(ServletConfig config) throws ServletException
init
in interface Servlet
init
in class GenericServlet
ServletException
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doGet
in class HttpServlet
ServletException
IOException
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doPost
in class HttpServlet
ServletException
IOException
protected void loadRequestHandler(HttpServletRequest request) throws ServletException
ServletException
protected void doAction(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
ServletException
IOException
protected String processRequest(String strDo, HttpServletRequest request, RequestHandler handler, String strUnvalidatedRequestParameters) throws ServletException
strDo
method on the handler
instance.
ServletException
public String getExceptionMessage(Throwable t)
public SecurityException findSecurityException(com.bea.util.AbstractExceptionContainer aec)
protected String getContainedExceptionMessages(com.bea.util.AbstractExceptionContainer aec)
protected boolean validateRequest(String strDo, HttpServletRequest request, RequestHandler handler, StringBuffer sbUnvalidatedRequestParameters) throws UnsupportedEncodingException
UnsupportedEncodingException
protected RequestHandler getRequestHandler(HttpServletRequest request) throws ServletException
RequestHandler
from the session; if one is not
available in the session, a new instance is created. A
RequestHandler
is responsible for "handling" user input from
HTML forms.
ServletException
protected final String getExceptionInfo(Throwable t)
protected String debug(HttpServletRequest request)
protected void debugRequest(PrintStream stream, HttpServletRequest request)
protected void debugRequestHeader(PrintStream stream, HttpServletRequest request)
protected void debugRequestInfo(PrintStream stream, HttpServletRequest request)
protected void debugRequestParameters(PrintStream stream, HttpServletRequest request)
protected void debugCookies(PrintStream stream, HttpServletRequest request)
protected void debugSession(PrintStream stream, HttpSession session)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |