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 ta...@apache.org on 2003/04/11 09:09:58 UTC

cvs commit: jakarta-jetspeed/webapp/WEB-INF/templates/vm/portlets/html forward-demo.vm

taylor      2003/04/11 00:09:56

  Modified:    src/java/org/apache/jetspeed/services/forward
                        ForwardService.java JetspeedForwardService.java
               webapp/WEB-INF/conf JetspeedSecurity.properties
                        TurbineResources.properties
               webapp/WEB-INF/psml/user/turbine/html default.psml
               webapp/WEB-INF/templates/vm/portlets/html forward-demo.vm
  Added:       src/java/org/apache/jetspeed/services/forward
                        ForwardTool.java
  Log:
  Forward Tool implemented
  
  Revision  Changes    Path
  1.2       +5 -4      jakarta-jetspeed/src/java/org/apache/jetspeed/services/forward/ForwardService.java
  
  Index: ForwardService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/forward/ForwardService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ForwardService.java	11 Apr 2003 05:41:21 -0000	1.1
  +++ ForwardService.java	11 Apr 2003 07:09:55 -0000	1.2
  @@ -89,8 +89,9 @@
        *
        * @param rundata The turbine rundata context for this request.     
        * @param name Forward to this abstract forward name.
  +     * @return String the full link to the referenced page
        */
  -    public void forward(RunData rundata, String name);
  +    public String forward(RunData rundata, String name);
   
   
       /**
  @@ -99,9 +100,9 @@
        *
        * @param portlet The name of the portlet for which we are forwarding.
        * @param target A logical target name. Portlets can have 1 or more targets.
  -     * @return A Profile object if found by the manager or null.
  +     * @return String the full link to the referenced page
        */
  -    public void forward(RunData rundata, String portlet, String target);
  +    public String forward(RunData rundata, String portlet, String target);
   
       
       public Collection getForwards();
  
  
  
  1.2       +13 -7     jakarta-jetspeed/src/java/org/apache/jetspeed/services/forward/JetspeedForwardService.java
  
  Index: JetspeedForwardService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/forward/JetspeedForwardService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JetspeedForwardService.java	11 Apr 2003 05:41:21 -0000	1.1
  +++ JetspeedForwardService.java	11 Apr 2003 07:09:55 -0000	1.2
  @@ -201,13 +201,16 @@
        *
        * @param rundata The turbine rundata context for this request.     
        * @param name Forward to this abstract forward name.
  +     * @return String the full link to the referenced page
        */
  -    public void forward(RunData rundata, String forwardName)
  +    public String forward(RunData rundata, String forwardName)
       {
  +        String result = "";
  +
           try
           {
  -            JetspeedLink link = JetspeedLinkFactory.getInstance(rundata);
               DynamicURI duri = null;
  +            JetspeedLink link = JetspeedLinkFactory.getInstance(rundata);
               int rootType = JetspeedLink.DEFAULT;
               int elementType = JetspeedLink.DEFAULT;
               String rootValue = null;
  @@ -310,7 +313,8 @@
               {
                   duri = link.getPage();
               }
  -            rundata.setRedirectURI(duri.toString());
  +            result = duri.toString();
  +            rundata.setRedirectURI(result);
               JetspeedLinkFactory.putInstance(link);
           }
           catch (Throwable t)
  @@ -318,6 +322,7 @@
               Log.error("Exception in Forward: " + t);
               t.printStackTrace();
           }
  +        return result;
       }
   
       /**
  @@ -345,9 +350,9 @@
        *
        * @param portlet The name of the portlet for which we are forwarding.
        * @param target A logical target name. Portlets can have 1 or more targets.
  -     * @return A Profile object if found by the manager or null.
  +     * @return String the full link to the referenced page
        */
  -    public void forward(RunData rundata, String portlet, String target)
  +    public String forward(RunData rundata, String portlet, String target)
       {
           try
           {
  @@ -364,12 +369,13 @@
                       forwardName = forward.getName();
                   }
               }
  -            forward(rundata, forwardName);
  +            return forward(rundata, forwardName);
           }
           catch (Throwable t)
           {
               t.printStackTrace();
           }
  +        return ""; // default page
       }
   
   
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/services/forward/ForwardTool.java
  
  Index: ForwardTool.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" 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" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * 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.jetspeed.services.forward;
  
  // Turbine
  import org.apache.turbine.util.RunData;
  import org.apache.turbine.util.Log;
  import org.apache.turbine.util.DynamicURI;
  import org.apache.turbine.services.pull.ApplicationTool;
  
  import org.apache.jetspeed.util.ServiceUtil;
  import org.apache.jetspeed.services.rundata.JetspeedRunData;
  
  /**
   * <p>Provides a tool interface to forwards</p>
   *
   *
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @version $Id: ForwardTool.java,v 1.1 2003/04/11 07:09:55 taylor Exp $
   */
  public class ForwardTool implements ApplicationTool
  {
      /**
       *<p>Request to which we refer.</p>
       */
      private JetspeedRunData rundata = null;
  
      ForwardService service = null;
  
      /**
       *  Forward to a specific forward by name.
       *
       * @param name Forward to this abstract forward name.
       * @return String the full link to the referenced page
       */
      public String forward(String forwardName)
      {
          if (null == service)
          {
              service = (ForwardService)ServiceUtil.getServiceByName(ForwardService.SERVICE_NAME);
          }
          return service.forward(this.rundata, forwardName);
      }
  
      /**
       *  For the given portlet and given action, forward to the target
       *  defined in the forward configuration for the portlet + action.
       *
       * @param portlet The name of the portlet for which we are forwarding.
       * @param target A logical target name. Portlets can have 1 or more targets.
       * @return String the full link to the referenced page
       */
      public String forward(String portlet, String target)
      {
          if (null == service)
          {
              service = (ForwardService)ServiceUtil.getServiceByName(ForwardService.SERVICE_NAME);
          }
          return service.forward(this.rundata, portlet, target);
      }
  
  
      /**
       * Methods required by ApplictionTool interface
       *
       */
  
      /**
       * This will initialise a JetspeedLink object that was
       * constructed with the default constructor (ApplicationTool
       * method).
       *
       * @param data assumed to be a RunData object
       */
  
      public void init(Object data)
      {
          // Keeping init small and fast
          if (data instanceof JetspeedRunData)
          {
              this.rundata = (JetspeedRunData) data;
          }
          else
          {
              this.rundata = null;
          }
          return;
      }
      /**
       * Refresh method - does nothing
       */
      public void refresh()
      {
          // empty
      }
  }
  
  
  1.62      +0 -0      jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedSecurity.properties
  
  Index: JetspeedSecurity.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedSecurity.properties,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  
  
  
  1.69      +2 -1      jakarta-jetspeed/webapp/WEB-INF/conf/TurbineResources.properties
  
  Index: TurbineResources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/conf/TurbineResources.properties,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- TurbineResources.properties	26 Feb 2003 17:46:34 -0000	1.68
  +++ TurbineResources.properties	11 Apr 2003 07:09:55 -0000	1.69
  @@ -527,6 +527,7 @@
   # Defaults: none
   
   tool.request.jslink=org.apache.jetspeed.util.template.BaseJetspeedLink
  +tool.request.jsforward=org.apache.jetspeed.services.forward.ForwardTool
   
   # link.setAction() has been replace by jslink.setAction()
   # link.setPage() has been replace by jslink.setPage()
  
  
  
  1.23      +7 -0      jakarta-jetspeed/webapp/WEB-INF/psml/user/turbine/html/default.psml
  
  Index: default.psml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/psml/user/turbine/html/default.psml,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- default.psml	20 Nov 2002 00:18:55 -0000	1.22
  +++ default.psml	11 Apr 2003 07:09:56 -0000	1.23
  @@ -77,6 +77,13 @@
               </layout>
           </entry>
   
  +        <entry id="102" parent="ForwardDemo">
  +            <layout position="-1" size="-1">
  +                <property name="column" value="1"/>
  +                <property name="row" value="5"/>
  +            </layout>
  +        </entry>
  +
           <!--
           <reference id="P-ed09142736-10018" path="group/apache/page/news">
               <layout position="-1" size="-1">
  
  
  
  1.2       +5 -1      jakarta-jetspeed/webapp/WEB-INF/templates/vm/portlets/html/forward-demo.vm
  
  Index: forward-demo.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/templates/vm/portlets/html/forward-demo.vm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- forward-demo.vm	11 Apr 2003 05:41:22 -0000	1.1
  +++ forward-demo.vm	11 Apr 2003 07:09:56 -0000	1.2
  @@ -28,6 +28,10 @@
         #end
         <input type="submit" name="eventSubmit_doTarget" value="PortletForward">
       </p>                                     
  -    
  +    <p>
  +    <a href="$jsforward.forward('ApacheGroupNews')">Tool - Forward</a>
  +    <br/>
  +    <a href="$jsforward.forward('ForwardDemo','Pane')">Tool  - PortletForward</a>
  +    </p>
     </font>
   </form>
  
  
  

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