You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ra...@apache.org on 2001/06/04 19:44:27 UTC

cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions JetspeedSessionValidator.java

raphael     01/06/04 10:44:26

  Modified:    src/java/org/apache/jetspeed/modules/actions
                        JetspeedSessionValidator.java
  Log:
  take advantage of the new JetspeedRunData object to initialize once
  useful variables...
  
  Revision  Changes    Path
  1.6       +38 -4     jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/JetspeedSessionValidator.java
  
  Index: JetspeedSessionValidator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/JetspeedSessionValidator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JetspeedSessionValidator.java	2001/03/08 16:25:40	1.5
  +++ JetspeedSessionValidator.java	2001/06/04 17:44:24	1.6
  @@ -58,18 +58,25 @@
   import org.apache.turbine.services.localization.LocaleDetector;
   
   import org.apache.turbine.util.RunData;
  +import org.apache.turbine.util.Log;
   import org.apache.turbine.services.security.TurbineSecurity;
   import org.apache.turbine.modules.actions.sessionvalidator.SessionValidator;
   import org.apache.turbine.services.resources.TurbineResources;
  +import org.apache.jetspeed.services.rundata.JetspeedRunData;
  +import org.apache.jetspeed.services.Profiler;
  +import org.apache.jetspeed.om.profile.Profile;
   
   /**
   Just like org.apache.turbine.actions.TemplateSessionValidator except:-
   - it doesn't check the session_access_counter
   - it doesn't require you to always logon
  -
  +- expects a JetspeedRunData object and put there the additionnal jetspeed
  +  properties
  +  
   @see org.apache.turbine.actions.SessionValidator
   @author <a href="mailto:ingo@raleigh.ibm.com">Ingo Schuster</a>
  -@version $Id: JetspeedSessionValidator.java,v 1.5 2001/03/08 16:25:40 ingo Exp $
  +@author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
  +@version $Id: JetspeedSessionValidator.java,v 1.6 2001/06/04 17:44:24 raphael Exp $
   */
   public class JetspeedSessionValidator extends SessionValidator
   {
  @@ -99,7 +106,7 @@
                        TurbineResources.getString("locale.default.country", "US"));
           }
           
  -       	data.getUser().setTemp("locale", locale);
  +        data.getUser().setTemp("locale", locale);
           
           // make sure we have some way to return a response
           if ( !data.hasScreen() &&
  @@ -123,11 +130,38 @@
           {
               data.setScreen(null);
           }
  +        
  +        // define Jetspeed specific properties
  +        JetspeedRunData jdata = null;
  +        
  +        try
  +        {
  +            jdata = (JetspeedRunData)data;
  +        }
  +        catch (ClassCastException e)
  +        {
  +            Log.error("The RunData object does not implement the expected interface, "
  +                       +"please verify the RunData factory settings");
  +            return;
  +        }
  +        
  +        // now set any jetspeed specific properties;
  +        Profile newProfile = Profiler.getProfile(jdata);
  +        Profile currentProfile = jdata.getProfile();
  +        
  +        if (   (currentProfile == null)
  +            || (!currentProfile.getURL().equals(newProfile.getURL())) )
  +        {
  +            // the profile changed due to the request parameters,
  +            // change it in the RunData
  +            jdata.setProfile(newProfile);
  +        }
       }
   
       /**
       */
  -    public boolean requiresNewSession( RunData data ) {
  +    public boolean requiresNewSession( RunData data )
  +    {
           return false;
       }
       
  
  
  

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