On Mon, 18 Mar 2002, Johannes Carlén wrote:
> Date: Mon, 18 Mar 2002 14:48:41 +0100 (CET)
> From: Johannes Carlén <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Unnecessary multiple URLEncoder.encode() in RequestUtils
>
> Hi,
> I was running our application with JProbe and
> discovered that some pages with many html:links
> consumed a whole lot of memory. I did some research
> and found the computeURL() method in
> org.apache.struts.util.RequestUtils. In computeURL()
> *every* single key and value is url encoded by itself
> and then appended to the url string.
>
This is necessary, for example, to avoid URL-encoding the "=" sign between
the name and the value -- if we encoded that, the server won't recognize
it as having special meaning. Same with the "&" character that separates
the multiple parameters.
> When trying a very simple test page with only one
> html:link tag on it and only one parameter (key/value)
> this increased the memory consumption by nearly
> 200kb's, and this consumption is linear by the number
> of parameters added!!! When changing the code,
> suddenly the memory consumed by some of our pages went
> down from 7-8MB's to 1.5MB. A real gain there...
>
> When the url encoding takes place, some memory is used
> every time and I think this method should be used with
> care and only when needed. In this case, on the whole
> url string at the end of the method.
>
It sounds appealling to do this, but can you provide a patch that does
what you propose, without destroying the ability of the server to parse
the query string correctly once we send it?
> Will any of you guys take care of this or would you
> like some help? I have the modified source code by
> hand if you'd like it (however this should be a quick
> fix anyhow).
>
> Best regards
> /Johannes
>
Craig
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>