use of com.willshex.blogwt.client.api.blog.event.GetPostEventHandler.GetPostFailure in project blogwt by billy1380.
the class PostController method getPost.
public void getPost(Post post) {
final GetPostRequest input = SessionController.get().setSession(ApiHelper.setAccessCode(new GetPostRequest())).post(post);
if (getPostRequest != null) {
getPostRequest.cancel();
}
getPostRequest = ApiHelper.createBlogClient().getPost(input, new AsyncCallback<GetPostResponse>() {
@Override
public void onSuccess(GetPostResponse output) {
getPostRequest = null;
boolean retryingGetWithSlug = false;
if (output.status == StatusType.StatusTypeSuccess) {
if (output.post != null) {
}
} else {
if (input.post.id != null) {
getPost(new Post().slug(input.post.id.toString()));
retryingGetWithSlug = true;
}
}
if (!retryingGetWithSlug) {
DefaultEventBus.get().fireEventFromSource(new GetPostSuccess(input, output), PostController.this);
}
}
@Override
public void onFailure(Throwable caught) {
getPostRequest = null;
DefaultEventBus.get().fireEventFromSource(new GetPostFailure(input, caught), PostController.this);
}
});
}
Aggregations