Package com.opensymphony.xwork2.util

Examples of com.opensymphony.xwork2.util.CompoundRoot


            return null;
        }
    }

    public Object callMethod(Map context, Object target, String name, Object[] objects) throws MethodFailedException {
        CompoundRoot root = (CompoundRoot) target;

        if ("describe".equals(name)) {
            Object v;
            if (objects != null && objects.length == 1) {
                v = objects[0];
            } else {
                v = root.get(0);
            }


            if (v instanceof Collection || v instanceof Map || v.getClass().isArray()) {
                return v.toString();
View Full Code Here


        Object root = Ognl.getRoot(context);

        try {
            if (root instanceof CompoundRoot) {
                if (className.startsWith("vs")) {
                    CompoundRoot compoundRoot = (CompoundRoot) root;

                    if ("vs".equals(className)) {
                        return compoundRoot.peek().getClass();
                    }

                    int index = Integer.parseInt(className.substring(2));

                    return compoundRoot.get(index - 1).getClass();
                }
            }
        } catch (Exception e) {
            // just try the old fashioned way
        }
View Full Code Here

            return root;
        }

        if (root instanceof CompoundRoot) {
            // find real target
            CompoundRoot cr = (CompoundRoot) root;

            try {
                for (Object target : cr) {
                    if (
                            OgnlRuntime.hasSetProperty((OgnlContext) context, target, property)
View Full Code Here

    }

    @Override
    public String intercept(ActionInvocation invocation) throws Exception {
        ValueStack stack = invocation.getStack();
        CompoundRoot root = stack.getRoot();

        if (root.size() > 1 && isChainResult(invocation)) {
            List<CompoundRoot> list = new ArrayList<CompoundRoot>(root);
            list.remove(0);
            Collections.reverse(list);

            Map<String, Object> ctxMap = invocation.getInvocationContext().getContextMap();
View Full Code Here

      if(!isProperPrg(invocation)) {
        LOG.debug("Restoring value stack from event phase");
        ValueStack oldStack = (ValueStack) invocation.getInvocationContext().getSession().get(
        STACK_FROM_EVENT_PHASE);
        if (oldStack != null) {
          CompoundRoot oldRoot = oldStack.getRoot();
          ValueStack currentStack = invocation.getStack();
          CompoundRoot root = currentStack.getRoot();
          root.addAll(oldRoot);
          LOG.debug("Restored stack");
        }
      }
      else {
        LOG.debug("Won't restore stack from event phase since it's a proper PRG request");
View Full Code Here

      if(!isProperPrg(invocation)) {
        if (LOG.isDebugEnabled()) LOG.debug("Restoring value stack from event phase");
        ValueStack oldStack = (ValueStack) invocation.getInvocationContext().getSession().get(
        STACK_FROM_EVENT_PHASE);
        if (oldStack != null) {
          CompoundRoot oldRoot = oldStack.getRoot();
          ValueStack currentStack = invocation.getStack();
          CompoundRoot root = currentStack.getRoot();
          root.addAll(0, oldRoot);
          if (LOG.isDebugEnabled()) LOG.debug("Restored stack");
        }
      }
      else {
        if (LOG.isDebugEnabled()) LOG.debug("Won't restore stack from event phase since it's a proper PRG request");
View Full Code Here

    private boolean devMode;
    private boolean logMissingProperties;

    protected OgnlValueStack(XWorkConverter xworkConverter, CompoundRootAccessor accessor, TextProvider prov, boolean allowStaticAccess) {
        setRoot(xworkConverter, accessor, new CompoundRoot(), allowStaticAccess);
        push(prov);
    }
View Full Code Here

        setRoot(xworkConverter, accessor, new CompoundRoot(), allowStaticAccess);
        push(prov);
    }

    protected OgnlValueStack(ValueStack vs, XWorkConverter xworkConverter, CompoundRootAccessor accessor, boolean allowStaticAccess) {
        setRoot(xworkConverter, accessor, new CompoundRoot(vs.getRoot()), allowStaticAccess);
    }
View Full Code Here

    public static void setDevMode(String mode) {
        devMode = "true".equals(mode);
    }

    public void setProperty(Map context, Object target, Object name, Object value) throws OgnlException {
        CompoundRoot root = (CompoundRoot) target;
        OgnlContext ognlContext = (OgnlContext) context;

        for (Object o : root) {
            if (o == null) {
                continue;
View Full Code Here

            }
        }
    }

    public Object getProperty(Map context, Object target, Object name) throws OgnlException {
        CompoundRoot root = (CompoundRoot) target;
        OgnlContext ognlContext = (OgnlContext) context;

        if (name instanceof Integer) {
            Integer index = (Integer) name;

            return root.cutStack(index.intValue());
        } else if (name instanceof String) {
            if ("top".equals(name)) {
                if (root.size() > 0) {
                    return root.get(0);
                } else {
                    return null;
                }
            }
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.util.CompoundRoot

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.