Package net.paoding.rose.web

Examples of net.paoding.rose.web.Invocation


    }

    protected Object[] resolveMethodParameters(String methodName) throws Exception {
        String uri = "/methodparameter/methodParameter2/" + methodName;
        invoke(uri, "GET", "");
        Invocation inv = (Invocation) request.getAttribute("$$paoding-rose.invocation");
        return inv.getMethodParameters();

        //        Method method = findMethod(methodName);
        //        assertNotNull("not found method named: " + methodName, method);
        //        ParameterNameDiscovererImpl parameterNameDiscoverer = new ParameterNameDiscovererImpl();
        //        ResolverFactoryImpl resolverFactory = new ResolverFactoryImpl();
View Full Code Here


    }
   
    protected Object[] resolveMethodParameters(String methodName) throws Exception {
        String uri =  "/methodparameter/123456/true/" + methodName;
        invoke(uri, "GET", "");
        Invocation inv = (Invocation) request.getAttribute("$$paoding-rose.invocation");
        return inv.getMethodParameters();
    }
View Full Code Here

        return inv.getRequest().getAttribute("msg");
    }

    public String b(Invocation inv) {
        System.out.println("===success to forward  [OncePerRequestController]");
        Invocation preByActionA = (Invocation) inv.getRequest().getAttribute("preInv");
        if (preByActionA == null) {
            return "preInvocation.error.null";
        }
        if (preByActionA != inv.getPreInvocation()) {
            return "preInvocation.error";
View Full Code Here

        return inv.getRequest().getAttribute("msg");
    }

    public String b(Invocation inv) {
        System.out.println("===success to forward  [OncePerRequest2Controller]");
        Invocation preByActionA = (Invocation) inv.getRequest().getAttribute("preInv");
        if (preByActionA == null) {
            return "preInvocation.error.null";
        }
        if (preByActionA != inv.getPreInvocation()) {
            return "preInvocation.error";
View Full Code Here

        this.preInvocation = preInvocation;
    }

    @Override
    public Invocation getHeadInvocation() {
        Invocation inv = this;
        while (inv.getPreInvocation() != null) {
            inv = inv.getPreInvocation();
        }
        return inv;
    }
View Full Code Here

            throw createException(rose, local);
        }
    }

    protected Object innerExecute(Rose rose) throws Throwable {
        Invocation inv = rose.getInvocation();

        // creates parameter binding result (not bean, just simple type, like int, Integer, int[] ...
        ParameterBindingResult paramBindingResult = new ParameterBindingResult(inv);
        String paramBindingResultName = MODEL_KEY_PREFIX + paramBindingResult.getObjectName();
        inv.addModel(paramBindingResultName, paramBindingResult);

        // resolves method parameters, adds the method parameters to model
        Object[] methodParameters = methodParameterResolver.resolve(inv, paramBindingResult);
        ((InvocationBean) inv).setMethodParameters(methodParameters);
        String[] parameterNames = methodParameterResolver.getParameterNames();

        Object instruction = null;

        ParamMetaData[] metaDatas = methodParameterResolver.getParamMetaDatas();
        // validators
        for (int i = 0; i < this.validators.length; i++) {
            if (validators[i] != null && !(methodParameters[i] instanceof Errors)) {
                Errors errors = inv.getBindingResult(parameterNames[i]);
                instruction = validators[i].validate(//
                        metaDatas[i], inv, methodParameters[i], errors);
                if (logger.isDebugEnabled()) {
                    logger.debug("do validate [" + validators[i].getClass().getName()
                            + "] and return '" + instruction + "'");
                }
                // 如果返回的instruction不是null、boolean或空串==>杯具:流程到此为止!
                if (instruction != null) {
                    if (instruction instanceof Boolean) {
                        continue;
                    }
                    if (instruction instanceof String && ((String) instruction).length() == 0) {
                        continue;
                    }
                    return instruction;
                }
            }
        }
       
        //
        for (int i = 0; i < parameterNames.length; i++) {
            if (parameterNames[i] != null && methodParameters[i] != null
                    && inv.getModel().get(parameterNames[i]) != methodParameters[i]) {
                inv.addModel(parameterNames[i], methodParameters[i]);
            }
        }

        // intetceptors & controller
        return new InvocationChainImpl(rose).doNext();
View Full Code Here

        return 1;
    }

    @Override
    public Object execute(Rose rose) throws Throwable {
        Invocation inv = rose.getInvocation();

        // 按照Spring规范,设置当前的applicationContext对象到request对象中,用于messageSource/国际化等功能
        inv.getRequest().setAttribute(RoseConstants.WEB_APPLICATION_CONTEXT_ATTRIBUTE,
                module.getApplicationContext());

        boolean isMultiPartRequest = false;
        try {
            isMultiPartRequest = checkMultipart(inv);
View Full Code Here

*/
public class InvocationLocalImpl implements InvocationLocal {

    @Override
    public Invocation getCurrent(boolean required) {
        Invocation inv = InvocationUtils.getInvocation(InvocationUtils.getCurrentThreadRequest());
        if (inv == null && required) {
            throw new IllegalStateException("invocation");
        }
        return inv;
    }
View Full Code Here

        this.suffix = suffix;
    }

    @Override
    public int doStartTag() throws JspException {
        Invocation invocation = InvocationUtils.getCurrentThreadInvocation();
        if (invocation != null) {
            String msg = invocation.getFlash().get(key);
            if (logger.isDebugEnabled()) {
                logger.debug("getFlashMessage: " + key + "=" + msg);
            }
            if (msg != null) {
                try {
View Full Code Here

        }

        // originalThreadRequest可能为null,特别是在portal框架下
        HttpServletRequest originalThreadRequest = InvocationUtils.getCurrentThreadRequest();
        //
        Invocation preInvocation = null;
        if (path.getDispatcher() != Dispatcher.REQUEST) {
            preInvocation = InvocationUtils.getInvocation(originalHttpRequest);
        }
        // invocation 对象 代表一次Rose调用
        InvocationBean inv = new InvocationBean(httpRequest, originalHttpResponse, path);
View Full Code Here

TOP

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

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.