[cvs] expresso commit by rimovm: Interface Extraction of

JCorporate Ltd jcorp at jcorporate.com
Fri May 6 18:03:16 UTC 2005


Log Message:
-----------
Interface Extraction of ControllerRequest/ControllerResponse and proper @deperacation of old methods.
Some Checkstyle Errors Fixed.
Javadocs added.
New Test Suite: DBMaint Smoke Test -- Iterates through all Schema DBObjects and attempts to list/promptUpdate/promptSearch/promptAdd on them.

Modified Files:
--------------
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller:
        Block.java
        Controller.java
        ControllerElement.java
        ControllerFactory.java
        ControllerRequest.java
        ControllerResponse.java
        DBController.java
        DefaultControllerFactory.java
        DefaultForm.java
        ExpressoActionServlet.java
        Input.java
        ServletControllerResponse.java
        State.java
        StateForm.java
        TilesController.java
        Transition.java
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj:
        SchemaDefinition.java
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/logging:
        DBAppender.java
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/servlet/viewhandler:
        DefaultViewHandler.java
        JSPViewHandler.java
        XMLViewHandler.java
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/controller:
        TestController.java
        Upload.java
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/dbobj:
        AppIntegration.java
        RestrictedCountries.java
        ReverseLookupDomains.java
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/struts/taglib:
        ControllerUtils.java
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/ext/velocity:
        ExpressoTool.java
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/controller:
        CacheControl.java
        Configuration.java
        ControllerSecurityMatrix.java
        CronController.java
        LoginController.java
        Registration.java
        SimpleLoginController.java
        SimpleRegistration.java
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/controller/dbmaint:
        DynamicCmd.java
        GetBase.java
        ListBase.java
        Search.java
        Update.java
        UpdateBase.java
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/controller/ui:
        AutoControllerElement.java
        DefaultAutoElement.java
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/dbobj:
        CacheSync.java
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/test:
        ControllerTestFixture.java
        SchemaDeleter.java
    expresso/expresso-web/WEB-INF/test-src/com/jcorporate/expresso/core:
        ExpressoTestSuite.java
    expresso/expresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/controller/tests:
        ControllerReflectionTestModel.java
        TestControllerReflectionTestModel.java

Added Files:
-----------
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller:
        DeprecatedInvocationUtils.java
        ExpressoRequest.java
        ExpressoResponse.java
    expresso/expresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/controller/tests:
        DeprecatedTestController.java
        TestDeprecatedControllerFunctions.java
    expresso/expresso-web/WEB-INF/test-src/com/jcorporate/expresso/services/controller/tests:
        DBMaintSmokeTest.java
        TestDBMaint.java

Revision Data
-------------
Index: ExpressoTestSuite.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/ExpressoTestSuite.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -Lexpresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/ExpressoTestSuite.java -Lexpresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/ExpressoTestSuite.java -u -r1.7 -r1.8
--- expresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/ExpressoTestSuite.java
+++ expresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/ExpressoTestSuite.java
@@ -117,6 +117,7 @@
         ts.addTestSuite(com.jcorporate.expresso.core.security.filters.FilterTreeTest.class);
         ts.addTestSuite(com.jcorporate.expresso.core.db.tests.DBConnectionPoolTest.class);
         ts.addTestSuite(com.jcorporate.expresso.core.controller.tests.TestControllerReflectionTestModel.class);
+        ts.addTestSuite(com.jcorporate.expresso.core.controller.tests.TestDeprecatedControllerFunctions.class);
         ts.addTestSuite(com.jcorporate.expresso.core.controller.tests.InputTests.class);
         ts.addTestSuite(com.jcorporate.expresso.core.controller.tests.OutputTests.class);
         ts.addTestSuite(com.jcorporate.expresso.core.controller.tests.TransitionTests.class);
@@ -156,6 +157,8 @@
 
         ts.addTestSuite(com.jcorporate.expresso.core.security.tests.UserGroupTest.class);
         ts.addTestSuite(com.jcorporate.expresso.core.security.tests.UserTest.class);
+
+        ts.addTest(com.jcorporate.expresso.services.controller.tests.DBMaintSmokeTest.suite(new ExpressoSchema()));
 
         ts.addTestSuite(com.jcorporate.expresso.services.crontab.tests.TestCrontabEntry.class);
         ts.addTestSuite(com.jcorporate.expresso.services.dbobj.tests.MimeTypesTests.class);
Index: ControllerReflectionTestModel.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/controller/tests/ControllerReflectionTestModel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lexpresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/controller/tests/ControllerReflectionTestModel.java -Lexpresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/controller/tests/ControllerReflectionTestModel.java -u -r1.1 -r1.2
--- expresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/controller/tests/ControllerReflectionTestModel.java
+++ expresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/controller/tests/ControllerReflectionTestModel.java
@@ -15,11 +15,18 @@
         State s = new State("test1", "ControllerRequest/ControllerResponse signature");
         this.addState(s);
 
+        s = new State("test2", "ExpressoRequest/ExpressoResponse signature");
+        this.addState(s);
+
         this.setInitialState("test1");
 
     }
 
     public void runTest1State(final ControllerRequest request, final ControllerResponse response) throws Exception {
+        response.add(new Output("This is a test"));
+    }
+
+    public void runTest2State(final ExpressoRequest request, final ExpressoResponse response) throws Exception {
         response.add(new Output("This is a test"));
     }
 
--- /dev/null
+++ expresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/controller/tests/TestDeprecatedControllerFunctions.java
@@ -0,0 +1,41 @@
+package com.jcorporate.expresso.core.controller.tests;
+
+import junit.framework.*;
+import com.jcorporate.expresso.core.controller.*;
+import com.jcorporate.expresso.services.test.ControllerTestFixture;
+import java.util.HashMap;
+
+/**
+ * Tests to make sure the deprecated ControllerRequest/ControllerResponse-based
+ * states still get invoked.
+ * @author Michael Rimov
+ * @version $Revision: 1.1 $ on $Date: 2005/05/06 18:02:44 $
+ */
+public class TestDeprecatedControllerFunctions extends TestCase {
+    private DeprecatedTestController controller = null;
+
+    private ControllerTestFixture fixture = new ControllerTestFixture();
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        controller = new DeprecatedTestController();
+        fixture = new ControllerTestFixture();
+        fixture.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        controller = null;
+        fixture.tearDown();
+        fixture = null;
+        super.tearDown();
+    }
+
+    public void testDeprecatedMethodsGetCalled() throws Exception {
+        ExpressoRequest buildRequest = fixture.buildControllerRequest(new HashMap(), "dummy");
+        ExpressoResponse response = fixture.invokeState("dummy", controller, buildRequest);
+        assertEquals(1, controller.prePerformCalled);
+        assertEquals(1, controller.postPerformCalled);
+        assertEquals(1, controller.stateAllowedCalled);
+    }
+
+}
--- /dev/null
+++ expresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/controller/tests/DeprecatedTestController.java
@@ -0,0 +1,40 @@
+package com.jcorporate.expresso.core.controller;
+
+/**
+
+ *
+ * @author Michael Rimov
+ * @version $Revision: 1.1 $ on $Date: 2005/05/06 18:02:44 $
+ */
+public class DeprecatedTestController extends Controller
+{
+    public int prePerformCalled = 0;
+
+    public int postPerformCalled = 0;
+
+    public int stateAllowedCalled = 0;
+
+    public DeprecatedTestController() {
+        super();
+        this.addState(new State("dummy", "DummyState"));
+        this.setInitialState("dummy");
+    }
+
+    public boolean stateAllowed(final String stateName, final ControllerRequest request) {
+        stateAllowedCalled++;
+        return true;
+    }
+
+    protected void prePerform(final State nextState, final ControllerRequest request, final ControllerResponse response) throws ControllerException {
+        prePerformCalled++;
+    }
+
+    protected void postPerform(final State nextState, final ControllerRequest request, final ControllerResponse response) throws ControllerException {
+        postPerformCalled++;
+    }
+
+    protected void runDummyState(ControllerRequest request, ControllerResponse response) throws ControllerException {
+        response.add(new Output("Got Here!"));
+    }
+
+}
Index: TestControllerReflectionTestModel.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/controller/tests/TestControllerReflectionTestModel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lexpresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/controller/tests/TestControllerReflectionTestModel.java -Lexpresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/controller/tests/TestControllerReflectionTestModel.java -u -r1.1 -r1.2
--- expresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/controller/tests/TestControllerReflectionTestModel.java
+++ expresso-web/WEB-INF/test-src/com/jcorporate/expresso/core/controller/tests/TestControllerReflectionTestModel.java
@@ -25,7 +25,13 @@
     }
 
     public void testRunTest1State() throws Exception {
-        ControllerResponse response = controllerFixture.invokeFacade(ControllerReflectionTestModel.class, new HashMap(), "test1");
+        ExpressoResponse response = controllerFixture.invokeFacade(ControllerReflectionTestModel.class, new HashMap(), "test1");
+        assertTrue(response != null);
+        assertTrue(response.getOutputs().size() == 1);
+    }
+
+    public void testRunTest2State() throws Exception {
+        ExpressoResponse response = controllerFixture.invokeFacade(ControllerReflectionTestModel.class, new HashMap(), "test2");
         assertTrue(response != null);
         assertTrue(response.getOutputs().size() == 1);
     }
Index: ServletControllerResponse.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ServletControllerResponse.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ServletControllerResponse.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ServletControllerResponse.java -u -r1.6 -r1.7
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ServletControllerResponse.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ServletControllerResponse.java
@@ -144,7 +144,7 @@
      */
     public ActionMapping getMapping()
             throws ControllerException {
-        ServletControllerRequest req = (ServletControllerRequest) getRequest();
+        ServletControllerRequest req = (ServletControllerRequest) getExpressoRequest();
         return req.getMapping();
     }
 
Index: ControllerRequest.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerRequest.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerRequest.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerRequest.java -u -r1.37 -r1.38
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerRequest.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerRequest.java
@@ -64,36 +64,31 @@
 
 package com.jcorporate.expresso.core.controller;
 
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
 import com.jcorporate.expresso.core.controller.session.PersistentSession;
 import com.jcorporate.expresso.core.db.DBException;
 import com.jcorporate.expresso.core.dbobj.DBObject;
 import com.jcorporate.expresso.core.misc.ConfigManager;
 import com.jcorporate.expresso.core.misc.ConfigurationException;
 import com.jcorporate.expresso.core.misc.StringUtil;
+import com.jcorporate.expresso.core.registry.RequestRegistry;
+import com.jcorporate.expresso.core.security.ReadOnlyUser;
 import com.jcorporate.expresso.core.security.User;
-import com.jcorporate.expresso.kernel.util.ClassLocator;
 import org.apache.log4j.Logger;
 import org.apache.struts.Globals;
 
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
-import com.jcorporate.expresso.core.security.ReadOnlyUser;
-import com.jcorporate.expresso.core.registry.RequestRegistry;
-import com.jcorporate.expresso.core.dbobj.RequestContext;
-import java.util.Collections;
-
-
 /**
  * ControllerRequest is a simple "wrapper" object that holds the parameters and data required
  * for a controller to be able to transition to a new state. <br />
  * <b>Developer Notes</b> Because this class can be cloned, please make sure that
  * you add any fields to this class to the clone function.
  */
