Examples of ActionInvocation


Examples of com.opensymphony.xwork2.ActionInvocation

        MockActionWithCookieAware action = new MockActionWithCookieAware();

        ActionContext.getContext().getValueStack().push(action);

        MockControl actionInvocationControl = MockControl.createControl(ActionInvocation.class);
        ActionInvocation invocation = (ActionInvocation) actionInvocationControl.getMock();
        actionInvocationControl.expectAndDefaultReturn(
                                                       invocation.getAction(), action);
        actionInvocationControl.expectAndDefaultReturn(
                                                       invocation.invoke(), Action.SUCCESS);

        actionInvocationControl.replay();

        CookieInterceptor interceptor = new CookieInterceptor();
        interceptor.setCookiesName("cookie1, cookie3");
View Full Code Here

Examples of com.opensymphony.xwork2.ActionInvocation

        MockActionWithCookieAware action = new MockActionWithCookieAware();

        ActionContext.getContext().getValueStack().push(action);

        MockControl actionInvocationControl = MockControl.createControl(ActionInvocation.class);
        ActionInvocation invocation = (ActionInvocation) actionInvocationControl.getMock();
        actionInvocationControl.expectAndDefaultReturn(
                                                       invocation.getAction(), action);
        actionInvocationControl.expectAndDefaultReturn(
                                                       invocation.invoke(), Action.SUCCESS);

        actionInvocationControl.replay();

        CookieInterceptor interceptor = new CookieInterceptor();
        interceptor.setCookiesName("cookie1, cookie3");
View Full Code Here

Examples of com.opensymphony.xwork2.ActionInvocation

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        ActionConfig config = new ActionConfig.Builder("", "name", "").build();
        ActionInvocation invocation = EasyMock.createNiceMock(ActionInvocation.class);
        ActionProxy proxy = EasyMock.createNiceMock(ActionProxy.class);

        EasyMock.expect(invocation.getProxy()).andReturn(proxy).anyTimes();
        EasyMock.expect(invocation.getAction()).andReturn(null).anyTimes();
        EasyMock.expect(invocation.invoke()).andReturn(Action.SUCCESS).anyTimes();
        EasyMock.expect(proxy.getMethod()).andReturn("execute").anyTimes();
        EasyMock.expect(proxy.getConfig()).andReturn(config).anyTimes();
       
        EasyMock.replay(invocation);
        EasyMock.replay(proxy);
View Full Code Here

