cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 6520] New: - HTMLGenerator delete request parameters
Date Mon, 18 Feb 2002 10:05:55 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6520>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6520

HTMLGenerator delete request parameters

           Summary: HTMLGenerator delete request parameters
           Product: Cocoon 2
           Version: Current CVS
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: general components
        AssignedTo: cocoon-dev@xml.apache.org
        ReportedBy: kreyssel@inter-forum.de
                CC: cocoon-dev@xml.apache.org


The current version of HTMLGenerator has a little confusing bug. It attach´s 
the request parameters with the URL wrong. When I submit in the request any 
parameters then it should attach to the URL of the document but in the current 
cvs version all request parameters will parsed and attached to StringBuffer 
query and if the query length > 0 then query is replaced with new StringBuffer
(super.source).

Current CVS Version:
-----------------------

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) {
      query = new StringBuffer(super.source);
      if (super.source.indexOf("?") == -1) {
          query.append('?');
      } else {
          query.append('&');
      }
      query.append( query.substring( 0, query.length() - 1) );
      super.source = query.toString();
  }
}
-----------------------

In the passage 

if (query.length() > 0) {
      query = new StringBuffer(super.source);

the StringBuffer query from top is overwritten with query=new StringBuffer.


I should replace this with my little example:
-----------------------

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) {
        StringBuffer fullquery = new StringBuffer(super.source);
        if (super.source.indexOf("?") == -1) {
            fullquery.append('?');
        } else {
            fullquery.append('&');
        }
        fullquery.append(query.toString());
        super.source = fullquery.toString();
    }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message