Hi,
I am using Restygwt with jackson and it works brilliantly, thanks for a great library.
I do have an issue though is in handling the RequestException that is thrown from the server. I read that I can get the message using the method.getResponse().getText() but there is nothing in there for me.
This is typically what I would do:
Interface
@POST
@Path("/assets/user/create")
@Consumes("application/json")
void createUser(CreateUserDTO createUserDTO) throws RequestException;
Server side
@Override
public void createUser(CreateUserDTO createUserDTO) throws RequestException {
// some code
}
Client side
try {
UserHelper.checkUserValues(createUserDTO);
requestAccessView.displayLoading("Saving user");
REST.withCallback(new MethodCallback<Void>() {
@Override
public void onFailure(Method method, Throwable exception) {
requestAccessView.hideLoading();
requestAccessView.displayUserCreationError("User could not be created, reason is " + method.getResponse().getText());
}
@Override
public void onSuccess(Method method, Void result) {
requestAccessView.hideLoading();
requestAccessView.displayCreationSuccess("Your user has been successfully created. " +
"Our staff will contact you very shortly to validate your request and provide you access to the EO Broker.");
}
}).call(ServicesUtil.assetsService).createUser(createUserDTO);
} catch (Exception e) {
requestAccessView.displayUserCreationError(e.getMessage());
}
The message I get is
User could not be created, reason is
Instead of, for instance,
User could not be created, reason is name already taken.
If I look at the response, I cannot see any message, content length is 0, etc... so maybe something on the server side then?
Any idea would be very much appreciated!
Thanks