Rev 939 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package org.tela_botanica.del.client.services.rest.async;
import org.tela_botanica.del.client.modeles.ObservationServiceResultat;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.Response;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.user.client.Window;
public abstract class ObservationsCallback implements RequestCallback {
public ObservationsCallback() {
}
@Override
public void onResponseReceived(Request request, Response response) {
ObservationServiceResultat observationsRecues = convertirReponseVersListeObservation(response);
surObservationsRecues(observationsRecues);
}
@Override
public void onError(Request request, Throwable exception) {
Window.alert(exception.getMessage());
}
public abstract void surObservationsRecues(ObservationServiceResultat observationsRecues);
private ObservationServiceResultat convertirReponseVersListeObservation(Response reponse) {
ObservationServiceResultat resultat = new ObservationServiceResultat(JSONParser.parseStrict(reponse.getText()));
return resultat;
}
}