use of com.willshex.gson.web.service.client.HttpException 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;
}
use of com.willshex.gson.web.service.client.HttpException in project blogwt by billy1380.
the class UserService method logout.
public Request logout(LogoutRequest input, AsyncSuccess<LogoutRequest, LogoutResponse> onSuccess, AsyncFailure<LogoutRequest> onFailure) {
Request handle = null;
try {
handle = sendRequest(UserMethodLogout, input, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
try {
LogoutResponse outputParameter = new LogoutResponse();
parseResponse(response, outputParameter);
if (onSuccess != null) {
onSuccess.call(input, outputParameter);
}
onCallSuccess(UserService.this, UserMethodLogout, input, outputParameter);
} catch (JSONException | HttpException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodLogout, input, exception);
}
}
@Override
public void onError(Request request, Throwable exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodLogout, input, exception);
}
});
onCallStart(UserService.this, UserMethodLogout, input, handle);
} catch (RequestException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodLogout, input, exception);
}
return handle;
}
use of com.willshex.gson.web.service.client.HttpException in project blogwt by billy1380.
the class UserService method changePassword.
public Request changePassword(ChangePasswordRequest input, AsyncSuccess<ChangePasswordRequest, ChangePasswordResponse> onSuccess, AsyncFailure<ChangePasswordRequest> onFailure) {
Request handle = null;
try {
handle = sendRequest(UserMethodChangePassword, input, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
try {
ChangePasswordResponse outputParameter = new ChangePasswordResponse();
parseResponse(response, outputParameter);
if (onSuccess != null) {
onSuccess.call(input, outputParameter);
}
onCallSuccess(UserService.this, UserMethodChangePassword, input, outputParameter);
} catch (JSONException | HttpException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodChangePassword, input, exception);
}
}
@Override
public void onError(Request request, Throwable exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodChangePassword, input, exception);
}
});
onCallStart(UserService.this, UserMethodChangePassword, input, handle);
} catch (RequestException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodChangePassword, input, exception);
}
return handle;
}
use of com.willshex.gson.web.service.client.HttpException in project blogwt by billy1380.
the class UserService method getUsers.
public Request getUsers(GetUsersRequest input, AsyncSuccess<GetUsersRequest, GetUsersResponse> onSuccess, AsyncFailure<GetUsersRequest> onFailure) {
Request handle = null;
try {
handle = sendRequest(UserMethodGetUsers, input, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
try {
GetUsersResponse outputParameter = new GetUsersResponse();
parseResponse(response, outputParameter);
if (onSuccess != null) {
onSuccess.call(input, outputParameter);
}
onCallSuccess(UserService.this, UserMethodGetUsers, input, outputParameter);
} catch (JSONException | HttpException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodGetUsers, input, exception);
}
}
@Override
public void onError(Request request, Throwable exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodGetUsers, input, exception);
}
});
onCallStart(UserService.this, UserMethodGetUsers, input, handle);
} catch (RequestException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodGetUsers, input, exception);
}
return handle;
}
use of com.willshex.gson.web.service.client.HttpException in project blogwt by billy1380.
the class UserService method login.
public Request login(LoginRequest input, AsyncSuccess<LoginRequest, LoginResponse> onSuccess, AsyncFailure<LoginRequest> onFailure) {
Request handle = null;
try {
handle = sendRequest(UserMethodLogin, input, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
try {
LoginResponse outputParameter = new LoginResponse();
parseResponse(response, outputParameter);
if (onSuccess != null) {
onSuccess.call(input, outputParameter);
}
onCallSuccess(UserService.this, UserMethodLogin, input, outputParameter);
} catch (JSONException | HttpException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodLogin, input, exception);
}
}
@Override
public void onError(Request request, Throwable exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodLogin, input, exception);
}
});
onCallStart(UserService.this, UserMethodLogin, input, handle);
} catch (RequestException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodLogin, input, exception);
}
return handle;
}
Aggregations