WebLogic Integration


com.bea.web
Class ControllerServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--com.bea.web.ControllerServlet

public class ControllerServlet
extends javax.servlet.http.HttpServlet

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.

Author:
Copyright © 2000, 2001 BEA Systems, Inc. All Rights Reserved.
See Also:
Serialized Form

Constructor Summary
ControllerServlet()
           
 
Method Summary
protected  java.lang.String debug(javax.servlet.http.HttpServletRequest request)
           
protected  void debugCookies(java.io.PrintStream stream, javax.servlet.http.HttpServletRequest request)
           
protected  void debugRequest(java.io.PrintStream stream, javax.servlet.http.HttpServletRequest request)
           
protected  void debugRequestHeader(java.io.PrintStream stream, javax.servlet.http.HttpServletRequest request)
           
protected  void debugRequestInfo(java.io.PrintStream stream, javax.servlet.http.HttpServletRequest request)
           
protected  void debugRequestParameters(java.io.PrintStream stream, javax.servlet.http.HttpServletRequest request)
           
protected  void debugSession(java.io.PrintStream stream, javax.servlet.http.HttpSession session)
           
protected  void doAction(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Used to invoke a method on the request handler
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected  void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 java.lang.SecurityException findSecurityException(AbstractExceptionContainer aec)
          Locates a nested SecurityException; may return null
protected  java.lang.String getContainedExceptionMessages(AbstractExceptionContainer aec)
          Appends messages from contained exceptions; don't pass null
protected  java.lang.String getExceptionInfo(java.lang.Throwable t)
           
 java.lang.String getExceptionMessage(java.lang.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(javax.servlet.http.HttpServletRequest request)
          Retrieves a RequestHandler from the session; if one is not available in the session, a new instance is created.
 void init(javax.servlet.ServletConfig config)
           
protected  void loadRequestHandler(javax.servlet.http.HttpServletRequest request)
          Used to load the request handler.
protected  java.lang.String processRequest(java.lang.String strDo, javax.servlet.http.HttpServletRequest request, RequestHandler handler, java.lang.String strUnvalidatedRequestParameters)
          Invokes the strDo method on the handler instance.
protected  boolean validateRequest(java.lang.String strDo, javax.servlet.http.HttpServletRequest request, RequestHandler handler, java.lang.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

ControllerServlet

public ControllerServlet()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException

Overrides:
init in class javax.servlet.GenericServlet

doGet

protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException,
                     java.io.IOException

Overrides:
doGet in class javax.servlet.http.HttpServlet

doPost

protected void doPost(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws javax.servlet.ServletException,
                      java.io.IOException

Overrides:
doPost in class javax.servlet.http.HttpServlet

loadRequestHandler

protected void loadRequestHandler(javax.servlet.http.HttpServletRequest request)
                           throws javax.servlet.ServletException
Used to load the request handler. In order to use this method a 'command' parameter must be set on the request object. The command should specify 'loadrequest'.

Returns:
void

doAction

protected void doAction(javax.servlet.http.HttpServletRequest request,
                        javax.servlet.http.HttpServletResponse response)
                 throws javax.servlet.ServletException,
                        java.io.IOException
Used to invoke a method on the request handler

Returns:
void outcome of invoking the action on the request handler.

processRequest

protected java.lang.String processRequest(java.lang.String strDo,
                                          javax.servlet.http.HttpServletRequest request,
                                          RequestHandler handler,
                                          java.lang.String strUnvalidatedRequestParameters)
                                   throws javax.servlet.ServletException
Invokes the strDo method on the handler instance.

Returns:
the next page to display to the user which is determined by the outcome of invoking the action on the request handler.

getExceptionMessage

public java.lang.String getExceptionMessage(java.lang.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.

findSecurityException

public java.lang.SecurityException findSecurityException(AbstractExceptionContainer aec)
Locates a nested SecurityException; may return null

getContainedExceptionMessages

protected java.lang.String getContainedExceptionMessages(AbstractExceptionContainer aec)
Appends messages from contained exceptions; don't pass null

validateRequest

protected boolean validateRequest(java.lang.String strDo,
                                  javax.servlet.http.HttpServletRequest request,
                                  RequestHandler handler,
                                  java.lang.StringBuffer sbUnvalidatedRequestParameters)
                           throws java.io.UnsupportedEncodingException

getRequestHandler

protected RequestHandler getRequestHandler(javax.servlet.http.HttpServletRequest request)
                                    throws javax.servlet.ServletException
Retrieves a 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.

getExceptionInfo

protected final java.lang.String getExceptionInfo(java.lang.Throwable t)

debug

protected java.lang.String debug(javax.servlet.http.HttpServletRequest request)

debugRequest

protected void debugRequest(java.io.PrintStream stream,
                            javax.servlet.http.HttpServletRequest request)

debugRequestHeader

protected void debugRequestHeader(java.io.PrintStream stream,
                                  javax.servlet.http.HttpServletRequest request)

debugRequestInfo

protected void debugRequestInfo(java.io.PrintStream stream,
                                javax.servlet.http.HttpServletRequest request)

debugRequestParameters

protected void debugRequestParameters(java.io.PrintStream stream,
                                      javax.servlet.http.HttpServletRequest request)

debugCookies

protected void debugCookies(java.io.PrintStream stream,
                            javax.servlet.http.HttpServletRequest request)

debugSession

protected void debugSession(java.io.PrintStream stream,
                            javax.servlet.http.HttpSession session)

WebLogic Integration

WebLogic Integration (WLI)