Package com.opensymphony.xwork2.util

Examples of com.opensymphony.xwork2.util.ValueStack.findValue()


    protected Object findRootObject(ActionInvocation invocation) {
        Object rootObject;
        if (this.root != null) {
            ValueStack stack = invocation.getStack();
            rootObject = stack.findValue(root);
        } else {
            rootObject = invocation.getStack().peek(); // model overrides action
        }
        return rootObject;
    }
View Full Code Here


            response.setContentType(mimeType);

            Object result = invocation.getAction();
            if (exposedValue != null) {
                ValueStack stack = invocation.getStack();
                result = stack.findValue(exposedValue);
            }

            Source xmlSource = getDOMSourceForStack(result);

            // Transform the source XML to System.out.
View Full Code Here

                res.setContentType("text/plain");

                try {
                    PrintWriter writer =
                            ServletActionContext.getResponse().getWriter();
                    writer.print(stack.findValue(cmd));
                    writer.close();
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
                cont = false;
View Full Code Here

                            String rootObjectExpression = getParameter(OBJECT_PARAM);
                            if (rootObjectExpression == null)
                                rootObjectExpression = "#context";
                            String decorate = getParameter(DECORATE_PARAM);
                            ValueStack stack = (ValueStack) ctx.get(ActionContext.VALUE_STACK);
                            Object rootObject = stack.findValue(rootObjectExpression);
                           
                            try {
                                StringWriter writer = new StringWriter();
                                ObjectToHTMLWriter htmlWriter = new ObjectToHTMLWriter(writer);
                                htmlWriter.write(reflectionProvider, rootObject, rootObjectExpression);
View Full Code Here

public class XWorkMapPropertyAccessorTest extends XWorkTestCase {
    public void testCreateNullObjectsIsFalseByDefault() {
        ValueStack vs = ActionContext.getContext().getValueStack();
        vs.push(new MapHolder(Collections.emptyMap()));
        assertNull(vs.findValue("map[key]"));
    }

    public void testMapContentsAreReturned() {
        ValueStack vs = ActionContext.getContext().getValueStack();
        vs.push(new MapHolder(Collections.singletonMap("key", "value")));
View Full Code Here

    }

    public void testMapContentsAreReturned() {
        ValueStack vs = ActionContext.getContext().getValueStack();
        vs.push(new MapHolder(Collections.singletonMap("key", "value")));
        assertEquals("value", vs.findValue("map['key']"));
    }

    public void testNullIsNotReturnedWhenCreateNullObjectsIsSpecified() {
        ValueStack vs = ActionContext.getContext().getValueStack();
        vs.push(new MapHolder(Collections.emptyMap()));
View Full Code Here

    public void testNullIsNotReturnedWhenCreateNullObjectsIsSpecified() {
        ValueStack vs = ActionContext.getContext().getValueStack();
        vs.push(new MapHolder(Collections.emptyMap()));
        ReflectionContextState.setCreatingNullObjects(vs.getContext(), true);

        Object value = vs.findValue("map['key']");
        assertNotNull(value);
        assertSame(Object.class, value.getClass());
    }

    public void testNullIsReturnedWhenCreateNullObjectsIsSpecifiedAsFalse() {
View Full Code Here

    public void testNullIsReturnedWhenCreateNullObjectsIsSpecifiedAsFalse() {
        ValueStack vs = ActionContext.getContext().getValueStack();
        vs.push(new MapHolder(Collections.emptyMap()));
        ReflectionContextState.setCreatingNullObjects(vs.getContext(), false);
        assertNull(vs.findValue("map['key']"));
    }

    private static class MapHolder {
        private final Map map;
View Full Code Here

        // Construct the data source for the report.
        ValueStack stack = invocation.getStack();
        ValueStackDataSource stackDataSource = null;

        Connection conn = (Connection) stack.findValue(connection);
        if (conn == null)
            stackDataSource = new ValueStackDataSource(stack, dataSource);

        // Determine the directory that the report file is in and set the reportDirectory parameter
        // For WW 2.1.7:
View Full Code Here

                parameters.put(JRParameter.REPORT_TIME_ZONE, tz);
            }
        }

        // Add any report parameters from action to param map.
        Map reportParams = (Map) stack.findValue(reportParameters);
        if (reportParams != null) {
            if (LOG.isDebugEnabled()) {
          LOG.debug("Found report parameters; adding to parameters...");
            }
            parameters.putAll(reportParams);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.