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