cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/modules/input BaseLinkModule.java
Date Sun, 08 Jun 2003 18:07:11 GMT
haul        2003/06/08 11:07:11

  Modified:    src/java/org/apache/cocoon/components/modules/input
                        BaseLinkModule.java
  Log:
  Kudos to volker.schmitt.at.basf-it-services.com for this patch
  
  Revision  Changes    Path
  1.3       +39 -33    cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/BaseLinkModule.java
  
  Index: BaseLinkModule.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/BaseLinkModule.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BaseLinkModule.java	4 Jun 2003 13:06:48 -0000	1.2
  +++ BaseLinkModule.java	8 Jun 2003 18:07:11 -0000	1.3
  @@ -52,7 +52,6 @@
   package org.apache.cocoon.components.modules.input;
   
   import java.util.Iterator;
  -import java.util.LinkedList;
   import java.util.Map;
   import java.util.Vector;
   
  @@ -74,52 +73,59 @@
   public class BaseLinkModule extends AbstractInputModule implements ThreadSafe {
   
       final static Vector returnNames = new Vector() {
  -            {
  -                add("RequestBaseLink");
  -                add("SitemapBaseLink");
  -            }
  -        };
  -    
  -    public Object getAttribute(final String name, final Configuration modeConf, final Map
objectModel ) throws ConfigurationException {
  -        
  -	String uri;
  -	if (name.equals("SitemapBaseLink"))
  +        {
  +            add("RequestBaseLink");
  +            add("SitemapBaseLink");
  +        }
  +    };
  +
  +    public Object getAttribute(
  +        final String name,
  +        final Configuration modeConf,
  +        final Map objectModel)
  +        throws ConfigurationException {
  +
  +        String uri;
  +        if (name.equals("SitemapBaseLink"))
               uri = ObjectModelHelper.getRequest(objectModel).getSitemapURI();
  -	else if (name.equals("RequestBaseLink"))
  +        else if (name.equals("RequestBaseLink"))
               uri = ObjectModelHelper.getRequest(objectModel).getRequestURI();
  -	else uri = "";
  -        
  +        else
  +            uri = "";
  +
           if (uri.startsWith("/")) {
               uri = uri.substring(1);
           }
  -        
  +
           StringBuffer result = new StringBuffer(uri.length());
  -        
  +
           int nextIndex = 0;
  -        while ((nextIndex = uri.indexOf ('/', nextIndex) + 1) > 0) {
  +        while ((nextIndex = uri.indexOf('/', nextIndex) + 1) > 0) {
               result.append("../");
           }
  -        
  +
           if (getLogger().isDebugEnabled())
  -            getLogger().debug ("Returns " + result + " for uri " + uri + " and attribute
" + name);
  -        
  +            getLogger().debug("Returns " + result + " for uri " + uri + " and attribute
" + name);
  +
           return result.toString();
       }
  -    
  -    
  -    public Iterator getAttributeNames(final Configuration modeConf, final Map objectModel)
throws ConfigurationException {
  -        
  +
  +    public Iterator getAttributeNames(final Configuration modeConf, final Map objectModel)
  +        throws ConfigurationException {
  +
           return RequestURIModule.returnNames.iterator();
       }
  -    
  -    public Object[] getAttributeValues(final String name, final Configuration modeConf,
final Map objectModel )
  +
  +    public Object[] getAttributeValues(
  +        final String name,
  +        final Configuration modeConf,
  +        final Map objectModel)
           throws ConfigurationException {
  -        
  -        return (new LinkedList() {
  -                {
  -                    add(getAttribute(name, modeConf, objectModel) );
  -                }
  -            }).toArray();
  +
  +        Object[] result = new Object[1];
  +        result[0] = getAttribute(name, modeConf, objectModel);
  +        return result;
  +
       }
  -    
  +
   }
  
  
  

Mime
View raw message