463 |
jp_milcent |
1 |
package org.tela_botanica.client.http;
|
|
|
2 |
|
|
|
3 |
import com.google.gwt.core.client.GWT;
|
|
|
4 |
import com.google.gwt.http.client.Request;
|
|
|
5 |
import com.google.gwt.http.client.RequestBuilder;
|
|
|
6 |
import com.google.gwt.http.client.RequestCallback;
|
|
|
7 |
import com.google.gwt.http.client.RequestException;
|
|
|
8 |
|
|
|
9 |
public class JsonRestRequestBuilder extends RequestBuilder {
|
|
|
10 |
|
|
|
11 |
public JsonRestRequestBuilder(Method httpMethod, String url) {
|
|
|
12 |
super(httpMethod, url);
|
|
|
13 |
// TODO Auto-generated constructor stub
|
|
|
14 |
}
|
|
|
15 |
|
|
|
16 |
public Request envoyerRequete(String donneesRequete, RequestCallback retour) {
|
|
|
17 |
Request requeteSortie = null;
|
|
|
18 |
try {
|
|
|
19 |
requeteSortie = sendRequest(donneesRequete, retour);
|
|
|
20 |
} catch (RequestException e) {
|
|
|
21 |
GWT.log("Une exception est survenue lors de l'envoie de la requĂȘte JRest", e);
|
|
|
22 |
}
|
|
|
23 |
return requeteSortie;
|
|
|
24 |
}
|
748 |
jpm |
25 |
|
|
|
26 |
public Request envoyerRequeteSuppression(RequestCallback retour) {
|
|
|
27 |
Request requeteSortie = envoyerRequete("action=DELETE", retour);
|
|
|
28 |
return requeteSortie;
|
|
|
29 |
}
|
463 |
jp_milcent |
30 |
|
|
|
31 |
}
|