Package net.paoding.rose.web

Examples of net.paoding.rose.web.RequestPath


        }

        supportsRosepipe(httpRequest);

        // 创建RequestPath对象,用于记录对地址解析的结果
        final RequestPath requestPath = new RequestPath(httpRequest);

        //  简单、快速判断本次请求,如果不应由Rose执行,返回true
        if (quicklyPass(requestPath)) {
            notMatched(filterChain, httpRequest, httpResponse, requestPath);
            return;
View Full Code Here


        }

        supportsRosepipe(httpRequest);

        // 创建RequestPath对象,用于记录对地址解析的结果
        final RequestPath requestPath = new RequestPath(httpRequest);

        //  简单、快速判断本次请求,如果不应由Rose执行,返回true
        if (quicklyPass(requestPath)) {
            notMatched(filterChain, httpRequest, httpResponse, requestPath);
            return;
View Full Code Here

        }

        supportsRosepipe(httpRequest);

        // 创建RequestPath对象,用于记录对地址解析的结果
        final RequestPath requestPath = new RequestPath(httpRequest);

        //  简单、快速判断本次请求,如果不应由Rose执行,返回true
        if (quicklyPass(requestPath)) {
            notMatched(filterChain, httpRequest, httpResponse, requestPath);
            return;
View Full Code Here

        }

        supportsRosepipe(httpRequest);

        // 创建RequestPath对象,用于记录对地址解析的结果
        final RequestPath requestPath = new RequestPath(httpRequest);

        //  简单、快速判断本次请求,如果不应由Rose执行,返回true
        if (quicklyPass(requestPath)) {
            notMatched(filterChain, httpRequest, httpResponse, requestPath);
            return;
View Full Code Here

    }

    @Get("method")
    public Object method(Invocation pinv) {
        InvocationBean inv = (InvocationBean) pinv;
        RequestPath curpath = inv.getRequestPath();
        String testUri = inv.getRequest().getQueryString(); // queryString as uri
        if (testUri == null || testUri.length() == 0) {
            return "@e.g. <a href='/rose-info/method?get=/rose-info/tree'>/rose-info/method?get=/rose-info/tree</a>";
        }
        ReqMethod testMethod = curpath.getMethod();
        if (testUri.indexOf('=') > 0) {
            int index = testUri.indexOf('=');
            testMethod = ReqMethod.parse(testUri.substring(0, index));
            testUri = testUri.substring(index + 1);
        }
        if (!testUri.startsWith(curpath.getCtxpath())) {
            return "@wrong uri:" + testUri;
        }
        MappingNode tree = inv.getRose().getMappingTree();
        RequestPath testPath = new RequestPath(//
                testMethod, testUri, curpath.getCtxpath(), curpath.getDispatcher());
        //
        ArrayList<MatchResult> matchResults = tree.match(testPath);
        if (matchResults == null) {
            // not rose uri
View Full Code Here

        }

    }

    private Exception createException(Rose rose, Throwable exception) {
        final RequestPath requestPath = rose.getInvocation().getRequestPath();
        StringBuilder sb = new StringBuilder(1024);
        sb.append("[Rose-").append(RoseVersion.getVersion()).append("@Spring-").append(
                SpringVersion.getVersion());
        sb.append("]Error happended: ").append(requestPath.getMethod());
        sb.append(" ").append(requestPath.getUri());
        sb.append("->");
        sb.append(this).append(" params=");
        sb.append(Arrays.toString(rose.getInvocation().getMethodParameters()));
        InvocationTargetException servletException = new InvocationTargetException(exception, sb
                .toString());
View Full Code Here

            public void render(Invocation inv) throws IOException, ServletException, Exception {
                String actionPath = action;
                if (action.length() > 0 && action.charAt(0) != '/') {
                    actionPath = "/" + action;
                }
                RequestPath requestPath = inv.getRequestPath();
                path(requestPath.getModulePath() + requestPath.getControllerPath() + actionPath);
            }
        };
        return this;
    }
View Full Code Here

            public void render(Invocation inv) throws IOException, ServletException, Exception {
                String controllerPath = controller;
                if (controller.length() > 0 && controller.charAt(0) != '/') {
                    controllerPath = "/" + controller;
                }
                RequestPath requestPath = inv.getRequestPath();
                location(requestPath.getCtxpath() + requestPath.getModulePath() + controllerPath);
            }
        };
        return this;
    }
View Full Code Here

            public void render(Invocation inv) throws IOException, ServletException, Exception {
                String actionPath = action;
                if (action.length() > 0 && action.charAt(0) != '/') {
                    actionPath = "/" + action;
                }
                RequestPath requestPath = inv.getRequestPath();
                location(requestPath.getCtxpath() + requestPath.getModulePath()
                        + requestPath.getControllerPath() + actionPath);
            }
        };
        return this;
    }
View Full Code Here

                        + request.getCharacterEncoding());
            }
        }

        //
        final RequestPath requestPath = inv.getRequestPath();

        // save before include
        if (requestPath.isIncludeRequest()) {
            saveAttributesBeforeInclude(inv);
            // 恢复include请求前的各种请求属性(包括Model对象)
            rose.addAfterCompletion(new AfterCompletion() {

                @Override
                public void afterCompletion(Invocation inv, Throwable ex) throws Exception {
                    restoreRequestAttributesAfterInclude(inv);
                }
            });
        }

        // 调用之前设置内置属性
        inv.addModel("invocation", inv);
        inv.addModel("ctxpath", requestPath.getCtxpath());

        // instruction是控制器action方法的返回结果或其对应的Instruction对象(也可能是拦截器、错误处理器返回的)
        Object instruction = rose.doNext();

        if (Thread.currentThread().isInterrupted()) {
            logger.info("stop to render: thread is interrupted");
        } else {
            // 写flash消息到Cookie (被include的请求不会有功能)
            if (!requestPath.isIncludeRequest()) {
                FlashImpl flash = (FlashImpl) inv.getFlash(false);
                if (flash != null) {
                    flash.writeNewMessages();
                }
            }
View Full Code Here

TOP

Related Classes of net.paoding.rose.web.RequestPath

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.