4,6 → 4,7 |
import org.tela_botanica.client.interfaces.Rafraichissable; |
|
import com.extjs.gxt.ui.client.Registry; |
import com.google.gwt.core.client.GWT; |
import com.google.gwt.http.client.Request; |
import com.google.gwt.http.client.RequestBuilder; |
import com.google.gwt.http.client.RequestCallback; |
68,4 → 69,54 |
|
} |
} |
|
public void supprimer(final Rafraichissable r, String idUtilisateur, String idStr) { |
// Ajout des paramètres et données à supprimer dans l'URL |
final String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl() + |
"CoelStructureListe/" + |
idUtilisateur + "/" + |
idStr + |
""; |
|
// DELETE n'étant pas disponible comme méthode HTTP, nous utilisons POST avec le paramètre action=DELETE |
RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, url); |
String postDonnees = "action=DELETE"; |
|
try { |
rb.sendRequest(postDonnees, new RequestCallback() { |
|
public void onError(Request request, Throwable exception) { |
// TODO Auto-generated method stub |
|
} |
|
public void onResponseReceived(Request request, Response response) { |
if (response.getText().length() != 0 && response.getText() != null) { |
final JSONValue responseValue = JSONParser.parse(response.getText()); |
|
// Si la requête est un succès, reception d'un tableau |
if (responseValue.isString() != null) { |
GWT.log(responseValue.isString().stringValue(), null); |
Information info = new Information("suppression_structure", responseValue.isString().stringValue()); |
info.setMessage("ok"); |
r.rafraichir(info); |
} else { |
GWT.log(url+"\n\tLa réponse est une chaine valant null", null); |
} |
} else { |
GWT.log(url, null); |
if (response.getText().length() == 0) { |
GWT.log("\tLa réponse a une taille de 0", null); |
} |
if (response.getText() == null) { |
GWT.log("\tLa réponse vaul null", null); |
} |
} |
} |
|
}) ; |
} catch (RequestException e) { |
|
} |
} |
} |