-public class ControllerRequest implements Serializable, RequestContext, Cloneable
+public class ControllerRequest implements  ExpressoRequest
 {
 
     /**
@@ -538,7 +533,7 @@
      */
     public Map getAllParameters() {
         if (params != null) {
-            return Collections.unmodifiableMap(params);
+            return new HashMap(params);
         } else {
             return new HashMap(0);
         }
Index: TilesController.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/TilesController.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/TilesController.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/TilesController.java -u -r1.3 -r1.4
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/TilesController.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/TilesController.java
@@ -97,12 +97,12 @@
      * Implementation of perform() method.  Obtains ControllerRequest and ControllerResponse
      * from supplied HttpServletRequest and calls execute().
      */
-    public final void perform(ComponentContext context, HttpServletRequest request,
-                              HttpServletResponse response, ServletContext servletContext)
+    public final void perform(final ComponentContext context, final HttpServletRequest request,
+                              final HttpServletResponse response, final ServletContext servletContext)
             throws ServletException, IOException {
 
         ControllerResponse res = (ControllerResponse) request.getAttribute(ExpressoConstants.CONTROLLER_RESPONSE_KEY);
-        ControllerRequest req = (ControllerRequest) res.getRequest();
+        ExpressoRequest req = (ExpressoRequest) res.getExpressoRequest();
         try {
             execute(context, req, res, servletContext);
         } catch (ControllerException ce) {
@@ -114,8 +114,8 @@
      * This method will be called by the perform() method.  Subclasses should
      * contain code to set up data to be displayed by the corresponding tile
      */
-    public void execute(ComponentContext context, ControllerRequest request,
-                        ControllerResponse response, ServletContext servletContext)
+    public void execute(final ComponentContext context, final ExpressoRequest request,
+                        final ControllerResponse response, final ServletContext servletContext)
             throws ControllerException {
 
     }
Index: ExpressoActionServlet.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ExpressoActionServlet.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ExpressoActionServlet.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ExpressoActionServlet.java -u -r1.23 -r1.24
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ExpressoActionServlet.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ExpressoActionServlet.java
@@ -93,9 +93,9 @@
 
 
 /**
- * 
+ *
  * <p>
- * 
+ *
  * <p>
  * Title:        Expresso Project
  * Description:
@@ -478,7 +478,7 @@
      * @throws ControllerException if there's an error instantiating the
      *                             controller
      */
-    public Controller getController(ControllerRequest request)
+    public Controller getController(ExpressoRequest request)
             throws ControllerException {
         // We have to get a HttpServletRequest and from this object
         // get the module context.
Index: DefaultForm.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/DefaultForm.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/DefaultForm.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/DefaultForm.java -u -r1.26 -r1.27
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/DefaultForm.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/DefaultForm.java
@@ -113,13 +113,13 @@
         return null;
     }
 
-    public void saveForm(ControllerRequest req)
+    public void saveForm(ExpressoRequest req)
             throws ControllerException {
         formData.clear();
         formData.putAll(req.getAllParameters());
     }
 
-    public void restoreForm(ControllerRequest req)
+    public void restoreForm(ExpressoRequest req)
             throws ControllerException {
         String oneKey = null;
 
@@ -264,7 +264,7 @@
      * @param request The servlet request we are processing.
      * @return ActionErrors containing validation errors.
      */
-    public ErrorCollection validate(ControllerRequest request) {
+    public ErrorCollection validate(ExpressoRequest request) {
         if (request instanceof ServletControllerRequest) {
             ServletControllerRequest scr = (ServletControllerRequest) request;
             return (ErrorCollection) this.validate(scr.getMapping(), (HttpServletRequest) scr.getServletRequest());
Index: State.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/State.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/State.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/State.java -u -r1.32 -r1.33
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/State.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/State.java
@@ -64,9 +64,18 @@
 
 package com.jcorporate.expresso.core.controller;
 
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
 import com.jcorporate.expresso.core.controller.session.PersistentSession;
 import com.jcorporate.expresso.core.dbobj.DBObject;
 import com.jcorporate.expresso.core.misc.StringUtil;
+import com.jcorporate.expresso.core.security.ReadOnlyUser;
 import com.jcorporate.expresso.kernel.util.FastStringBuffer;
 import org.apache.log4j.Logger;
 import org.apache.oro.text.regex.MalformedPatternException;
@@ -76,15 +85,6 @@
 import org.apache.oro.text.regex.Perl5Compiler;
 import org.apache.oro.text.regex.Perl5Matcher;
 
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-import com.jcorporate.expresso.core.security.ReadOnlyUser;
-
 
 /**
  * A State embodies a single state in the finite state machine of a
@@ -101,6 +101,16 @@
         implements Cloneable,
         Serializable {
 
+    public static final Method NO_METHOD;
+
+    static {
+        try {
+            NO_METHOD = Object.class.getMethod("hashCode", new Class[] {});
+        } catch (NoSuchMethodException ex) {
+            throw new Error("Unable to locate method 'hashCode' in java.lang.Object");
+        }
+    }
+
     /**
      * Name of this state, referred to by the "state" parameter
      */
@@ -110,9 +120,18 @@
      * Long description of the state
      */
     private String descrip;
+
+    /**
+     * Current class name.
+     */
     private static final String className = State.class.getName();
 
     /**
+     * Cached method for invoking this particular state.
+     */
+    private Method stateInvocationMethod = NO_METHOD;
+
+    /**
      * Parameters needed by this state. It is possible for a state
      * to need other parameters, but the ones listed here can be
      * verified as present when transitioning into the state
@@ -144,13 +163,13 @@
     /**
      * The request for this particular state handler. [Different for each thread]
      */
-    private ControllerRequest myRequest = null;
+    private ExpressoRequest myRequest = null;
 
     /**
      * The ControllerResponse for this particular state handler
      * [Different for each thread]
      */
-    private ControllerResponse myResponse = null;
+    private ExpressoResponse myResponse = null;
 
     /**
      * Log4J category for this state handler
@@ -211,7 +230,7 @@
      * @param newController The controller instance to set for the state
      * @throws ControllerException upon error or null parameter
      */
-    public void setController(Controller newController)
+    public void setController(final Controller newController)
             throws ControllerException {
         if (newController == null) {
             throw new ControllerException("Cannot set a null Controller here");
@@ -330,7 +349,7 @@
      * @param res The controller response associated with the state's instance.
      * @throws ControllerException upon invalid parameter
      */
-    protected void setResponse(ControllerResponse res)
+    protected void setResponse(ExpressoResponse res)
             throws ControllerException {
         if (res == null) {
             throw new ControllerException("Null response object not allowed here");
@@ -369,7 +388,19 @@
         successTransition = newSuccessTransition;
     }
 
+    /**
+     * @deprecated use getExpressoResponse() instead.
+     * @return ControllerResponse
+     */
     public ControllerResponse getResponse() {
+        return (ControllerResponse)myResponse;
+    }
+
+    /**
+     * Retrieves the expresso response associated with this state.
+     * @return ExpressoResponse
+     */
+    public ExpressoResponse getExpressoResponse() {
         return myResponse;
     }
 
@@ -424,7 +455,7 @@
      *                   (preferrably) a key into the local language file in order to facilitate
      *                   internationalization, or just a simple string.
      */
-    public State(String newName, String newDescrip) {
+    public State(final String newName, final String newDescrip) {
         setName(newName);
         setDescription(newDescrip);
     } /* State(String, String) */
@@ -657,8 +688,8 @@
      * @throws ControllerException    upon error
      * @throws NonHandleableException upon fatal error
      */
-    public void run(ControllerRequest newRequest,
-                    ControllerResponse newResponse)
+    public void runState(final ExpressoRequest newRequest,
+                    final ExpressoResponse newResponse)
             throws ControllerException, NonHandleableException {
         myRequest = newRequest;
         myResponse = newResponse;
@@ -666,6 +697,19 @@
     }
 
     /**
+     * Override in your state handler.
+     * @deprecated Use runState(ExpressoRequest/ExpressoResponse) instead.
+     * @param request ControllerRequest the request
+     * @param response ControllerResponse the Response.
+     * @throws ControllerException
+     * @throws NonHandleableException
+     *
+     */
+    public void run(final ControllerRequest request, final ControllerResponse response) throws ControllerException , NonHandleableException {
+        runState((ExpressoRequest)request, (ExpressoResponse)response);
+    }
+
+    /**
      * A state may implement a "perform" method to actually perform it's
      * logic by overriding this method.  Any associated state form will
      * be passed in with its data populated.
@@ -680,10 +724,10 @@
      * @throws ControllerException    upon error
      * @throws NonHandleableException upon fatal error
      */
-    public void perform(StateForm stateForm, ControllerRequest newRequest,
-                        ControllerResponse newResponse)
+    public void perform(final StateForm stateForm, final ExpressoRequest newRequest,
+                        final ExpressoResponse newResponse)
             throws NonHandleableException, ControllerException {
-        run(newRequest, newResponse);
+        run((ControllerRequest)newRequest, (ControllerResponse)newResponse);
     }
 
     /**
@@ -740,12 +784,13 @@
      * @param validValues   The valid value list associated with the input
      *                      (for drop-down multivalue inputs only)
      * @throws ControllerException upon error
+     * @deprecated Since Expresso 5.7 Use AutoElement instead.
      */
     protected void addAutoInput(String fieldName, String friendlyName,
                                 String defaultValue, int displayLength,
                                 int maxLength, Vector validValues)
             throws ControllerException {
-        myResponse.addAutoInput(fieldName, friendlyName, defaultValue,
+        ((ControllerResponse)myResponse).addAutoInput(fieldName, friendlyName, defaultValue,
                 displayLength, maxLength, validValues);
     }
 
@@ -784,11 +829,12 @@
      * @param dbClassName  java.lang.String
      * @param defaultValue java.lang.String
      * @throws ControllerException upon error
+     * @deprecated Since Expresso 5.7 Use AutoElement instead.
      */
     protected void addAutoInput(String fieldName, String dbClassName,
                                 String defaultValue)
             throws ControllerException {
-        myResponse.addAutoInput(fieldName, dbClassName, defaultValue);
+        ((ControllerResponse)myResponse).addAutoInput(fieldName, dbClassName, defaultValue);
     }
 
     /**
@@ -804,11 +850,12 @@
      * @param dbClassName  java.lang.String
      * @param defaultValue java.lang.String
      * @throws ControllerException upon error
+     * @deprecated Since Expresso 5.7 Use AutoElement instead.
      */
     protected void addAutoInput(String fieldName, String friendlyName,
                                 String dbClassName, String defaultValue)
             throws ControllerException {
-        myResponse.addAutoInput(fieldName, friendlyName, dbClassName,
+        ((ControllerResponse)myResponse).addAutoInput(fieldName, friendlyName, dbClassName,
                 defaultValue);
     }
 
@@ -824,11 +871,12 @@
      * @throws com.jcorporate.expresso.core.controller.ValidationException
      *                             The exception description.
      * @throws ControllerException upon error
+     * @deprecated Since Expresso 5.7 Use AutoElement instead.
      */
     protected void autoValidate(String checkClassName,
                                 ErrorCollection errorCollection)
             throws ValidationException, ControllerException {
-        myResponse.autoValidate(checkClassName, errorCollection);
+        ((ControllerResponse)myResponse).autoValidate(checkClassName, errorCollection);
     }
 
     /**
@@ -847,12 +895,13 @@
      * @throws com.jcorporate.expresso.core.controller.ValidationException
      *                             Upon validation error
      * @throws ControllerException upon error
+     * @deprecated Since Expresso 5.7 Use AutoElement instead.
      */
     protected void autoValidate(String checkClassName,
                                 ErrorCollection errorCollection,
                                 Vector requiredFields)
             throws ValidationException, ControllerException {
-        myResponse.autoValidate(checkClassName, errorCollection,
+        ((ControllerResponse)myResponse).autoValidate(checkClassName, errorCollection,
                 requiredFields);
     }
 
@@ -912,16 +961,7 @@
         this.handlerName = newName;
     }
 
-    /**
-     * ?
-     *
-     * @param paramName The parameter name to retrieve
-     * @return java.lang.String
-     * @deprecated Appears to be unused.  Since Expresso 5.7
-     */
-    public String getInitParameter(String paramName) {
-        return myRequest.getInitParameter(paramName);
-    }
+
 
     /**
      * Return the success transition.  This is the transition that will be
@@ -933,15 +973,6 @@
         return successTransition;
     }
 
-    /**
-     * Get the user name
-     *
-     * @return java.lang.String login name of the user
-     * @deprecated 3/5/04 use ControllerRequest getUid() instead.
-     */
-    public String getUser() {
-        return myRequest.getUser();
-    }
 
     /**
      * Fetch the value for the given parameter. Return null
@@ -1004,8 +1035,18 @@
      * Gets the ControllerRequest object associated with this state.
      *
      * @return the ControllerRequest Object associated with this state.
+     * @deprecated Use getExpressoRequest instead.
      */
     protected ControllerRequest getControllerRequest() {
+        return (ControllerRequest)myRequest;
+    }
+
+    /**
+     * Gets the ControllerRequest object associated with this state.
+     *
+     * @return the ExpressoRequest Object associated with this state.
+     */
+    protected ExpressoRequest getExpressoRequest() {
         return myRequest;
     }
 
@@ -1015,7 +1056,7 @@
      * @return ControllerResponse object associated with this state.
      */
     protected ControllerResponse getControllerResponse() {
-        return myResponse;
+        return (ControllerResponse)myResponse;
     }
 
     /**
@@ -1102,6 +1143,10 @@
         errorTransition = newErrorTransition;
     }
 
+    public void setStateInvocationMethod(Method stateInvocationMethod) {
+        this.stateInvocationMethod = stateInvocationMethod;
+    }
+
     /**
      * To the form cache in the controller response
      *
@@ -1169,6 +1214,10 @@
      */
     public String getStateFormClass() {
         return stateFormClass;
+    }
+
+    public Method getStateInvocationMethod() {
+        return stateInvocationMethod;
     }
 
     /**
Index: ControllerFactory.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerFactory.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerFactory.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerFactory.java -u -r1.7 -r1.8
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerFactory.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerFactory.java
@@ -153,7 +153,7 @@
      * @throws ControllerException if there's an error instantiating the
      *                             controller
      */
-    public Controller getController(ControllerRequest request)
+    public Controller getController(ExpressoRequest request)
             throws ControllerException;
 
-}
\ No newline at end of file
+}
Index: ControllerResponse.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerResponse.java,v
retrieving revision 1.59
retrieving revision 1.60
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerResponse.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerResponse.java -u -r1.59 -r1.60
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerResponse.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerResponse.java
@@ -92,6 +92,7 @@
 import com.jcorporate.expresso.core.misc.StringUtil;
 import com.jcorporate.expresso.kernel.util.ClassLocator;
 import com.jcorporate.expresso.kernel.util.FastStringBuffer;
+import java.util.List;
 
 
 /**
@@ -103,7 +104,8 @@
  * by querying the request context for an object named &quot;controllerResponse&quot;
  * </p>
  */
-public class ControllerResponse implements Serializable {
+public class ControllerResponse implements Serializable, ExpressoResponse
+{
     /**
      * The log4j logger.
      */
@@ -112,7 +114,7 @@
     /**
      * The ControllerRequest object set for this response
      */
-    protected ControllerRequest myRequest = null;
+    protected ExpressoRequest myRequest = null;
 
 
     /**
@@ -123,22 +125,22 @@
     /**
      * A name to value map of blocks
      */
-    protected HashMap blockCache = null;
+    protected Map blockCache = null;
 
     /**
      * The name to value map for inputs
      */
-    protected HashMap inputCache = null;
+    protected Map inputCache = null;
 
     /**
      * A name to value map for outputs
      */
-    protected HashMap outputCache = null;
+    protected Map outputCache = null;
 
     /**
      * A name to value map for Transitions
      */
-    protected HashMap transitionCache = null;
+    protected Map transitionCache = null;
 
     /**
      * The current state
@@ -178,22 +180,22 @@
     /**
      * A list of all blocks in the order they were added to the response
      */
-    protected Vector blockCacheOrdered = null;
+    protected List blockCacheOrdered = null;
 
     /**
      * A list of all inputs as added to the response
      */
-    protected Vector inputCacheOrdered = null;
+    protected List inputCacheOrdered = null;
 
     /**
      * A list of all outputs in the order they were added to the response
      */
-    protected Vector outputCacheOrdered = null;
+    protected List outputCacheOrdered = null;
 
     /**
      * A list of all transitions in the order they were added to the response
      */
-    protected Vector transitionCacheOrdered = null;
+    protected List transitionCacheOrdered = null;
 
 
     /**
@@ -227,10 +229,12 @@
      * @param attrib The name of an "attribtue" for this ControllerElement item
      * @param val    The value for this attribute
      * @throws ControllerException upon error
+     * @deprecated Since Expresso 5.7.  Use <tt>ExpressoRequest</tt>.setAttribute()
+     * instead.
      */
-    public void setAttribute(String attrib, String val)
+    public void setAttribute(final String attrib, final String val)
             throws ControllerException {
-        getRequest().setAttrib(attrib, val);
+        getExpressoRequest().setAttrib(attrib, val);
     }
 
     /* setAttributes(String, String) */
@@ -241,9 +245,11 @@
      * @param attrib The name of an "attribute" for this ControllerElement item
      * @return the attribute value (may be null)
      * @throws ControllerException upon error
+     * @deprecated Since Expresso 5.7.  Use <tt>ExpressoRequest</tt>.getAttribute()
+     * instead.
      */
-    public String getAttribute(String attrib) throws ControllerException {
-        return (String) getRequest().getAttrib(attrib);
+    public String getAttribute(final String attrib) throws ControllerException {
+        return (String) getExpressoRequest().getAttrib(attrib);
     }
 
     /* setAttributes(String, String) */
@@ -253,9 +259,11 @@
      *
      * @param attributes the supplied attribute values
      * @throws ControllerException upon error
+     * @deprecated Since Expresso 5.7.  Use <tt>ExpressoRequest</tt>.setAttributes()
+     * instead.
      */
-    public void setAttributes(Map attributes) throws ControllerException {
-        getRequest().setAttributes(attributes);
+    public void setAttributes(final Map attributes) throws ControllerException {
+        getExpressoRequest().setAttributes(attributes);
     }
 
     /* setAttributes(Map) */
@@ -265,9 +273,11 @@
      *
      * @return an java.util.Map of Strings
      * @throws ControllerException upon error
+     * @deprecated Since Expresso 5.7.  Use <tt>ExpressoRequest</tt>.getAtributes()
+     * instead.
      */
     public Map getAttributes() throws ControllerException {
-        return getRequest().getAttributes();
+        return getExpressoRequest().getAttributes();
     }
 
     /* getAttributes() */
@@ -279,7 +289,7 @@
      * @return Block instance or null if no block found.
      * @throws ControllerException upon error
      */
-    public Block getBlock(String blockName) throws ControllerException {
+    public Block getBlock(final String blockName) throws ControllerException {
         validState();
 
         if (blockCache != null) {
@@ -300,7 +310,7 @@
         validState();
 
         if (blockCacheOrdered != null) {
-            return blockCacheOrdered;
+            return new Vector(blockCacheOrdered);
         }
 
         return null;
@@ -313,7 +323,7 @@
      *
      * @param newClass the new controller class name
      */
-    public void setControllerClass(String newClass) {
+    public void setControllerClass(final String newClass) {
         myControllerClass = newClass;
     }
 
@@ -364,7 +374,7 @@
         validState();
 
         if (inputCacheOrdered != null) {
-            return inputCacheOrdered;
+            return new Vector(inputCacheOrdered);
         }
 
         return new Vector();
@@ -404,10 +414,18 @@
      *
      * @param newDBName the new database name
      * @throws ControllerException upon error
+     * @deprecated Since Expresso 5.7  Use setDataContext() instead.
      */
-    public synchronized void setDBName(String newDBName)
-            throws ControllerException {
-        this.dataContext = newDBName;
+    public synchronized void setDBName(final String newDBName) throws ControllerException {
+        this.setDataContext(newDBName);
+    }
+
+    /**
+     * Sets the data context of this controller response object.
+     * @param newDataContext String the new datacontext by string.
+     */
+    public synchronized void setDataContext(final String newDataContext) {
+        this.dataContext = newDataContext;
     }
 
     /**
@@ -415,16 +433,17 @@
      *
      * @return the database context that the system is set for.
      * @throws ControllerException upon error
+     * @deprecated Since Expresso 5.7  Use setDataContext() instead.
      */
     public String getDBName() throws ControllerException {
         return getDataContext();
-    } /* getDBName() */
+    }
 
     /**
      * Get the database from the request, if there is a request available
      *
      * @return the database context that the system is set for.
-     * @throws ControllerException upon error
+     * @throws ControllerException actually thrown.
      */
     public String getDataContext() throws ControllerException {
         if (dataContext != null) {
@@ -613,7 +632,7 @@
         validState();
 
         if (outputCacheOrdered != null) {
-            return outputCacheOrdered;
+            return new Vector(outputCacheOrdered);
         }
 
         return new Vector();
@@ -628,7 +647,7 @@
      * @throws ControllerException upon error reading from the session
      */
     public ErrorCollection getErrors() throws ControllerException {
-        ErrorCollection errs = (ErrorCollection) getRequest().getSession()
+        ErrorCollection errs = (ErrorCollection) getExpressoRequest().getSession()
                 .getAttribute(Globals.ERROR_KEY);
 
         return errs;
@@ -640,9 +659,11 @@
      * @param paramName the name of the parameter to retrieve
      * @return java.lang.String or null if the parameter doesn't exist
      * @throws ControllerException upon error
+     * @deprecated Since Expresso 5.7.  Use <tt>ExpressoRequest</tt>.getParameter()
+     * instead.
      */
     public String getParameter(String paramName) throws ControllerException {
-        return getRequest().getParameter(paramName);
+        return getExpressoRequest().getParameter(paramName);
     }
 
     /**
@@ -653,7 +674,7 @@
      * @param newRequest the new controller request.
      * @throws ControllerException upon error
      */
-    public void setRequest(ControllerRequest newRequest)
+    public void setRequest(ExpressoRequest newRequest)
             throws ControllerException {
         if (newRequest == null) {
             throw new ControllerException("You cannot set a null Controller Request here");
@@ -671,11 +692,25 @@
      * @return <code>ControllerRequest</code> object
      * @throws IllegalArgumentException if the setRequest() object has not
      *                                  been set yet.
+     * @deprecated Since Expresso 5.7 Use getExpressoRequest() instead.
+     *
      */
     public ControllerRequest getRequest() {
         if (myRequest == null) {
             throw new IllegalStateException("ControllerResponse.setRequest() must be set before calling getRequest()");
         }
+        return (ControllerRequest)myRequest;
+    }
+
+    /**
+     * Retrieve the ExpressoRequest object associated with this response.
+     * @return <tt>ExpressoRequest</tt> object.
+     * @throws IllegalArgumentException if the setRequest() object has not been set yet.
+     */
+    public ExpressoRequest getExpressoRequest() {
+        if (myRequest == null) {
+            throw new IllegalStateException("ControllerResponse.setRequest() must be set before calling getRequest()");
+        }
         return myRequest;
     }
 
@@ -1065,7 +1100,7 @@
         validState();
 
         if (transitionCacheOrdered != null) {
-            return transitionCacheOrdered;
+            return new Vector(transitionCacheOrdered);
         }
 
         return null;
@@ -1113,20 +1148,24 @@
     }
 
     /**
-     * Set the user string value
+     * Set the user string value.
      *
      * @param newUser the new user.
      * @throws ControllerException upon error
+     * @deprecated If you have to use it, use <tt>ExpressoRequest</tt>.setUser()
+     * otherwise, use RequestRegistry capabilities. (Since Expresso 5.7)
      */
     public synchronized void setUser(String newUser) throws ControllerException {
         getRequest().setUser(newUser);
     }
 
     /**
-     * Get the database from the request, if there is a request available
+     * Get the database from the request, if there is a request available.
      *
      * @return the User as specified by the request.
      * @throws ControllerException upon error
+     * @deprecated Since Expresso 5.7 Use <tt>RequestRegistry</tt>.getUser()
+     * instead.
      */
     public String getUser() throws ControllerException {
         return getRequest().getUser();
@@ -1136,7 +1175,7 @@
 
     /**
      * Convenience method to allow us to add any ControllerElement to this
-     * controllers inputs, outputs or transitions
+     * controllers inputs, outputs or transitions.
      *
      * @param t the new ControllerElement
      * @throws ControllerException upon error [Such as if the ControllerElement
@@ -1171,6 +1210,7 @@
      * @param maxLength     the maximum length of the input
      * @param validValues   a Vector of valid value objects for dropdowns
      * @throws ControllerException upon error
+     * @deprecated since Expresso 5.7 Use Default AutoElement instead.
      */
     public void addAutoInput(String fieldName, String friendlyName,
                              String defaultValue, int displayLength, int maxLength,
@@ -1191,6 +1231,7 @@
      * @param dbobj        com.jcorporate.expresso.core.dbobj.DBObject
      * @param defaultValue java.lang.String
      * @throws ControllerException upon error
+     * @deprecated since Expresso 5.7 Use Default AutoElement instead.
      */
     public void addAutoInput(String fieldName, DBObject dbobj,
                              String defaultValue) throws ControllerException {
@@ -1241,6 +1282,7 @@
      * @param dbClassName  java.lang.String
      * @param defaultValue java.lang.String
      * @throws ControllerException upon error
+     * @deprecated since Expresso 5.7 Use Default AutoElement instead.
      */
     public void addAutoInput(String fieldName, String dbClassName,
                              String defaultValue) throws ControllerException {
@@ -1297,6 +1339,7 @@
      *
      * @param myDBObj the dbobject to render to the controller response
      * @throws ControllerException upon error
+     * @deprecated since Expresso 5.7 Use Default AutoElement instead.
      */
     public void addAutoInput(DBObject myDBObj) throws ControllerException {
         try {
@@ -1334,6 +1377,7 @@
      * @param dbClassName  java.lang.String
      * @param defaultValue java.lang.String
      * @throws ControllerException upon error
+     * @deprecated since Expresso 5.7 Use Default AutoElement instead.
      */
     public void addAutoInput(String fieldName, String friendlyName,
                              String dbClassName, String defaultValue) throws ControllerException {
@@ -1396,6 +1440,7 @@
      * @param fieldType     the type of the field such as "datetime", "varchar",
      *                      etc
      * @throws ControllerException upon error
+     * @deprecated Since Expresso 5.7  Use DefaultAutoElement instead.
      */
     public void addAutoInput(String fieldName, String friendlyName,
                              String defaultValue, int displayLength, int maxLength,
@@ -1470,6 +1515,7 @@
      * @param dbobj         com.jcorporate.expresso.core.dbobj.DBObject
      * @param defaultValue  java.lang.String
      * @throws ControllerException upon error
+     * @deprecated since Expresso 5.7 Use Default AutoElement instead.
      */
     public void addAutoInputRenameField(String fieldName, String renameFieldTo,
                                         DBObject dbobj, String defaultValue) throws ControllerException {
@@ -1512,7 +1558,6 @@
         }
     }
 
-    /* addAutoInputRenameField(String, DBObject, String) */
 
     /**
      * Adds a Block to the response that will be formatted by the controller
@@ -1541,7 +1586,7 @@
             blockCacheOrdered = new Vector();
         }
 
-        blockCacheOrdered.addElement(newBlock);
+        blockCacheOrdered.add(newBlock);
     }
 
     /* addBlock(Block) */
@@ -1549,11 +1594,10 @@
     /**
      * Add and error message to the response
      *
-     * @param errorMessage
-     *
+     * @param errorMessage The Error message to add to the error collection.
      * @throws ControllerException on error
      */
-    public void addError(String errorMessage) throws ControllerException {
+    public void addError(final String errorMessage) throws ControllerException {
         ErrorCollection errs = getErrors();
 
         if (errs == null) {
@@ -1605,9 +1649,10 @@
     }
 
     /**
-     * @param propName
-     * @param errorMessage
+     * @param propName the bean property name
+     * @param errorMessage the bean error message.
      * @deprecated 7/04 v5.5 expresso uses only one property name, the default; use addError(String errmsg) instead
+     * @throws ControllerException upon error.
      */
     public void addError(String propName, String errorMessage)
             throws ControllerException {
@@ -1647,7 +1692,7 @@
             inputCacheOrdered = new Vector();
         }
 
-        inputCacheOrdered.addElement(newInput);
+        inputCacheOrdered.add(newInput);
     }
 
     /* addInput(Input) */
@@ -1678,7 +1723,7 @@
             outputCacheOrdered = new Vector();
         }
 
-        outputCacheOrdered.addElement(newOutput);
+        outputCacheOrdered.add(newOutput);
     }
 
     /* addOutput(Output) */
@@ -1711,7 +1756,7 @@
             transitionCacheOrdered = new Vector();
         }
 
-        transitionCacheOrdered.addElement(newTransition);
+        transitionCacheOrdered.add(newTransition);
     }
 
     /* addTransition(Transition) */
@@ -1724,6 +1769,7 @@
      * @param errorCollection where Errors are saved to
      * @throws ValidationException The exception description.
      * @throws ControllerException upon error
+     * @deprecated Use DefaultAutoElement for parsing (Since Expreso 5.7)
      */
     public void autoValidate(String checkClassName,
                              ErrorCollection errorCollection)
@@ -1759,6 +1805,7 @@
      * @param requiredFields  the field anmes that are required
      * @throws ValidationException The exception description.
      * @throws ControllerException upon error
+     * @deprecated Since Expresso 5.7 use DefaultAutoElement instead.
      */
     public void autoValidate(String checkClassName,
                              ErrorCollection errorCollection, Vector requiredFields)
@@ -1906,10 +1953,11 @@
     }
 
     /**
-     * Restore the controller form
+     * Restore the controller form.
+     * @throws ControllerException upon error.
      */
     public void restoreForm() throws ControllerException {
-        getDefaultForm().restoreForm(getRequest());
+        getDefaultForm().restoreForm(getExpressoRequest());
     }
 
     /**
@@ -1926,9 +1974,8 @@
      * @param errorCollection java.jcorporate.expresso.core.controller.ErrorCollection
      * @throws ControllerException upon error
      */
-    public void saveErrors(ErrorCollection errorCollection)
-            throws ControllerException {
-        ControllerRequest req = getRequest();
+    public void saveErrors(final ErrorCollection errorCollection) throws ControllerException {
+        ExpressoRequest req = getExpressoRequest();
         HttpServletRequest hreq = null;
 
         if (req instanceof ServletControllerRequest) {
@@ -2060,7 +2107,7 @@
      * @param validSet        com.jcorporate.expresso.core.controller.ValidationSet
      * @param errorCollection com.jcorporate.expresso.core.controller.ErrorCollection
      * @throws ValidationException upon error
-     * @deprecated See ControllerRequest.validateDBObject instead....
+     * @deprecated See ControllerRequest.validateDBObject instead.  (Since Pre-Expresso 5.7)
      */
     public void validate(ValidationSet validSet, ErrorCollection errorCollection)
             throws ValidationException {
@@ -2170,7 +2217,7 @@
      * @throws ControllerException upon error
      */
     protected DefaultForm getDefaultForm() throws ControllerException {
-        String formKey = getRequest().getFormAttribute();
+        String formKey = getExpressoRequest().getFormAttribute();
 
         if (StringUtil.notNull(formKey).equals("")) {
             throw new ControllerException("No ActionForm has been specified for this Controller mapping," +
@@ -2178,11 +2225,11 @@
                     " by setting name=\"default\" in the Action mapping. (i.e., use the default expresso formbean)");
         }
 
-        DefaultForm myForm = (DefaultForm) getRequest().getSession()
+        DefaultForm myForm = (DefaultForm) getExpressoRequest().getSession()
                 .getAttribute(formKey);
 
         if (myForm == null) {
-            myForm = (DefaultForm) getRequest().getSession()
+            myForm = (DefaultForm) getExpressoRequest().getSession()
                     .getPersistentAttribute(formKey);
         }
 
@@ -2229,11 +2276,11 @@
     }
 
     /**
-     * Set the current State object
+     * Set the current State object.
      *
      * @param newState the new current state
      */
-    void setCurrentState(State newState) {
+    public void setCurrentState(State newState) {
         currentState = newState;
     }
 
@@ -2241,6 +2288,7 @@
      * Useful for JSTL iteration of all items in response.
      *
      * @return a Map of all nested elements keyed by controllerElement name.
+     * @throws ControllerException upon error grabbing the controller exceptions.
      */
     public Map getNestedMap() throws ControllerException {
         HashMap mappedNested = new HashMap();
@@ -2269,7 +2317,7 @@
     }
 
     /**
-     * return raw key, without running through msg bundle string translation--useful for when 'cloning' in Transition
+     * Return raw key, without running through msg bundle string translation--useful for when 'cloning' in Transition.
      *
      * @return String the title key
      */
Index: ControllerElement.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerElement.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerElement.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerElement.java -u -r1.31 -r1.32
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerElement.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/ControllerElement.java
@@ -142,7 +142,7 @@
     private HashMap attributes = null;
 
     /* The ControllerResponse that contains this ControllerElement */
-    private ControllerResponse myResponse = null;
+    private ExpressoResponse myResponse = null;
 
     /**
      * A map of nested elements keyed by name.  May be incomplete if the
@@ -186,9 +186,9 @@
         mappedNested.put(e.getName(), e);
 
         e.setParent(this);
-        ControllerResponse cr = getControllerResponse();
+        ExpressoResponse cr = getResponse();
         if (cr != null) {
-            e.setControllerResponse(getControllerResponse());
+            e.setControllerResponse(getResponse());
         }
     } /* addNested(ControllerElement) */
 
@@ -956,7 +956,7 @@
      *
      * @param newResponse the new Response.
      */
-    public synchronized void setControllerResponse(final ControllerResponse newResponse) {
+    public synchronized void setControllerResponse(final ExpressoResponse newResponse) {
         myResponse = newResponse;
 
         Vector allNested = getNestedOrNull();
@@ -974,7 +974,19 @@
         }
     }
 
+    /**
+     * @deprecated Since Expresso 5.7  Use getResponse() instead.
+     * @return ControllerResponse
+     */
     protected ControllerResponse getControllerResponse() {
+        return (ControllerResponse)myResponse;
+    }
+
+    /**
+     * Returns the previously set 'ExpressoResponse' object.
+     * @return ExpressoResponse
+     */
+    protected ExpressoResponse getResponse() {
         return myResponse;
     }
 }
Index: StateForm.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/StateForm.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/StateForm.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/StateForm.java -u -r1.10 -r1.11
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/StateForm.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/StateForm.java
@@ -73,9 +73,9 @@
 public interface StateForm {
     /**
      * method prototype so it can be called from an external State  *RD* Mon Jul 27 2004
-     * 
+     *
      * @param request the servlet request
      * @return ErrorCollection a collection of errors
      */
-    public ErrorCollection validate(ControllerRequest request);
+    public ErrorCollection validate(ExpressoRequest request);
 }
Index: Input.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Input.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Input.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Input.java -u -r1.35 -r1.36
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Input.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Input.java
@@ -564,7 +564,7 @@
             return new ArrayList();
         }
 
-        return Collections.unmodifiableList(validValues);
+        return new ArrayList(validValues);
     }
 
     /**
--- /dev/null
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/DeprecatedInvocationUtils.java
@@ -0,0 +1,60 @@
+package com.jcorporate.expresso.core.controller;
+
+import java.lang.reflect.*;
+import org.apache.log4j.Logger;
+
+/**
+ * Checks to see if a 'deprecated' function exists, and then invokes it.  This will
+ * probably be removed by Expresso 5.8.  Will be marked deprecated then.
+ * @author Michael Rimov
+ */
+final class DeprecatedInvocationUtils
+{
+
+    /**
+     * The log4j logger.
+     */
+    private static final Logger LOG = Logger.getLogger(DeprecatedInvocationUtils.class);
+
+    /**
+     * Do not use constructor.
+     */
+    private DeprecatedInvocationUtils() {
+        super();
+    }
+
+
+    /**
+     * Invokes a controller-related function and resturns the result handling
+     * exceptions properly.
+     * @param functionName String the name of the deprecated function.
+     * @param invocationObject the object to invoke the method on.
+     * @param expectedClasses Class[] the class array we're expecting.
+     * @param expectedParameters Object[] the object we're expecting.
+     * @return Object the result.  Is null if not invoked.
+     * @throws ControllerException
+     * @throws java.lang.NoSuchMethodException if the specified function
+     * doesn't exist. (Which is usually a good thing as far as this class is concerned)
+     */
+    public static Object invokeDeprecatedFunction(final String functionName, final Object invocationObject
+        , final Class[] expectedClasses, final Object[] expectedParameters) throws ControllerException
+        , NoSuchMethodException {
+
+        try {
+            Method m = invocationObject.getClass().getMethod(functionName, expectedClasses);
+            Object result = (Object) m.invoke(invocationObject, expectedParameters);
+            return result;
+        } catch (InvocationTargetException ex1) {
+            LOG.error("Invocation target exception", ex1);
+            if (ex1.getTargetException() instanceof ControllerException) {
+                throw ((ControllerException) ex1.getTargetException());
+            }
+            throw new ControllerException("Error invoking stateAllowed(String,ControllerRequest)", ex1);
+        } catch (IllegalAccessException ex1) {
+            LOG.error("Didn't find public exception", ex1);
+            throw new ControllerException("Error invoking stateAllowed(String,ControllerRequest)", ex1);
+        }
+    }
+
+
+}
Index: Block.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Block.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Block.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Block.java -u -r1.19 -r1.20
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Block.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Block.java
@@ -220,9 +220,9 @@
      * Generate a copy of this current Block
      *
      * @return an instantiated Block onbject
+     * @throws java.lang.CloneNotSupportedException upon construction error.
      */
-    public Object clone()
-            throws CloneNotSupportedException {
+    public Object clone() throws CloneNotSupportedException {
         Block b;
 
         synchronized (this) {
Index: Transition.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Transition.java,v
retrieving revision 1.63
retrieving revision 1.64
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Transition.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Transition.java -u -r1.63 -r1.64
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Transition.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Transition.java
@@ -120,10 +120,9 @@
  * <p/>
  * <p><i>default behavior:</i> Renders as a clickable button</p>
  */
-public class Transition
-        extends ControllerElement
-        implements Cloneable,
-        java.io.Serializable {
+public class Transition extends ControllerElement implements Cloneable,
+    java.io.Serializable
+{
 
     private static Logger log = Logger.getLogger(Transition.class);
 
@@ -175,7 +174,7 @@
      * @param myController An instantiated Controller object. Use a <code>ControllerFactory</code>
      *                     to instantiate the controller if you must use this constructor.
      */
-    public Transition(String newState, Controller myController) {
+    public Transition(final String newState, final Controller myController) {
 
         //
         //Precalculate the class name because it can take significant CPU time.
@@ -198,14 +197,16 @@
 
         if (theState == null) {
             throw new IllegalArgumentException("No such state as '" +
-                    newState + "' in controller '" +
-                    className +
-                    "'");
+                newState + "' in controller '" +
+                className +
+                "'");
         }
 
         setLabel(theState.getDescription());
         addParam(Controller.STATE_PARAM_KEY, newState);
-    } /* Transition(String, Controller) */
+    }
+
+    /* Transition(String, Controller) */
 
     /**
      * Convenience constructor to create an action with a label
@@ -214,12 +215,14 @@
      * @param newLabel  Label for the new action
      * @param newObject The name of the object this action referred to
      */
-    public Transition(String newLabel, String newObject) {
+    public Transition(final String newLabel, final String newObject) {
         super();
         setName(StringUtil.replace(newLabel, " ", ""));
         setLabel(newLabel);
         setControllerObject(newObject);
-    } /* Transition(String, String) */
+    }
+
+    /* Transition(String, String) */
 
     /**
      * Convenience constructor to create an action with a label
@@ -229,12 +232,14 @@
      * @param newLabel  Label for the new action
      * @param newObject The name of the Controller object this action referred to
      */
-    public Transition(String newName, String newLabel, String newObject) {
+    public Transition(final String newName, final String newLabel, final String newObject) {
         super();
         setName(newName);
         setLabel(newLabel);
         setControllerObject(newObject);
-    } /* Transition(String, String, String) */
+    }
+
+    /* Transition(String, String, String) */
 
     /**
      * Convenience method to allow for one line of code to construct a transition.
@@ -244,10 +249,8 @@
      * @param controllerClass The <code>Class</code> of the controller to use
      * @param controllerState The name of the controller's state.
      */
-    public Transition(String name,
-                      String label,
-                      Class controllerClass,
-                      String controllerState) {
+    public Transition(final String name, final String label, final Class controllerClass,
+        final String controllerState) {
         super();
         setName(name);
         setLabel(label);
@@ -263,9 +266,8 @@
      * @param controllerClass The <code>Class</code> of the controller to use
      * @param controllerState The name of the controller's state.
      */
-    public Transition(String label,
-                      Class controllerClass,
-                      String controllerState) {
+    public Transition(final String label, final Class controllerClass, final String controllerState) {
+
         super();
         setName(controllerState);
         setLabel(label);
@@ -281,7 +283,7 @@
      * @param paramCode  The code name of the parameter
      * @param paramValue The value for the paramter
      */
-    public synchronized void addParam(String paramCode, String paramValue) {
+    public synchronized void addParam(final String paramCode, final String paramValue) {
         clearCache();
         if (paramCode.equals(Controller.STATE_PARAM_KEY)) {
             setState(StringUtil.notNull(paramValue));
@@ -295,7 +297,9 @@
         }
 
         params.put(paramCode, StringUtil.notNull(paramValue));
-    } /* addParam(String, String) */
+    }
+
+    /* addParam(String, String) */
 
     private synchronized void clearCache() {
         cacheParamStringWithController = null;
@@ -307,7 +311,7 @@
      *
      * @param newState java.lang.String
      */
-    public synchronized void setState(String newState) {
+    public synchronized void setState(final String newState) {
         clearCache();
         myState = newState;
     }
@@ -332,12 +336,11 @@
      * @throws CloneNotSupportedException as required by the method
      *                                    signature.
      */
-    public Object clone()
-            throws CloneNotSupportedException {
+    public Object clone() throws CloneNotSupportedException {
         Transition t;
 
         synchronized (this) {
-            t = (Transition) super.clone();
+            t = (Transition)super.clone();
             t.params = new HashMap(params);
             t.controllerObject = controllerObject;
             t.myState = myState;
@@ -364,8 +367,7 @@
      * @param response the ControllerResponse object
      * @throws ControllerException upon error
      */
-    public void enableReturnToSender(ControllerResponse response)
-            throws ControllerException {
+    public void enableReturnToSender(final ExpressoResponse response) throws ControllerException {
         returnToSender = true;
         String returnToSender = null;
         if (response != null) {
@@ -400,7 +402,7 @@
      *                          a parameter.
      * @return true if this is a transition to a another controller.
      */
-    public boolean isExternalTransition(String runningController) {
+    public boolean isExternalTransition(final String runningController) {
         if (controllerObject == null || controllerObject.equals(runningController)) {
             return false;
         } else {
@@ -422,7 +424,9 @@
         }
 
         return controllerObject;
-    } /* getControllerObject() */
+    }
+
+    /* getControllerObject() */
 
     /**
      * Sets the controller that created this transition.  If controllerObject
@@ -442,7 +446,9 @@
      */
     public String getParam(String paramCode) {
         return (String) params.get(paramCode);
-    } /* getParam(String) */
+    }
+
+    /* getParam(String) */
 
     /**
      * Return the hashtable of parameters for this transition object.
@@ -455,7 +461,9 @@
      */
     public Hashtable getParams() {
         return new Hashtable(params);
-    } /* getParams() */
+    }
+
+    /* getParams() */
 
     /**
      * Retrieve a <tt>Map</tt> of parameters for this transition object.
@@ -472,7 +480,7 @@
      * @return parameter string which includes all params added to trans, as well
      *         as state param. controller param added optionally
      */
-    public synchronized String getParamString(boolean includeControllerParameter) {
+    public synchronized String getParamString(final boolean includeControllerParameter) {
         if (includeControllerParameter && cacheParamStringWithController == null) {
             FastStringBuffer paramString = FastStringBuffer.getInstance();
             try {
@@ -504,7 +512,6 @@
 
         }
 
-
         if (includeControllerParameter) {
             return cacheParamStringWithController;
         } else {
@@ -518,7 +525,7 @@
             if (!this.params.isEmpty()) {
                 String oneKey = null;
 
-                for (Iterator e = this.params.keySet().iterator(); e.hasNext();) {
+                for (Iterator e = this.params.keySet().iterator(); e.hasNext(); ) {
                     if (paramString.length() != 0) {
                         paramString.append("&");
                     }
@@ -530,7 +537,7 @@
                     try {
                         fsb.append(oneKey);
                         fsb.append("=");
-                        fsb.append(URLUTF8Encoder.encode((String) this.params.get(oneKey)));
+                        fsb.append(URLUTF8Encoder.encode((String)this.params.get(oneKey)));
                         paramString.append(fsb.toString());
                     } finally {
                         fsb.release();
@@ -561,7 +568,9 @@
 
         return getParamString(true);
 
-    } /* getParamString() */
+    }
+
+    /* getParamString() */
 
     /**
      * This method invokes a new controller by dispatching to it rather than
@@ -577,10 +586,11 @@
      *
      * @param request the <code>ControllerRequest</code> Object
      * @return an instantiated <code>ControllerResponse</code> object
+     * @throws ControllerException upon controller error.
+     * @throws NonHandleableException upon fatal error.
      */
-    protected ControllerResponse newStateDispatch(ControllerRequest request)
-            throws ControllerException,
-            NonHandleableException {
+    protected ControllerResponse newStateDispatch(ExpressoRequest request) throws ControllerException,
+        NonHandleableException {
         ServletControllerRequest servletRequest = (ServletControllerRequest) request;
         HttpServletRequest httpRequest = (HttpServletRequest) servletRequest.getServletRequest();
         HttpServletResponse httpResponse = (HttpServletResponse) servletRequest.getServletResponse();
@@ -591,8 +601,8 @@
 
         if (ac == null) {
             throw new ControllerException("Cannot transition to controller: " +
-                    controllerObject +
-                    " controller not defined in Struts configuration");
+                controllerObject +
+                " controller not defined in Struts configuration");
         }
 
         String apath = ac.getPath();
@@ -614,7 +624,7 @@
 
             if (dispatcher == null) {
                 throw new ControllerException("Request dispatcher was null - cannot include URL '" +
-                        urlValue + "'");
+                    urlValue + "'");
             }
         } finally {
             newURL.release();
@@ -641,11 +651,11 @@
             }
         }
 
-        request = (ControllerRequest) httpRequest.getAttribute(ExpressoConstants.CONTROLLER_REQUEST_KEY);
+        request = (ExpressoRequest) httpRequest.getAttribute(ExpressoConstants.CONTROLLER_REQUEST_KEY);
         httpRequest.removeAttribute(ExpressoConstants.CONTROLLER_REQUEST_KEY);
 
         ControllerResponse response = (ControllerResponse) httpRequest.getAttribute(
-                ExpressoConstants.CONTROLLER_RESPONSE_KEY);
+            ExpressoConstants.CONTROLLER_RESPONSE_KEY);
         httpRequest.removeAttribute(ExpressoConstants.CONTROLLER_RESPONSE_KEY);
 
         return response;
@@ -660,13 +670,12 @@
      * @return true if we're recusing to the same state and controller as we're
      *         already in.
      */
-    public boolean isRecursiveTransition(String runningState,
-                                         String runningController) {
+    public boolean isRecursiveTransition(final String runningState, final String runningController) {
         String targetController = StringUtil.notNull(controllerObject);
         String targetState = StringUtil.notNull(myState);
 
         if (targetController.equals(runningController) &&
-                targetState.equals(runningState)) {
+            targetState.equals(runningState)) {
             return true;
         }
 
@@ -722,17 +731,21 @@
             sb = null;
         }
         return returnValue;
-    } /* getHTMLParamStriong() */
+    }
+
+    /* getHTMLParamStriong() */
 
     /**
      * Set the Controller that this action referrs to
      *
      * @param newObject Name of the Controller object that this Transition refers to
      */
-    public synchronized void setControllerObject(String newObject) {
+    public synchronized void setControllerObject(final String newObject) {
         clearCache();
         controllerObject = newObject;
-    } /* setControllerObject(String) */
+    }
+
+    /* setControllerObject(String) */
 
     /**
      * Mor Typesafe way of setting the controller object.  Any typos will be caught
@@ -744,12 +757,12 @@
      *
      * @param c the class of the controller object to add.
      */
-    public synchronized void setControllerObject(Class c) {
+    public synchronized void setControllerObject(final Class c) {
         clearCache();
         if (c != null) {
             setControllerObject(c.getName());
         } else {
-            setControllerObject((String) null);
+            setControllerObject((String)null);
         }
     }
 
@@ -792,7 +805,7 @@
      *
      * @param newReturnToSenderRequest The <code>ControllerRequest</code> object
      */
-    public synchronized void setReturnToSenderParms(final ControllerRequest newReturnToSenderRequest) {
+    public synchronized void setReturnToSenderParms(final ExpressoRequest newReturnToSenderRequest) {
         clearCache();
         String oneParamName = null;
         Object oneParamValue = null;
@@ -804,13 +817,13 @@
         //Passing the xxx_params caused problems when the transition was encoded again and sent to HTML.
         //When the double-encoded parameter comes back with the next user request it is never unencoded.
         //This ends up causing problems with the fromXML/toXML methods in Transition.
-        for (Iterator e = params.keySet().iterator(); e.hasNext();) {
+        for (Iterator e = params.keySet().iterator(); e.hasNext(); ) {
             oneParamName = (String) e.next();
 
             if (!oneParamName.endsWith("_params") &&
-                    !oneParamName.endsWith("_encoding") &&
-                    !oneParamName.equals(Controller.STATE_PARAM_KEY) &&
-                    !oneParamName.equals(Controller.CONTROLLER_PARAM_KEY)) {
+                !oneParamName.endsWith("_encoding") &&
+                !oneParamName.equals(Controller.STATE_PARAM_KEY) &&
+                !oneParamName.equals(Controller.CONTROLLER_PARAM_KEY)) {
                 oneParamValue = params.get(oneParamName);
                 newParams.put(oneParamName, oneParamValue);
             }
@@ -858,7 +871,7 @@
         if (!params.isEmpty()) {
             stream.append("\t<transition-parameters>\n");
 
-            for (Enumeration ap = params.keys(); ap.hasMoreElements();) {
+            for (Enumeration ap = params.keys(); ap.hasMoreElements(); ) {
                 oneKey = (String) ap.nextElement();
                 stream.append("\t\t<transition-param name=\"");
                 stream.append(StringUtil.xmlEscape(oneKey));
@@ -883,8 +896,7 @@
      * @return an instantiated Transition object
      * @throws ControllerException upon error
      */
-    public static Transition fromXML(String newTransition)
-            throws ControllerException {
+    public static Transition fromXML(String newTransition) throws ControllerException {
         StringDOMParser parser = new StringDOMParser();
         Document d = parser.parseString(newTransition);
 
@@ -904,8 +916,7 @@
      * @return an instantiated ControllerElement
      * @throws ControllerException upon error
      */
-    public static ControllerElement fromXML(Node n)
-            throws ControllerException {
+    public static ControllerElement fromXML(Node n) throws ControllerException {
 
         //If we're at the root node, then it'll be doc instead of input.
         if (n.getNodeName().equals("#document")) {
@@ -987,26 +998,26 @@
      * @throws ControllerException if there is an error or there is no controller
      *                             response object available to help resoolve the reference.
      */
-    public String getTheUrl(boolean resolveControllerReference) throws ControllerException {
+    public String getTheUrl(final boolean resolveControllerReference) throws ControllerException {
         String returnValue = null;
         FastStringBuffer fsb = FastStringBuffer.getInstance();
         try {
             String paramString = "";
 
             if (resolveControllerReference
-                    && this.getControllerObject() != null
-                    && this.getControllerObject().length() > 0) {
+                && this.getControllerObject() != null
+                && this.getControllerObject().length() > 0) {
 
                 // try mapping first
                 try {
                     fsb.append(getMapping());
                 } catch (Exception e) {
                     // try response
-                    ControllerResponse myResponse = getControllerResponse();
+                    ExpressoResponse myResponse = getResponse();
 
                     if (myResponse == null) {
                         throw new ControllerException(
-                                "No controller object, nor controller response object available - cannot build URL");
+                            "No controller object, nor controller response object available - cannot build URL");
                     }
 
                     fsb.clear();
@@ -1018,14 +1029,14 @@
             } else {
 
                 // try response first
-                ControllerResponse myResponse = getControllerResponse();
+                ExpressoResponse myResponse = getResponse();
 
                 if (myResponse == null) {
                     try {
                         fsb.append(getMapping());
                     } catch (Exception e) {
                         throw new ControllerException(
-                                "No controller param nor ControllerResponse available - cannot build URL");
+                            "No controller param nor ControllerResponse available - cannot build URL");
                     }
                 } else {
                     fsb.append(myResponse.getRequestPath());
@@ -1057,8 +1068,7 @@
      * @return java.lang.String
      * @throws ControllerException upon error
      */
-    public String getUrl()
-            throws ControllerException {
+    public String getUrl() throws ControllerException {
         return getTheUrl(true);
     }
 
@@ -1090,14 +1100,15 @@
      * .do part) but without a context prepended to the mapping.
      *
      * @return java.lang.String
+     * @throws ControllerException if we cannot find a mapping.
      */
     public String getMapping() throws ControllerException {
         ActionConfig actionConfig = ConfigManager.getActionConfig("",
-                this.getControllerObject(), this.getState());
+            this.getControllerObject(), this.getState());
         if (actionConfig == null) {
             throw new ControllerException("Unable to locate action mapping for: "
-                    + this.getControllerObject()
-                    + " and state " + this.getState());
+                + this.getControllerObject()
+                + " and state " + this.getState());
         }
         return actionConfig.getPath() + ".do";
     }
@@ -1114,15 +1125,32 @@
      * @return the ControllerResponse Object from the called controller
      * @throws ControllerException    upon error
      * @throws NonHandleableException upon fatal error
+     * @deprecated Since Expresso 5.7 Use executeTransition() instead to get proper interface
+     * return type.
      */
-    public ControllerResponse transition(ControllerRequest req,
-                                         ControllerResponse res)
-            throws ControllerException,
-            NonHandleableException {
+    public ControllerResponse transition(final ExpressoRequest req
+        , final ExpressoResponse res) throws ControllerException,
+        NonHandleableException {
         return transition(req, res, true);
     }
 
     /**
+     * Run this transition - e.g. transition to the new state of the
+     * specified controller object immediately, setting the specified
+     * response to the response of this new controller/state, discarding
+     * any previous response
+     * @param request ExpressoRequest
+     * @param response ExpressoResponse
+     * @return ExpressoResponse
+     * @throws ControllerException
+     * @throws NonHandleableException
+     */
+    public ExpressoResponse executeTransition(final ExpressoRequest request
+        , final ExpressoResponse response) throws ControllerException, NonHandleableException {
+        return executeTransition(request, response, true);
+    }
+
+    /**
      * Transition to a new controller and state by issuing a <code>Redirect</code>
      * request to the browser.  This can only be used in a Servlet environment,
      * and is mainly useful when you want the URL for the browser to change after
@@ -1132,42 +1160,43 @@
      *
      * @param request  The ControllerRequest object handed to you by the framework
      * @param response the ControllerResponse object handed to you by the framework
+     * @throws ControllerException upon redirect error.
      */
-    public void redirectTransition(ControllerRequest request,
-                                   ControllerResponse response) throws ControllerException {
+    public void redirectTransition(final ExpressoRequest request
+        , final ExpressoResponse response) throws ControllerException {
+
         try {
 
             if (isRecursiveTransition(response.getCurrentState().getName(),
-                    response.getControllerClass())) {
+                response.getControllerClass())) {
                 throw new ControllerException("State cannot transition to itself.");
             }
 
             if (this.getControllerObject() == null) {
                 throw new ControllerException("Transition.redirectTransition(): "
-                        + " controller object parameter must be set before calling this function");
+                    + " controller object parameter must be set before calling this function");
             }
 
             if (!(request instanceof ServletControllerRequest)) {
                 log.error("Cannot redirect transition in a non-servlet environment. " +
-                        "Transitioning normally instead");
+                    "Transitioning normally instead");
                 try {
-                    this.transition(request, response);
+                    this.executeTransition(request, response);
                 } catch (NonHandleableException ex) {
                     log.error("Non Handleable Exception during transition", ex);
                     throw new ControllerException(ex);
                 }
-                return;
+                return ;
             }
 
             ServletControllerRequest scr = (ServletControllerRequest) request;
             HttpServletResponse hserv = (HttpServletResponse) scr.getServletResponse();
             this.setControllerResponse(response);
 
-
 //            ActionMapping mapping = ConfigManager.getMapping(this.getControllerObject(),
 //                    this.getState());
             ActionConfig actionConfig = ConfigManager.getActionConfig("",
-                    this.getControllerObject(), this.getState());
+                this.getControllerObject(), this.getState());
             response.setRequestPath(actionConfig.getPath());
 
             hserv.sendRedirect(((HttpServletRequest) scr.getServletRequest()).getContextPath() + this.getTheUrl(true));
@@ -1180,6 +1209,36 @@
         }
     }
 
+    /**
+     * Runs the transition
+     * @deprecated since Expresso 5.7  Use Transition.execute() to return
+     * the proper response type.
+     * @param request ExpressoRequest
+     * @param response ExpressoResponse
+     * @param clear boolean
+     * @return ControllerResponse
+     * @throws ControllerException
+     * @throws NonHandleableException
+     */
+    public ControllerResponse transition(ExpressoRequest request, ExpressoResponse response
+        , boolean clear) throws ControllerException, NonHandleableException {
+        return (ControllerResponse)this.execute(request, response, clear);
+    }
+
+    /**
+     * Executes a transition.
+     * @param request ExpressoRequest
+     * @param response ExpressoResponse
+     * @param clear boolean
+     * @return ExpressoResponse
+     * @throws ControllerException
+     * @throws NonHandleableException
+     */
+    public ExpressoResponse executeTransition(ExpressoRequest request, ExpressoResponse response
+        , boolean clear) throws ControllerException, NonHandleableException {
+        return this.execute(request, response, clear);
+    }
+
 
     /**
      * Run this transition - e.g. transition to the new state of the
@@ -1206,12 +1265,11 @@
      *      and response.getFormCache(paramName) to retrieve them
      * @see ControllerResponse#getFormCache(String)
      */
-    public ControllerResponse transition(ControllerRequest req,
-                                         ControllerResponse res, boolean clear)
-            throws ControllerException,
-            NonHandleableException {
+    public ExpressoResponse execute(ExpressoRequest req, ExpressoResponse res
+        , boolean clear) throws ControllerException,
+        NonHandleableException {
         if (isRecursiveTransition(res.getCurrentState().getName(),
-                res.getControllerClass())) {
+            res.getControllerClass())) {
             throw new ControllerException("State cannot transition to itself.");
         }
 
@@ -1227,7 +1285,7 @@
         String oneParamKey = null;
         String oneParamValue = null;
 
-        for (Iterator ep = params.keySet().iterator(); ep.hasNext();) {
+        for (Iterator ep = params.keySet().iterator(); ep.hasNext(); ) {
             oneParamKey = (String) ep.next();
             oneParamValue = (String) params.get(oneParamKey);
 
@@ -1236,9 +1294,9 @@
             }
         }
 
-        ControllerRequest newRequest = null;
+        ExpressoRequest newRequest = null;
         try {
-            newRequest = (ControllerRequest) req.clone();
+            newRequest = (ExpressoRequest) req.clone();
             newRequest.setParameters(this.params);
             newRequest.setParameter(Controller.STATE_PARAM_KEY, StringUtil.notNull(this.getState()));
             newRequest.setParameter(Controller.CONTROLLER_PARAM_KEY, this.getControllerObject());
@@ -1246,10 +1304,10 @@
             throw new ControllerException("Error cloning the ControllerRequestObject.", ex);
         }
 
-        ControllerResponse newResponse = null;
+        ExpressoResponse newResponse = null;
 
         if ((externalTransition) &&
-                (req instanceof ServletControllerRequest)) {
+            (req instanceof ServletControllerRequest)) {
             newResponse = newStateDispatch(req);
         } else {
             Controller c = null;
@@ -1260,7 +1318,7 @@
                 c = ConfigManager.getControllerFactory().getController(this.getControllerObject());
             }
 
-            newResponse = c.newState(getState(), newRequest);
+            newResponse = c.newState(getState(), (ControllerRequest)newRequest);
         }
         if (clear) {
             res.clearOutputCache();
@@ -1270,7 +1328,7 @@
             res.clearAttributes();
         }
 
-        res.setDBName(newResponse.getDBName());
+        res.setDataContext(newResponse.getDataContext());
         res.setCustomResponse(newResponse.isCustomResponse());
         res.setCurrentState(newResponse.getCurrentState());
         res.setStyle(newResponse.getStyle());
@@ -1282,7 +1340,7 @@
         Vector newBlocks = newResponse.getBlocks();
 
         if (newBlocks != null) {
-            for (Enumeration eb = newBlocks.elements(); eb.hasMoreElements();) {
+            for (Enumeration eb = newBlocks.elements(); eb.hasMoreElements(); ) {
                 oneBlock = (Block) eb.nextElement();
                 oneBlock.setControllerResponse(res);
                 res.addBlock(oneBlock);
@@ -1293,7 +1351,7 @@
         Vector newOutputs = newResponse.getOutputs();
 
         if (newOutputs != null) {
-            for (Enumeration eo = newOutputs.elements(); eo.hasMoreElements();) {
+            for (Enumeration eo = newOutputs.elements(); eo.hasMoreElements(); ) {
                 oneOutput = (Output) eo.nextElement();
                 oneOutput.setControllerResponse(res);
                 res.addOutput(oneOutput);
@@ -1304,7 +1362,7 @@
         Vector newInputs = newResponse.getInputs();
 
         if (newInputs != null) {
-            for (Enumeration ei = newInputs.elements(); ei.hasMoreElements();) {
+            for (Enumeration ei = newInputs.elements(); ei.hasMoreElements(); ) {
                 oneInput = (Input) ei.nextElement();
                 oneInput.setControllerResponse(res);
                 res.addInput(oneInput);
@@ -1316,7 +1374,7 @@
 
         if (newTransitions != null) {
             for (Enumeration et = newTransitions.elements();
-                 et.hasMoreElements();) {
+                et.hasMoreElements(); ) {
                 oneTransition = (Transition) et.nextElement();
                 oneTransition.setControllerResponse(res);
                 res.addTransition(oneTransition);
@@ -1326,9 +1384,9 @@
             res.setControllerClass(getControllerObject());
         }
 
-        Map attributes = newResponse.getAttributes();
+        Map attributes = newResponse.getExpressoRequest().getAttributes();
         if (attributes != null) {
-            res.setAttributes(attributes);
+            res.getExpressoRequest().setAttributes(attributes);
         }
 
         return res;
@@ -1351,7 +1409,7 @@
      *
      * @param servletResponse a servlet response object for encoding URLs
      */
-    public void setServletResponse(HttpServletResponse servletResponse) {
+    public void setServletResponse(final HttpServletResponse servletResponse) {
         this.servletResponse = servletResponse;
     }
 
@@ -1361,16 +1419,18 @@
      *
      * @param newResponse the controllerResponse to set.
      */
-    public synchronized void setControllerResponse(ControllerResponse newResponse) {
+    public synchronized void setControllerResponse(ExpressoResponse newResponse) {
         super.setControllerResponse(newResponse);
         if (newResponse == null) {
             log.warn("Null 'newReponse'");
             return;
         }
-        if (newResponse.getRequest() != null && (newResponse.getRequest() instanceof ServletControllerRequest)) {
+        if (newResponse.getExpressoRequest() != null
+            && (newResponse.getExpressoRequest() instanceof ServletControllerRequest)) {
 
             this.setServletResponse(
-                    (HttpServletResponse) ((ServletControllerRequest) newResponse.getRequest()).getServletResponse());
+                (HttpServletResponse) ((ServletControllerRequest) newResponse.getExpressoRequest()).getServletResponse());
         }
     }
-} /* Transition */
+}
+/* Transition */
Index: DBController.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/DBController.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/DBController.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/DBController.java -u -r1.38 -r1.39
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/DBController.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/DBController.java
@@ -88,6 +88,9 @@
 import java.util.List;
 import java.util.Stack;
 import java.util.StringTokenizer;
+import com.jcorporate.expresso.core.registry.RequestRegistry;
+import com.jcorporate.expresso.core.security.ReadOnlyUser;
+import com.jcorporate.expresso.core.security.SuperUser;
 
 
 /**
@@ -267,8 +270,7 @@
      * @throws ControllerException if another undefined error takes place while
      *                             checking security.
      */
-    public boolean stateAllowed(String newState,
-                                ControllerRequest myRequest)
+    public boolean stateAllowed(final String newState, final ExpressoRequest myRequest)
             throws ControllerException {
         try {
             boolean allowed = isAllowed(myRequest, this, newState);
@@ -283,6 +285,7 @@
         }
     } /* stateAllowed(String) */
 
+
     /**
      * for the given controller class and state, can the user in this request access this state?
      *
@@ -293,7 +296,7 @@
      * @throws DBException    upon database error
      * @throws CacheException upon error working with the cache system.
      */
-    public static boolean isAllowed(ControllerRequest request, DBController controller, String newState) throws DBException,
+    public static boolean isAllowed(final ExpressoRequest request, final DBController controller, final String newState) throws DBException,
             CacheException {
         boolean allowed = false;
 
@@ -301,14 +304,12 @@
             return false;
         }
 
-        //Grab the user
-        User thisUser = new User();
-        thisUser.setDataContext(request.getDataContext());
-        thisUser.setUid(request.getUid());
-        thisUser.retrieve();
+        ReadOnlyUser thisUser = RequestRegistry.getUser();
+
+
 
         // admin is always allowed
-        if (thisUser.isAdmin()) {
+        if (thisUser.isAdmin() || thisUser == SuperUser.INSTANCE) {
             return true;
         }
 
@@ -445,9 +446,8 @@
      *             be used in *all* cases - this method is not reliable, as the
      *             same DBController instance is shared between users.
      */
-    protected String getString(String stringCode, Object[] args,
-                               ControllerRequest myRequest) {
-        if (myRequest.getUser().equals("")) {
+    protected String getString(final String stringCode, final Object[] args, final ExpressoRequest myRequest) {
+        if (RequestRegistry.getUser() == SuperUser.INSTANCE) {
             return super.getString(stringCode, args);
         } else {
 //			return Messages.getStringForUser(myRequest.getUid(),
Index: Controller.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Controller.java,v
retrieving revision 1.112
retrieving revision 1.113
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Controller.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Controller.java -u -r1.112 -r1.113
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Controller.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/controller/Controller.java
@@ -115,6 +115,7 @@
 import java.util.Stack;
 import java.util.Vector;
 import java.util.Map;
+import com.jcorporate.expresso.core.registry.RequestRegistry;
 
 
 /**
@@ -148,9 +149,8 @@
  * @see com.jcorporate.expresso.core.controller.DBController
  * @see com.jcorporate.expresso.core.controller.SecureIfSetController
  */
-public abstract class Controller
-        extends Action
-        implements Serializable {
+public abstract class Controller extends Action implements Serializable
+{
     /**
      * log for methods in this class alone
      */
@@ -219,7 +219,7 @@
      * is indexed by controller class name. Each entry against a classname is itself a hashtable
      * with a list of the valid state objects for the given controller
      */
-    private static Hashtable states = new Hashtable();
+    private static Map states = new Hashtable();
 
 
     /**
@@ -231,9 +231,17 @@
         com.jcorporate.expresso.core.controller.ControllerRequest.class
     };
 
+    /**
+     * Used for state interface handlers.
+     */
+    private static final Class[] newStateInterfaceParams = {
+        com.jcorporate.expresso.core.controller.ExpressoRequest.class,
+        com.jcorporate.expresso.core.controller.ExpressoResponse.class
+    };
+
 
     /**
-     * used for reflection into the state handlers
+     * Used for reflection into the state handlers.
      */
     private static final Class[] stateHandlerParams = {
         com.jcorporate.expresso.core.controller.ControllerRequest.class,
@@ -241,7 +249,7 @@
     };
 
     /**
-     * used for reflection into the state handlers
+     * Used for reflection into the state handlers.
      */
     private static final Class[] servletStateHandlerParams = {
         com.jcorporate.expresso.core.controller.ServletControllerRequest.class,
@@ -292,7 +300,9 @@
      */
     public Controller() {
 
-    } /* Controller() */
+    }
+
+    /* Controller() */
 
 
     /**
@@ -304,18 +314,15 @@
      * @param newFinalState the new state to use as your final state.
      * @throws NonHandleableException if you send it an improper final state.
      */
-    protected void addFinalState(State newFinalState)
-            throws NonHandleableException {
+    protected void addFinalState(State newFinalState) throws NonHandleableException {
         if (promptStates.contains(newFinalState) ||
-                handleStates.contains(newFinalState)) {
+            handleStates.contains(newFinalState)) {
             throw new NonHandleableException("Final state must not be the same as any of the paired states.");
         }
 
-
         finalState = newFinalState;
         addState(newFinalState);
 
-
         //Set the initial state to this final state only if it is the only state in this controller.
         if (StringUtil.notNull(getInitialState()).equals("")) {
             setInitialState(newFinalState.getName());
@@ -335,16 +342,13 @@
      *                  added to.
      * @throws ControllerException upon error.
      */
-    protected void addPromptTransitions(State nextState,
-                                        ControllerResponse response)
-            throws ControllerException {
-
+    protected void addPromptTransitions(final State nextState
+        , final ExpressoResponse response) throws ControllerException {
 
         //Tack on the wizards Prev/Next/Finish transitions to any promptStates.
         if (isPromptState(nextState)) {
             String previousPromptState = previousPromptState(nextState);
 
-
             if (previousPromptState != null) {
                 Transition previousTransition = new Transition();
                 previousTransition.setControllerObject(getClass().getName());
@@ -354,16 +358,13 @@
                 response.addTransition(previousTransition);
             }
 
-
             //Add the 'Next' or 'Done' buttons ('Done' is replaced with the name of the final state)
             Transition nextTransition = null;
             String nextPromptState = nextPromptState(nextState);
 
-
             if (nextPromptState != null) { //Would not exist if this is the last screen in wizard
                 String nextHandleState = nextHandleState(nextState);
 
-
                 //Safer to use no-arg constructor, this prevents the transition's ownerObject from being set.
                 //Setting this can prevent the getParamString() method from returning a 'controller' param.
                 //This can be problematic in situations, eg - DefaultViewHandler uses the getRequestPath()
@@ -376,16 +377,14 @@
                 nextTransition.setLabel("Next");
                 nextTransition.addParam(STATE_SUCC_STATE, nextPromptState); //ie transition to next screen in wizard
                 nextTransition.addParam(STATE_SUCC_CTL,
-                        response.getControllerClass());
+                    response.getControllerClass());
             } else { //Final state will be last and must exist - It will auto rerun any handler states
                 State finalState = getFinalState();
 
-
                 if (finalState == null) {
                     throw new ControllerException("Final state must exist.");
                 }
 
-
                 nextTransition = new Transition();
                 nextTransition.setControllerObject(getClass().getName());
                 nextTransition.setState(finalState.getName());
@@ -393,7 +392,6 @@
                 nextTransition.setLabel(finalState.getDescription());
             }
 
-
             response.addTransition(nextTransition);
         }
     }
@@ -405,25 +403,22 @@
      * @param newState The State object to be added to the list of states for this
      *                 controller
      */
-    protected void addState(State newState) {
+    protected void addState(final State newState) {
         try {
             newState.setController(this);
         } catch (ControllerException ce) {
             log.error("Unable to set controller", ce);
         }
 
-
         Hashtable myStateList = (Hashtable) states.get(getClass().getName());
 
-
         if (myStateList == null) {
             myStateList = new Hashtable();
             states.put(getClass().getName(), myStateList);
         }
 
-
         myStateList.put(newState.getName(), newState);
-    } /* addState(State) */
+    }
 
 
     /**
@@ -437,8 +432,7 @@
      *                                caused by a java.lang.IllegalArumentException
      */
     protected void addStatePairing(State promptState, State handleState,
-                                   String stateFormClass)
-            throws NonHandleableException {
+        String stateFormClass) throws NonHandleableException {
         if (promptState == null || handleState == null) {
             throw new NonHandleableException("Can't add null state in pairing.");
         }
@@ -448,13 +442,12 @@
             throw new NonHandleableException("Can't add states once final state has been added.");
         }
         if (promptStates.contains(promptState) ||
-                promptStates.contains(handleState) ||
-                handleStates.contains(promptState) ||
-                handleStates.contains(handleState)) {
+            promptStates.contains(handleState) ||
+            handleStates.contains(promptState) ||
+            handleStates.contains(handleState)) {
             throw new NonHandleableException("Paired states must be unique.");
         }
 
-
         promptState.setStateFormClass(stateFormClass);
         handleState.setStateFormClass(stateFormClass);
         promptStates.add(promptState);
@@ -462,13 +455,11 @@
         addState(promptState);
         addState(handleState);
 
-
         //Let's enter via the 1st prompt state in the controller if the value hasn't already been explicitly set.
         if (StringUtil.notNull(getInitialState()).equals("")) {
             setInitialState(promptState.getName());
         }
 
-
         //Set the default transition to return to prompt the user if any errors generated
         //within the handler state.  This setting can be overriden at state-runtime.
         Transition errorTransition = new Transition();
@@ -486,8 +477,7 @@
      * @return The appropriate <code>ActionForm</code> for this controller request
      * @throws ControllerException if unable to find the Controller Form.
      */
-    protected ActionForm findControllerForm(ControllerRequest request)
-            throws ControllerException {
+    protected ActionForm findControllerForm(ExpressoRequest request) throws ControllerException {
         ActionConfig config = ConfigManager.getActionConfig("", getClass().getName(), null);
 //        ActionMapping mapping = ConfigManager.getMapping(getClass().getName(),
 //                null);
@@ -497,19 +487,15 @@
 
         String controllerFormAttribute = config.getAttribute();
 
-
         if (controllerFormAttribute == null) { //no form associated with this controller
             return null;
         }
 
-
         // Find the controller's form.  It would have been created by Strut's form logic before getting here.
         PersistentSession session = request.getSession();
 
-
         if ("request".equals(config.getScope())) {
 
-
             //The getAttribute() method appears to read attributes from the HTTPRequest scope!!
             return (ActionForm) session.getAttribute(controllerFormAttribute);
         } else {
@@ -557,7 +543,9 @@
      */
     public String getInitialState() {
         return (String) initialStates.get(getClass().getName());
-    } /* getInitialState() */
+    }
+
+    /* getInitialState() */
 
 
     /**
@@ -568,7 +556,6 @@
     protected final String getSchema() {
         Stack mySchemaStack = (Stack) schemas.get(getClass().getName());
 
-
         if (mySchemaStack == null) {
             setSchema(ExpressoSchema.class.getName());
             mySchemaStack = (Stack) schemas.get(getClass().getName());
@@ -576,7 +563,9 @@
 
         String returnValue = (String) mySchemaStack.peek();
         return returnValue;
-    } /* getSchema() */
+    }
+
+    /* getSchema() */
 
 
     /**
@@ -621,23 +610,20 @@
     }
 
     /**
-     * Return a specific state
+     * Return a specific state.
      *
      * @param stateName The name of the state to retrieve
      * @return the Instantiated State.
      */
-    public final State getState(String stateName) {
+    public final State getState(final String stateName) {
         Hashtable myStateList = (Hashtable) states.get(getClass().getName());
 
-
         if (myStateList == null) {
             return null;
         }
 
-
         State stateClass = (State) myStateList.get(stateName);
 
-
         if (stateClass == null) {
             return null;
         }
@@ -645,19 +631,19 @@
             State newStateClass = (State) stateClass.clone();
             newStateClass.setController(this);
 
-
             return newStateClass;
         } catch (CloneNotSupportedException cne) {
             log.error("Unable to clone  " + "State object '" + stateClass +
-                    "'", cne);
+                "'", cne);
         } catch (ControllerException ce) {
             log.error("Unable to clone  " + "State object '" + stateClass +
-                    "'", ce);
+                "'", ce);
         }
 
-
         return null;
-    } /* getState(String) */
+    }
+
+    /* getState(String) */
 
 
     /**
@@ -673,7 +659,9 @@
         }
 
         return myStateList;
-    } /* getStates() */
+    }
+
+    /* getStates() */
 
 
     /**
@@ -688,7 +676,9 @@
      */
     protected String getString(String stringCode) {
         return this.getString(stringCode, new Object[0]);
-    } /* getString(String) */
+    }
+
+    /* getString(String) */
 
 
     /**
@@ -724,7 +714,9 @@
      */
     public String getTitle() {
         return ("No Title");
-    } /* getTitle() */
+    }
+
+    /* getTitle() */
 
 
     /**
@@ -743,9 +735,8 @@
      * @throws ServletException upon fatal error for handling the exception
      */
     protected void handleException(HttpServletRequest req,
-                                   ControllerRequest creq, String dbName,
-                                   String userName, Throwable theException)
-            throws ServletException {
+        ControllerRequest creq, String dbName,
+        String userName, Throwable theException) throws ServletException {
         if (StringUtil.notNull(dbName).equals("")) {
             dbName = "default";
         }
@@ -759,14 +750,12 @@
             ControllerResponse errorResponse = new ControllerResponse();
             errorResponse.setRequest(creq);
             errorResponse.setTitle(getTitle());
-            errorResponse.setSchemaStack((java.util.Stack) this.getSchemaStack().clone());
+            errorResponse.setSchemaStack((java.util.Stack)this.getSchemaStack().clone());
             errorResponse.setControllerClass(getClass().getName());
 
-
             /* Stash the stackTrace, if available, in an output */
             boolean showStack = true;
 
-
             try {
                 if (ConfigManager.getContext(dbName) != null) {
                     showStack = ConfigManager.getContext(dbName).showStackTrace();
@@ -779,53 +768,48 @@
                     ByteArrayOutputStream bos = new ByteArrayOutputStream();
                     theException.printStackTrace(new PrintStream(bos));
                     errorResponse.addOutput(new Output("stackTrace",
-                            bos.toString()));
+                        bos.toString()));
                 } else {
                     errorResponse.addOutput(new Output("stackTrace",
-                            "No stack trace was available"));
+                        "No stack trace was available"));
                 }
             } else {
                 errorResponse.addOutput(new Output("stackTrace",
-                        "Stack trace display is not " + "enabled."));
+                    "Stack trace display is not " + "enabled."));
             }
 
-
             errorResponse.addOutput(new Output("exceptionMessage",
-                    theException.getMessage()));
-
+                theException.getMessage()));
 
             if (theException instanceof com.jcorporate.expresso.kernel.exception.ChainedException) {
-                com.jcorporate.expresso.kernel.exception.ChainedException c = (com.jcorporate.expresso.kernel.exception.ChainedException) theException;
+                com.jcorporate.expresso.kernel.exception.ChainedException c = (com.jcorporate.expresso.kernel.exception.
+                    ChainedException) theException;
                 Throwable nestedException = c.getNested();
 
-
                 if (nestedException != null) {
                     String nested = StringUtil.notNull(c.getNested().getMessage());
 
-
                     if (theException.getMessage().indexOf(nested) == -1) {
                         errorResponse.addOutput(new Output("nestedMessage",
-                                nested));
+                            nested));
                     }
                 }
                 if (c.getErrorNumber() != 0) {
                     errorResponse.addOutput(new Output("errorNumber",
-                            Integer.toString(c.getErrorNumber())));
+                        Integer.toString(c.getErrorNumber())));
                 }
             }
 
-
             errorResponse.addOutput(new Output("requestedURL",
-                    StringUtil.notNull(req.getRequestURI())));
+                StringUtil.notNull(req.getRequestURI())));
             errorResponse.addOutput(new Output("queryString",
-                    StringUtil.notNull(req.getQueryString())));
+                StringUtil.notNull(req.getQueryString())));
             errorResponse.addOutput(new Output("db", dbName));
             errorResponse.addOutput(new Output("userName", userName));
             errorResponse.addOutput(new Output("dbDescrip",
-                    ConfigManager.getContext(dbName).getDescription()));
+                ConfigManager.getContext(dbName).getDescription()));
             errorResponse.addOutput(new Output("errorClass",
-                    theException.getClass().getName()));
-
+                theException.getClass().getName()));
 
             if (theException instanceof SecurityException) {
                 errorResponse.addOutput(new Output("errorType", "security"));
@@ -833,28 +817,23 @@
             } else if (theException instanceof DBException) {
                 errorResponse.addOutput(new Output("errorType", "database"));
 
-
                 DBException de = (DBException) theException;
                 errorResponse.addOutput(new Output("dbMessage",
-                        de.getDBMessage()));
+                    de.getDBMessage()));
             } else {
                 errorResponse.addOutput(new Output("errorType", "other"));
             }
 
-
             errorResponse.addOutput(new Output("controllerClass",
-                    getClass().getName()));
+                getClass().getName()));
             req.setAttribute(ExpressoConstants.CONTROLLER_RESPONSE_KEY, errorResponse);
 
-
             /* Now see if we also email the error anywhere */
             boolean mailError = false;
 
-
             try {
                 String servletEventFlag = StringUtil.notNull(Setup.getValue(dbName, "ServletEvent"));
 
-
                 if (StringUtil.toBoolean(servletEventFlag)) {
                     mailError = true;
                 } else if (servletEventFlag.equalsIgnoreCase("E")) {
@@ -867,18 +846,18 @@
             }
             if (!mailError) {
                 log.info("Sending of '" + theException.getClass().getName() +
-                        "' errors via email is not enabled in " +
-                        "db/context '" + dbName + "'");
+                    "' errors via email is not enabled in " +
+                    "db/context '" + dbName + "'");
             } else {
                 FastStringBuffer theMessage = FastStringBuffer.getInstance();
                 try {
                     theMessage.append("Error:\n");
                     theMessage.append("\tA " +
-                            theException.getClass().getName() +
-                            " Error occurred at " +
-                            DateTime.getDateTimeForDB(dbName) +
-                            " in database/context '" + dbName +
-                            "' to user '" + userName + "'\n");
+                        theException.getClass().getName() +
+                        " Error occurred at " +
+                        DateTime.getDateTimeForDB(dbName) +
+                        " in database/context '" + dbName +
+                        "' to user '" + userName + "'\n");
                     theMessage.append("\tThe requested URL was '");
                     theMessage.append(getRequestURL(req));
                     theMessage.append("'\n");
@@ -892,12 +871,11 @@
                         theMessage.append("No error message was available");
                     }
 
-
                     theMessage.append(errorResponse.getOutput("stackTrace").getContent());
                     String finalMessage = theMessage.toString();
                     log.error(finalMessage, theException);
                     EventHandler.Event(dbName, "SYSERROR",
-                            finalMessage, false);
+                        finalMessage, false);
                 } catch (Exception ee) {
                     log.error("Unable to send error email", ee);
                 } finally {
@@ -905,7 +883,8 @@
                     theMessage = null;
                 }
 
-            } /* if we send an email */
+            }
+            /* if we send an email */
 
         } catch (NullPointerException npe) {
             log.error("Null Pointer Exception while handling error", npe);
@@ -917,21 +896,22 @@
             log.error("Exception while handling error", ee);
             throw new ServletException(ee);
         }
-    } /* handleException */
+    }
+
+    /* handleException */
 
 
     /* Stash the original URL that we asked for in the session,
-* so that if we log in and want to try again, it's available
-*/
+     * so that if we log in and want to try again, it's available
+     */
     protected void addRequestedURLtoSession(HttpServletRequest req,
-                                            ControllerRequest creq)
-            throws ControllerException {
+        ControllerRequest creq) throws ControllerException {
         PersistentSession session = creq.getSession();
 
         if (session != null) {
             String origUrl = getRequestURL(req);
             session.setPersistentAttribute(ExpressoConstants.CONTROLLER_ORIGINAL_URL_KEY,
-                    new SerializableString(origUrl));
+                new SerializableString(origUrl));
         }
     }
 
@@ -959,14 +939,13 @@
      * @throws ControllerException upon error.
      */
     protected void addRegDomainParamtoSession(HttpServletRequest req,
-                                              ControllerRequest creq,
-                                              String regDomain)
-            throws ControllerException {
+        ControllerRequest creq,
+        String regDomain) throws ControllerException {
         PersistentSession session = creq.getSession();
 
         if (session != null) {
             session.setPersistentAttribute("regDomain",
-                    new SerializableString(regDomain));
+                new SerializableString(regDomain));
         }
     }
 
@@ -979,12 +958,10 @@
      * @return a fully instantiated Controller Object
      * @throws ControllerException upon construction failure
      */
-    public static synchronized Controller instantiate(String className)
-            throws ControllerException {
+    public static synchronized Controller instantiate(String className) throws ControllerException {
         StringUtil.assertNotBlank(className,
-                "Controller class name " +
-                " may not be blank or null here");
-
+            "Controller class name " +
+            " may not be blank or null here");
 
         try {
 
@@ -992,20 +969,22 @@
             return (Controller) c.newInstance();
         } catch (ClassNotFoundException cn) {
             throw new ControllerException("Controller object '" + className +
-                    "' not found", cn);
+                "' not found", cn);
         } catch (InstantiationException ie) {
             throw new ControllerException("Controller object '" + className +
-                    "' cannot be instantiated", ie);
+                "' cannot be instantiated", ie);
         } catch (IllegalArgumentException e) {
             throw new ControllerException("Controller object '" + className +
-                    "' cannot be instantiated (IllegalArgumentException",
-                    e);
+                "' cannot be instantiated (IllegalArgumentException",
+                e);
         } catch (IllegalAccessException iae) {
             throw new ControllerException("llegal access loading " +
-                    "Controller object '" + className +
-                    "'", iae);
+                "Controller object '" + className +
+                "'", iae);
         }
-    } /* instantiate(String) */
+    }
+
+    /* instantiate(String) */
 
 
     /**
@@ -1056,22 +1035,18 @@
      * @throws ControllerException if there is an error instantiating the State Form
      */
     protected StateForm loadStateForm(State nextState,
-                                      ActionForm controllerForm)
-            throws ControllerException {
+        ActionForm controllerForm) throws ControllerException {
         StateForm stateForm = null;
         String stateFormClass = StringUtil.notNull(nextState.getStateFormClass());
 
-
         if (controllerForm == null) {
             if (!stateFormClass.equals("")) {
                 throw new ControllerException("Controller needs ActionForm because it's state expects one.");
             }
 
-
             return (null);
         } else {
 
-
             //If the state's form is blank then use the controller's form - if it's of ControllerForm type
             if (stateFormClass.equals("")) {
                 /** changed instanceof ControllerForm for instanceof DefaultForm  *RD* Mon Jul 27 2004 */
@@ -1082,17 +1057,15 @@
                 }
             } else {
 
-
                 //Populate a new instance of the state's form from the controller's form.
                 try {
 
                     Class clazz = ClassLocator.loadClass(nextState.getStateFormClass());
                     stateForm = (StateForm) clazz.newInstance();
 
-
                     try {
                         BeanUtils.populate(stateForm,
-                                BeanUtils.describe(controllerForm));
+                            BeanUtils.describe(controllerForm));
                     } catch (Exception e) {
                         throw new ControllerException(e);
                     }
@@ -1100,13 +1073,24 @@
                     throw new ControllerException(t);
                 }
 
-
                 return (stateForm);
             }
         }
     }
 
     /**
+     * @deprecated since Expresso 5.7  Migrate to newExpressoState(String,ExpressoRequest);
+     * @param newState String
+     * @param request ControllerRequest
+     * @return ControllerResponse
+     * @throws ControllerException
+     * @throws NonHandleableException
+     */
+    public ControllerResponse newState(String newState, final ControllerRequest request) throws ControllerException, NonHandleableException {
+        return (ControllerResponse)newExpressoState(newState, request);
+    }
+
+    /**
      * This is the method where all of the real work of the controller
      * is done. The client calls this to indicate what state the
      * controller is transitioning into.
@@ -1124,61 +1108,62 @@
      * @throws NonHandleableException if the error should not be handled
      *                                by an error controller
      */
-    public ControllerResponse newState(String newState,
-                                       ControllerRequest myRequest)
-            throws ControllerException,
-            NonHandleableException {
+    public ExpressoResponse newExpressoState(String newState, final ExpressoRequest myRequest) throws ControllerException,
+        NonHandleableException {
         newState = StringUtil.notNull(newState);
 
         if (log.isDebugEnabled()) {
             log.debug("Transitioning to state '" + newState +
-                    "' in controller '" + getClass().getName() + "'");
+                "' in controller '" + getClass().getName() + "'");
         }
         if (newState.length() == 0) {
             if (getInitialState() != null) {
-                return newState(getInitialState(), myRequest);
+                return newState(getInitialState(), (ControllerRequest)myRequest);
             } else {
                 throw new ControllerException("You must specify a " +
-                        "non-blank state. No default initial state is specified.");
+                    "non-blank state. No default initial state is specified.");
             }
-        } /* if state blank */
-
+        }
+        /* if state blank */
 
         //Used to ensure the state we are executing "newState" is in fact the one used to lookup
         //the controller security matrix.  This should not be needed but is added for 'comfort'.
         String entryState = newState;
 
-
         /* Is this a valid state for this controller? */
         State nextState = getState(newState);
 
-
         if (nextState == null) {
             throw new ControllerException("State '" + newState +
-                    "' is unknown for Controller " +
-                    getClass().getName());
-        } /* if new state exists */
-
+                "' is unknown for Controller " +
+                getClass().getName());
+        }
+        /* if new state exists */
 
         /* Is the user permitted to access this state? */
         // todo what does newstate=="" mean?
         if (!newState.equals("")) {
-            if (controllerSecurityTransition == null && !stateAllowed(newState, myRequest)) {
-                DelayThread.delay();
-                throw new SecurityException("State '" +
+
+            try {
+                if (controllerSecurityTransition == null && !stateAllowed(newState, (ControllerRequest)myRequest)) {
+                    DelayThread.delay();
+                    throw new SecurityException("State '" +
                         nextState.getDescription() +
                         "' is not allowed for user '" +
-                        myRequest.getUser() + "' (" +
+                        RequestRegistry.get