Search in sources :

Example 1 with GenerateDownloadRequest

use of com.willshex.blogwt.shared.api.download.call.GenerateDownloadRequest 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 GenerateDownloadRequest

use of com.willshex.blogwt.shared.api.download.call.GenerateDownloadRequest in project blogwt by billy1380.

the class DownloadJsonServlet method processAction.

@Override
protected String processAction(String action, JsonObject request) {
    String output = "null";
    if ("DeleteGeneratedDownloads".equals(action)) {
        DeleteGeneratedDownloadsRequest input = new DeleteGeneratedDownloadsRequest();
        input.fromJson(request);
        output = new DeleteGeneratedDownloadsActionHandler().handle(input).toString();
    } else if ("GenerateDownload".equals(action)) {
        GenerateDownloadRequest input = new GenerateDownloadRequest();
        input.fromJson(request);
        output = new GenerateDownloadActionHandler().handle(input).toString();
    } else if ("GetGeneratedDownloads".equals(action)) {
        GetGeneratedDownloadsRequest input = new GetGeneratedDownloadsRequest();
        input.fromJson(request);
        output = new GetGeneratedDownloadsActionHandler().handle(input).toString();
    }
    return output;
}
Also used : GenerateDownloadRequest(com.willshex.blogwt.shared.api.download.call.GenerateDownloadRequest) DeleteGeneratedDownloadsRequest(com.willshex.blogwt.shared.api.download.call.DeleteGeneratedDownloadsRequest) GetGeneratedDownloadsActionHandler(com.willshex.blogwt.server.api.download.action.GetGeneratedDownloadsActionHandler) GenerateDownloadActionHandler(com.willshex.blogwt.server.api.download.action.GenerateDownloadActionHandler) DeleteGeneratedDownloadsActionHandler(com.willshex.blogwt.server.api.download.action.DeleteGeneratedDownloadsActionHandler) GetGeneratedDownloadsRequest(com.willshex.blogwt.shared.api.download.call.GetGeneratedDownloadsRequest)

Example 3 with GenerateDownloadRequest

use of com.willshex.blogwt.shared.api.download.call.GenerateDownloadRequest 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)3 DeleteGeneratedDownloadsRequest (com.willshex.blogwt.shared.api.download.call.DeleteGeneratedDownloadsRequest)2 GenerateDownloadResponse (com.willshex.blogwt.shared.api.download.call.GenerateDownloadResponse)2 GetGeneratedDownloadsRequest (com.willshex.blogwt.shared.api.download.call.GetGeneratedDownloadsRequest)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 DeleteGeneratedDownloadsActionHandler (com.willshex.blogwt.server.api.download.action.DeleteGeneratedDownloadsActionHandler)1 GenerateDownloadActionHandler (com.willshex.blogwt.server.api.download.action.GenerateDownloadActionHandler)1 GetGeneratedDownloadsActionHandler (com.willshex.blogwt.server.api.download.action.GetGeneratedDownloadsActionHandler)1 GeneratedDownload (com.willshex.blogwt.shared.api.datatype.GeneratedDownload)1 DeleteGeneratedDownloadsResponse (com.willshex.blogwt.shared.api.download.call.DeleteGeneratedDownloadsResponse)1 GetGeneratedDownloadsResponse (com.willshex.blogwt.shared.api.download.call.GetGeneratedDownloadsResponse)1 HttpException (com.willshex.gson.web.service.client.HttpException)1