1986 |
aurelien |
1 |
package org.tela_botanica.del.client.services.rest;
|
|
|
2 |
|
|
|
3 |
import java.util.Map;
|
|
|
4 |
|
|
|
5 |
import org.tela_botanica.del.client.config.Config;
|
|
|
6 |
import org.tela_botanica.del.client.services.RequestBuilderWithCredentials;
|
|
|
7 |
import org.tela_botanica.del.client.services.rest.async.PaysCallback;
|
|
|
8 |
import org.tela_botanica.del.client.services.rest.async.PHPCallback.ModeRequete;
|
|
|
9 |
|
|
|
10 |
public class PaysServiceConcret implements PaysService {
|
|
|
11 |
|
|
|
12 |
private String baseUrl;
|
|
|
13 |
private Map<String, String> pays;
|
|
|
14 |
|
|
|
15 |
public PaysServiceConcret() {
|
|
|
16 |
Config config = new Config();
|
|
|
17 |
this.baseUrl = config.getServiceBaseUrl();
|
|
|
18 |
}
|
|
|
19 |
|
|
|
20 |
public PaysServiceConcret(Config config) {
|
|
|
21 |
this.baseUrl = config.getServiceBaseUrl();
|
|
|
22 |
}
|
|
|
23 |
|
|
|
24 |
@Override
|
|
|
25 |
public void getPays(PaysCallback callback) {
|
|
|
26 |
String urlService = baseUrl+"ontologie/pays/";
|
|
|
27 |
RequestBuilderWithCredentials rb = new RequestBuilderWithCredentials(RequestBuilderWithCredentials.GET, urlService);
|
|
|
28 |
|
|
|
29 |
callback.setMode(ModeRequete.LECTURE);
|
|
|
30 |
try {
|
|
|
31 |
rb.sendRequest(null, callback);
|
|
|
32 |
} catch (Exception e) {
|
|
|
33 |
//TODO: quoi faire si la requete est mal formée coté client avant d'être envoyée ?
|
|
|
34 |
}
|
|
|
35 |
}
|
|
|
36 |
}
|