You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2003/07/18 10:37:15 UTC

cvs commit: cocoon-2.1/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/acting SessionAction.java

cziegeler    2003/07/18 01:37:15

  Modified:    src/blocks/session-fw/java/org/apache/cocoon/webapps/session/acting
                        SessionAction.java
  Log:
  Cleaning up code, adding javadocs
  
  Revision  Changes    Path
  1.3       +21 -5     cocoon-2.1/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/acting/SessionAction.java
  
  Index: SessionAction.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/acting/SessionAction.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SessionAction.java	4 May 2003 20:19:42 -0000	1.2
  +++ SessionAction.java	18 Jul 2003 08:37:15 -0000	1.3
  @@ -64,6 +64,15 @@
   
   /**
    * This action creates and terminates a session.
  + * The action is controlled via parameters. The action parameter defines
  + * the action (creating or terminating).
  + * The value "create" creates a new session (if not already available)
  + * The value "terminate" terminates the session. The termination can be controlled
  + * with a second parameter "mode": The default value "immediately" terminates
  + * the session, the value "if-unused" terminates the session only if no
  + * session context is available anymore. This means the user must not have
  + * any own session context and must not be authenticated anymore using
  + * the uthentication framework.
    *
    * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
    * @version CVS $Id$
  @@ -82,17 +91,24 @@
           try {
               sessionManager = (SessionManager)this.manager.lookup(SessionManager.ROLE);
               final String action = par.getParameter("action", "create");
  -            if ( action.equals("create") == true ) {
  +          
  +            if ( action.equals("create") ) {
  +                
  +                // create a session
                   sessionManager.createSession();
  -            } else if ( action.equals("terminate") == true ) {
  +                
  +            } else if ( action.equals("terminate") ) {
  +                
  +                // terminate a session
                   final String mode = par.getParameter("mode", "immediately");
  -                if ( mode.equals("immediately") == true) {
  +                if ( mode.equals("immediately") ) {
                       sessionManager.terminateSession(true);
  -                } else if ( mode.equals("if-unused") == true ) {
  +                } else if ( mode.equals("if-unused")  ) {
                       sessionManager.terminateSession(false);
                   } else {
                       throw new ProcessingException("Unknown mode " + mode + " for action " + action);
                   }
  +                
               } else {
                   throw new ProcessingException("Unknown action: " + action);
               }