portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/container/session NavigationalStateComponent.java
Date Tue, 01 Jun 2004 20:24:23 GMT
taylor      2004/06/01 13:24:23

  Modified:    portal/src/java/org/apache/jetspeed/container/url/impl
                        AbstractPortalURL.java
               portal/src/java/org/apache/jetspeed/container/session/impl
                        JetspeedNavigationalStateComponent.java
               jetspeed-api/src/java/org/apache/jetspeed/container/session
                        NavigationalStateComponent.java
  Log:
  added hasPortalParameter to NavigationalStateComponent to determine if a request is an action
request
  
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.6       +6 -4      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/url/impl/AbstractPortalURL.java
  
  Index: AbstractPortalURL.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/url/impl/AbstractPortalURL.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractPortalURL.java	28 May 2004 18:54:08 -0000	1.5
  +++ AbstractPortalURL.java	1 Jun 2004 20:24:23 -0000	1.6
  @@ -232,9 +232,11 @@
   
           if (context.getRequest().getPathInfo() != null)
           {
  -            String pathInfo = new String(context.getRequest().getPathInfo());         
  
  -            StringTokenizer tokenizer = new StringTokenizer(pathInfo, "/.");
  -
  +            String pathInfo = new String(context.getRequest().getPathInfo());
  +            // DST: TODO: why do we need to parse "." as well as "/"?
  +            // this is creating a problem with params like "default.psml"
  +            //StringTokenizer tokenizer = new StringTokenizer(pathInfo, "/.");
  +            StringTokenizer tokenizer = new StringTokenizer(pathInfo, "/");
               int mode = 0; // 0=navigation, 1=control information
               String name = null;
               while (tokenizer.hasMoreTokens())
  
  
  
  1.9       +34 -1     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/session/impl/JetspeedNavigationalStateComponent.java
  
  Index: JetspeedNavigationalStateComponent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/session/impl/JetspeedNavigationalStateComponent.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- JetspeedNavigationalStateComponent.java	27 May 2004 19:49:18 -0000	1.8
  +++ JetspeedNavigationalStateComponent.java	1 Jun 2004 20:24:23 -0000	1.9
  @@ -17,10 +17,12 @@
   
   import java.lang.reflect.Constructor;
   import java.lang.reflect.Field;
  +import java.util.Enumeration;
   import java.util.StringTokenizer;
   
   import javax.portlet.PortletMode;
   import javax.portlet.WindowState;
  +import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpSession;
   
   import org.apache.commons.logging.Log;
  @@ -226,5 +228,36 @@
               return PortletMode.HELP;
           }        
           return new PortletMode(name);
  +    }
  +    
  +    public boolean hasPortalParameter(HttpServletRequest request, int parameterType)
  +    {
  +        String key = getNavigationKey(NavigationalStateComponent.PREFIX) + getNavigationKey(parameterType);
  +        String pathInfo = request.getPathInfo();
  +        if (null == pathInfo)
  +        {
  +            return false;
  +        }
  +        StringTokenizer tokenizer = new StringTokenizer(pathInfo, "/");
  +        StringBuffer path = new StringBuffer();
  +        boolean isName = true;
  +        while (tokenizer.hasMoreTokens())
  +        {
  +            String token = tokenizer.nextToken();
  +            if (isName)
  +            {
  +                isName = false;
  +            }
  +            else
  +            {
  +                isName = true;
  +                continue;
  +            }
  +            if (token.startsWith(key))
  +            {
  +                return true;            
  +            }
  +        }
  +        return false;
       }
   }
  
  
  
  1.2       +22 -1     jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/container/session/NavigationalStateComponent.java
  
  Index: NavigationalStateComponent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/container/session/NavigationalStateComponent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NavigationalStateComponent.java	28 May 2004 18:51:55 -0000	1.1
  +++ NavigationalStateComponent.java	1 Jun 2004 20:24:23 -0000	1.2
  @@ -17,6 +17,7 @@
   
   import javax.portlet.PortletMode;
   import javax.portlet.WindowState;
  +import javax.servlet.http.HttpServletRequest;
   
   import org.apache.jetspeed.container.url.PortalURL;
   import org.apache.jetspeed.request.RequestContext;
  @@ -115,5 +116,25 @@
        * @return The corresponding PortletMode object
        */    
       PortletMode lookupPortletMode(String name);
  +    
  +    /**
  +     * <p>
  +     * Check to see if the request contains the given request parameter.
  +     * Returns true if the request containers the request parameter, false if it does not.
  +     * Valid parameter types
  +     * </p>
  +     * <ul>
  +     *      <li>NavigationalStateComponent.ACTION</li>
  +     *      <li>NavigationalStateComponent.MODE</li>
  +     *      <li>NavigationalStateComponent.STATE</li>
  +     *      <li>NavigationalStateComponent.RENDER_PARAM</li>
  +     *      <li>NavigationalStateComponent.PREV_STATE</li>
  +     *      <li>NavigationalStateComponent.PREV_MODE</li>
  +     *
  +     * @param request The HTTP request.
  +     * @param parameterType The NavigationStateComponent-defined parameter type.
  +     * @return boolean true if the specified parameter type exists as a request parameter.

  +     */    
  +    boolean hasPortalParameter(HttpServletRequest request, int parameterType);
       
   }
  
  
  

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


Mime
View raw message