Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] Getting remote call results as stream

Hi Torkild,

Torkild Ulvøy Resheim wrote:
Hi all,

Sorry if I'm asking the question in the wrong place. I was looking for an ECF users list but could not find one. I'm playing around with the ECF REST API for a generic build monitor program I'm working on and found that the each query (to a Hudson instance) produces results such as:

Mar 29, 2010 9:45:44 PM org.apache.commons.httpclient.HttpMethodBase getResponseBody WARNING: Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.

I could not find a way of enabling the suggested method and digging a bit further I found that RestClientService.ivokeRemoteCall(...) does not at all use getResponseAsStream(). So I'm wondering if it is at all possible using the latest version of ECF?

Yes, it is possible.  As you say, currently in this method:, IRemoteCallable)

there is this code:

               responseBody = httpMethod.getResponseBodyAsString();

And I guess the apache httpclient code produces the above warning when callled.

This code (in the RestClientService impl) could be replaces with a call to getResponseBodyAsStream(). But before doing so...I wanted to ask you a question: Is the current code not working properly for you/your use case?...or is this httpclient message just annoying?

Also...just so you and others are aware...if it is not working properly for you then it is possible to change the existing impl by creating a new provider...simply by subclassing RestClientService (and overriding invokeRemoteCall) well as subclassing RestClientContainer (so as to create your own RestClientService by overriding RestClientContainer.createRemoteService) and then adding your own containerFactory extension (to create your new type of RestClientContainer). In this way, if you wish, you could customize the behavior of this method.

But in any event, you are probably right that it would be better in future versions of ECF to have the RestClientService.invokeRemoteService method call httpMethod.getResponseAsStream() and explicitly process the InputStream. I've created this bug to track this request:

Actually, I've already released a fix to HEAD for this, and it will be in ECF 3.3/Helios release.

Thanks for reporting this issue.


Best regards,
Torkild U. Resheim.


ecf-dev mailing list

Back to the top