Package com.opensymphony.xwork2

Examples of com.opensymphony.xwork2.ActionInvocation


                LOG.debug("Intercepting tiles include '" + include + "'. Processing as freemarker result.");
            }
            HttpServletRequest request = (HttpServletRequest) getRequest();
            HttpServletResponse response = (HttpServletResponse) getResponse();

            ActionInvocation invocation =
                    ServletActionContext.getActionContext(request).getActionInvocation();

            try {
                FreemarkerResult result = new FreemarkerResult();
                result.setWriter(response.getWriter());
View Full Code Here


        Map params = ac.getParameters();
        params.remove(tokenName);
        params.remove(TokenHelper.TOKEN_NAME_FIELD);

        if ((tokenName != null) && (token != null)) {
            ActionInvocation savedInvocation = InvocationSessionStore.loadInvocation(tokenName, token);

            if (savedInvocation != null) {
                // set the valuestack to the request scope
                ValueStack stack = savedInvocation.getStack();
                request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack);

                Result result = savedInvocation.getResult();

                if ((result != null) && (savedInvocation.getProxy().getExecuteResult())) {
                    result.execute(savedInvocation);
                }

                // turn off execution of this invocations result
                invocation.getProxy().setExecuteResult(false);

                return savedInvocation.getResultCode();
            }
        }

        return INVALID_TOKEN_CODE;
    }
View Full Code Here

        if (LOG.isDebugEnabled()) {
            LOG.debug("Rendering template " + templateName);
        }

        ActionInvocation ai = ActionContext.getContext().getActionInvocation();

        Object action = (ai == null) ? null : ai.getAction();
        SimpleHash model = freemarkerManager.buildTemplateModel(stack, action, servletContext, req, res, config.getObjectWrapper());

        model.put("tag", templateContext.getTag());
        model.put("themeProperties", getThemeProps(templateContext.getTemplate()));
View Full Code Here

        map.put(BASE, req.getContextPath());
        map.put(STACK, stack);
        map.put(OGNL, OgnlTool.getInstance());
        map.put(STRUTS, new StrutsUtil(stack, req, res));

        ActionInvocation invocation = (ActionInvocation) stack.getContext().get(ActionContext.ACTION_INVOCATION);
        if (invocation != null) {
            map.put(ACTION, invocation.getAction());
        }
        return map;
    }
View Full Code Here

        ActionComponent component = (ActionComponent) tag.getComponent();

        tag.doEndTag();

        // check parameters, there should be one
        ActionInvocation ai = component.getProxy().getInvocation();
        ActionContext ac = ai.getInvocationContext();
        assertEquals(1, ac.getParameters().size());
    }
View Full Code Here

        ActionComponent component = (ActionComponent) tag.getComponent();

        tag.doEndTag();

        // check parameters, there should be one
        ActionInvocation ai = component.getProxy().getInvocation();
        ActionContext ac = ai.getInvocationContext();
        assertEquals(0, ac.getParameters().size());
    }
View Full Code Here

        return stack;
    }

    public static String buildNamespace(ValueStack stack, HttpServletRequest request) {
        ActionContext context = new ActionContext(stack.getContext());
        ActionInvocation invocation = context.getActionInvocation();

        if (invocation == null) {
            ActionMapper mapper = ActionMapperFactory.getMapper();
            ActionMapping mapping = mapper.getMapping(request,
                    Dispatcher.getInstance().getConfigurationManager());

            if (mapping != null) {
                return mapping.getNamespace();
            } else {
                // well, if the ActionMapper can't tell us, and there is no existing action invocation,
                // let's just go with a default guess that the namespace is the last the path minus the
                // last part (/foo/bar/baz.xyz -> /foo/bar)

                String path = RequestUtils.getServletPath(request);
                return path.substring(0, path.lastIndexOf("/"));
            }
        } else {
            return invocation.getProxy().getNamespace();
        }
    }
View Full Code Here

    result.setEncode(false);
    result.setPrependServletContext(false);
   
    IMocksControl control = EasyMock.createControl();
    ActionProxy mockActionProxy = control.createMock(ActionProxy.class);
    ActionInvocation mockInvocation = control.createMock(ActionInvocation.class);
    mockInvocation.getProxy();
    control.andReturn(mockActionProxy);
    mockInvocation.getResultCode();
    control.andReturn("myResult");
    mockActionProxy.getConfig();
    control.andReturn(actionConfig);
    mockInvocation.getInvocationContext();
    control.andReturn(context);
    mockInvocation.getStack();
    control.andReturn(stack);
    control.anyTimes();
   
    control.replay();
   
View Full Code Here

    result.setEncode(false);
    result.setPrependServletContext(false);
   
    IMocksControl control = EasyMock.createControl();
    ActionProxy mockActionProxy = control.createMock(ActionProxy.class);
    ActionInvocation mockInvocation = control.createMock(ActionInvocation.class);
    mockInvocation.getProxy();
    control.andReturn(mockActionProxy);
    mockInvocation.getResultCode();
    control.andReturn("myResult");
    mockActionProxy.getConfig();
    control.andReturn(actionConfig);
    mockInvocation.getInvocationContext();
    control.andReturn(context);
   
    control.replay();
   
    result.execute(mockInvocation);
View Full Code Here

    ActionContext actionContext = new ActionContext(new HashMap());
    actionContext.put(ActionContext.PARAMETERS, paramMap);
    actionContext.put(ActionContext.SESSION, sessionMap);
   
    // Mock (ActionInvocation)
    ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class);
    mockActionInvocation.getInvocationContext();
    EasyMock.expectLastCall().andReturn(actionContext);
    EasyMock.expectLastCall().anyTimes();
   
    mockActionInvocation.invoke();
    EasyMock.expectLastCall().andReturn(Action.SUCCESS);
   
    mockActionInvocation.getAction();
    EasyMock.expectLastCall().andReturn(action);
   
   
    EasyMock.replay(mockActionInvocation);
   
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.ActionInvocation

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.