5 Replies Latest reply on Jun 13, 2014 4:21 PM by Marc Zbyszynski

    Need some Advice about RestClientInterceptors

    Marc Zbyszynski Newbie

      Hello Everyone,


      I'm trying to implement a fallback to-local cache behavior on the client using Errai JPA when a JAX-RS call fails. I'm trying to do this in a way that is transparent to the code invoking the rest service, but I'm running into some trouble getting it working.


      I've tried implementing a RestClientInterceptor, but once I make the RestCallbackContext.proceed() and the rest call fails, I'm having trouble getting out of my RestErrorCallback back into a non-error state. I've tried calling RestCallbackContext.setResult(..) from inside the error callback and returning false to stop handling the error, but that still never invokes the downstream RemoteCallbacks so the results are never read. Is there any other way to accomplish this with a RestClientInterceptor, or some other way that I haven't thought Of? I also tried extending the CallerProvider class using @Alternative and added the fallback to cache logic there, but it doesn't seem like wiring for IOCProviders respects the @Alternative directive (or at least, I couldn't get it to work).


      Any ideas? I'm happy to provide some code snippets if that would help explain what I'm asking...


      Thanks for your help!