protected void internalResume(Throwable t, Consumer<Throwable> onComplete) { ResteasyContext.pushContextDataMap(contextDataMap); HttpRequest httpRequest = (HttpRequest) contextDataMap.get(HttpRequest.class); HttpResponse httpResponse = (HttpResponse) contextDataMap.get(HttpResponse.class); try { dispatcher.writeException(httpRequest, httpResponse, t, onComplete); }catch(Throwable t2) { // ignore t2 and report the original exception without going through filters dispatcher.unhandledAsynchronousException(httpResponse, t); onComplete.accept(t); } }
public void asynchronousExceptionDelivery(HttpRequest request, HttpResponse response, Throwable exception, Consumer<Throwable> onComplete) { try { pushContextObjects(request, response); writeException(request, response, exception, t -> { if(t != null) unhandledAsynchronousException(response, t); onComplete.accept(null); ResteasyContext.removeContextDataLevel(); }); } catch (Throwable ex) { unhandledAsynchronousException(response, ex); onComplete.accept(ex); } }
private void writeException(Throwable t) { /* * Here we cannot call AsyncResponse.resume(t) because that would invoke the response filters * and we should not invoke them because we're already in them. */ HttpResponse httpResponse = (HttpResponse) contextDataMap.get(HttpResponse.class); SynchronousDispatcher dispatcher = (SynchronousDispatcher) contextDataMap.get(Dispatcher.class); ResteasyAsynchronousResponse asyncResponse = request.getAsyncContext().getAsyncResponse(); RESTEasyTracingLogger tracingLogger = RESTEasyTracingLogger.getInstance(request); tracingLogger.flush(httpResponse.getOutputHeaders()); dispatcher.unhandledAsynchronousException(httpResponse, t); onComplete.accept(t); asyncResponse.complete(); asyncResponse.completionCallbacks(t); }
private void writeException(Throwable t) { HttpRequest httpRequest = (HttpRequest) contextDataMap.get(HttpRequest.class); HttpResponse httpResponse = (HttpResponse) contextDataMap.get(HttpResponse.class); SynchronousDispatcher dispatcher = (SynchronousDispatcher) contextDataMap.get(Dispatcher.class); try { dispatcher.writeException(httpRequest, httpResponse, t, t2 -> {}); }catch(Throwable x) { dispatcher.unhandledAsynchronousException(httpResponse, x); } }
private void writeException(Throwable t) { HttpRequest httpRequest = (HttpRequest) contextDataMap.get(HttpRequest.class); HttpResponse httpResponse = (HttpResponse) contextDataMap.get(HttpResponse.class); SynchronousDispatcher dispatcher = (SynchronousDispatcher) contextDataMap.get(Dispatcher.class); try { dispatcher.writeException(httpRequest, httpResponse, t, onComplete); }catch(Throwable x) { dispatcher.unhandledAsynchronousException(httpResponse, x); LogMessages.LOGGER.unhandledAsynchronousException(x); onComplete.accept(null); } }
protected void internalResume(Throwable t, Consumer<Throwable> onComplete) { ResteasyContext.pushContextDataMap(contextDataMap); HttpRequest httpRequest = (HttpRequest) contextDataMap.get(HttpRequest.class); HttpResponse httpResponse = (HttpResponse) contextDataMap.get(HttpResponse.class); try { dispatcher.writeException(httpRequest, httpResponse, t, onComplete); }catch(Throwable t2) { // ignore t2 and report the original exception without going through filters dispatcher.unhandledAsynchronousException(httpResponse, t); onComplete.accept(t); } }
public void asynchronousExceptionDelivery(HttpRequest request, HttpResponse response, Throwable exception, Consumer<Throwable> onComplete) { try { pushContextObjects(request, response); writeException(request, response, exception, t -> { if(t != null) unhandledAsynchronousException(response, t); onComplete.accept(null); ResteasyContext.removeContextDataLevel(); }); } catch (Throwable ex) { unhandledAsynchronousException(response, ex); onComplete.accept(ex); } }
public void asynchronousExceptionDelivery(HttpRequest request, HttpResponse response, Throwable exception, Consumer<Throwable> onComplete) { try { pushContextObjects(request, response); writeException(request, response, exception, t -> { if(t != null) unhandledAsynchronousException(response, t); onComplete.accept(null); ResteasyProviderFactory.removeContextDataLevel(); }); } catch (Throwable ex) { onComplete.accept(ex); unhandledAsynchronousException(response, ex); } }
private void writeException(Throwable t) { /* * Here we cannot call AsyncResponse.resume(t) because that would invoke the response filters * and we should not invoke them because we're already in them. */ HttpResponse httpResponse = (HttpResponse) contextDataMap.get(HttpResponse.class); SynchronousDispatcher dispatcher = (SynchronousDispatcher) contextDataMap.get(Dispatcher.class); ResteasyAsynchronousResponse asyncResponse = request.getAsyncContext().getAsyncResponse(); RESTEasyTracingLogger tracingLogger = RESTEasyTracingLogger.getInstance(request); tracingLogger.flush(httpResponse.getOutputHeaders()); dispatcher.unhandledAsynchronousException(httpResponse, t); onComplete.accept(t); asyncResponse.complete(); asyncResponse.completionCallbacks(t); }