use of com.willshex.blogwt.shared.api.blog.call.GetResourceResponse in project blogwt by billy1380.
the class BlogService method getResource.
public Request getResource(GetResourceRequest input, AsyncSuccess<GetResourceRequest, GetResourceResponse> onSuccess, AsyncFailure<GetResourceRequest> onFailure) {
Request handle = null;
try {
handle = sendRequest(BlogMethodGetResource, input, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
try {
GetResourceResponse outputParameter = new GetResourceResponse();
parseResponse(response, outputParameter);
if (onSuccess != null) {
onSuccess.call(input, outputParameter);
}
onCallSuccess(BlogService.this, BlogMethodGetResource, input, outputParameter);
} catch (JSONException | HttpException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(BlogService.this, BlogMethodGetResource, input, exception);
}
}
@Override
public void onError(Request request, Throwable exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(BlogService.this, BlogMethodGetResource, input, exception);
}
});
onCallStart(BlogService.this, BlogMethodGetResource, input, handle);
} catch (RequestException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(BlogService.this, BlogMethodGetResource, input, exception);
}
return handle;
}
use of com.willshex.blogwt.shared.api.blog.call.GetResourceResponse in project blogwt by billy1380.
the class ResourceController method getResource.
public void getResource(Resource resource) {
final GetResourceRequest input = SessionController.get().setSession(ApiHelper.setAccessCode(new GetResourceRequest())).resource(resource);
ApiHelper.createBlogClient().getResource(input, new AsyncCallback<GetResourceResponse>() {
@Override
public void onSuccess(GetResourceResponse output) {
if (output.status == StatusType.StatusTypeSuccess) {
if (input.resource != null) {
}
}
DefaultEventBus.get().fireEventFromSource(new GetResourceSuccess(input, output), ResourceController.this);
}
@Override
public void onFailure(Throwable caught) {
DefaultEventBus.get().fireEventFromSource(new GetResourceFailure(input, caught), ResourceController.this);
}
});
}
Aggregations