cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/generation HTMLGenerator.java
Date Tue, 21 Aug 2001 18:00:02 GMT
dims        01/08/21 11:00:02

  Modified:    src/org/apache/cocoon/components/language/programming/java
                        Tag: cocoon_20_branch JavaLanguage.java
               src/org/apache/cocoon/generation Tag: cocoon_20_branch
                        HTMLGenerator.java
  Log:
  - Patch for "JavaLanguage - Multiple Extension paths" from Stuart Roebuck <stuart.roebuck@adolos.co.uk>
  - Patch for HTML Generator from Gerd Mueller <gerd@smb-tec.com>
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.4   +27 -12    xml-cocoon2/src/org/apache/cocoon/components/language/programming/java/JavaLanguage.java
  
  Index: JavaLanguage.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/programming/java/JavaLanguage.java,v
  retrieving revision 1.2.2.3
  retrieving revision 1.2.2.4
  diff -u -r1.2.2.3 -r1.2.2.4
  --- JavaLanguage.java	2001/08/20 14:07:27	1.2.2.3
  +++ JavaLanguage.java	2001/08/21 18:00:01	1.2.2.4
  @@ -25,12 +25,13 @@
   import java.io.File;
   import java.io.IOException;
   import java.util.List;
  +import java.util.StringTokenizer;
   
   /**
    * The Java programming language processor
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.2.2.3 $ $Date: 2001/08/20 14:07:27 $
  + * @version CVS $Revision: 1.2.2.4 $ $Date: 2001/08/21 18:00:01 $
    */
   public class JavaLanguage extends CompiledProgrammingLanguage implements ThreadSafe, Composable,
Disposable {
   
  @@ -275,18 +276,32 @@
       return buffer.toString();
     }
   
  -  private String expandDirs(String d) throws LanguageException {
  -    File dir = new File(d);
  -    if ( ! dir.isDirectory() ) {
  -        throw new LanguageException(
  -            "Attempted to retrieve directory listing of non-directory "
  -            + dir.toString()
  -        );
  -    }
  -    File[] files = dir.listFiles(new JavaArchiveFilter());
  +  /**
  +   * Expand a directory path or list of directory paths (File.pathSeparator
  +   * delimited) into a list of file paths of all the jar files in those
  +   * directories.
  +   *
  +   * @param dirPaths The string containing the directory path or list of
  +   * 		directory paths.
  +   * @return The file paths of the jar files in the directories. This is an
  +   *		empty string if no files were found, and is terminated by an
  +   *		additional pathSeparator in all other cases.
  +   */
  +  private String expandDirs(String dirPaths) throws LanguageException {
  +    StringTokenizer st = new StringTokenizer(dirPaths, File.pathSeparator);
       StringBuffer buffer = new StringBuffer();
  -    for (int i = 0; i < files.length; i++) {
  -        buffer.append(files[i]).append(File.pathSeparator);
  +    while (st.hasMoreTokens()) {
  +        String d = st.nextToken();
  +        File dir = new File(d);
  +        if ( ! dir.isDirectory() ) {
  +            // The absence of a listed directory may not be an error.
  +            if (getLogger().isWarnEnabled()) getLogger().warn("Attempted to retrieve directory
listing of non-directory " + dir.toString());
  +        } else {
  +            File[] files = dir.listFiles(new JavaArchiveFilter());
  +            for (int i = 0; i < files.length; i++) {
  +                buffer.append(files[i]).append(File.pathSeparator);
  +            }
  +        }
       }
       return buffer.toString();
     }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.7   +23 -2     xml-cocoon2/src/org/apache/cocoon/generation/HTMLGenerator.java
  
  Index: HTMLGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/HTMLGenerator.java,v
  retrieving revision 1.4.2.6
  retrieving revision 1.4.2.7
  diff -u -r1.4.2.6 -r1.4.2.7
  --- HTMLGenerator.java	2001/08/20 14:07:31	1.4.2.6
  +++ HTMLGenerator.java	2001/08/21 18:00:02	1.4.2.7
  @@ -34,11 +34,12 @@
   import java.io.BufferedInputStream;
   import java.io.IOException;
   import java.util.Map;
  +import java.util.Enumeration;
   
   /**
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.4.2.6 $ $Date: 2001/08/20 14:07:31 $
  + * @version CVS $Revision: 1.4.2.7 $ $Date: 2001/08/21 18:00:02 $
    */
   public class HTMLGenerator extends ComposerGenerator implements Cacheable, Recyclable {
   
  @@ -65,12 +66,32 @@
       public void setup(SourceResolver resolver, Map objectModel, String src, Parameters
par)
       throws ProcessingException, SAXException, IOException {
           super.setup(resolver, objectModel, src, par);
  -        this.inputSource = resolver.resolve(super.source);
           
           Request request = (Request) objectModel.get(Constants.REQUEST_OBJECT);
           xpath = request.getParameter("xpath");
           if(xpath == null)
               xpath = par.getParameter("xpath",null);
  +
  +        // append the request parameter to the URL if necessary
  +        if (par.getParameterAsBoolean( "copy-parameters", false )) {
  +            StringBuffer query = new StringBuffer( 32 );
  +
  +            Enumeration params = request.getParameterNames();
  +            while (params.hasMoreElements()) {
  +                String name = (String)params.nextElement();
  +                String[] values = request.getParameterValues( name );
  +
  +                for (int i = 0; i < values.length; i++) {
  +                    query.append( name ).append( "=" ).append( values[i] ).append( "&"
); 
  +                }
  +            }
  +            
  +            if (query.length() > 0) {
  +                super.source += "?" + query.substring( 0, query.length() - 1 );
  +            }
  +        }
  +
  +        this.inputSource = resolver.resolve(super.source);
       }
   
       /**
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message