Search in sources :

Example 1 with GenerateDownloadResponse

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);
        }
    });
}
Also used : GenerateDownloadRequest(com.willshex.blogwt.shared.api.download.call.GenerateDownloadRequest) GeneratedDownload(com.willshex.blogwt.shared.api.datatype.GeneratedDownload) GenerateDownloadResponse(com.willshex.blogwt.shared.api.download.call.GenerateDownloadResponse)

Example 2 with GenerateDownloadResponse

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;
}
Also used : GenerateDownloadResponse(com.willshex.blogwt.shared.api.download.call.GenerateDownloadResponse) GetGeneratedDownloadsResponse(com.willshex.blogwt.shared.api.download.call.GetGeneratedDownloadsResponse) DeleteGeneratedDownloadsResponse(com.willshex.blogwt.shared.api.download.call.DeleteGeneratedDownloadsResponse) Response(com.google.gwt.http.client.Response) RequestCallback(com.google.gwt.http.client.RequestCallback) DeleteGeneratedDownloadsRequest(com.willshex.blogwt.shared.api.download.call.DeleteGeneratedDownloadsRequest) GenerateDownloadRequest(com.willshex.blogwt.shared.api.download.call.GenerateDownloadRequest) Request(com.google.gwt.http.client.Request) GetGeneratedDownloadsRequest(com.willshex.blogwt.shared.api.download.call.GetGeneratedDownloadsRequest) JSONException(com.google.gwt.json.client.JSONException) HttpException(com.willshex.gson.web.service.client.HttpException) GenerateDownloadResponse(com.willshex.blogwt.shared.api.download.call.GenerateDownloadResponse) RequestException(com.google.gwt.http.client.RequestException)

Aggregations

GenerateDownloadRequest (com.willshex.blogwt.shared.api.download.call.GenerateDownloadRequest)2 GenerateDownloadResponse (com.willshex.blogwt.shared.api.download.call.GenerateDownloadResponse)2 Request (com.google.gwt.http.client.Request)1 RequestCallback (com.google.gwt.http.client.RequestCallback)1 RequestException (com.google.gwt.http.client.RequestException)1 Response (com.google.gwt.http.client.Response)1 JSONException (com.google.gwt.json.client.JSONException)1 GeneratedDownload (com.willshex.blogwt.shared.api.datatype.GeneratedDownload)1 DeleteGeneratedDownloadsRequest (com.willshex.blogwt.shared.api.download.call.DeleteGeneratedDownloadsRequest)1 DeleteGeneratedDownloadsResponse (com.willshex.blogwt.shared.api.download.call.DeleteGeneratedDownloadsResponse)1 GetGeneratedDownloadsRequest (com.willshex.blogwt.shared.api.download.call.GetGeneratedDownloadsRequest)1 GetGeneratedDownloadsResponse (com.willshex.blogwt.shared.api.download.call.GetGeneratedDownloadsResponse)1 HttpException (com.willshex.gson.web.service.client.HttpException)1