You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by ce...@apache.org on 2001/11/02 17:50:05 UTC

cvs commit: jakarta-struts/contrib/tiles/src/tutorial/org/apache/struts/example/tiles/rssChannel Channels.java

cedric      01/11/02 08:50:05

  Modified:    contrib/tiles/src/share/org/apache/struts/tiles/xmlDefinition
                        XmlAttribute.java
               contrib/tiles/web/doc/WEB-INF tutorialDefinitions.xml
                        struts-config.xml
               contrib/tiles/web/doc/rss rss-example.xml
                        apacheweek-headlines.xml
               contrib/tiles/web/doc/doc/portal revisions.jsp download.jsp
               contrib/tiles/src/share/org/apache/struts/taglib/tiles
                        InsertTag.java ImportAttributeTag.java
               contrib/tiles/src/share/org/apache/struts/tiles
                        ComponentContext.java
               contrib/tiles/src/tutorial/org/apache/struts/example/tiles/rssChannel
                        Channels.java
  Log:
  Correct bug preventing Tiles to run with Orion in production mode.
  Update rssChannels example to let it run even if we are disconnected.
  
  Revision  Changes    Path
  1.4       +3 -3      jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/xmlDefinition/XmlAttribute.java
  
  Index: XmlAttribute.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/xmlDefinition/XmlAttribute.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XmlAttribute.java	2001/10/29 17:32:24	1.3
  +++ XmlAttribute.java	2001/11/02 16:50:04	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/xmlDefinition/XmlAttribute.java,v 1.3 2001/10/29 17:32:24 cedric Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/10/29 17:32:24 $
  + * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/xmlDefinition/XmlAttribute.java,v 1.4 2001/11/02 16:50:04 cedric Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/11/02 16:50:04 $
    * $Author: cedric $
    *
    */
  
  
  
  1.5       +4 -3      jakarta-struts/contrib/tiles/web/doc/WEB-INF/tutorialDefinitions.xml
  
  Index: tutorialDefinitions.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/tiles/web/doc/WEB-INF/tutorialDefinitions.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- tutorialDefinitions.xml	2001/10/08 13:49:38	1.4
  +++ tutorialDefinitions.xml	2001/11/02 16:50:04	1.5
  @@ -214,8 +214,8 @@
       <!-- Dynamic portal main page (use common layout) -->
   <definition name="rssLocalChannelTile"  path="/actions/rssChannel.do" >
         <putList name="urls" >
  -	    <add value="http://localhost:8080/wtiles-struts/rss/rss-example.xml" />
  -	    <add value="http://localhost:8080/wtiles-struts/rss/apacheweek-headlines.xml" />
  +	    <add value="/rss/rss-example.xml" />
  +	    <add value="/rss/apacheweek-headlines.xml" />
   	  </putList>
   </definition>
   
  @@ -238,10 +238,11 @@
   	    <add value="/tutorial/portal/messages.jsp" />
   	    <add value="/tutorial/portal/newsFeed.jsp" />
   	    <add value="/tutorial/portal/advert2.jsp" />
  -	    <add value="rssLocalChannelTile" />
  +	    <add value="rssChannelTile" />
   	  </putList>
   	  <putList name="list1" >
   	    <add value="/tutorial/portal/advert3.jsp" />
  +	    <add value="rssLocalChannelTile" />
   	    <add value="/tutorial/portal/stocks.jsp" />
   	    <add value="/tutorial/portal/whatsNew.jsp" />
   	    <add value="/tutorial/portal/personalLinks.jsp" />
  
  
  
  1.4       +3 -3      jakarta-struts/contrib/tiles/web/doc/WEB-INF/struts-config.xml
  
  Index: struts-config.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/tiles/web/doc/WEB-INF/struts-config.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- struts-config.xml	2001/10/08 13:49:38	1.3
  +++ struts-config.xml	2001/11/02 16:50:04	1.4
  @@ -1,8 +1,8 @@
   <?xml version="1.0" encoding="ISO-8859-1" ?>
   
   <!DOCTYPE struts-config PUBLIC
  -          "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
  -          "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
  +          "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
  +          "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
   <!--
        This is the Struts configuration file for the example application,
        using the proposed new syntax.
  @@ -111,7 +111,7 @@
       <action     path="/actions/rssChannel"
                   type="org.apache.struts.example.tiles.rssChannel.Channels">
         <forward  name="continue"        path="/tutorial/dynPortal/Channels.jsp"/>
  -      <forward  name="error"           path="/tutorial/dynPortal/Channels.jsp"/>
  +      <forward  name="error"           path="/tutorial/dynPortal/Errors.jsp"/>
      </action>
   
     <!-- =======================================================  -->
  
  
  
  1.2       +1 -1      jakarta-struts/contrib/tiles/web/doc/rss/rss-example.xml
  
  Index: rss-example.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/tiles/web/doc/rss/rss-example.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- rss-example.xml	2001/10/08 13:56:40	1.1
  +++ rss-example.xml	2001/11/02 16:50:04	1.2
  @@ -1,4 +1,4 @@
  -<?xml version="1.0"?>
  +<?xml version="1.0" encoding="UTF-8" ?>
   
   <!DOCTYPE rss PUBLIC
    "-//Netscape Communications//DTD RSS 0.91//EN"
  
  
  
  1.2       +1 -1      jakarta-struts/contrib/tiles/web/doc/rss/apacheweek-headlines.xml
  
  Index: apacheweek-headlines.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/tiles/web/doc/rss/apacheweek-headlines.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- apacheweek-headlines.xml	2001/10/08 13:56:40	1.1
  +++ apacheweek-headlines.xml	2001/11/02 16:50:04	1.2
  @@ -1,4 +1,4 @@
  -<?xml version="1.0"?>
  +<?xml version="1.0" encoding="UTF-8" ?>
   <!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">
   <rss version="0.91">
     <channel>
  
  
  
  1.6       +7 -0      jakarta-struts/contrib/tiles/web/doc/doc/portal/revisions.jsp
  
  Index: revisions.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/tiles/web/doc/doc/portal/revisions.jsp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- revisions.jsp	2001/10/29 17:32:24	1.5
  +++ revisions.jsp	2001/11/02 16:50:04	1.6
  @@ -2,6 +2,13 @@
   <tr>
   <th bgcolor="aqua"><FONT size=4>History</FONT></th></tr>
     <TR>
  +    <TD><FONT size=2><STRONG> 02&nbsp;nov. 2001</STRONG> </FONT></TD></TR>
  +  <TR>
  +    <TD>
  +      <UL>
  +        <LI><FONT size=2>  Correct another bug with Orion : "importAttribute 
  +        not working whenreused"</FONT></LI></UL></TD></TR> 
  +  <TR>
       <TD><FONT size=2><STRONG> 29&nbsp;oct. 2001</STRONG> </FONT></TD></TR>
     <TR>
       <TD>
  
  
  
  1.6       +1 -1      jakarta-struts/contrib/tiles/web/doc/doc/portal/download.jsp
  
  Index: download.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/tiles/web/doc/doc/portal/download.jsp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- download.jsp	2001/10/29 17:32:24	1.5
  +++ download.jsp	2001/11/02 16:50:04	1.6
  @@ -15,7 +15,7 @@
                      You can also 
         download it, and additional resources, from</font> <font size="2">following web sites :</font> </div>
                  <div align="center">
  -                  <font size="2"> Latest build : 2001&nbsp;10&nbsp;29 (with struts 2001 10 
  +                  <font size="2"> Latest build : 2001&nbsp;11&nbsp;02 (with struts 2001 10 
         15 - 1.1dev)</font> </div>
                  <div align="center">
                     <table border="2">
  
  
  
  1.4       +4 -4      jakarta-struts/contrib/tiles/src/share/org/apache/struts/taglib/tiles/InsertTag.java
  
  Index: InsertTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/taglib/tiles/InsertTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- InsertTag.java	2001/10/29 17:32:24	1.3
  +++ InsertTag.java	2001/11/02 16:50:04	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/taglib/tiles/InsertTag.java,v 1.3 2001/10/29 17:32:24 cedric Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/10/29 17:32:24 $
  + * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/taglib/tiles/InsertTag.java,v 1.4 2001/11/02 16:50:04 cedric Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/11/02 16:50:04 $
    * $Author: cedric $
    *
    */
  @@ -41,7 +41,7 @@
    *
    * @author David Geary
    * @author Cedric Dumoulin
  - * @version $Revision: 1.3 $ $Date: 2001/10/29 17:32:24 $
  + * @version $Revision: 1.4 $ $Date: 2001/11/02 16:50:04 $
    */
   public class InsertTag extends TagSupport implements PutTagParent, ComponentConstants, PutListTagParent
   {
  
  
  
  1.2       +8 -8      jakarta-struts/contrib/tiles/src/share/org/apache/struts/taglib/tiles/ImportAttributeTag.java
  
  Index: ImportAttributeTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/taglib/tiles/ImportAttributeTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ImportAttributeTag.java	2001/08/01 14:36:40	1.1
  +++ ImportAttributeTag.java	2001/11/02 16:50:05	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/taglib/tiles/ImportAttributeTag.java,v 1.1 2001/08/01 14:36:40 cedric Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/08/01 14:36:40 $
  + * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/taglib/tiles/ImportAttributeTag.java,v 1.2 2001/11/02 16:50:05 cedric Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/11/02 16:50:05 $
    * $Author: cedric $
    *
    */
  @@ -65,7 +65,7 @@
       }
   
       /**
  -     * Return the length.
  +     * Return the name.
        */
       public String getName()
        {
  @@ -74,9 +74,9 @@
   
   
       /**
  -     * Set the length.
  +     * Set the name.
        *
  -     * @param length The new length
  +     * @param name The new name
        */
       public void setName(String name)
        {
  @@ -138,11 +138,11 @@
         Iterator names = compContext.getAttributeNames();
         while(names.hasNext())
           {
  -        name = (String)names.next();
  +        String name = (String)names.next();
           pageContext.setAttribute(name, compContext.getAttribute(name), scope);
           } // end loop
         } // end if
  -      
  +
   	    // Continue processing this page
       return SKIP_BODY;
       }
  
  
  
  1.3       +5 -4      jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/ComponentContext.java
  
  Index: ComponentContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/ComponentContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ComponentContext.java	2001/09/10 12:52:11	1.2
  +++ ComponentContext.java	2001/11/02 16:50:05	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/ComponentContext.java,v 1.2 2001/09/10 12:52:11 cedric Exp $
  - * $Revision: 1.2 $
  - * $Date: 2001/09/10 12:52:11 $
  + * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/ComponentContext.java,v 1.3 2001/11/02 16:50:05 cedric Exp $
  + * $Revision: 1.3 $
  + * $Date: 2001/11/02 16:50:05 $
    * $Author: cedric $
    *
    */
  @@ -17,11 +17,12 @@
   import javax.servlet.ServletRequest;
   import javax.servlet.jsp.PageContext;
   import org.apache.struts.taglib.tiles.ComponentConstants;
  +import java.io.Serializable;
   
   /**
    * Component context.
    */
  -public class ComponentContext
  +public class ComponentContext implements Serializable
   {
   
     /**
  
  
  
  1.2       +31 -6     jakarta-struts/contrib/tiles/src/tutorial/org/apache/struts/example/tiles/rssChannel/Channels.java
  
  Index: Channels.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/tiles/src/tutorial/org/apache/struts/example/tiles/rssChannel/Channels.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Channels.java	2001/10/08 13:39:24	1.1
  +++ Channels.java	2001/11/02 16:50:05	1.2
  @@ -31,10 +31,13 @@
    * @expects path={uri} on command line or as parameter property to ActionMapping.
    * @expects an input page or error forwarding if exception digesting RSS
    * @author Ted Husted
  - * @version $Revision: 1.1 $ $Date: 2001/10/08 13:39:24 $
  + * @version $Revision: 1.2 $ $Date: 2001/11/02 16:50:05 $
    */
   public final class Channels extends Action {
   
  +
  +      /** Debug flag */
  +    public static final boolean debug = true;
       /**
        * Tile attribute key for saving Channel bean
        */
  @@ -60,7 +63,8 @@
                                    HttpServletResponse response)
           throws IOException, ServletException {
   
  -    System.out.println( "Enter Rss Channel Action" );
  +    if(debug)
  +      System.out.println( "Enter Rss Channel Action" );
   
             // Try to retrieve tile context
       ComponentContext context = ComponentContext.getContext( request );
  @@ -87,14 +91,22 @@
               //channels.add("http://lwn.net/headlines/rss");
           // channels.trimToSize();
   
  -        System.out.println( "urls count" + channels.size() ) ;
  +        if(debug)
  +          System.out.println( "urls count" + channels.size() ) ;
           // -- Loop through channels --
           ArrayList channelBeans = new ArrayList(channels.size());
           try {
               for (int i=0; i<channels.size(); i++) {
                   RSSDigester digester = new RSSDigester();
  -                Channel obj = (Channel)digester.parse((String)channels.get(i));
  -                System.out.println( "Channel:" + obj) ;
  +                String url = (String)channels.get(i);
  +                  // Add application path if needed
  +                if( url.startsWith("/") )
  +                  {
  +                  url = toFullUrl( request, url );
  +                  }
  +                if(debug)  System.out.println( "Channel url=" + url) ;
  +                Channel obj = (Channel)digester.parse(url);
  +                if(debug)  System.out.println( "Channel:" + obj) ;
                   //System.out.println( "Channel.items:" + obj.getI) ;
                   channelBeans.add(obj);
               }
  @@ -111,26 +123,39 @@
               if (mapping.getInput()!=null)
                   return (new ActionForward(mapping.getInput()));
               // If no input page, use error forwarding
  -         System.out.println( "Exit Rss Channel Action : error" );
  +         if(debug)
  +           System.out.println( "Exit Rss Channel Action : error" );
               return (mapping.findForward("error"));
           }
   
           // -- Save Bean, and Continue  ---
   
  -         System.out.println( "Exit Rss Channel Action" );
  +         if(debug)
  +           System.out.println( "Exit Rss Channel Action" );
           //request.setAttribute(CHANNELS_KEY,channelBeans);
             // Use Tile context to pass channels
           context.putAttribute( CHANNELS_KEY,channelBeans);
           return (mapping.findForward("continue"));
       } // ---- End perform ----
   
  +  private String toFullUrl( HttpServletRequest request, String url )
  +    {
  +    StringBuffer buff = new StringBuffer();
  +
  +    buff.append( request.getScheme() ) .append( "://" ) . append(request.getServerName());
  +    if( request.getServerPort() != 80 )
  +      buff.append( ":" ).append( request.getServerPort() );
  +    buff.append( request.getContextPath()).append( url);
  +    return buff.toString();
  +    }
  +
   } // ---- End Fetch ----
   
   
   /*
  - * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/tutorial/org/apache/struts/example/tiles/rssChannel/Channels.java,v 1.1 2001/10/08 13:39:24 cedric Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/10/08 13:39:24 $
  + * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/tutorial/org/apache/struts/example/tiles/rssChannel/Channels.java,v 1.2 2001/11/02 16:50:05 cedric Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/11/02 16:50:05 $
    *
    * ====================================================================
    *
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>