515 |
aurelien |
1 |
package org.tela_botanica.del.client.services.rest;
|
|
|
2 |
|
|
|
3 |
import org.tela_botanica.del.client.services.rest.async.UtilisateurCallback;
|
|
|
4 |
|
|
|
5 |
import com.google.gwt.http.client.RequestBuilder;
|
|
|
6 |
|
|
|
7 |
public class UtilisateurServiceConcret implements UtilisateurService {
|
|
|
8 |
|
|
|
9 |
private String serverUrl = "/del/jrest/";
|
|
|
10 |
|
|
|
11 |
@Override
|
|
|
12 |
public void connecterUtilisateur(String login, String motDePasse, UtilisateurCallback callback) {
|
|
|
13 |
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, serverUrl + "Utilisateur/"+login+"/"+motDePasse);
|
|
|
14 |
try {
|
|
|
15 |
rb.sendRequest(null, callback);
|
|
|
16 |
} catch (Exception e) {
|
|
|
17 |
// TODO: handle exception
|
|
|
18 |
}
|
|
|
19 |
}
|
|
|
20 |
|
|
|
21 |
@Override
|
|
|
22 |
public void deconnecterUtilisateur(String login, UtilisateurCallback callback) {
|
|
|
23 |
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, serverUrl + "Utilisateur/"+login);
|
|
|
24 |
try {
|
|
|
25 |
rb.sendRequest(null, callback);
|
|
|
26 |
} catch (Exception e) {
|
|
|
27 |
// TODO: handle exception
|
|
|
28 |
}
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
@Override
|
|
|
32 |
public void obtenirUtilisateur(UtilisateurCallback callback) {
|
|
|
33 |
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, serverUrl + "Utilisateur/");
|
|
|
34 |
try {
|
|
|
35 |
rb.sendRequest(null, callback);
|
|
|
36 |
} catch (Exception e) {
|
|
|
37 |
// TODO: handle exception
|
|
|
38 |
}
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
}
|