Java Code Examples for io.undertow.servlet.handlers.ServletRequestContext#getOriginalRequest()
The following examples show how to use
io.undertow.servlet.handlers.ServletRequestContext#getOriginalRequest() .
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: HttpServletRequestImpl.java From quarkus-http with Apache License 2.0 | 6 votes |
@Override public AsyncContext startAsync(final ServletRequest servletRequest, final ServletResponse servletResponse) throws IllegalStateException { final ServletRequestContext servletRequestContext = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY); if (!servletContext.getDeployment().getDeploymentInfo().isAllowNonStandardWrappers()) { if (servletRequestContext.getOriginalRequest() != servletRequest) { if (!(servletRequest instanceof ServletRequestWrapper)) { throw UndertowServletMessages.MESSAGES.requestWasNotOriginalOrWrapper(servletRequest); } } if (servletRequestContext.getOriginalResponse() != servletResponse) { if (!(servletResponse instanceof ServletResponseWrapper)) { throw UndertowServletMessages.MESSAGES.responseWasNotOriginalOrWrapper(servletResponse); } } } if (!isAsyncSupported()) { throw UndertowServletMessages.MESSAGES.startAsyncNotAllowed(); } else if (asyncStarted) { throw UndertowServletMessages.MESSAGES.asyncAlreadyStarted(); } asyncStarted = true; servletRequestContext.setServletRequest(servletRequest); servletRequestContext.setServletResponse(servletResponse); return asyncContext = new AsyncContextImpl(exchange, servletRequest, servletResponse, servletRequestContext, true, asyncContext); }
Example 2
Source File: HttpServletRequestImpl.java From lams with GNU General Public License v2.0 | 6 votes |
@Override public AsyncContext startAsync(final ServletRequest servletRequest, final ServletResponse servletResponse) throws IllegalStateException { final ServletRequestContext servletRequestContext = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY); if (!servletContext.getDeployment().getDeploymentInfo().isAllowNonStandardWrappers()) { if (servletRequestContext.getOriginalRequest() != servletRequest) { if (!(servletRequest instanceof ServletRequestWrapper)) { throw UndertowServletMessages.MESSAGES.requestWasNotOriginalOrWrapper(servletRequest); } } if (servletRequestContext.getOriginalResponse() != servletResponse) { if (!(servletResponse instanceof ServletResponseWrapper)) { throw UndertowServletMessages.MESSAGES.responseWasNotOriginalOrWrapper(servletResponse); } } } if (!isAsyncSupported()) { throw UndertowServletMessages.MESSAGES.startAsyncNotAllowed(); } else if (asyncStarted) { throw UndertowServletMessages.MESSAGES.asyncAlreadyStarted(); } asyncStarted = true; servletRequestContext.setServletRequest(servletRequest); servletRequestContext.setServletResponse(servletResponse); return asyncContext = new AsyncContextImpl(exchange, servletRequest, servletResponse, servletRequestContext, true, asyncContext); }
Example 3
Source File: RequestDispatcherImpl.java From quarkus-http with Apache License 2.0 | 5 votes |
private void setupIncludeImpl(final ServletRequest request, final ServletResponse response) throws ServletException, IOException { final ServletRequestContext servletRequestContext = SecurityActions.currentServletRequestContext(); if(servletRequestContext == null) { UndertowLogger.REQUEST_LOGGER.debugf("No servlet request context for %s, dispatching mock request", request); mock(request, response); return; } final HttpServletRequestImpl requestImpl = servletRequestContext.getOriginalRequest(); final HttpServletResponseImpl responseImpl = servletRequestContext.getOriginalResponse(); ServletContextImpl oldServletContext = null; HttpSessionImpl oldSession = null; if (servletRequestContext.getCurrentServletContext() != this.servletContext) { //cross context request, we need to run the thread setup actions oldServletContext = servletRequestContext.getCurrentServletContext(); oldSession = servletRequestContext.getSession(); servletRequestContext.setSession(null); servletRequestContext.setCurrentServletContext(this.servletContext); try { servletRequestContext.getCurrentServletContext().invokeAction(servletRequestContext.getExchange(), new ThreadSetupHandler.Action<Void, Object>() { @Override public Void call(HttpServerExchange exchange, Object context) throws Exception { includeImpl(request, response, servletRequestContext, requestImpl, responseImpl); return null; } }); } finally { // update time in new context and run the requestDone for the session servletRequestContext.getCurrentServletContext().updateSessionAccessTime(servletRequestContext.getExchange()); servletRequestContext.setSession(oldSession); servletRequestContext.setCurrentServletContext(oldServletContext); } } else { includeImpl(request, response, servletRequestContext, requestImpl, responseImpl); } }
Example 4
Source File: RequestDispatcherImpl.java From lams with GNU General Public License v2.0 | 5 votes |
private void setupIncludeImpl(final ServletRequest request, final ServletResponse response) throws ServletException, IOException { final ServletRequestContext servletRequestContext = SecurityActions.currentServletRequestContext(); if(servletRequestContext == null) { UndertowLogger.REQUEST_LOGGER.debugf("No servlet request context for %s, dispatching mock request", request); mock(request, response); return; } final HttpServletRequestImpl requestImpl = servletRequestContext.getOriginalRequest(); final HttpServletResponseImpl responseImpl = servletRequestContext.getOriginalResponse(); ServletContextImpl oldServletContext = null; HttpSessionImpl oldSession = null; if (servletRequestContext.getCurrentServletContext() != this.servletContext) { //cross context request, we need to run the thread setup actions oldServletContext = servletRequestContext.getCurrentServletContext(); oldSession = servletRequestContext.getSession(); servletRequestContext.setSession(null); servletRequestContext.setCurrentServletContext(this.servletContext); try { servletRequestContext.getCurrentServletContext().invokeAction(servletRequestContext.getExchange(), new ThreadSetupHandler.Action<Void, Object>() { @Override public Void call(HttpServerExchange exchange, Object context) throws Exception { includeImpl(request, response, servletRequestContext, requestImpl, responseImpl); return null; } }); } finally { servletRequestContext.setSession(oldSession); servletRequestContext.setCurrentServletContext(oldServletContext); } } else { includeImpl(request, response, servletRequestContext, requestImpl, responseImpl); } }