Package com.alibaba.citrus.webx.handler

Examples of com.alibaba.citrus.webx.handler.RequestHandlerContext


     * 执行内部请求。
     *
     * @return 如果是内部请求,并且被执行了,则返回<code>true</code>。
     */
    private boolean handleInternalRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
        RequestHandlerContext internalRequestHandlerContext = internalHandlerMapping.getRequestHandlerContext(request, response);

        if (internalRequestHandlerContext == null) {
            return false;
        }

        // 如果是一个内部请求,则执行内部请求
        internalRequestHandlerContext.handleRequest();

        return true;
    }
View Full Code Here


            }

            clearBuffer(requestContext, response);

            // 取得并执行errorHandler
            RequestHandlerContext errorRequestHandlerContext = internalHandlerMapping.getRequestHandlerContextForError(request, response, e);

            assertNotNull(errorRequestHandlerContext, "Could not get exception handler for exception: %s", e);

            try {
                // 对于error处理过程,设置component为特殊的root component。
                WebxUtil.setCurrentComponent(request, components.getComponent(null));

                // error handler要负责记录日志,可以通过ErrorHandlerHelper.logError()来做。
                errorRequestHandlerContext.handleRequest();
            } finally {
                WebxUtil.setCurrentComponent(request, null);
            }
        } catch (Throwable ee) {
            // 有两种情况:
View Full Code Here

     * 执行内部请求。
     *
     * @return 如果是内部请求,并且被执行了,则返回<code>true</code>。
     */
    private boolean handleInternalRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
        RequestHandlerContext internalRequestHandlerContext = internalHandlerMapping.getRequestHandlerContext(request, response);

        if (internalRequestHandlerContext == null) {
            return false;
        }

        // 如果是一个内部请求,则执行内部请求
        internalRequestHandlerContext.handleRequest();

        return true;
    }
View Full Code Here

            }

            clearBuffer(requestContext, response);

            // 取得并执行errorHandler
            RequestHandlerContext errorRequestHandlerContext = internalHandlerMapping.getRequestHandlerContextForError(request, response, e);

            assertNotNull(errorRequestHandlerContext, "Could not get exception handler for exception: %s", e);

            try {
                // 对于error处理过程,设置component为特殊的root component。
                WebxUtil.setCurrentComponent(request, components.getComponent(null));

                // error handler要负责记录日志,可以通过ErrorHandlerHelper.logError()来做。
                errorRequestHandlerContext.handleRequest();
            } finally {
                WebxUtil.setCurrentComponent(request, null);
            }
        } catch (Throwable ee) {
            // 有两种情况:
View Full Code Here

     * 执行内部请求。
     *
     * @return 如果是内部请求,并且被执行了,则返回<code>true</code>。
     */
    private boolean handleInternalRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
        RequestHandlerContext internalRequestHandlerContext = internalHandlerMapping.getRequestHandlerContext(request, response);

        if (internalRequestHandlerContext == null) {
            return false;
        }

        // 如果是一个内部请求,则执行内部请求
        internalRequestHandlerContext.handleRequest();

        return true;
    }
View Full Code Here

            }

            clearBuffer(requestContext, response);

            // 取得并执行errorHandler
            RequestHandlerContext errorRequestHandlerContext = internalHandlerMapping.getRequestHandlerContextForError(request, response, e);

            assertNotNull(errorRequestHandlerContext, "Could not get exception handler for exception: %s", e);

            try {
                // 对于error处理过程,设置component为特殊的root component。
                WebxUtil.setCurrentComponent(request, components.getComponent(null));

                // error handler要负责记录日志,可以通过ErrorHandlerHelper.logError()来做。
                errorRequestHandlerContext.handleRequest();
            } finally {
                WebxUtil.setCurrentComponent(request, null);
            }
        } catch (Throwable ee) {
            // 有两种情况:
View Full Code Here

            if (checkRequest(requestContext)) {
                request = requestContext.getRequest();
                response = requestContext.getResponse();

                RequestHandlerContext ctx = internalHandlerMapping.getRequestHandler(request, response);

                if (ctx == null) {
                    // ���������passthru filter�����ж�request�Ƿ�passthru��
                    // ������Ҫ��passthru��request��ִ��handleRequest����ֱ�ӷ��ء�
                    // �ù��������ڽ���webx������ͨ��filter����filter chain�Ľ������IJ��ֽ���ʹ��webx���ṩ��request contexts��
                    boolean requestProcessed = false;

                    if (passthruFilter == null || !passthruFilter.matches(request)) {
                        requestProcessed = handleRequest(requestContext);
                    }

                    if (!requestProcessed) {
                        giveUpControl(requestContext, chain);
                    }
                } else {
                    ctx.getRequestHandler().handleRequest(ctx);
                }
            }
        } catch (Throwable e) {
            // �����쳣e�Ĺ��̣�
            //
            // 1. ���ȵ���errorHandler�����쳣e��errorHandler�������ѺõĴ���ҳ�档
            //    errorHandlerҲ�����¼��־ �� �����Ҫ�Ļ���
            // 2. Handler����ֱ�Ӱ��쳣�׻���������servlet engine�ͻ�ӹ�����쳣��ͨ������ʾweb.xml��ָ���Ĵ���ҳ�档
            //    ��������£�errorHandler����Ҫ�����¼��־��
            // 3. ���粻��errorHandler���������쳣����servlet engine�ͻ�ӹ�����쳣��ͨ������ʾweb.xml��ָ���Ĵ���ҳ�档
            //    ��������£������쳣���ᱻ��¼����־�С�
            try {
                try {
                    response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                } catch (Exception ee) {
                    // ignore this exception
                }

                clearBuffer(requestContext, response);

                // ȡ�ò�ִ��errorHandler
                RequestHandlerContext ctx = internalHandlerMapping.getRequestHandler(request, response, e);

                assertNotNull(ctx, "Could not get exception handler for exception: %s", e);

                // ��¼��־
                ctx.getLogger().error("Error occurred while process request " + request.getRequestURI(), e);

                try {
                    // ����error������̣�����componentΪ�����root component��
                    WebxUtil.setCurrentComponent(request, components.getComponent(null));
                    ctx.getRequestHandler().handleRequest(ctx);
                } finally {
                    WebxUtil.setCurrentComponent(request, null);
                }
            } catch (Throwable ee) {
                // �����������
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.webx.handler.RequestHandlerContext

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.