[prev in list] [next in list] [prev in thread] [next in thread] 

List:       groovy-dev
Subject:    Re: [groovy-dev] Bug or Feature: HTTPBuilder steals content from entity?
From:       Aschemann Gerd <gerd () aschemann ! net>
Date:       2014-08-22 8:14:34
Message-ID: 28B326C7-C618-4625-B300-266FC5CF42A2 () aschemann ! net
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


I just see in the debugger that getData returns the ByteArrayInputStream which allows \
me to handle the data myself ... 

Nevertheless: If it is a ByteArrayInputStream it means that HTTP builder had read the \
whole stream to construct the object? What about large streams of data? Do I need to \
write some sort of handler for that?

On 22.08.2014, at 09:27, Aschemann Gerd <gerd@aschemann.net> wrote:

> Hi,
> 
> I just found out that HTTPBuilder (for get requests) does not allow to get the \
> content via the HttpEntity contained in the HttpResponseDecorator. The bytes are \
> already consumed away and can only be retrieved through getData(). I would consider \
> this a bug, but maybe it was mentioned as a feature? However, I would appreciate if \
> I could handle the data myself instead of handling an presumably arbitrary large \
> data object. This makes much sense for the typical small TEXT or XML or JSON \
> contents which are directly slurped into objects of respective classes. But I would \
> like to download large ZIP files ...  
> Would it be possible to implement getData() more lazy: It should only grab the \
> content when it is called instead of delivering the already available object (in \
> the current source I see that HttpResponseDecorator gets the data directly through \
> it's constructor). 
> What do you think?
> 
> Regs,
> Gerd
> 
> --
> Gerd Aschemann --- Veröffentlichen heißt Verändern (Carmen Thomas)
> +49/173/3264070 -- gerd@aschemann.net -- http://www.aschemann.net
> 

--
Gerd Aschemann --- Veröffentlichen heißt Verändern (Carmen Thomas)
+49/173/3264070 -- gerd@aschemann.net -- http://www.aschemann.net


[Attachment #5 (unknown)]

<html><head><meta http-equiv="Content-Type" content="text/html \
charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: \
space; -webkit-line-break: after-white-space; ">I just see in the debugger that \
getData returns the ByteArrayInputStream which allows me to handle the data myself \
...&nbsp;<div><br></div><div>Nevertheless: If it is a ByteArrayInputStream it means \
that HTTP builder had read the whole stream to construct the object? What about large \
streams of data? Do I need to write some sort of handler for \
that?<div><br><div><div>On 22.08.2014, at 09:27, Aschemann Gerd &lt;<a \
href="mailto:gerd@aschemann.net">gerd@aschemann.net</a>&gt; wrote:</div><br \
class="Apple-interchange-newline"><blockquote type="cite"><meta \
http-equiv="Content-Type" content="text/html charset=iso-8859-1"><div \
style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: \
after-white-space; ">Hi,<div><br></div><div>I just found out that HTTPBuilder (for \
get requests) does not allow to get the content via the HttpEntity contained in the \
HttpResponseDecorator. The bytes are already consumed away and can only be retrieved \
through getData(). I would consider this a bug, but maybe it was mentioned as a \
feature? However, I would appreciate if I could handle the data myself instead of \
handling an presumably arbitrary large data object. This makes much sense for the \
typical small TEXT or XML or JSON contents which are directly slurped into objects of \
respective classes. But I would like to download large ZIP files \
...&nbsp;</div><div><br></div><div>Would it be possible to implement getData() more \
lazy: It should only grab the content when it is called instead of delivering the \
already available object (in the current source I see that HttpResponseDecorator gets \
the data directly through it's constructor).</div><div><br></div><div>What do you \
think?</div><div><br></div><div>Regs,</div><div>&nbsp; Gerd</div><div><br><div \
apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: \
separate; font-family: Helvetica; font-style: normal; font-variant: normal; \
font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; \
text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: \
normal; widows: 2; word-spacing: 0px; border-spacing: 0px; \
-webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; \
-webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: \
break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; \
">--</div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; \
-webkit-line-break: after-white-space; ">Gerd Aschemann --- Veröffentlichen heißt \
Verändern (Carmen Thomas)<br>+49/173/3264070 -- <a \
href="mailto:gerd@aschemann.net">gerd@aschemann.net</a> -- <a \
href="http://www.aschemann.net/">http://www.aschemann.net</a><br></div></span> </div>
<br></div></div></blockquote></div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); \
font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: \
normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: \
-webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; \
word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; \
-webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; \
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; \
"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: \
after-white-space; ">--</div><div style="word-wrap: break-word; -webkit-nbsp-mode: \
space; -webkit-line-break: after-white-space; ">Gerd Aschemann --- Veröffentlichen \
heißt Verändern (Carmen Thomas)<br>+49/173/3264070 -- <a \
href="mailto:gerd@aschemann.net">gerd@aschemann.net</a> -- <a \
href="http://www.aschemann.net">http://www.aschemann.net</a><br></div></span> </div>
<br></div></div></body></html>


["signature.asc" (signature.asc)]

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQCVAwUBU/b76v2kph3fRrnpAQqSogP/XlA8PStiEayHvkYsAfsnWdfYzek1R3te
YjCUrVZZCUL2V/RSn/LsiefDcH3a2J7io5ElRgMwqervcIE1UvDhpsr4GMvVFJwe
srhthFJ+G3zMv5vo8ynkvRoZFGIm0s1t4RLUBv9NMtPQHtkv1E+6hc6jm68QxeY7
CfZrfHksVsM=
=UCDN
-----END PGP SIGNATURE-----


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic