Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] rest API work

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Scott


> 
>    protected HttpClient getHttpClientForCall(HttpMethod httpMethod,
> IRemoteCall call, IRestCallable callable) {
>        // By default, create a new HttpClient instance for every
> request.        return httpClient;
>    }
> 
> The intention is that subclasses can override this behavior if they
> wish...e.g. to reuse an HttpClient for all calls.  This change is now
> committed to HEAD.

perfect! Thanks!

> 
> Now the question is:  what should the default behavior be in
> RestClientService?  (i.e. a separate HttpClient for each call, or one
> that is shared for all calls)?  My initial inclination was that the
> default should be a new HttpClient for each call (i.e.
> creating/returning a new one each time getHttpClientForCall is called),
> but I think upon reflection that having an HttpClient that is reused for
> each call is probably a better default...and so I've changed the default
> implementation in RestClientService to reuse the httpClient (created
> upon construction) for each call.  Subclasses may override this behavior
> simply by implementing getHttpClientForCall in a different manner (i.e.
> returning a new HttpClient for each instance).

A slight drawback is that overriding it, you have a reference to a
non-used HttpClient left in the RestClientService. Nevertheless, the
alternative to provide an reuse-option provides less flexibility. I
therefore think that your current implementation's the better alternative.

> On the other hand, I wonder here too, if there's any good reason to
> deliberately loose the error code. What do I miss?
>   
> 
>> I've introduced an new class:  RestException that provides access to the
>> error code.  This is/also been committed to HEAD.  It allows
>> receivers/handlers of the RestException to get at the error code if they
>> wish.
> 

great, thanks!

> I agree that there should be some way of specifying that a
> RequestEntity is to be used for post requests, but I'm not clear on
> the 'best' or 'clearest' way to represent it in the API.  Any
> thoughts/comments would be appreciated...and we will get it back in
> there.

My initial thought is that RestCallFactory and RestCall shall be
extended. I started looking through the HttpClient and I'm currently not
that sure if we really need to provide an additional parameter for
entities. The first few snippets I found seemed to bridge from
HttpMethod-parameters to HttpMethod-entites/body. I'll investigate on
this as soon as my component's up and running.

Greetings
André
_______________________________________________
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


- --
André Dietisheim
Head of Eclipse Development

Puzzle ITC GmbH
www.puzzle.ch

Telefon +41 31 370 22 00
Fax     +41 31 370 22 01
Mobile  +41 76 423 03 02

Abonnieren Sie unsere News:
<http://www.puzzle.ch/follow-us>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkseUb8ACgkQxpTsx9UecrnUJgCffvEziQT9WuQ+u0+1BsXV2qrp
21kAn1eu/J6QFbKkr4f/BAO4ryLAA5Mz
=X1tb
-----END PGP SIGNATURE-----


Back to the top