This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Is it necessary to remove any Request attributes? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Is it necessary to remove any Request attributes?" Watch "Is it necessary to remove any Request attributes?" New topic
Author

Is it necessary to remove any Request attributes?

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Would it make noticeable slowdown in my application if I don't remove it? Would it add extra overhead to my app? Or is it destroyed sometime in my application? Thanks!


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

Generally, don't worry about it. The request will go out of scope when the response is sent back to the client. At that time, any scoped variables (attributes) will be subject to garbage collection rules.

Because session and application scopes stay around longer, you need to be mindful of variable life-time in those scopes, but for page and request scopes, it's not usually an issue.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
Some servlet containers maintain an object pool of request objects, so the content won't be collected. However in this case servlet container has to assure that request looks like freshly created.


Tough in space?, <a href="http://tjws.sf.net" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="http://mediachest.sf.net" target="_blank" rel="nofollow">Check it here.</a><br /><a href="http://7bee.j2ee.us/book/Generics%20in%20JDK%201.5.html" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="http://7bee.j2ee.us/bee/index-bee.html" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="http://7bee.j2ee.us/addressbook/" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="http://searchdir.sourceforge.net/" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Thanks for your inputs guys
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Is it necessary to remove any Request attributes?
 
Similar Threads
NullPointerException caused by session.getAttributeNames() thrown in Enumerator
How to remove unsed code
How can I remove the message while loading applet
Wildcard delete w/ File Object?
Displaying image which is outside my web application