You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by ta...@apache.org on 2004/01/08 23:20:32 UTC

cvs commit: jakarta-pluto/container/src/java/org/apache/pluto/tags ActionURLTag.java BasicURLTag.java DefineObjectsTag.java NamespaceTag.java ParamTag.java RenderURLTag.java

taylor      2004/01/08 14:20:32

  Added:       container/src/java/org/apache/pluto/tags ActionURLTag.java
                        BasicURLTag.java DefineObjectsTag.java
                        NamespaceTag.java ParamTag.java RenderURLTag.java
  Log:
  merging these from old directory structure
  
  Revision  Changes    Path
  1.1                  jakarta-pluto/container/src/java/org/apache/pluto/tags/ActionURLTag.java
  
  Index: ActionURLTag.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Pluto", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  /* 
  
   */
  
  /*
   * Created on Feb 21, 2003
   *
   * To change this generated comment go to 
   * Window>Preferences>Java>Code Generation>Code Template
   */
  package org.apache.pluto.tags;
  
  import javax.portlet.PortletMode;
  import javax.portlet.PortletModeException;
  import javax.portlet.PortletSecurityException;
  import javax.portlet.RenderResponse;
  import javax.portlet.WindowState;
  import javax.portlet.WindowStateException;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.PageContext;
  
  /**
   * Supporting class for the <CODE>actionURL</CODE> tag.
   * Creates a url that points to the current Portlet and triggers an action request
   * with the supplied parameters. 
   *
   */
  public class ActionURLTag extends BasicURLTag
  {
  
      /* (non-Javadoc)
       * @see javax.servlet.jsp.tagext.Tag#doStartTag()
       */
      public int doStartTag() throws JspException {
          if (var != null)
          {
              pageContext.removeAttribute(var, PageContext.PAGE_SCOPE);
          }
          RenderResponse renderResponse = (RenderResponse)pageContext.getRequest().getAttribute("javax.portlet.response");
  
          if (renderResponse != null)
          {
              setUrl(renderResponse.createActionURL());
              if (portletMode != null)
              {
                  try
                  {
                      url.setPortletMode((PortletMode)TEI.portletModes.get(portletMode.toUpperCase()));
                  }
                  catch (PortletModeException e)
                  {
                      throw new JspException(e);
                  }
              }
              if (windowState != null)
              {
                  try
                  {
                      url.setWindowState((WindowState)TEI.definedWindowStates.get(windowState.toUpperCase()));
                  }
                  catch (WindowStateException e)
                  {
                      throw new JspException(e);
                  }
              }
              if (secure != null)
              {
                  try
                  {
                      url.setSecure(getSecureBoolean());
                  }
                  catch (PortletSecurityException e)
                  {
                      throw new JspException(e);
                  }
              }
          }
          return EVAL_PAGE;
      }
  }
  
  
  
  
  1.1                  jakarta-pluto/container/src/java/org/apache/pluto/tags/BasicURLTag.java
  
  Index: BasicURLTag.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Pluto", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  /* 
  
   */
  
  package org.apache.pluto.tags;
  
  import java.io.IOException;
  import java.lang.reflect.Field;
  import java.util.Hashtable;
  
  import javax.portlet.PortletMode;
  import javax.portlet.PortletURL;
  import javax.portlet.WindowState;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.JspWriter;
  import javax.servlet.jsp.PageContext;
  import javax.servlet.jsp.tagext.TagData;
  import javax.servlet.jsp.tagext.TagExtraInfo;
  import javax.servlet.jsp.tagext.TagSupport;
  import javax.servlet.jsp.tagext.VariableInfo;
  
  /**
   * Supporting class for the <CODE>actionURL</CODE> and <CODE>renderURL</CODE> tag.
   * Creates a url that points to the current Portlet and triggers an action request
   * with the supplied parameters.
   *
   */
  public abstract class BasicURLTag extends TagSupport
  {
  
      public static class TEI extends TagExtraInfo
      {
          public final static Hashtable definedWindowStates = getDefinedWindowStates();
          public final static Hashtable portletModes        = getDefinedPortletModes();
  
          /**
           * Provides a list of all static PortletMode available in the specifications by
           * using introspection
           * @return Hashtable
           */
          private static Hashtable getDefinedPortletModes()
          {
              Hashtable portletModes = new Hashtable();
              Field[] f = PortletMode.class.getDeclaredFields();
  
              for (int i = 0; i < f.length; i++)
              {
                  if (f[i].getType().isAssignableFrom(javax.portlet.PortletMode.class))
                  {
                      try
                      {
                          portletModes.put(f[i].get(f[i]).toString().toUpperCase(), f[i].get(f[i]));
                      }
                      catch (IllegalAccessException e)
                      {
                      }
                  }
              }
  
              return portletModes;
          }
  
          /**
           * Provides a list of all static WindowsStates available in the specifications by
           * using introspection
           * @return Hashtable
           */
          private static Hashtable getDefinedWindowStates()
          {
              Hashtable definedWindowStates = new Hashtable();
              Field[] f = WindowState.class.getDeclaredFields();
  
              for (int i = 0; i < f.length; i++)
              {
                  if (f[i].getType().isAssignableFrom(javax.portlet.WindowState.class))
                  {
                      try
                      {
                          definedWindowStates.put(f[i].get(f[i]).toString().toUpperCase(), f[i].get(f[i]));
                      }
                      catch (IllegalAccessException e)
                      {
                          ;
                      }
                  }
              }
              return definedWindowStates;
          }
  
          public VariableInfo[] getVariableInfo(TagData tagData)
          {
              VariableInfo vi[] = null;
              String var = tagData.getAttributeString("var");
              if (var != null)
              {
                  vi = new VariableInfo[1];
                  vi[0] = new VariableInfo(var, "java.lang.String", true, VariableInfo.AT_BEGIN);
              }
              return vi;
          }
  
      }
  
      protected String portletMode;
      protected String secure;
      protected Boolean secureBoolean;
      protected String windowState;
      protected PortletURL url;
      protected String var;
  
      /**
       * Processes the <CODE>actionURL</CODE> or <CODE>renderURL</CODE> tag.
       * @return int
       */
      public abstract int doStartTag() throws JspException;
  
      /**
       *
       * @return int
       */
      public int doEndTag() throws JspException {
          if (var == null)
          {
              try
              {
                  JspWriter writer = pageContext.getOut();
                  writer.print(url); 
                  writer.flush();
              }
              catch (IOException ioe)
              {
                  throw new JspException("actionURL/renderURL Tag Exception: cannot write to the output writer.");
              }
          } else {
                  pageContext.setAttribute (var, url.toString(), PageContext.PAGE_SCOPE);
          }
          return EVAL_PAGE;
      }
  
      /**
       * Returns the portletMode.
       * @return String
       */
      public String getPortletMode()
      {
          return portletMode;
      }
  
      /**
       * @return secure as String
       */
      public String getSecure()
      {
          return secure;
      }
  
      /**
       * @return secure as Boolean
       */
      public boolean getSecureBoolean()
      {
          return this.secureBoolean.booleanValue();
      }
  
      /**
       * Returns the windowState.
       * @return String
       */
      public String getWindowState()
      {
          return windowState;
      }
  
      /**
       * @return PortletURL
       */
      public PortletURL getUrl()
      {
          return url;
      }
  
      /**
       * Returns the var.
       * @return String
       */
      public String getVar()
      {
          return var;
      }
  
      /**
       * Sets the portletMode.
       * @param portletMode The portletMode to set
       */
      public void setPortletMode(String portletMode)
      {
          this.portletMode = portletMode;
      }
  
      /**
       * Sets secure to boolean value of the string
       * @param String
       */
      public void setSecure(String secure)
      {
          this.secure = secure;
          this.secureBoolean = new Boolean(secure);
      }
  
      /**
       * Sets the windowState.
       * @param windowState The windowState to set
       */
      public void setWindowState(String windowState)
      {
          this.windowState = windowState;
      }
  
      /**
       * Sets the url.
       * @param url The url to set
       */
      public void setUrl(PortletURL url)
      {
          this.url = url;
      }
  
      /**
       * Sets the var.
       * @param var The var to set
       */
      public void setVar(String var)
      {
          this.var = var;
      }
  }
  
  
  
  1.1                  jakarta-pluto/container/src/java/org/apache/pluto/tags/DefineObjectsTag.java
  
  Index: DefineObjectsTag.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Pluto", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  /* 
  
   */
  
  package org.apache.pluto.tags;
  
  import javax.portlet.*;
  
  import javax.servlet.jsp.*;
  import javax.servlet.jsp.tagext.*;
  
  import org.apache.pluto.Constants;
  
  
  /**
   * Supporting class for the <CODE>defineObjects</CODE> tag.
   * Creates the following variables to be used in the JSP:
   * <UL>
   * <LI><CODE>renderRequest</CODE>
   * <LI><CODE>renderResponse</CODE>
   * <LI><CODE>portletConfig</CODE>
   * </UL>
   * @see   org.apache.pluto.portlet.PortletRequest
   * @see   org.apache.pluto.portlet.RenderResponse
   * @see   org.apache.pluto.portlet.PortletConfig
   *
   */
  public class DefineObjectsTag extends TagSupport
  {
  
      /**
       * Processes the <CODE>defineObjects</CODE> tag.
       * @return <CODE>SKIP_BODY</CODE>
       */
      public int doStartTag() throws JspException
      {
          PortletRequest renderRequest = (PortletRequest)pageContext.getRequest().getAttribute(Constants.PORTLET_REQUEST);
          RenderResponse renderResponse = (RenderResponse)pageContext.getRequest().getAttribute(Constants.PORTLET_RESPONSE);
          PortletConfig portletConfig = (PortletConfig)pageContext.getRequest().getAttribute(Constants.PORTLET_CONFIG);
  
          if (pageContext.getAttribute("renderRequest") == null)   //Set attributes only once
          {
              pageContext.setAttribute("renderRequest",
                                       renderRequest,
                                       PageContext.PAGE_SCOPE);
          }
  
          if (pageContext.getAttribute("renderResponse") == null)
          {
              pageContext.setAttribute("renderResponse",
                                       renderResponse,
                                       PageContext.PAGE_SCOPE);
          }
  
          if (pageContext.getAttribute("portletConfig") == null)
          {
              pageContext.setAttribute("portletConfig",
                                       portletConfig,
                                       PageContext.PAGE_SCOPE);
          }
  
          return SKIP_BODY;
      }
  
      public static class TEI extends TagExtraInfo
      {
  
          public VariableInfo [] getVariableInfo (TagData tagData)
          {
              VariableInfo [] info = new VariableInfo [] {
                  new VariableInfo("renderRequest",
                                   "javax.portlet.PortletRequest",
                                   true,
                                   VariableInfo.AT_BEGIN),
                  new VariableInfo("renderResponse",
                                   "javax.portlet.RenderResponse",
                                   true,
                                   VariableInfo.AT_BEGIN),
                  new VariableInfo("portletConfig",
                                   "javax.portlet.PortletConfig",
                                   true,
                                   VariableInfo.AT_BEGIN)
              };
  
              return info;
          }
      }
  }
  
  
  
  1.1                  jakarta-pluto/container/src/java/org/apache/pluto/tags/NamespaceTag.java
  
  Index: NamespaceTag.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Pluto", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  /* 
  
   */
  
  package org.apache.pluto.tags;
  
  import java.io.IOException;
  
  import javax.portlet.RenderResponse;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.JspWriter;
  import javax.servlet.jsp.tagext.TagSupport;
  
  /**
   * This tag produces a unique value for the current portlet.
   *
   *
   * Supporting class for the <CODE>namespace</CODE> tag.
   * writes a unique value for the current portlet
   * <BR>This tag has no attributes
   */
  public class NamespaceTag extends TagSupport
  {
  
      /* (non-Javadoc)
       * @see javax.servlet.jsp.tagext.Tag#doStartTag()
       */
      public int doStartTag() throws JspException {
          RenderResponse renderResponse = (RenderResponse)pageContext.getRequest().getAttribute("javax.portlet.response");
          String namespace = renderResponse.getNamespace();
          JspWriter writer = pageContext.getOut();
          try
          {
              writer.print(namespace);
              writer.flush();
          }
          catch (IOException ioe)
          {
              throw new JspException("namespace Tag Exception: cannot write to the output writer.");
          }
          return SKIP_BODY;
      }
  }
  
  
  
  1.1                  jakarta-pluto/container/src/java/org/apache/pluto/tags/ParamTag.java
  
  Index: ParamTag.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Pluto", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  /* 
  
   */
  
  package org.apache.pluto.tags;
  
  import javax.portlet.PortletURL;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.tagext.TagSupport;
  
  
  /**
   ** Supporting class for the <CODE>param</CODE> tag.
   ** defines a parameter that can be added to a <CODE>actionURL</CODE> or
   ** a <CODE>renderURL</CODE>
   ** <BR>The following attributes are mandatory
   ** <UL>
   ** <LI><CODE>name</CODE>
   ** <LI><CODE>value</CODE>
   ** </UL>
   **/
  public class ParamTag extends TagSupport
  {
  
      private String name;
      private String value;
  
      /**
       * Processes the <CODE>param</CODE> tag.
       * @return <CODE>SKIP_BODY</CODE>
       */
      public int doStartTag() throws JspException
      {
          BasicURLTag urlTag = (BasicURLTag)findAncestorWithClass(this, BasicURLTag.class);
          if (urlTag == null)
          {
              throw new JspException("the 'param' Tag must have actionURL or renderURL as a parent");
          }
          PortletURL url = urlTag.getUrl();
  
          if (getName() != null)
          {
              url.setParameter(getName(),getValue());
          }
  
          return SKIP_BODY;
      }
  
      /**
       * Returns the name.
       * @return String
       */
      public String getName()
      {
          return name;
      }
  
      /**
       * Returns the value.
       * @return String
       */
      public String getValue()
      {
          if (value == null)
          {
              value = "";
          }
          return value;
      }
  
      /**
       * Sets the name.
       * @param name The name to set
       */
      public void setName(String name)
      {
          this.name = name;
      }
  
      /**
       * Sets the value.
       * @param value The value to set
       */
      public void setValue(String value)
      {
          this.value = value;
      }
  
  }
  
  
  
  1.1                  jakarta-pluto/container/src/java/org/apache/pluto/tags/RenderURLTag.java
  
  Index: RenderURLTag.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Pluto", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  /* 
  
   */
  
  /*
   * Created on Feb 21, 2003
   *
   * To change this generated comment go to 
   * Window>Preferences>Java>Code Generation>Code Template
   */
  package org.apache.pluto.tags;
  
  import javax.portlet.PortletMode;
  import javax.portlet.PortletModeException;
  import javax.portlet.PortletSecurityException;
  import javax.portlet.RenderResponse;
  import javax.portlet.WindowState;
  import javax.portlet.WindowStateException;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.PageContext;
  
  /**
   ** Supporting class for the <CODE>renderURL</CODE> tag.
   ** Creates a url that points to the current Portlet and triggers an render request
   ** with the supplied parameters. 
   **
   **/
  public class RenderURLTag extends BasicURLTag
  {
  
  
      /* (non-Javadoc)
           * @see javax.servlet.jsp.tagext.Tag#doStartTag()
           */
      public int doStartTag() throws JspException {
          if (var != null)
          {
              pageContext.removeAttribute(var, PageContext.PAGE_SCOPE);
          }
          RenderResponse renderResponse = (RenderResponse)pageContext.getRequest().getAttribute("javax.portlet.response");
  
          if (renderResponse != null)
          {
              setUrl(renderResponse.createRenderURL());
              if (portletMode != null)
              {
                  try
                  {
                      url.setPortletMode((PortletMode)TEI.portletModes.get(portletMode.toUpperCase()));
                  }
                  catch (PortletModeException e)
                  {
                      throw new JspException(e);
                  }
              }
              if (windowState != null)
              {
                  try
                  {
                      url.setWindowState((WindowState)TEI.definedWindowStates.get(windowState.toUpperCase()));
                  }
                  catch (WindowStateException e)
                  {
                      throw new JspException(e);
                  }
              }
              if (secure != null)
              {
                  try
                  {
                      url.setSecure(getSecureBoolean());
                  }
                  catch (PortletSecurityException e)
                  {
                      throw new JspException(e);
                  }
              }
          }
          return EVAL_PAGE;
      }
  }