cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/generation HTMLGenerator.java
Date Mon, 18 Feb 2002 11:02:47 GMT
cziegeler    02/02/18 03:02:47

  Modified:    src/java/org/apache/cocoon/generation HTMLGenerator.java
  Log:
  Fixing request parameter handling.
  PR:6520
  
  Revision  Changes    Path
  1.11      +9 -15     xml-cocoon2/src/java/org/apache/cocoon/generation/HTMLGenerator.java
  
  Index: HTMLGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/HTMLGenerator.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- HTMLGenerator.java	13 Feb 2002 07:07:52 -0000	1.10
  +++ HTMLGenerator.java	18 Feb 2002 11:02:47 -0000	1.11
  @@ -93,7 +93,7 @@
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
    * @author <a href="mailto:barozzi@nicolaken.com">Nicola Ken Barozzi</a>
  - * @version CVS $Id: HTMLGenerator.java,v 1.10 2002/02/13 07:07:52 cziegeler Exp $
  + * @version CVS $Id: HTMLGenerator.java,v 1.11 2002/02/18 11:02:47 cziegeler Exp $
    */
   public class HTMLGenerator extends ComposerGenerator
   implements Cacheable, Disposable {
  @@ -145,28 +145,22 @@
   
           // append the request parameter to the URL if necessary
           if (par.getParameterAsBoolean( "copy-parameters", false )) {
  -            StringBuffer query = new StringBuffer( 32 );
  -
  +            final StringBuffer query = new StringBuffer( super.source );
  +            char separator = (super.source.indexOf("?") == -1 ? '?' : '&');
               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) {
  -                query = new StringBuffer(super.source);
  -                if (super.source.indexOf("?") == -1) {
  -                    query.append('?');
  -                } else {
  -                    query.append('&');
  +                    query.append( separator )
  +                         .append( name )
  +                         .append( "=" )
  +                         .append( values[i] );
  +                    separator = '&';
                   }
  -                query.append( query.substring( 0, query.length() - 1) );
  -                super.source = query.toString();
               }
  +            super.source = query.toString();
           }
   
           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