Package io.undertow.servlet.spec

Examples of io.undertow.servlet.spec.HttpServletRequestImpl


            exchange.setRequestURI(exchange.getRequestURI() + info.getRewriteLocation());
            exchange.setRequestPath(exchange.getRequestPath() + info.getRewriteLocation());
        }

        final HttpServletResponseImpl response = new HttpServletResponseImpl(exchange, servletContext);
        final HttpServletRequestImpl request = new HttpServletRequestImpl(exchange, servletContext);
        final ServletRequestContext servletRequestContext = new ServletRequestContext(servletContext.getDeployment(), request, response, info);
        //set the max request size if applicable
        if (info.getServletChain().getManagedServlet().getMaxRequestSize() > 0) {
            exchange.setMaxEntitySize(info.getServletChain().getManagedServlet().getMaxRequestSize());
        }
View Full Code Here


            relative = request.getServletPath() + request.getPathInfo();
        }
        exchange.setRelativePath(relative);
        final ServletPathMatch info = paths.getServletHandlerByPath(request.getServletPath());
        final HttpServletResponseImpl oResponse = new HttpServletResponseImpl(exchange, servletContext);
        final HttpServletRequestImpl oRequest = new HttpServletRequestImpl(exchange, servletContext);
        final ServletRequestContext servletRequestContext = new ServletRequestContext(servletContext.getDeployment(), oRequest, oResponse, info);
        servletRequestContext.setServletRequest(request);
        servletRequestContext.setServletResponse(response);
        //set the max request size if applicable
        if (info.getServletChain().getManagedServlet().getMaxRequestSize() > 0) {
View Full Code Here

        //we need to redirect in a manner that is indistinguishable from a a direct request
        //we can't just use a forward, as these do not have security applied, and
        //also the filters that have been applied to the request would be different.
        //instead we get the exchange and do a dispatch, and then redirect. This basically acts like
        //two seperate servlet requests
        final HttpServletRequestImpl requestImpl = ServletRequestContext.requireCurrent().getOriginalRequest();
        final HttpServerExchange exchange = requestImpl.getExchange();
        if(!exchange.isRequestChannelAvailable()) {
            throw UndertowServletMessages.MESSAGES.responseAlreadyCommited();
        }
        exchange.dispatch(SameThreadExecutor.INSTANCE, new Runnable() {
            @Override
            public void run() {
                String path = pathAddition;
                if(!exchange.getRelativePath().endsWith("/")) {
                    path = "/" + path;
                }

                exchange.getResponseHeaders().clear();
                exchange.setResponseCode(200);

                exchange.setRelativePath(exchange.getRelativePath() + path);
                exchange.setRequestPath(exchange.getRequestPath() + path);
                exchange.setRequestURI(exchange.getRequestURI() + path);
                HttpHandlers.executeRootHandler(requestImpl.getServletContext().getDeployment().getHandler(), exchange, false);
            }
        });

    }
View Full Code Here

        }

        final ServletPathMatch info = paths.getServletHandlerByPath(path);

        final HttpServletResponseImpl response = new HttpServletResponseImpl(exchange, servletContext);
        final HttpServletRequestImpl request = new HttpServletRequestImpl(exchange, servletContext);
        final ServletRequestContext servletRequestContext = new ServletRequestContext(servletContext.getDeployment(), request, response, info);
        //set the max request size if applicable
        if(info.getManagedServlet().getMaxRequestSize() > 0) {
            exchange.setMaxEntitySize(info.getManagedServlet().getMaxRequestSize());
        }
View Full Code Here

            relative = request.getServletPath() + request.getPathInfo();
        }
        exchange.setRelativePath(relative);
        final ServletPathMatch info = paths.getServletHandlerByPath(request.getServletPath());
        final HttpServletResponseImpl oResponse = new HttpServletResponseImpl(exchange, servletContext);
        final HttpServletRequestImpl oRequest = new HttpServletRequestImpl(exchange, servletContext);
        final ServletRequestContext servletRequestContext = new ServletRequestContext(servletContext.getDeployment(), oRequest, oResponse, info);
        servletRequestContext.setServletRequest(request);
        servletRequestContext.setServletResponse(response);
        //set the max request size if applicable
        if(info.getManagedServlet().getMaxRequestSize() > 0) {
View Full Code Here

        response.setStatus(code);
    }

    @Override
    public void upgradeChannel(final UpgradeCallback upgradeCallback) {
        HttpServletRequestImpl impl = HttpServletRequestImpl.getRequestImpl(request);
        HttpServerExchange exchange = impl.getExchange();
        exchange.upgradeChannel(new ExchangeCompletionListener() {
            @Override
            public void exchangeEvent(final HttpServerExchange exchange, final NextListener nextListener) {
                upgradeCallback.handleUpgrade(exchange.getConnection().getChannel(), exchange.getConnection().getBufferPool());
            }
View Full Code Here

        //noop
    }

    @Override
    public void close() {
        HttpServletRequestImpl impl = HttpServletRequestImpl.getRequestImpl(request);
        HttpServerExchange exchange = impl.getExchange();
        IoUtils.safeClose(exchange.getConnection());
    }
View Full Code Here

        return request.getRequestURI();
    }

    @Override
    public Pool<ByteBuffer> getBufferPool() {
        HttpServletRequestImpl impl = HttpServletRequestImpl.getRequestImpl(request);
        HttpServerExchange exchange = impl.getExchange();
        return exchange.getConnection().getBufferPool();
    }
View Full Code Here

            return;
        }
        final String path = exchange.getRelativePath();
        final ServletPathMatch info = paths.getServletHandlerByPath(path);
        final HttpServletResponseImpl response = new HttpServletResponseImpl(exchange, servletContext);
        final HttpServletRequestImpl request = new HttpServletRequestImpl(exchange, servletContext);
        exchange.putAttachment(HttpServletRequestImpl.ATTACHMENT_KEY, request);
        exchange.putAttachment(HttpServletResponseImpl.ATTACHMENT_KEY, response);

        try {
            exchange.startBlocking(new ServletBlockingHttpExchange(exchange));
View Full Code Here

            exchange.endExchange();
        }
    }

    public void dispatchToPath(final HttpServerExchange exchange, final ServletPathMatch pathInfo, final DispatcherType dispatcherType) throws Exception {
        HttpServletRequestImpl req = HttpServletRequestImpl.getRequestImpl(exchange.getAttachment(HttpServletRequestImpl.ATTACHMENT_KEY));
        HttpServletResponseImpl resp = HttpServletResponseImpl.getResponseImpl(exchange.getAttachment(HttpServletResponseImpl.ATTACHMENT_KEY));
        exchange.putAttachment(ServletAttachments.SERVLET_PATH_MATCH, pathInfo);
        dispatchRequest(exchange, pathInfo, req, resp, dispatcherType);
    }
View Full Code Here

TOP

Related Classes of io.undertow.servlet.spec.HttpServletRequestImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.