void recycle() { request = null; servletResponse = null; reader = null; inputStream.recycle(); usingInputStream = false; usingReader = false; upgrade = false; httpUpgradeHandler = null; /* * Clear and reinitialize all async related instance vars */ if (asyncContext != null) { asyncContext.clear(); asyncContext = null; } isAsyncSupported = true; asyncStarted.set(false); isAsyncComplete = false; asyncStartedThread = null; }
int startAsyncCurrent = asyncContext.startAsyncCounter.get(); try { dispatcher.dispatch(asyncContext.getRequest(), asyncContext.getResponse(), DispatcherType.ASYNC); asyncContext.complete(); } else { origRequest.setAsyncTimeout(asyncContext.getTimeout()); asyncContext.notifyAsyncListeners(AsyncEventType.ERROR, t); asyncContext.getOriginalRequest().errorDispatchAndComplete(t); } finally { asyncContext.isStartAsyncInScope.set(Boolean.FALSE);
private boolean processTimeout() { boolean result; final AsyncContextImpl asyncContextLocal = this.asyncContext; try { asyncTimeout(); } finally { result = asyncContextLocal != null && !asyncContextLocal.getAndResetDispatchInScope(); } return result; }
throw new IllegalStateException("Response already closed"); if (!asyncContextLocal.isStartAsyncInScope()) { throw new IllegalStateException("ServletRequest.startAsync called " + "outside the scope of an async dispatch"); asyncContextLocal.reinitialize(servletRequest, servletResponse, isStartAsyncWithZeroArg); } else { final AsyncContextImpl asyncContextFinal = new AsyncContextImpl(this, servletRequest, servletResponse,
/** * Notifies this Request that the container-initiated dispatch * during which ServletRequest#startAsync was called is about to * return to the container */ void onAfterService() throws IOException { if (asyncContext != null) { asyncContext.setOkToConfigure(false); if (asyncStarted.get()) { request.getResponse().getSuspendContext().setTimeout( asyncContext.getTimeout(), MILLISECONDS); } } else if (isUpgrade()) { if (httpUpgradeHandler != null) { final WebConnection wc = WebConnectionFactory.create( this, getInputStream(), servletResponse.getOutputStream()); httpUpgradeHandler.init(wc); } else { LOGGER.log(Level.SEVERE, "HttpUpgradeHandler handler cannot be null"); } } }
@Override public void dispatch() { ApplicationDispatcher dispatcher = (ApplicationDispatcher)getZeroArgDispatcher( origRequest, servletRequest, isStartAsyncWithZeroArg); isDispatchInScope.set(true); if (dispatcher != null) { if (isDispatchInProgress.compareAndSet(false, true)) { pool.execute(new Handler(this, dispatcher, origRequest)); } else { throw new IllegalStateException("Asynchronous dispatch already " + "in progress, must call ServletRequest.startAsync first"); } } else { // Should never happen, because any unmapped paths will be // mapped to the DefaultServlet log.warning("Unable to determine target of zero-arg dispatcher"); } }
dispatchTarget = getCombinedPath(req); } else { DispatchTargetsInfo dtInfo = (DispatchTargetsInfo)origRequest.getAttribute( dispatchTarget = getCombinedPath(origRequest);
throw new IllegalStateException("Response already closed"); if (!asyncContextLocal.isStartAsyncInScope()) { throw new IllegalStateException("ServletRequest.startAsync called " + "outside the scope of an async dispatch"); asyncContextLocal.reinitialize(servletRequest, servletResponse, isStartAsyncWithZeroArg); } else { final AsyncContextImpl asyncContextFinal = new AsyncContextImpl(this, servletRequest, servletResponse,
/** * Notifies this Request that the container-initiated dispatch * during which ServletRequest#startAsync was called is about to * return to the container */ void onAfterService() throws IOException { if (asyncContext != null) { asyncContext.setOkToConfigure(false); if (asyncStarted.get()) { request.getResponse().getSuspendContext().setTimeout( asyncContext.getTimeout(), MILLISECONDS); } } else if (isUpgrade()) { if (httpUpgradeHandler != null) { final WebConnection wc = WebConnectionFactory.create( this, getInputStream(), servletResponse.getOutputStream()); httpUpgradeHandler.init(wc); } else { LOGGER.log(Level.SEVERE, "HttpUpgradeHandler handler cannot be null"); } } }
@Override public void dispatch() { ApplicationDispatcher dispatcher = (ApplicationDispatcher)getZeroArgDispatcher( origRequest, servletRequest, isStartAsyncWithZeroArg); isDispatchInScope.set(true); if (dispatcher != null) { if (isDispatchInProgress.compareAndSet(false, true)) { pool.execute(new Handler(this, dispatcher, origRequest)); } else { throw new IllegalStateException("Asynchronous dispatch already " + "in progress, must call ServletRequest.startAsync first"); } } else { // Should never happen, because any unmapped paths will be // mapped to the DefaultServlet log.warning("Unable to determine target of zero-arg dispatcher"); } }
dispatchTarget = getCombinedPath(req); } else { DispatchTargetsInfo dtInfo = (DispatchTargetsInfo)origRequest.getAttribute( dispatchTarget = getCombinedPath(origRequest);
int startAsyncCurrent = asyncContext.startAsyncCounter.get(); try { dispatcher.dispatch(asyncContext.getRequest(), asyncContext.getResponse(), DispatcherType.ASYNC); asyncContext.complete(); } else { origRequest.setAsyncTimeout(asyncContext.getTimeout()); asyncContext.notifyAsyncListeners(AsyncEventType.ERROR, t); asyncContext.getOriginalRequest().errorDispatchAndComplete(t); } finally { asyncContext.isStartAsyncInScope.set(Boolean.FALSE);
throw new IllegalStateException("Response already closed"); if (!asyncContextLocal.isStartAsyncInScope()) { throw new IllegalStateException("ServletRequest.startAsync called " + "outside the scope of an async dispatch"); asyncContextLocal.reinitialize(servletRequest, servletResponse, isStartAsyncWithZeroArg); } else { final AsyncContextImpl asyncContextFinal = new AsyncContextImpl(this, servletRequest, servletResponse,
/** * Notifies this Request that the container-initiated dispatch * during which ServletRequest#startAsync was called is about to * return to the container */ void onAfterService() throws IOException { if (asyncContext != null) { asyncContext.setOkToConfigure(false); if (asyncStarted.get()) { request.getResponse().getSuspendContext().setTimeout( asyncContext.getTimeout(), MILLISECONDS); } } else if (isUpgrade()) { if (httpUpgradeHandler != null) { final WebConnection wc = WebConnectionFactory.create( this, getInputStream(), servletResponse.getOutputStream()); httpUpgradeHandler.init(wc); } else { LOGGER.log(Level.SEVERE, "HttpUpgradeHandler handler cannot be null"); } } }
private boolean processTimeout() { boolean result; final AsyncContextImpl asyncContextLocal = this.asyncContext; try { asyncTimeout(); } finally { result = asyncContextLocal != null && !asyncContextLocal.getAndResetDispatchInScope(); } return result; }
@Override public void dispatch() { ApplicationDispatcher dispatcher = (ApplicationDispatcher)getZeroArgDispatcher( origRequest, servletRequest, isStartAsyncWithZeroArg); isDispatchInScope.set(true); if (dispatcher != null) { if (isDispatchInProgress.compareAndSet(false, true)) { pool.execute(new Handler(this, dispatcher, origRequest)); } else { throw new IllegalStateException("Asynchronous dispatch already " + "in progress, must call ServletRequest.startAsync first"); } } else { // Should never happen, because any unmapped paths will be // mapped to the DefaultServlet log.warning("Unable to determine target of zero-arg dispatcher"); } }
void recycle() { request = null; servletResponse = null; reader = null; inputStream.recycle(); usingInputStream = false; usingReader = false; upgrade = false; httpUpgradeHandler = null; /* * Clear and reinitialize all async related instance vars */ if (asyncContext != null) { asyncContext.clear(); asyncContext = null; } isAsyncSupported = true; asyncStarted.set(false); isAsyncComplete = false; asyncStartedThread = null; }
dispatchTarget = getCombinedPath(req); } else { DispatchTargetsInfo dtInfo = (DispatchTargetsInfo)origRequest.getAttribute( dispatchTarget = getCombinedPath(origRequest);
int startAsyncCurrent = asyncContext.startAsyncCounter.get(); try { dispatcher.dispatch(asyncContext.getRequest(), asyncContext.getResponse(), DispatcherType.ASYNC); asyncContext.complete(); } else { origRequest.setAsyncTimeout(asyncContext.getTimeout()); asyncContext.notifyAsyncListeners(AsyncEventType.ERROR, t); asyncContext.getOriginalRequest().errorDispatchAndComplete(t); } finally { asyncContext.isStartAsyncInScope.set(Boolean.FALSE);
throw new IllegalStateException("Response already closed"); if (!asyncContextLocal.isStartAsyncInScope()) { throw new IllegalStateException("ServletRequest.startAsync called " + "outside the scope of an async dispatch"); asyncContextLocal.reinitialize(servletRequest, servletResponse, isStartAsyncWithZeroArg); } else { final AsyncContextImpl asyncContextFinal = new AsyncContextImpl(this, servletRequest, servletResponse,