Java Code Examples for javax.servlet.AsyncEvent#getAsyncContext()
The following examples show how to use
javax.servlet.AsyncEvent#getAsyncContext() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AsyncListenerWrapper.java From Tomcat8-Source-Read with MIT License | 5 votes |
private AsyncEvent customizeEvent(AsyncEvent event) { if (servletRequest != null && servletResponse != null) { return new AsyncEvent(event.getAsyncContext(), servletRequest, servletResponse, event.getThrowable()); } else { return event; } }
Example 2
Source File: ServletHttpHandlerAdapter.java From spring-analysis-note with MIT License | 5 votes |
@Override public void onError(AsyncEvent event) { Throwable ex = event.getThrowable(); logger.debug(this.logPrefix + "Error notification: " + (ex != null ? ex : "<no Throwable>")); AsyncContext context = event.getAsyncContext(); runIfAsyncNotComplete(context, this.isCompleted, context::complete); }
Example 3
Source File: ServletHttpHandlerAdapter.java From java-technology-stack with MIT License | 5 votes |
@Override public void onError(AsyncEvent event) { Throwable ex = event.getThrowable(); logger.debug(this.logPrefix + "Error notification: " + (ex != null ? ex : "<no Throwable>")); AsyncContext context = event.getAsyncContext(); runIfAsyncNotComplete(context, this.isCompleted, context::complete); }
Example 4
Source File: ApmAsyncListener.java From apm-agent-java with Apache License 2.0 | 5 votes |
/** * If another async is created (ex via asyncContext.dispatch), this needs to be re-attached */ @Override public void onStartAsync(AsyncEvent event) { AsyncContext eventAsyncContext = event.getAsyncContext(); if (eventAsyncContext != null) { eventAsyncContext.addListener(this, event.getSuppliedRequest(), event.getSuppliedResponse()); } }
Example 5
Source File: WingtipsRequestSpanCompletionAsyncListener.java From wingtips with Apache License 2.0 | 5 votes |
@Override public void onStartAsync(AsyncEvent event) { // Another async event was started (e.g. via asyncContext.dispatch(...), which means this listener was // removed and won't be called on completion unless we re-register (as per the javadocs for this // method from the interface). AsyncContext eventAsyncContext = event.getAsyncContext(); if (eventAsyncContext != null) { eventAsyncContext.addListener(this, event.getSuppliedRequest(), event.getSuppliedResponse()); } }
Example 6
Source File: OcHttpServletListener.java From opencensus-java with Apache License 2.0 | 5 votes |
@Override public void onStartAsync(AsyncEvent event) { AsyncContext eventAsyncContext = event.getAsyncContext(); if (eventAsyncContext != null) { eventAsyncContext.addListener(this, event.getSuppliedRequest(), event.getSuppliedResponse()); } }
Example 7
Source File: AsyncListenerWrapper.java From tomcatsrc with Apache License 2.0 | 5 votes |
private AsyncEvent customizeEvent(AsyncEvent event) { if (servletRequest != null && servletResponse != null) { return new AsyncEvent(event.getAsyncContext(), servletRequest, servletResponse, event.getThrowable()); } else { return event; } }
Example 8
Source File: WeblogicAsyncListener.java From pinpoint with Apache License 2.0 | 5 votes |
private int getStatusCode(final AsyncEvent asyncEvent) { try { if (asyncEvent.getAsyncContext() instanceof ResponseGetter) { final ServletResponse response = ((ResponseGetter) asyncEvent.getAsyncContext())._$PINPOINT$_getResponse(); if (response instanceof ServletResponseImpl) { return ((ServletResponseImpl) response).getStatus(); } } } catch (Exception ignored) { // Expected exception: java.lang.IllegalStateException: [HTTP:101402]Cannot get Request or Response when the current state is completed or dispatched } return 0; }
Example 9
Source File: WebsphereAsyncListener.java From pinpoint with Apache License 2.0 | 5 votes |
private int getStatusCode(final AsyncEvent asyncEvent) { try { if (asyncEvent.getAsyncContext() instanceof InitResponseGetter) { final InitResponseGetter getter = (InitResponseGetter) asyncEvent.getAsyncContext(); return getter._$PINPOINT$_getInitResponse().getStatusCode(); } } catch (Exception ignored) { } return 0; }
Example 10
Source File: ServletRuntime.java From brave with Apache License 2.0 | 5 votes |
/** If another async is created (ex via asyncContext.dispatch), this needs to be re-attached */ @Override public void onStartAsync(AsyncEvent e) { AsyncContext eventAsyncContext = e.getAsyncContext(); if (eventAsyncContext != null) { eventAsyncContext.addListener(this, e.getSuppliedRequest(), e.getSuppliedResponse()); } }
Example 11
Source File: ServletHttpHandlerAdapter.java From spring-analysis-note with MIT License | 4 votes |
@Override public void onTimeout(AsyncEvent event) { logger.debug(this.logPrefix + "Timeout notification"); AsyncContext context = event.getAsyncContext(); runIfAsyncNotComplete(context, this.isCompleted, context::complete); }
Example 12
Source File: ServletHttpHandlerAdapter.java From java-technology-stack with MIT License | 4 votes |
@Override public void onTimeout(AsyncEvent event) { logger.debug(this.logPrefix + "Timeout notification"); AsyncContext context = event.getAsyncContext(); runIfAsyncNotComplete(context, this.isCompleted, context::complete); }
Example 13
Source File: AsyncContextImpl.java From component-runtime with Apache License 2.0 | 4 votes |
private AsyncEvent wrap(final AsyncEvent event) { if (request != null && response != null) { return new AsyncEvent(event.getAsyncContext(), request, response, event.getThrowable()); } return event; }