cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From upayav...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon/bean CocoonBean.java CocoonWrapper.java Target.java
Date Fri, 19 Sep 2003 09:09:43 GMT
upayavira    2003/09/19 02:09:43

  Modified:    .        cli.xconf
               src/documentation/xdocs/userdocs/advanced/offline cli.xml
               src/java/org/apache/cocoon Main.java
               src/java/org/apache/cocoon/bean CocoonBean.java
                        CocoonWrapper.java Target.java
  Log:
  Adding support for <uris> node, which allows grouping of URIs so that they share properties.
With this, you can have one set of URIs on which links are followed, and another where they
aren't. Similarly, you can have a group of URIs that share a destination folder (or other
URI, e.g. ftp).
  
  The code is almost in place to allow a different logging category for each URI group, but
I don't know how to tell Cocoon to switch logging category.
  
  Revision  Changes    Path
  1.6       +46 -7     cocoon-2.1/cli.xconf
  
  Index: cli.xconf
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/cli.xconf,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- cli.xconf	1 Sep 2003 14:07:33 -0000	1.5
  +++ cli.xconf	19 Sep 2003 09:09:43 -0000	1.6
  @@ -111,7 +111,7 @@
          |                  INFO and WARN ones.
          |    FATAL_ERROR:  prints only log messages of this level
          +-->
  -   <logging log-kit="WEB-INF/logkit.xconf" logger="cli" level="ERROR" />
  +   <logging log-kit="build/webapp/WEB-INF/logkit.xconf" logger="cli" level="DEBUG" />
   
      <!--+
          |  Specifies the filename to be appended to URIs that
  @@ -153,12 +153,13 @@
          | dev@cocoon.apache.org.
          +-->
      <include pattern="**"/>
  -   <exclude pattern="api/**"/>
  +   <exclude pattern="docs/apidocs/**"/>
  +   
  +<!--   <include-links extension=".html"/>-->
      
      <!--+
  -       |  Specifies the URIs that should be generated (using <uri>
  -       |  elements, and (if necessary) what should be done with the
  -       |  generated pages.
  +       |  <uri> nodes specify the URIs that should be generated, and 
  +       |  where required, what should be done with the generated pages.
          |
          |  Append: append the generated page's URI to the end of the 
          |  source URI:
  @@ -183,8 +184,46 @@
          |  the value provided globally using the <dest-dir> node will 
          |  be used.
          +-->
  -   <uri type="append" src-prefix="docs/" src="index.html"
  +
  +   <uri type="replace" 
  +        src-prefix="samples/" 
  +        src="hello-world/hello.html"
  +        dest="build/dest/hello-world.html"/>
  +        
  +   <!--+
  +       | <uri> nodes can be grouped together in a <uris> node. This 
  +       | enables a group of URIs to share properties. The following
  +       | properties can be set for a group of URIs:
  +       |   * follow-links:       should pages be crawled for links
  +       |   * confirm-extensions: should file extensions be checked
  +       |                         for the correct mime type
  +       |   * src-prefix:         all source URIs should be 
  +       |                         pre-pended with this prefix before
  +       |                         generation. The prefix is not 
  +       |                         included when calculating the 
  +       |                         destination URI
  +       |   * dest:               the base destination URI to be
  +       |                         shared by all pages in this group
  +       |   * type:               the method to be used to calculate
  +       |                         the destination URI. See above 
  +       |                         section on <uri> node for details.
  +       +-->
  +   <uris follow-links="true">
  +     <uri type="append" src-prefix="docs/" src="index.html"
             dest="build/dest/" />
  +   </uris>
  +   
  +   <uris follow-links="false"
  +         confirm-extensions="true"
  +         src-prefix="samples/"
  +         dest="build/dest/examples/"
  +         type="append"
  +         >
  +      <uri src=""/>
  +      <uri src="hello-world/"/>
  +      <uri src="hello-world/hello.html"/>
  +      <uri src="hello-world/hello.xml"/>
  +   </uris>
   
      <!--+
          |  File containing URIs (plain text, one per
  
  
  
  1.2       +124 -42   cocoon-2.1/src/documentation/xdocs/userdocs/advanced/offline/cli.xml
  
  Index: cli.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/advanced/offline/cli.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- cli.xml	2 Sep 2003 12:03:22 -0000	1.1
  +++ cli.xml	19 Sep 2003 09:09:43 -0000	1.2
  @@ -36,10 +36,11 @@
         <s2 title="Using an Xconf file">
           <p>To start the CLI using an xconf file, on Unix do <code>./cocoon.sh
cli -x &lt;xconf file&gt;</code>
              or on Windows: <code>cocoon cli -x &lt;xconf file&gt;</code>.</p>
  -        <p>A sample xconf file is included below.</p>
  +        <p>A sample xconf file, with comments describing each option, is included
below.</p>
           <source>
   <![CDATA[
   <?xml version="1.0"?>
  +
   <!--+
       |  This is the Apache Cocoon command line configuration file. 
       |  Here you give the command line interface details of where
  @@ -64,12 +65,40 @@
       |                        and adjust filename and links extensions
       |                        to match the mime type 
       |                        (e.g. text/html->.html)
  +    |
  +    |  Note: Whilst using an xconf file to configure the Cocoon 
  +    |        Command Line gives access to more features, the use of 
  +    |        command line parameters is more stable, as there are 
  +    |        currently plans to improve the xconf format to allow 
  +    |        greater flexibility. If you require a stable and
  +    |        consistent method for accessing the CLI, it is recommended 
  +    |        that you use the command line parameters to configure 
  +    |        the CLI.</note>
  +    |
       +-->
       
   <cocoon verbose="true"  
           follow-links="true" 
           precompile-only="false" 
  -        confirm-extensions="false">
  +        confirm-extensions="true">
  +
  +   <!--+
  +       |  The context directory is usually the webapp directory
  +       |  containing the sitemap.xmap file.
  +       |
  +       |  The config file is the cocoon.xconf file.
  +       |
  +       |  The work directory is used by Cocoon to store temporary
  +       |  files and cache files.
  +       |  
  +       |  The destination directory is where generated pages will
  +       |  be written (assuming the 'simple' mapper is used, see 
  +       |  below)
  +       +-->
  +   <context-dir>build/webapp</context-dir>
  +   <config-file>WEB-INF/cocoon.xconf</config-file>
  +   <work-dir>build/work</work-dir>
  +   <dest-dir>build/dest</dest-dir>
   
      <!--+
          | Broken link reporting options:
  @@ -79,15 +108,15 @@
          |     <broken-links type="xml" report="filename"/>
          |   Ignore broken links (default):
          |     <broken-links type="none"/>
  -       |   When a page includes an error, should a page be generated?
          |     
          |   Two attributes to this node specify whether a page should
  -       |   be generated when an error occured. 'generate' specifies 
  +       |   be generated when an error has occured. 'generate' specifies 
          |   whether a page should be generated (default: true) and
          |   extension specifies an extension that should be appended
          |   to the generated page's filename (default: none)
  -       |     <broken-links generate="true" extension=".error.txt"/>
  -       |
  +       |   
  +       |   Using this, a quick scan through the destination directory
  +       |   will show broken links, by their filename extension.
          +-->
      <broken-links type="xml" 
                    file="brokenlinks.xml"
  @@ -105,39 +134,35 @@
      -->
   
      <!--+
  -       |
  -       +-->
  -   <logging log-kit="WEB-INF/logkit.xconf" logger="cli" level="ERROR" />
  -
  -   <!--+
  -       |  The context directory is usually the webapp directory
  -       |  containing the sitemap.xmap file.
  -       |
  -       |  The config file is the cocoon.xconf file.
  -       |
  -       |  The work directory is used by Cocoon to store temporary
  -       |  files and cache files.
  -       |  
  -       |  The destination directory is where generated pages will
  -       |  be written (assuming the 'simple' mapper is used)
  +       |  Configures logging. 
  +       |  The 'log-kit' parameter specifies the location of the log kit 
  +       |  configuration file (usually called logkit.xconf. 
  +       | 
  +       |  Logger specifies the logging category (for all logging prior 
  +       |  to other Cocoon logging categories taking over)
  +       |
  +       |  Available log levels are:
  +       |    DEBUG:        prints all level of log messages.
  +       |    INFO:         prints all level of log messages except DEBUG 
  +       |                  ones.
  +       |    WARN:         prints all level of log messages except DEBUG 
  +       |                  and INFO ones.
  +       |    ERROR:        prints all level of log messages except DEBUG, 
  +       |                  INFO and WARN ones.
  +       |    FATAL_ERROR:  prints only log messages of this level
          +-->
  -   <context-dir>.</context-dir>
  -   <config-file>WEB-INF/cocoon.xconf</config-file>
  -   <work-dir>work/docs</work-dir>
  -   <dest-dir>dest</dest-dir>
  +   <logging log-kit="build/webapp/WEB-INF/logkit.xconf" logger="cli" level="DEBUG" />
   
      <!--+
  -       | Specifies the filename to be appended to URIs that
  -       | refer to a directory (i.e. end with a forward slash).
  +       |  Specifies the filename to be appended to URIs that
  +       |  refer to a directory (i.e. end with a forward slash).
          +-->
  -       
      <default-filename>index.html</default-filename>
   
      <!--+
          |  Specifies a user agent string to the sitemap when
          |  generating the site.
          +-->
  -   
      <!--
      <user-agent>xxx</user-agent>
      -->
  @@ -146,18 +171,35 @@
          |  Specifies an accept string to the sitemap when generating
          |  the site.
          +-->
  -       
      <accept>*/*</accept>
      
      <!--+
  -       |  Specifies the URIs that should be generated (using <uri>
  -       |  elements, and (if necessary) what should be done with the
  -       |  generated pages.
  -       |
  -       |  The old behaviour - appends uri to the specified destination
  -       |  directory (as specified in <dest-dir>):
  -       |
  -       |   <uri>documents/index.html</uri>
  +       | Specifies which URIs should be included or excluded, according
  +       | to wildcard patterns. 
  +       | 
  +       | By default, all URIs are included. If both include and exclude
  +       | patterns are specified, a URI is first checked against the 
  +       | include patterns, and then against the exclude patterns.
  +       | 
  +       | Multiple patterns can be given, using muliple include or exclude
  +       | nodes. 
  +       | 
  +       | The order of the elements is not significant, as only the first 
  +       | successful match of each category is used.
  +       | 
  +       | Currently, only the complete source URI can be matched (including
  +       | any URI prefix). Future plans include destination URI matching 
  +       | and regexp matching. If you have requirements for these, contact
  +       | dev@cocoon.apache.org.
  +       +-->
  +   <include pattern="**"/>
  +   <exclude pattern="docs/apidocs/**"/>
  +   
  +<!--   <include-links extension=".html"/>-->
  +   
  +   <!--+
  +       |  <uri> nodes specify the URIs that should be generated, and 
  +       |  where required, what should be done with the generated pages.
          |
          |  Append: append the generated page's URI to the end of the 
          |  source URI:
  @@ -178,15 +220,55 @@
          |   <uri type="insert" src-prefix="documents/" src="index.html" 
          |   dest="zip://*.zip/page.html"/>
          |
  -       +-->
  -   <uri>favicon.ico</uri>
  -   <uri type="append" src-prefix="documents/" src="index.html" dest="docs/"/>
  +       |  If in any of these scenarios, the dest attribute is omitted,
  +       |  the value provided globally using the <dest-dir> node will 
  +       |  be used.
  +       +-->
  +
  +   <uri type="replace" 
  +        src-prefix="samples/" 
  +        src="hello-world/hello.html"
  +        dest="build/dest/hello-world.html"/>
  +        
  +   <!--+
  +       | <uri> nodes can be grouped together in a <uris> node. This 
  +       | enables a group of URIs to share properties. The following
  +       | properties can be set for a group of URIs:
  +       |   * follow-links:       should pages be crawled for links
  +       |   * confirm-extensions: should file extensions be checked
  +       |                         for the correct mime type
  +       |   * src-prefix:         all source URIs should be 
  +       |                         pre-pended with this prefix before
  +       |                         generation. The prefix is not 
  +       |                         included when calculating the 
  +       |                         destination URI
  +       |   * dest:               the base destination URI to be
  +       |                         shared by all pages in this group
  +       |   * type:               the method to be used to calculate
  +       |                         the destination URI. See above 
  +       |                         section on <uri> node for details.
  +       +-->
  +   <uris follow-links="true">
  +     <uri type="append" src-prefix="docs/" src="index.html"
  +          dest="build/dest/" />
  +   </uris>
  +   
  +   <uris follow-links="false"
  +         confirm-extensions="true"
  +         src-prefix="samples/"
  +         dest="build/dest/examples/"
  +         type="append"
  +         >
  +      <uri src=""/>
  +      <uri src="hello-world/"/>
  +      <uri src="hello-world/hello.html"/>
  +      <uri src="hello-world/hello.xml"/>
  +   </uris>
   
      <!--+
          |  File containing URIs (plain text, one per
          |  line).
          +-->
  -  
      <!--
      <uri-file></uri-file>
      -->
  
  
  
  1.17      +69 -1     cocoon-2.1/src/java/org/apache/cocoon/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/Main.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Main.java	18 Sep 2003 12:11:49 -0000	1.16
  +++ Main.java	19 Sep 2003 09:09:43 -0000	1.17
  @@ -171,6 +171,8 @@
       private static final String ATTR_URI_SOURCEURI = "src";
       private static final String ATTR_URI_DESTURI = "dest";
   
  +    private static final String NODE_URIS = "uris";
  +
       private static Options options;
       private static OutputStreamListener listener;
   
  @@ -510,6 +512,9 @@
                       } else if (nodeName.equals(NODE_URI)) {
                           Main.parseURINode(cocoon, node, destDir);
   
  +                    } else if (nodeName.equals(NODE_URIS)) {
  +                        Main.parseURIsNode(cocoon, node, destDir);
  +
                       } else if (nodeName.equals(NODE_URI_FILE)) {
                           cocoon.addTargets(Main.processURIFile(getNodeValue(node)), destDir);
   
  @@ -579,6 +584,69 @@
           }
       }
   
  +    private static void parseURIsNode(CocoonBean cocoon, Node node, String destDir) throws
IllegalArgumentException {
  +
  +        boolean followLinks = cocoon.followLinks();
  +        boolean confirmExtensions = cocoon.confirmExtensions();
  +        String logger = cocoon.getLoggerName();
  +        String destURI = destDir;
  +        String root = null;
  +        String type = null;
  +
  +        if (Main.hasAttribute(node, ATTR_FOLLOW_LINKS)) {
  +            followLinks = Main.getBooleanAttributeValue(node, ATTR_FOLLOW_LINKS);
  +        }
  +        if (Main.hasAttribute(node, ATTR_CONFIRM_EXTENSIONS)) {
  +            confirmExtensions = Main.getBooleanAttributeValue(node, ATTR_CONFIRM_EXTENSIONS);
  +        }
  +        if (Main.hasAttribute(node, ATTR_URI_TYPE)) {
  +            type = Main.getAttributeValue(node, ATTR_URI_TYPE);
  +        }
  +        if (Main.hasAttribute(node, ATTR_URI_SOURCEPREFIX)) {
  +            root = Main.getAttributeValue(node, ATTR_URI_SOURCEPREFIX);
  +        }
  +        if (Main.hasAttribute(node, ATTR_URI_DESTURI)) {
  +            destURI = Main.getAttributeValue(node, ATTR_URI_DESTURI);
  +        }
  +        if (Main.hasAttribute(node, ATTR_LOGGER)) {
  +            logger = Main.getAttributeValue(node, ATTR_LOGGER);
  +        }
  +
  +        NodeList nodes = node.getChildNodes();
  +        for (int i = 0; i < nodes.getLength(); i++) {
  +            Node child = nodes.item(i);
  +            if (child.getNodeType()== Node.ELEMENT_NODE) {
  +                String childName = child.getNodeName();
  +                if (childName.equals(NODE_URI)) {
  +                    String _sourceURI = null;
  +                    String _destURI = destURI;
  +                    String _root = root;
  +                    String _type = type;
  +                    
  +                    if (child.getAttributes().getLength() == 0) {
  +                        _sourceURI = getNodeValue(child);
  +                        //destURI is inherited 
  +                    } else {
  +                        _sourceURI = Main.getAttributeValue(child, ATTR_URI_SOURCEURI);
  +
  +                        if (Main.hasAttribute(child, ATTR_URI_TYPE)) {
  +                            _type = Main.getAttributeValue(child, ATTR_URI_TYPE);
  +                        }
  +                        if (Main.hasAttribute(child, ATTR_URI_SOURCEPREFIX)) {
  +                            _root = Main.getAttributeValue(child, ATTR_URI_SOURCEPREFIX);
  +                        }
  +                        if (Main.hasAttribute(child, ATTR_URI_DESTURI)) {
  +                            _destURI = Main.getAttributeValue(child, ATTR_URI_DESTURI);
  +                        }
  +                    }
  +                    cocoon.addTarget(_type, _root, _sourceURI, _destURI, followLinks, confirmExtensions,
logger);
  +                } else {
  +                    throw new IllegalArgumentException("Unknown element: <" + childName
+ ">");
  +                }
  +            }
  +        }
  +    }
  +        
       private static void parseURINode(CocoonBean cocoon, Node node, String destDir) throws
IllegalArgumentException {
           NodeList nodes = node.getChildNodes();
           if (nodes.getLength() != 0) {
  
  
  
  1.28      +56 -14    cocoon-2.1/src/java/org/apache/cocoon/bean/CocoonBean.java
  
  Index: CocoonBean.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/bean/CocoonBean.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- CocoonBean.java	18 Sep 2003 12:11:50 -0000	1.27
  +++ CocoonBean.java	19 Sep 2003 09:09:43 -0000	1.28
  @@ -169,6 +169,13 @@
           this.brokenLinkExtension = brokenLinkExtension;
       }
   
  +    public boolean followLinks() {
  +        return followLinks;
  +    }
  +    
  +    public boolean confirmExtensions() {
  +        return confirmExtension;
  +    }
       /**
        * Adds a target for processing
        *
  @@ -179,21 +186,26 @@
        * @throws IllegalArgumentException if destURI is missing
        */
       public void addTarget(
  -        String type,
  -        String root,
  -        String sourceURI,
  -        String destURI)
  -        throws IllegalArgumentException {
  +            String type,
  +            String root,
  +            String sourceURI,
  +            String destURI)
  +            throws IllegalArgumentException {
           Target target = new Target(type, root, sourceURI, destURI);
           target.setDefaultFilename(this.defaultFilename);
  +        target.setFollowLinks(this.followLinks);
  +        target.setConfirmExtension(this.confirmExtension);
  +        target.setLogger(this.logger);
           targets.add(target);
  -
       }
   
       public void addTarget(String type, String sourceURI, String destURI)
           throws IllegalArgumentException {
           Target target = new Target(type, sourceURI, destURI);
           target.setDefaultFilename(this.defaultFilename);
  +        target.setFollowLinks(this.followLinks);
  +        target.setConfirmExtension(this.confirmExtension);
  +        target.setLogger(this.logger);
           targets.add(target);
       }
   
  @@ -201,6 +213,9 @@
           throws IllegalArgumentException {
           Target target = new Target(sourceURI, destURI);
           target.setDefaultFilename(this.defaultFilename);
  +        target.setFollowLinks(this.followLinks);
  +        target.setConfirmExtension(this.confirmExtension);
  +        target.setLogger(this.logger);
           targets.add(target);
       }
   
  @@ -210,10 +225,38 @@
           while (i.hasNext()) {
               Target target = new Target((String) i.next(), destURI);
               target.setDefaultFilename(this.defaultFilename);
  +            target.setFollowLinks(this.followLinks);
  +            target.setConfirmExtension(this.confirmExtension);
  +            target.setLogger(this.logger);
               targets.add(target);
           }
       }
   
  +    public void addTarget(
  +        String type,
  +        String root,
  +        String sourceURI,
  +        String destURI,
  +        boolean followLinks,
  +        boolean confirmExtension,
  +        String logger)
  +        throws IllegalArgumentException {
  +        
  +        Target target;
  +        if (root == null && type == null) {
  +            target = new Target(sourceURI, destURI);
  +        } else if (root == null) {
  +            target = new Target(type, sourceURI, destURI);
  +        } else {
  +            target = new Target(type, root, sourceURI, destURI);
  +        }
  +        target.setDefaultFilename(this.defaultFilename);
  +        target.setFollowLinks(followLinks);
  +        target.setConfirmExtension(confirmExtension);
  +        target.setLogger(logger);
  +        targets.add(target);
  +    }
  +
       public void addExcludePattern(String pattern) {
           int preparedPattern[] = WildcardHelper.compilePattern(pattern);
           excludePatterns.add(preparedPattern);
  @@ -406,7 +449,7 @@
           
           long startTimeMillis = System.currentTimeMillis();
   
  -        if (confirmExtension) {
  +        if (target.confirmExtensions()) {
               if (null == allTranslatedLinks.get(target.getSourceURI())) {
                   final String mimeType = getType(target.getDeparameterizedSourceURI(), target.getParameters());
                   target.setMimeType(mimeType);
  @@ -424,7 +467,7 @@
           // Process links
           final HashMap translatedLinks = new HashMap();
           final List targets = new ArrayList();
  -        if (followLinks && confirmExtension && isCrawlablePage(target))
{
  +        if (target.followLinks() && target.confirmExtensions() && isCrawlablePage(target))
{
               final Iterator i =
                   this.getLinks(target.getDeparameterizedSourceURI(), target.getParameters()).iterator();
   
  @@ -469,7 +512,7 @@
               DelayedOutputStream output = new DelayedOutputStream();
               try {
                   List gatheredLinks;
  -                if (!confirmExtension && followLinks && isCrawlablePage(target))
{
  +                if (!target.confirmExtensions() && target.followLinks() &&
isCrawlablePage(target)) {
                       gatheredLinks = new ArrayList();
                   } else {
                       gatheredLinks = null;
  @@ -480,7 +523,7 @@
                           target.getDeparameterizedSourceURI(),
                           getLastModified(target),
                           target.getParameters(),
  -                        confirmExtension ? translatedLinks : null,
  +                        target.confirmExtensions() ? translatedLinks : null,
                           gatheredLinks,
                           output);
   
  @@ -495,13 +538,12 @@
                           Target linkTarget = target.getDerivedTarget(linkURI);
   
                           if (linkTarget == null) {
  -                            System.out.println("Skipping "+ linkURI);
  -                            //@TODO@ Log/report skipped link
  +                            pageSkipped(linkURI, "link does not share same root as parent");
                               continue;
                           }
   
                           if (!isIncluded(linkTarget.getSourceURI())) {
  -                            //@TODO@ Log/report skipped link
  +                            pageSkipped(linkTarget.getSourceURI(), "matched include/exclude
rules");
                               continue;
                           }
                           targets.add(linkTarget);
  
  
  
  1.7       +5 -1      cocoon-2.1/src/java/org/apache/cocoon/bean/CocoonWrapper.java
  
  Index: CocoonWrapper.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/bean/CocoonWrapper.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CocoonWrapper.java	9 Sep 2003 19:03:44 -0000	1.6
  +++ CocoonWrapper.java	19 Sep 2003 09:09:43 -0000	1.7
  @@ -342,6 +342,10 @@
           this.logger = logger;
       }
   
  +    public String getLoggerName() {
  +        return logger;
  +    }
  +    
       /**
        * Set context directory
        * @param contextDir context directory
  
  
  
  1.7       +36 -3     cocoon-2.1/src/java/org/apache/cocoon/bean/Target.java
  
  Index: Target.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/bean/Target.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Target.java	18 Sep 2003 12:11:50 -0000	1.6
  +++ Target.java	19 Sep 2003 09:09:43 -0000	1.7
  @@ -85,7 +85,11 @@
       private String defaultFilename = Constants.INDEX_URI;
       private String finalDestinationURI = null;
       private String extension = null;    
  -            
  +
  +    private boolean followLinks;
  +    private boolean confirmExtension;
  +    private String logger;
  +                 
       private transient int _hashCode;
       private transient String _toString;
   
  @@ -141,6 +145,9 @@
           Target target = new Target(this.type, this.root, linkURI, this.destURI);
           target.setOriginalURI(originalLinkURI);
           target.setParentURI(this.sourceURI);
  +        target.setConfirmExtension(this.confirmExtension);
  +        target.setFollowLinks(this.followLinks);
  +        target.setLogger(this.logger);
           return target;
       }
   
  @@ -387,7 +394,7 @@
        * @return a mangled URI
        */
       private String mangle(String uri) {
  -        if (uri.charAt(uri.length() - 1) == '/') {
  +        if (uri.length()==0 || uri.charAt(uri.length() - 1) == '/') {
               uri += defaultFilename;
           }
           uri = uri.replace('"', '\'');
  @@ -422,5 +429,31 @@
                       + ">";
           }
           return _toString;
  +    }
  +    /**
  +     * @return
  +     */
  +    public boolean confirmExtensions() {
  +        return confirmExtension;
  +    }
  +
  +    public boolean followLinks() {
  +        return followLinks;
  +    }
  +
  +    public String getLogger() {
  +        return logger;
  +    }
  +
  +    public void setConfirmExtension(boolean b) {
  +        confirmExtension = b;
  +    }
  +
  +    public void setFollowLinks(boolean b) {
  +        followLinks = b;
  +    }
  +
  +    public void setLogger(String string) {
  +        logger = string;
       }
   }
  
  
  

Mime
View raw message