2011/9/29 Tim Funk <funk...@apache.org>:
> Wouldn't converting the whole method to use StringBuilder be more efficient
> - as compared instantiating a StringWriter AND PrintWriter? We could
> probably guess a good default size too of size()*40 which would assume most
> headers are less than 40 chars (which is typically true except for
> user-agent and cookie)
>
> But as the previous commit noted .. its a debug method so it may not really
> matter.
>
> -Tim

I like the idea. Though that will change the result a bit:
PrintWriter uses the value of "line.separator" property as the
delimiter in println().

The backport proposed to 6.0 though is about another issue: it
replaces single getHeader(name) with iteration over multiple values
using values(name).

Best regards,
Konstantin Kolinko

>
> On Thu, Sep 29, 2011 at 5:52 AM, <kkoli...@apache.org> wrote:
>
>> Author: kkolinko
>> Date: Thu Sep 29 09:52:56 2011
>> New Revision: 1177245
>>
>> URL: http://svn.apache.org/viewvc?rev=1177245&view=rev
>> Log:
>> A bit more memory-efficient code.
>>
>> Modified:
>>    tomcat/trunk/java/org/apache/tomcat/util/http/MimeHeaders.java
>>
>> Modified: tomcat/trunk/java/org/apache/tomcat/util/http/MimeHeaders.java
>> URL:
>> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/MimeHeaders.java?rev=1177245&r1=1177244&r2=1177245&view=diff
>>
>> ==============================================================================
>> --- tomcat/trunk/java/org/apache/tomcat/util/http/MimeHeaders.java
>> (original)
>> +++ tomcat/trunk/java/org/apache/tomcat/util/http/MimeHeaders.java Thu Sep
>> 29 09:52:56 2011
>> @@ -145,7 +145,9 @@ public class MimeHeaders {
>>             String n = e.nextElement();
>>             Enumeration<String> ev = values(n);
>>             while (ev.hasMoreElements()) {
>> -                pw.println(n + " = " + ev.nextElement());
>> +                pw.print(n);
>> +                pw.print(" = ");
>> +                pw.println(ev.nextElement());
>>             }
>>         }
>>         return sw.toString();
>>
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to