RE: RequestUtils.computeURL()

2003-03-10 Thread Nick Coleman
Only that unnecessary calls to the URLEncoder.encode within the computeURL
method adds excess overhead that is not always needed.  If encoding a url
could be optionally turned on / off, performance would be better.  The
URLEncoder instantiates a ByteArrayOutputStream and a BufferedWriter which
can add significant process cycles when called repetitively.   

Also, any routines that allocate memory buffers like the URLEncoder or
MessageFormat should be questioned for performance.  They add significant
overhead over time on highly repetitive calls.  Also, if a machine begins to
run low on memory, the constant allocation and release of these buffers only
makes the situation worse.

-Original Message-
From: James Mitchell [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 10, 2003 10:01 AM
To: Struts Developers List
Subject: RequestUtils.computeURL()



Is there any reason that any tag should NOT call computeURL when evaluating
a URL that needs a parameter of Map entries added?

It seems that ImgTag does it all by itself, and since it hard-codes ''
instead of the standard 'amp;', my new tests (which I haven't even
committed yet) are failing.

Should we refactor this now?

I cannot setup tests for this tag with the current code that's there.

Thoughts?



--
James Mitchell
Software Developer/Struts Evangelist http://jakarta.apache.org/struts

People demand freedom of speech to make up for the freedom of thought which
they avoid.
- Soren Aabye Kierkegaard (1813-1855)




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: RequestUtils.computeURL()

2003-03-10 Thread David Graham
Is there any reason that any tag should NOT call computeURL when
evaluating a URL that needs a parameter of Map entries added?
computeURL also encodes the url with session information which isn't 
desirable for images.  Maybe ImgTag should just replace  with amp; itself 
without calling computeURL.

David

_
Protect your PC - get McAfee.com VirusScan Online  
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: RequestUtils.computeURL()

2003-03-10 Thread James Mitchell
That was my initial thought, but wanted to bounce it off a few other
people first.


--
James Mitchell
Software Developer/Struts Evangelist
http://jakarta.apache.org/struts

People demand freedom of speech to make up for the freedom of thought
which they avoid.
- Soren Aabye Kierkegaard (1813-1855)




 -Original Message-
 From: David Graham [mailto:[EMAIL PROTECTED] 
 Sent: Monday, March 10, 2003 10:28 AM
 To: [EMAIL PROTECTED]
 Subject: Re: RequestUtils.computeURL()
 
 
 Is there any reason that any tag should NOT call computeURL when
 evaluating a URL that needs a parameter of Map entries added?
 
 computeURL also encodes the url with session information which isn't 
 desirable for images.  Maybe ImgTag should just replace  
 with amp; itself 
 without calling computeURL.
 
 David
 
 _
 Protect your PC - get McAfee.com VirusScan Online  
 http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: RequestUtils.computeURL()

2003-03-10 Thread Kris Schneider
Except that the doc for html:img says:

Renders an HTML img element with the image at the specified URL. Like the link
tag, URL rewriting will be applied automatically to the value specified in src
or page, to maintain session state in the absence of cookies. This will allow
dynamic generation of an image where the content displayed for this image will
be taken from the attributes of this tag.

So ImgTag already does URL rewriting, doesn't it?

Quoting James Mitchell [EMAIL PROTECTED]:

 That was my initial thought, but wanted to bounce it off a few other
 people first.
 
 
 --
 James Mitchell
 Software Developer/Struts Evangelist
 http://jakarta.apache.org/struts
 
 People demand freedom of speech to make up for the freedom of thought
 which they avoid.
 - Soren Aabye Kierkegaard (1813-1855)
 
 
 
 
  -Original Message-
  From: David Graham [mailto:[EMAIL PROTECTED] 
  Sent: Monday, March 10, 2003 10:28 AM
  To: [EMAIL PROTECTED]
  Subject: Re: RequestUtils.computeURL()
  
  
  Is there any reason that any tag should NOT call computeURL when
  evaluating a URL that needs a parameter of Map entries added?
  
  computeURL also encodes the url with session information which isn't 
  desirable for images.  Maybe ImgTag should just replace  
  with amp; itself 
  without calling computeURL.
  
  David
  
  _
  Protect your PC - get McAfee.com VirusScan Online  
  http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-- 
Kris Schneider mailto:[EMAIL PROTECTED]
D.O.Tech   http://www.dotech.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: RequestUtils.computeURL()

2003-03-10 Thread David Graham
Ok, so make the image tag call RequestUtils.computeURL() to escape the  and 
encode session data if needed.

David



Except that the doc for html:img says:

Renders an HTML img element with the image at the specified URL. Like the 
link
tag, URL rewriting will be applied automatically to the value specified in 
src
or page, to maintain session state in the absence of cookies. This will 
allow
dynamic generation of an image where the content displayed for this image 
will
be taken from the attributes of this tag.

So ImgTag already does URL rewriting, doesn't it?

Quoting James Mitchell [EMAIL PROTECTED]:

 That was my initial thought, but wanted to bounce it off a few other
 people first.


 --
 James Mitchell
 Software Developer/Struts Evangelist
 http://jakarta.apache.org/struts

 People demand freedom of speech to make up for the freedom of thought
 which they avoid.
 - Soren Aabye Kierkegaard (1813-1855)




  -Original Message-
  From: David Graham [mailto:[EMAIL PROTECTED]
  Sent: Monday, March 10, 2003 10:28 AM
  To: [EMAIL PROTECTED]
  Subject: Re: RequestUtils.computeURL()
 
 
  Is there any reason that any tag should NOT call computeURL when
  evaluating a URL that needs a parameter of Map entries added?
 
  computeURL also encodes the url with session information which isn't
  desirable for images.  Maybe ImgTag should just replace 
  with amp; itself
  without calling computeURL.
 
  David
 
  _
  Protect your PC - get McAfee.com VirusScan Online
  http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

--
Kris Schneider mailto:[EMAIL PROTECTED]
D.O.Tech   http://www.dotech.com/
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: RequestUtils.computeURL()

2003-03-10 Thread James Mitchell
Yes, well, my concern is that we have duplicate code doing the same
thing.  I assume computURL was added after the code for ImgTag was
written, and then perhaps overlooked.

I changed the '' to amp; in the ImgTag and my tests are now passing.

That sounds fine until you actually look at the test.

I use computeURL in my tests to verify that Tags are calculating URLs
correctly when using:
Map defined by name in any scope 
Map defined by name and property in any scope
Map defined by name in application scope 
Map defined by name and property in application scope
Map defined by name in session scope 
Map defined by name and property in session scope
Map defined by name in request scope 
Map defined by name and property in request scope


I don't believe refactoring it would help speed-wise, but I just hate
seeing duplicate code out there.


--
James Mitchell
Software Developer/Struts Evangelist
http://jakarta.apache.org/struts

People demand freedom of speech to make up for the freedom of thought
which they avoid.
- Soren Aabye Kierkegaard (1813-1855)




 -Original Message-
 From: Kris Schneider [mailto:[EMAIL PROTECTED] 
 Sent: Monday, March 10, 2003 11:13 AM
 To: Struts Developers List
 Subject: RE: RequestUtils.computeURL()
 
 
 Except that the doc for html:img says:
 
 Renders an HTML img element with the image at the specified 
 URL. Like the link
 tag, URL rewriting will be applied automatically to the value 
 specified in src
 or page, to maintain session state in the absence of cookies. 
 This will allow
 dynamic generation of an image where the content displayed 
 for this image will
 be taken from the attributes of this tag.
 
 So ImgTag already does URL rewriting, doesn't it?
 
 Quoting James Mitchell [EMAIL PROTECTED]:
 
  That was my initial thought, but wanted to bounce it off a few other
  people first.
  
  
  --
  James Mitchell
  Software Developer/Struts Evangelist
  http://jakarta.apache.org/struts
  
  People demand freedom of speech to make up for the freedom 
 of thought
  which they avoid.
  - Soren Aabye Kierkegaard (1813-1855)
  
  
  
  
   -Original Message-
   From: David Graham [mailto:[EMAIL PROTECTED] 
   Sent: Monday, March 10, 2003 10:28 AM
   To: [EMAIL PROTECTED]
   Subject: Re: RequestUtils.computeURL()
   
   
   Is there any reason that any tag should NOT call computeURL when
   evaluating a URL that needs a parameter of Map entries added?
   
   computeURL also encodes the url with session information 
 which isn't 
   desirable for images.  Maybe ImgTag should just replace  
   with amp; itself 
   without calling computeURL.
   
   David
   
   _
   Protect your PC - get McAfee.com VirusScan Online  
   http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
   
   
   
 -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: 
 [EMAIL PROTECTED]
   
  
  
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
 
 
 -- 
 Kris Schneider mailto:[EMAIL PROTECTED]
 D.O.Tech   http://www.dotech.com/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: RequestUtils.computeURL()

2003-03-10 Thread Craig R. McClanahan


On Mon, 10 Mar 2003, James Mitchell wrote:

 Date: Mon, 10 Mar 2003 10:01:16 -0500
 From: James Mitchell [EMAIL PROTECTED]
 Reply-To: Struts Developers List [EMAIL PROTECTED]
 To: Struts Developers List [EMAIL PROTECTED]
 Subject: RequestUtils.computeURL()


 Is there any reason that any tag should NOT call computeURL when
 evaluating a URL that needs a parameter of Map entries added?

 It seems that ImgTag does it all by itself, and since it hard-codes ''
 instead of the standard 'amp;', my new tests (which I haven't even
 committed yet) are failing.

 Should we refactor this now?

 I cannot setup tests for this tag with the current code that's there.


Sounds like we missed refactoring this when computeURL() was created in
the first place, so +1 for refactoring it now.

As of last night, I got all the test.tomcat.41 tests to run on my Linux
box (yah :-) -- thanks for all the hard work on creating these tests.  I
ran into line-end problems on the code we generate for html:form and
html:errors, so I tweaked them a bit.  I hope that didn't mess up
running the tests on Windows, and would be interested to find out if it
did.

 Thoughts?


Craig




 --
 James Mitchell
 Software Developer/Struts Evangelist
 http://jakarta.apache.org/struts

 People demand freedom of speech to make up for the freedom of thought
 which they avoid.
 - Soren Aabye Kierkegaard (1813-1855)




 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: RequestUtils.computeURL()

2003-03-10 Thread Craig R. McClanahan


On Mon, 10 Mar 2003, David Graham wrote:

 Date: Mon, 10 Mar 2003 08:27:32 -0700
 From: David Graham [EMAIL PROTECTED]
 Reply-To: Struts Developers List [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Re: RequestUtils.computeURL()

 Is there any reason that any tag should NOT call computeURL when
 evaluating a URL that needs a parameter of Map entries added?

 computeURL also encodes the url with session information which isn't
 desirable for images.  Maybe ImgTag should just replace  with amp; itself
 without calling computeURL.


It is definitely desireable if your image is dynamically calculated
based on information stored in the session.  It is also desireable if you
are using session affinity to track all of a particular user's requests
throughout their interaction with the app.

Having a boolean switch on the URL rewriting would be a nice 1.2
enhancement, but I think we should definitely call computeURL() now.

 David

Craig

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: RequestUtils.computeURL()

2003-03-10 Thread James Mitchell
Sounds great.  I'll take care of that tonight.

Can anyone run test.tomcat.all?  I guess I purchased some bad memory for
my laptop or the OS/JVM is a piece of sh#t, because when I try to run
them all, I get somewhere in the .40 tests and my laptop just shuts
downno blue screenno OutOfMemory errorsit just stopslike
pulling the plug on a desktop.very frustrating.


--
James Mitchell
Software Developer/Struts Evangelist
http://jakarta.apache.org/struts

People demand freedom of speech to make up for the freedom of thought
which they avoid.
- Soren Aabye Kierkegaard (1813-1855)


 -Original Message-
 From: Craig R. McClanahan [mailto:[EMAIL PROTECTED] 
 Sent: Monday, March 10, 2003 11:35 AM
 To: Struts Developers List
 Subject: Re: RequestUtils.computeURL()
 
 
 
 
 On Mon, 10 Mar 2003, James Mitchell wrote:
 
  Date: Mon, 10 Mar 2003 10:01:16 -0500
  From: James Mitchell [EMAIL PROTECTED]
  Reply-To: Struts Developers List [EMAIL PROTECTED]
  To: Struts Developers List [EMAIL PROTECTED]
  Subject: RequestUtils.computeURL()
 
 
  Is there any reason that any tag should NOT call computeURL when
  evaluating a URL that needs a parameter of Map entries added?
 
  It seems that ImgTag does it all by itself, and since it 
 hard-codes ''
  instead of the standard 'amp;', my new tests (which I haven't even
  committed yet) are failing.
 
  Should we refactor this now?
 
  I cannot setup tests for this tag with the current code 
 that's there.
 
 
 Sounds like we missed refactoring this when computeURL() was 
 created in
 the first place, so +1 for refactoring it now.
 
 As of last night, I got all the test.tomcat.41 tests to run 
 on my Linux
 box (yah :-) -- thanks for all the hard work on creating 
 these tests.  I
 ran into line-end problems on the code we generate for html:form and
 html:errors, so I tweaked them a bit.  I hope that didn't mess up
 running the tests on Windows, and would be interested to find 
 out if it
 did.
 
  Thoughts?
 
 
 Craig
 
 
 
 
  --
  James Mitchell
  Software Developer/Struts Evangelist
  http://jakarta.apache.org/struts
 
  People demand freedom of speech to make up for the freedom 
 of thought
  which they avoid.
  - Soren Aabye Kierkegaard (1813-1855)
 
 
 
 
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: RequestUtils.computeURL()

2003-03-10 Thread Craig R. McClanahan


On Mon, 10 Mar 2003, James Mitchell wrote:

 Date: Mon, 10 Mar 2003 11:44:01 -0500
 From: James Mitchell [EMAIL PROTECTED]
 Reply-To: Struts Developers List [EMAIL PROTECTED]
 To: 'Struts Developers List' [EMAIL PROTECTED]
 Subject: RE: RequestUtils.computeURL()

 Sounds great.  I'll take care of that tonight.

 Can anyone run test.tomcat.all?  I guess I purchased some bad memory for
 my laptop or the OS/JVM is a piece of sh#t, because when I try to run
 them all, I get somewhere in the .40 tests and my laptop just shuts
 downno blue screenno OutOfMemory errorsit just stopslike
 pulling the plug on a desktop.very frustrating.


The .40 tests do indeed work -- but only after a small change to each of
the pages (CVS commit forthcoming).  It's a bug in Tomcat 4.0 that we have
to work around.

At the bottom of many of the test pages, you've got a throw new
JspException() statement if a test was misconfigured.  Unfortunately,
Tomcat 4.0 does an implicit import of the org.apache.jasper.runtime.*
package into each page, and there's a
org.apache.jasper.runtime.JspException class that causes JspException
to be ambiguous.  I changed it to use javax.servlet.jsp.JspException
explicitly, which will still work on all the other containers, and am
rerunning .41 right now to ensure that nothing got messed up.

I'm going to have to go download Tomcat 3.3 to test those.  And shouldn't
we rip out the Tomcat 3.2 tests since we are no longer supporting it?


 --
 James Mitchell

Craig

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: RequestUtils.computeURL()

2003-03-10 Thread James Mitchell

 -Original Message-
 From: Craig R. McClanahan [mailto:[EMAIL PROTECTED] 
 Sent: Monday, March 10, 2003 12:24 PM
 To: Struts Developers List
 Subject: RE: RequestUtils.computeURL()
 
 
 
 
 On Mon, 10 Mar 2003, James Mitchell wrote:
 
  Date: Mon, 10 Mar 2003 11:44:01 -0500
  From: James Mitchell [EMAIL PROTECTED]
  Reply-To: Struts Developers List [EMAIL PROTECTED]
  To: 'Struts Developers List' [EMAIL PROTECTED]
  Subject: RE: RequestUtils.computeURL()
 
  Sounds great.  I'll take care of that tonight.
 
  Can anyone run test.tomcat.all?  I guess I purchased some 
 bad memory for
  my laptop or the OS/JVM is a piece of sh#t, because when I 
 try to run
  them all, I get somewhere in the .40 tests and my laptop just shuts
  downno blue screenno OutOfMemory errorsit just 
 stopslike
  pulling the plug on a desktop.very frustrating.
 
 
 The .40 tests do indeed work -- but only after a small change 
 to each of
 the pages (CVS commit forthcoming).  It's a bug in Tomcat 4.0 
 that we have
 to work around.

Yes, I can run test.tomcat.33, (or .40 or .41) 'one at a time', but it's
when I run test.tomcat.all that I get to take a break while the laptop
boots back up :(

 
 At the bottom of many of the test pages, you've got a throw new
 JspException() statement if a test was misconfigured.  Unfortunately,
 Tomcat 4.0 does an implicit import of the 
 org.apache.jasper.runtime.*
 package into each page, and there's a
 org.apache.jasper.runtime.JspException class that causes 
 JspException
 to be ambiguous.  I changed it to use javax.servlet.jsp.JspException
 explicitly, which will still work on all the other containers, and am
 rerunning .41 right now to ensure that nothing got messed up.

Ah, see, I learn something new everyday.


 I'm going to have to go download Tomcat 3.3 to test those.  
 And shouldn't
 we rip out the Tomcat 3.2 tests since we are no longer supporting it?

Yes, I haven't been using those for a few months now (or least since we
last discussed doing that)


 
  --
  James Mitchell
 
 Craig
 


--
James Mitchell
Software Developer/Struts Evangelist
http://jakarta.apache.org/struts

People demand freedom of speech to make up for the freedom of thought
which they avoid.
- Soren Aabye Kierkegaard (1813-1855)



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]