Examples of com.opensymphony.xwork2.ActionInvocation

        }
    }

    public void repopulateField(Object object) throws ValidationException {

        ActionInvocation invocation = ActionContext.getContext().getActionInvocation();
        Map<String, Object> conversionErrors = ActionContext.getContext().getConversionErrors();

        String fieldName = getFieldName();
        String fullFieldName = getValidatorContext().getFullFieldName(fieldName);
        if (conversionErrors.containsKey(fullFieldName)) {
            Object value = conversionErrors.get(fullFieldName);

            final Map<Object, Object> fakeParams = new LinkedHashMap<Object, Object>();
            boolean doExprOverride = false;

            if (value instanceof String[]) {
                // take the first element, if possible
                String[] tmpValue = (String[]) value;
                if ((tmpValue.length > 0)) {
                    doExprOverride = true;
                    fakeParams.put(fullFieldName, escape(tmpValue[0]));
                } else {
                    if (LOG.isWarnEnabled()) {
                        LOG.warn("value is an empty array of String or with first element in it as null [" + value + "], will not repopulate conversion error ");
                    }
                }
            } else if (value instanceof String) {
                String tmpValue = (String) value;
                doExprOverride = true;
                fakeParams.put(fullFieldName, escape(tmpValue));
            } else {
                // opps... it should be
                if (LOG.isWarnEnabled()) {
                    LOG.warn("conversion error value is not a String or array of String but instead is [" + value + "], will not repopulate conversion error");
                }
            }

            if (doExprOverride) {
                invocation.addPreResultListener(new PreResultListener() {
                    public void beforeResult(ActionInvocation invocation, String resultCode) {
                        ValueStack stack = ActionContext.getContext().getValueStack();
                        stack.setExprOverrides(fakeParams);
                    }
                });
View Full Code Here

Examples of com.opensymphony.xwork2.ActionInvocation

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

      String sessionTokenName = TokenHelper.buildTokenSessionAttributeName(tokenName);
            ActionInvocation savedInvocation = InvocationSessionStore.loadInvocation(sessionTokenName, token);

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

                ActionContext savedContext = savedInvocation.getInvocationContext();
                savedContext.getContextMap().put(ServletActionContext.HTTP_REQUEST, request);
                savedContext.getContextMap().put(ServletActionContext.HTTP_RESPONSE, response);
                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

Examples of mfinder.ActionInvocation

*/
public class ThreadActionFactory extends DefaultActionFactory {

    @Override
    protected ActionInvocation createActionInvocation(String path, Object... params) {
        ActionInvocation ai = super.createActionInvocation(path, params);
        if (ThreadContext.get() == null)
            ThreadContext.set(new ThreadContext());
        ThreadContext.setActionInvocation(ai);
        return ai;
    }
View Full Code Here

Examples of mfinder.ActionInvocation

                }
            }
        }

        //create ActionInvocation
        ActionInvocation invocation = createActionInvocation(path, params);

        //invoke
        Object res = null;
        try {
            res = invocation.invoke(params);
            //result is string
            if (res instanceof String) {
                String resInfo = res.toString();
                ActionProxy ap = invocation.getActionProxy();
                Result result = null;

                //如果action中存在相应的结果映射
                if ((result = ap.getResults().get(resInfo)) != null) {
                    //调用结果对象相应的结果类型
View Full Code Here

Examples of org.gatein.pc.api.invocation.ActionInvocation

        HashMap<String, String[]> allParams = new HashMap<String, String[]>();
        allParams.putAll(prc.getPortletParameters());
        allParams.putAll(this.getPublicParameters());
        allParams.remove(ExoPortletInvocationContext.NAVIGATIONAL_STATE_PARAM_NAME);
        if (type.equals(ActionInvocation.class)) {
            ActionInvocation actionInvocation = new ActionInvocation(pic);
            actionInvocation.setRequestContext(new AbstractRequestContext(servletRequest));

            String interactionState = servletRequest.getParameter(ExoPortletInvocationContext.INTERACTION_STATE_PARAM_NAME);
            if (interactionState != null) {
                actionInvocation.setInteractionState(StateString.create(interactionState));
                // remove the interaction state from remaining params
                allParams.remove(ExoPortletInvocationContext.INTERACTION_STATE_PARAM_NAME);
            }

            actionInvocation.setForm(allParams);

            invocation = type.cast(actionInvocation);
        } else if (type.equals(ResourceInvocation.class)) {
            ResourceInvocation resourceInvocation = new ResourceInvocation(pic);
            resourceInvocation.setRequestContext(new AbstractRequestContext(servletRequest));
View Full Code Here

Examples of org.gatein.pc.api.invocation.ActionInvocation

        HashMap<String, String[]> allParams = new HashMap<String, String[]>();
        allParams.putAll(prc.getPortletParameters());
        allParams.putAll(this.getPublicParameters());
        allParams.remove(ExoPortletInvocationContext.NAVIGATIONAL_STATE_PARAM_NAME);
        if (type.equals(ActionInvocation.class)) {
            ActionInvocation actionInvocation = new ActionInvocation(pic);
            actionInvocation.setRequestContext(new AbstractRequestContext(servletRequest));

            String interactionState = servletRequest.getParameter(ExoPortletInvocationContext.INTERACTION_STATE_PARAM_NAME);
            if (interactionState != null) {
                actionInvocation.setInteractionState(StateString.create(interactionState));
                // remove the interaction state from remaining params
                allParams.remove(ExoPortletInvocationContext.INTERACTION_STATE_PARAM_NAME);
            }

            actionInvocation.setForm(allParams);

            invocation = type.cast(actionInvocation);
        } else if (type.equals(ResourceInvocation.class)) {
            ResourceInvocation resourceInvocation = new ResourceInvocation(pic);
            resourceInvocation.setRequestContext(new AbstractRequestContext(servletRequest));
View Full Code Here

Examples of org.gatein.pc.api.invocation.ActionInvocation

            if (navState != null) {
                uiPortlet.setNavigationalState(ParametersStateString.create(navState));
            }

            //
            ActionInvocation actionInvocation = uiPortlet.create(ActionInvocation.class, prcontext);
            if (actionInvocation == null) {
                return;
            }
            //
            PortletInvocationResponse portletResponse = uiPortlet.invoke(actionInvocation);

            // deal with potential portlet context modifications
            ExoPortletInstanceContext instanceCtx = (ExoPortletInstanceContext) actionInvocation.getInstanceContext();
            if (instanceCtx.getModifiedContext() != null) {
                StatefulPortletContext<C> updatedCtx = (StatefulPortletContext<C>) instanceCtx.getModifiedContext();
                C portletState = uiPortlet.getModifiedState(updatedCtx);
                uiPortlet.update(portletState);
            } else {
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.