use of com.willshex.blogwt.shared.api.download.call.GenerateDownloadResponse in project blogwt by billy1380.
the class GeneratedDownloadController method generateDownload.
public void generateDownload(Filter filter) {
final GenerateDownloadRequest input = ApiHelper.setAccessCode(new GenerateDownloadRequest()).download(new GeneratedDownload().parameters(filter.url()));
input.session = SessionController.get().sessionForApiCall();
ApiHelper.createDownloadClient().generateDownload(input, new AsyncCallback<GenerateDownloadResponse>() {
@Override
public void onSuccess(GenerateDownloadResponse output) {
DefaultEventBus.get().fireEventFromSource(new GenerateDownloadEventHandler.GenerateDownloadSuccess(input, output), GeneratedDownloadController.this);
}
@Override
public void onFailure(Throwable caught) {
DefaultEventBus.get().fireEventFromSource(new GenerateDownloadEventHandler.GenerateDownloadFailure(input, caught), GeneratedDownloadController.this);
}
});
}
use of com.willshex.blogwt.shared.api.download.call.GenerateDownloadResponse in project blogwt by billy1380.
the class DownloadService method generateDownload.
public Request generateDownload(final GenerateDownloadRequest input, final AsyncCallback<GenerateDownloadResponse> callback) {
Request handle = null;
try {
handle = sendRequest(DownloadMethodGenerateDownload, input, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
try {
GenerateDownloadResponse outputParameter = new GenerateDownloadResponse();
parseResponse(response, outputParameter);
callback.onSuccess(outputParameter);
onCallSuccess(DownloadService.this, DownloadMethodGenerateDownload, input, outputParameter);
} catch (JSONException | HttpException exception) {
callback.onFailure(exception);
onCallFailure(DownloadService.this, DownloadMethodGenerateDownload, input, exception);
}
}
@Override
public void onError(Request request, Throwable exception) {
callback.onFailure(exception);
onCallFailure(DownloadService.this, DownloadMethodGenerateDownload, input, exception);
}
});
onCallStart(DownloadService.this, DownloadMethodGenerateDownload, input, handle);
} catch (RequestException exception) {
callback.onFailure(exception);
onCallFailure(DownloadService.this, DownloadMethodGenerateDownload, input, exception);
}
return handle;
}
Aggregations