mikeh       01/07/04 08:49:57

  Modified:    src/java/org/apache/turbine/modules/actions/sessionvalidator
                        TemplateSessionValidator.java
  Log:
  Added some comments, replaced repeated string with a constant
  
  Revision  Changes    Path
  1.8       +11 -11    
jakarta-turbine/src/java/org/apache/turbine/modules/actions/sessionvalidator/TemplateSessionValidator.java
  
  Index: TemplateSessionValidator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/modules/actions/sessionvalidator/TemplateSessionValidator.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TemplateSessionValidator.java     2001/06/19 21:51:54     1.7
  +++ TemplateSessionValidator.java     2001/07/04 15:49:54     1.8
  @@ -72,10 +72,15 @@
    * @see TemplateSecureSessionValidator
    * @author <a href="mailto:[EMAIL PROTECTED]";>John D. McNally</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Dave Bryson</a>
  - * @version $Id: TemplateSessionValidator.java,v 1.7 2001/06/19 21:51:54 mpoeschl 
Exp $
  + * @version $Id: TemplateSessionValidator.java,v 1.8 2001/07/04 15:49:54 mikeh Exp $
    */
   public class TemplateSessionValidator extends SessionValidator
   {
  +     private String COUNTER = "_session_access_counter";
  +     // the COUNTER can be placed as a hidden field in
  +     // forms.  This can be used to prevent a user from using the
  +     // browsers back button and submitting stale data.
  +
       /**
        * Execute the action.
        *
  @@ -84,14 +89,13 @@
        */
       public void doPerform( RunData data ) throws Exception
       {
  -        /*
  -         * Pull user from session.
  -         */
  +        // pull user from session, update access times, counters
           data.populate();
   
           // The user may have not logged in, so create a "guest" user.
           if ( data.getUser() == null )
           {
  +            // place user in the session
               data.setUser(TurbineSecurity.getAnonymousUser());
               data.save();
           }
  @@ -113,15 +117,11 @@
                       TurbineConstants.SCREEN_HOMEPAGE));
               }
           }
  -        // the session_access_counter can be placed as a hidden field in
  -        // forms.  This can be used to prevent a user from using the
  -        // browsers back button and submitting stale data.
  -        else if ( data.getParameters().containsKey("_session_access_counter") )
  +        else if ( data.getParameters().containsKey(COUNTER) )
           {
               // See comments in screens.error.InvalidState.
  -            if ( data.getParameters().getInt("_session_access_counter") <
  -                (((Integer)data.getUser().getTemp("_session_access_counter"))
  -                .intValue()-1) )
  +            if ( data.getParameters().getInt(COUNTER) <
  +                (((Integer)data.getUser().getTemp(COUNTER)).intValue() - 1) )
               {
                   if (data.getTemplateInfo().getScreenTemplate() != null)
                   {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to