tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteResponse.java
Date Wed, 04 Sep 2002 18:48:08 GMT
bobh        2002/09/04 11:48:08

  Modified:    coyote/src/java/org/apache/coyote/tomcat4
                        CoyoteResponse.java
               coyote/src/java/org/apache/coyote/tomcat5
                        CoyoteResponse.java
  Log:
   - I noticed that RequestDumperValve was unhappy, so I investigaged and found
  that getHeaderValues(String name) was not even using the name parameter.  This
  fixes that.
  
  Revision  Changes    Path
  1.21      +12 -9     jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteResponse.java
  
  Index: CoyoteResponse.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteResponse.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- CoyoteResponse.java	4 Aug 2002 19:39:49 -0000	1.20
  +++ CoyoteResponse.java	4 Sep 2002 18:48:08 -0000	1.21
  @@ -79,6 +79,7 @@
   import java.util.Locale;
   import java.util.Map;
   import java.util.TimeZone;
  +import java.util.Vector;
   
   import javax.servlet.ServletContext;
   import javax.servlet.ServletException;
  @@ -789,12 +790,14 @@
       public String[] getHeaderValues(String name) {
   
           MimeHeaders headers = coyoteResponse.getMimeHeaders();
  -        int n = headers.size();
  -        String[] result = new String[n];
  -        for (int i = 0; i < n; i++) {
  -            result[i] = headers.getValue(i).toString();
  +	Vector result = new Vector();
  +        for (int i = 0; i < headers.size(); i++) {
  +	    if (name.equals( headers.getName(i).toString() ))
  +		result.addElement( headers.getValue(i).toString() );
           }
  -        return result;
  +        String[] resultArray = new String[result.size()];
  +        result.copyInto(resultArray);
  +        return resultArray;
   
       }
   
  
  
  
  1.5       +12 -9     jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteResponse.java
  
  Index: CoyoteResponse.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteResponse.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CoyoteResponse.java	13 Aug 2002 20:44:13 -0000	1.4
  +++ CoyoteResponse.java	4 Sep 2002 18:48:08 -0000	1.5
  @@ -79,6 +79,7 @@
   import java.util.Locale;
   import java.util.Map;
   import java.util.TimeZone;
  +import java.util.Vector;
   
   import javax.servlet.ServletContext;
   import javax.servlet.ServletException;
  @@ -814,12 +815,14 @@
       public String[] getHeaderValues(String name) {
   
           MimeHeaders headers = coyoteResponse.getMimeHeaders();
  -        int n = headers.size();
  -        String[] result = new String[n];
  -        for (int i = 0; i < n; i++) {
  -            result[i] = headers.getValue(i).toString();
  +	Vector result = new Vector();
  +        for (int i = 0; i < headers.size(); i++) {
  +	    if (name.equals( headers.getName(i).toString() ))
  +		result.addElement( headers.getValue(i).toString() );
           }
  -        return result;
  +        String[] resultArray = new String[result.size()];
  +        result.copyInto(resultArray);
  +        return resultArray;
   
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message