You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by he...@apache.org on 2003/02/27 16:40:00 UTC

cvs commit: jakarta-turbine-2/src/java/org/apache/turbine Turbine.java TurbineConstants.java

henning     2003/02/27 07:40:00

  Modified:    src/java/org/apache/turbine Turbine.java
                        TurbineConstants.java
  Log:
  Constants. I love Constants. Some docs, too.
  
  Revision  Changes    Path
  1.28      +23 -14    jakarta-turbine-2/src/java/org/apache/turbine/Turbine.java
  
  Index: Turbine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/Turbine.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- Turbine.java	27 Feb 2003 15:02:22 -0000	1.27
  +++ Turbine.java	27 Feb 2003 15:40:00 -0000	1.28
  @@ -659,8 +659,10 @@
               // file if this is a new session
               if (data.getSession().isNew())
               {
  -                int timeout = configuration.getInt("session.timeout", -1);
  -                if (timeout != -1)
  +                int timeout = configuration.getInt(SESSION_TIMEOUT_KEY,
  +                                                   SESSION_TIMEOUT_DEFAULT);
  +
  +                if (timeout != SESSION_TIMEOUT_DEFAULT)
                   {
                       data.getSession().setMaxInactiveInterval(timeout);
                   }
  @@ -692,8 +694,9 @@
                   // associated with the previous User.  Currently the
                   // only keys stored in the session are "turbine.user"
                   // and "turbine.acl".
  -                if (data.getAction().equalsIgnoreCase(configuration
  -                        .getString("action.login")))
  +                if (data.getAction()
  +                    .equalsIgnoreCase(configuration.getString(ACTION_LOGIN_KEY,
  +                                                              ACTION_LOGIN_DEFAULT)))
                   {
                       String[] names = data.getSession().getValueNames();
                       if (names != null)
  @@ -717,7 +720,9 @@
               // TurbineResources.properties...screen.homepage; or, you
               // can specify your own SessionValidator action.
               ActionLoader.getInstance().exec(
  -                data, configuration.getString("action.sessionvalidator"));
  +              data,
  +              configuration.getString(ACTION_SESSION_VALIDATOR_KEY,
  +                                      ACTION_SESSION_VALIDATOR_DEFAULT));
   
               // Put the Access Control List into the RunData object, so
               // it is easily available to modules.  It is also placed
  @@ -725,7 +730,9 @@
               // out the ACL to force it to be rebuilt based on more
               // information.
               ActionLoader.getInstance().exec(
  -                data, configuration.getString("action.accesscontroller"));
  +              data,
  +              configuration.getString(ACTION_ACCESS_CONTROLLER_KEY,
  +                                      ACTION_ACCESS_CONTROLLER_DEFAULT));
   
               // Start the execution phase. DefaultPage will execute the
               // appropriate action as well as get the Layout from the
  @@ -754,8 +761,8 @@
                    * if they wish but the DefaultPage should work in
                    * most cases.
                    */
  -                defaultPage = configuration.getString(
  -                    "page.default", "DefaultPage");
  +                defaultPage = configuration.getString(PAGE_DEFAULT_KEY,
  +                                                      PAGE_DEFAULT_DEFAULT);
               }
   
               PageLoader.getInstance().exec(data, defaultPage);
  @@ -894,21 +901,23 @@
               data.setStackTrace(ExceptionUtils.getStackTrace(t), t);
   
               // setup the screen
  -            data.setScreen(configuration.getString("screen.error"));
  +            data.setScreen(configuration.getString(SCREEN_ERROR_KEY,
  +                                                   SCREEN_ERROR_DEFAULT));
   
               // do more screen setup for template execution if needed
               if (data.getTemplateInfo() != null)
               {
  -                data.getTemplateInfo().setScreenTemplate(configuration
  -                        .getString("template.error"));
  +                data.getTemplateInfo()
  +                    .setScreenTemplate(configuration.getString(TEMPLATE_ERROR_KEY,
  +                                                               TEMPLATE_ERROR_VM));
               }
   
               // Make sure to not execute an action.
               data.setAction("");
   
               PageLoader.getInstance().exec(data,
  -                                          configuration.getString("page.default",
  -                                                                  "DefaultPage"));
  +                                          configuration.getString(PAGE_DEFAULT_KEY,
  +                                                                  PAGE_DEFAULT_DEFAULT));
   
               data.getResponse().setContentType(data.getContentType());
               data.getResponse().setStatus(data.getStatusCode());
  
  
  
  1.11      +54 -44    jakarta-turbine-2/src/java/org/apache/turbine/TurbineConstants.java
  
  Index: TurbineConstants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/TurbineConstants.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TurbineConstants.java	27 Feb 2003 14:13:41 -0000	1.10
  +++ TurbineConstants.java	27 Feb 2003 15:40:00 -0000	1.11
  @@ -138,67 +138,71 @@
        */
       String MODULE_PACKAGES = "module.packages";
   
  -    /**
  -     * Home page template.
  -     */
  +    /** Home page template. */
       String TEMPLATE_HOMEPAGE = "template.homepage";
   
  -    /**
  -     * Login template.
  -     */
  +    /** Login template. */
       String TEMPLATE_LOGIN = "template.login";
   
  -    /**
  -     * Login error template.
  -     */
  -    String TEMPLATE_ERROR = "template.error";
  +    /** Template error template Property. */
  +    String TEMPLATE_ERROR_KEY = "template.error";
   
  -    /**
  -     * Home page screen.
  -     */
  +    /** Template error default for JSP */
  +    String TEMPLATE_ERROR_JSP = "error.jsp";
  +
  +    /** Template error default for Velocity */
  +    String TEMPLATE_ERROR_VM = "error.vm";
  +
  +    /** Home page screen. */
       String SCREEN_HOMEPAGE = "screen.homepage";
   
  -    /**
  -     * Login screen.
  -     */
  +    /** Login screen. */
       String SCREEN_LOGIN = "screen.login";
   
  -    /**
  -     * Login error screen.
  -     */
  -    String SCREEN_ERROR = "screen.error";
  +    /** Login error screen. */
  +    String SCREEN_ERROR_KEY = "screen.error";
  +
  +    /** Default value for Login Screen */
  +    String SCREEN_ERROR_DEFAULT = "VelocityErrorScreen";
  +
  +    /** Report Screen for invalid state in the application*/
       String SCREEN_INVALID_STATE = "screen.invalidstate";
  +
  +    /** Report Template for invalid state in the application */
       String TEMPLATE_INVALID_STATE = "template.invalidstate";
   
  -    /**
  -     * Action to perform when a user logs in.
  -     */
  -    String ACTION_LOGIN = "action.login";
  +    /** Action to perform when a user logs in. */
  +    String ACTION_LOGIN_KEY = "action.login";
   
  -    /**
  -     * Action to perform when a user logs out.
  -     */
  -    String ACTION_LOGOUT = "action.logout";
  +    /** Default Value for login Action */
  +    String ACTION_LOGIN_DEFAULT = "LoginUser";
   
  -    /**
  -     * Actions that performs session validation.
  -     */
  -    String ACTION_SESSION_VALIDATOR = "action.sessionvalidator";
  +    /** Action to perform when a user logs out. */
  +    String ACTION_LOGOUT_KEY = "action.logout";
   
  -    /**
  -     * I don't think this is being used, is it?
  -     */
  -    String ACTION_ACCESS_CONTROLLER = "action.accesscontroller";
  +    /** Default Value for ACTION_LOGOUT */
  +    String ACTION_LOGOUT_DEFAULT = "LogoutUser";
   
  -    /**
  -     * Default layout.
  -     */
  +    /** Actions that performs session validation. */
  +    String ACTION_SESSION_VALIDATOR_KEY = "action.sessionvalidator";
  +
  +    /** Default value for the session validator. (org.apache.modules.actions.sessionvalidator.TemplateSessionValidator) */
  +    String ACTION_SESSION_VALIDATOR_DEFAULT = "sessionvalidator.TemplateSessionValidator";
  +
  +    /** Action that performs Access control */
  +    String ACTION_ACCESS_CONTROLLER_KEY = "action.accesscontroller";
  +
  +    /** Default value for the access controller. (org.apache.modules.actions.AccessController) */
  +    String ACTION_ACCESS_CONTROLLER_DEFAULT = "AccessController";
  +
  +    /** Default layout. */
       String LAYOUT_DEFAULT = "layout.default";
   
  -    /**
  -     * Default page.
  -     */
  -    String PAGE_DEFAULT = "page.default";
  +    /** Default page. */
  +    String PAGE_DEFAULT_KEY = "page.default";
  +
  +    /** Default value for the Default Page */
  +    String PAGE_DEFAULT_DEFAULT = "DefaultPage";
   
       /**
        * Map building. This will probably be Torque generated at
  @@ -225,6 +229,12 @@
        * Message to display when a user logs out.
        */
       String LOGOUT_MESSAGE = "logout.message";
  +
  +    /** Session Timeout */
  +    String SESSION_TIMEOUT_KEY = "session.timeout";
  +
  +    /** Session Timeout Default Value */
  +    int SESSION_TIMEOUT_DEFAULT = -1;
   
       /**
        * Indicate whether this Turbine application is using SSL.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org