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 Scott,

The code is working nicely as far as I can see, however I guess there could be some performance issues when loading the entire (large) reply as a String. And yes, the warnings are annoying :-) Subclassing RestClientService is definitely an option as I also need to handle the slightly off standard way Hudson is handling API queries in a better way. It does not care much for parameters.

Thank you for the explanation - and for the fix :-)

Best regards,
Torkild U. Resheim.

Den 30. mars 2010 kl. 00.50 skrev Scott Lewis:

> 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:
> 
> org.eclipse.ecf.remoteservice.rest.client.RestClientService.invokeRemoteCall(IRemoteCall, 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)...as 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: 
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=307453
> 
> 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.
> 
> Scott
> 
> 
> 
>> Best regards,
>> Torkild U. Resheim.
>> 
>> 
>> ------------------------------------------------------------------------
>> 
>> _______________________________________________
>> ecf-dev mailing list
>> ecf-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/ecf-dev
>>  
> 
> _______________________________________________
> ecf-dev mailing list
> ecf-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/ecf-dev



Back to the top