jersey - How to map exception for gwt-resty -


i using gwt-resty , jersey server side. problem have run how map exception methodcallback implementation. have created exceptionmapper converts exception json , returns in json format onfailure method giving me generic error message exception, "failed bad request"

the question how convert exception gwt-resty can process exception in order message server side exception.

here service implementation

    service.getcurrentaddress("123456", new methodcallback<address>() {          @override         public void onsuccess(method method, address response) {             window.alert("got address" + response);         }          @override         public void onfailure(method method, throwable e) {             gwt.log("failed", e);             gwt.log("failed " + e.getmessage());         }     }); } 

here exception mapper.

@provider public class vendorexceptionmapper implements exceptionmapper<exception> {      @override     public response toresponse(exception exception) {         return response.status(response.status.bad_request).type(mediatype.application_json).entity(exception).build();     }  } 

i not sure understood question think can parse throwable e exception in case of failure.

you can intercept exception coding restygwt dispatcher , treat before entering onfailure().


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -