Re: Redirecting response stream to avoid OutOfMemoryErrors

Christian Mahnke <[email protected]> Tue, 22 Sep 2009 21:29:05 +0200
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <[email protected]>
Hi,
> you wrote:
> > is there a way to redirect the response stream of a servlet into a file
> > to avoid OutOfMemoryErrors due to the use of a ByteArrayOutputStream in
> > ServletUnitOutputStream.java. My Test can create quite huge responses
> > depending on the configuration of the tested servlet. Or should I look
> > into other frameworks like Apache Cactus.
> my name is Wolfgang Fahl, i also live in germany and you may contact 
> me directly via my personal e-mail or my phone number. Please go to 
> http://www.bitplan.com to find out about both of these.
>
> The fix for your issue looks like just a few lines of code to be 
> changed and I encourage you to do this based on the lastest subversion 
> state. Since the latest subversion state is not stable at this point 
> I'd then recommend to use the modification to patch a subversion state 
> of a few revisons back to get a version that will work nicely for you. 
> As soon as we have a stable revision again you can use that one again.
Thank's for your answer.

I'm a bit in a hurry, so maybe my approach isn't considered as clean:
 From my point of view the stream to be used has to be added before the 
request is actually executed. For example by adding a appropriate setter 
method to ServletUnitClient which in turn adds it somehow to the used 
implementation of WebResponse.

Or one can create a empty WebResponse impülementation, add a the stream 
and then populate it for the actually execution. I'm looking deeper into 
the problem tomorrow.


Cheers,
Christian

-- 
----------------
Christian Mahnke
----------------
Center for Retrospective Digitization
Goettingen State and University Library (SUB)
University of Goettingen
Papendiek 14
37073 Goettingen, Germany

web: http://gdz.sub.uni-goettingen.de/
phone: +49 (0)551 39 - 4917
skype: christian.mahnke
mail: [email protected]

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf

_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop