-
1. Re: Need some Advice about RestClientInterceptors
csa Jun 12, 2014 7:23 PM (in response to marrrck)Hi Marc,
Can you elaborate what you mean by "rest call fails". Do you mean the server returning an error (status code other than 200/201)? In that case you should be able to use a ResponseCallback (org.jboss.errai.enterprise.client.jaxrs.api.ResponseCallback) in the interceptor, check for the status code and call context.setResult().
Or do you mean the client having no connection and throwing an exception?
Cheers,
Christian
-
2. Re: Need some Advice about RestClientInterceptors
marrrck Jun 12, 2014 10:32 PM (in response to csa)Hi Christian,
Thanks for the reply! I was hoping to handle both scenarios, but the primary use case would be the client device having no connection. I'm using cordova so I guess for the connection use-case I can check to see if the device has any connection, then also use a ResponseCallback for http errors like 404. I'll give it a shot.
-
3. Re: Need some Advice about RestClientInterceptors
csa Jun 13, 2014 11:49 AM (in response to marrrck)Hi Marc,
I am starting to think now that we should give interceptors the power to call context.setResult in an ErrorCallback and subsequently cause the RemoteCallback(s) to be invoked. It seems this would make your code a lot easier.
Cheers,
Christian
-
4. Re: Need some Advice about RestClientInterceptors
csa Jun 13, 2014 12:59 PM (in response to csa)OK I've published new 3.1.0- and 3.0.1-SNAPSHOTs that contain a fix for this. Your original approach should work now.
-
5. Re: Need some Advice about RestClientInterceptors
marrrck Jun 13, 2014 4:21 PM (in response to marrrck)Nice! Javadocs and unit tests and everything Thank you!