use of com.willshex.blogwt.shared.api.page.call.CreatePageResponse in project blogwt by billy1380.
the class PageController method createPage.
/**
* @param page
*/
public void createPage(Page page) {
final CreatePageRequest input = SessionController.get().setSession(ApiHelper.setAccessCode(new CreatePageRequest())).page(page);
ApiHelper.createPageClient().createPage(input, new AsyncCallback<CreatePageResponse>() {
@Override
public void onSuccess(CreatePageResponse output) {
if (output.status == StatusType.StatusTypeSuccess) {
}
DefaultEventBus.get().fireEventFromSource(new CreatePageSuccess(input, output), PageController.this);
}
@Override
public void onFailure(Throwable caught) {
DefaultEventBus.get().fireEventFromSource(new CreatePageFailure(input, caught), PageController.this);
}
});
}
use of com.willshex.blogwt.shared.api.page.call.CreatePageResponse in project blogwt by billy1380.
the class PageService method createPage.
public Request createPage(CreatePageRequest input, AsyncSuccess<CreatePageRequest, CreatePageResponse> onSuccess, AsyncFailure<CreatePageRequest> onFailure) {
Request handle = null;
try {
handle = sendRequest(PageMethodCreatePage, input, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
try {
CreatePageResponse outputParameter = new CreatePageResponse();
parseResponse(response, outputParameter);
if (onSuccess != null) {
onSuccess.call(input, outputParameter);
}
onCallSuccess(PageService.this, PageMethodCreatePage, input, outputParameter);
} catch (JSONException | HttpException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(PageService.this, PageMethodCreatePage, input, exception);
}
}
@Override
public void onError(Request request, Throwable exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(PageService.this, PageMethodCreatePage, input, exception);
}
});
onCallStart(PageService.this, PageMethodCreatePage, input, handle);
} catch (RequestException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(PageService.this, PageMethodCreatePage, input, exception);
}
return handle;
}
Aggregations