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

while working with the existing API (by Holger) I noticed some issues,
I'd love to get your feeback on and hopefully get a solution for my
usecase. The issues exist in the former incarnation and your new
implementation. I did not use your new version yet, just looked through
the code:

- - The current implementation allways creates a fresh instance of the
httpClient:

RestClientService:
  protected Object callHttpMethod(final IRemoteCall call, final
    IRestCallable callable) throws ECFException {
	String uri = prepareRequestURI(call, callable);
	HttpMethod httpMethod = createHttpMethod(uri, call, callable);
	// add additional request headers
	addRequestHeaders(httpMethod, call, callable);
	HttpClient httpClient = new HttpClient();
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I need the httpClient to be reused in order to keep the HTTP session
state and so that existing cookies are re-sent in a later call.
As far as I understand the code so far the user programmer holds the
instance of the RestClientService.and may decide whether to reuse it or
not. It should therefore be sufficient to move the httpClient to an
instance variable of RestClientService.

- - I need to be able to elaborate on the specific HTTP error.In some
cases my REST service answers 404 to signal me that there's no
information present. I'll have to react by not showing any information
for this call. On the other hand I'd have to popup an error for any
other error that may occur (authentication, transport etc.). I'd suggest
to pass an IStatus to the ECFException instead of a plain string. I'll
then be able to fetch it's code.

Thanks for your feedback!
Cheers
André

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

iEYEARECAAYFAksPlv0ACgkQxpTsx9UecrnGoQCfV7XzWrFntOteN5ZzGTxOyDcr
v9kAn2T4eDYVplYbtCl54G+C6v/t4SD7
=1BU2
-----END PGP SIGNATURE-----


Back to the top