Package org.gatein.pc.api.invocation

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


            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

      if (!(invocation instanceof ActionInvocation))
      {
         throw new IllegalArgumentException("ActionHandler can only handle ActionInvocations!");
      }

      ActionInvocation actionInvocation = invocation;

      PortletContext portletContext = requestPrecursor.getPortletContext();
      if (debug)
      {
         log.debug("Consumer about to attempt action on portlet '" + portletContext.getPortletHandle() + "'");
      }

      // access mode
      InstanceContext instanceContext = invocation.getInstanceContext();
      ParameterValidation.throwIllegalArgExceptionIfNull(instanceContext, "instance context");
      AccessMode accessMode = instanceContext.getAccessMode();
      ParameterValidation.throwIllegalArgExceptionIfNull(accessMode, "access mode");
      if (debug)
      {
         log.debug("Portlet is requesting " + accessMode + " access mode");
      }
      InteractionParams interactionParams = WSRPTypeFactory.createInteractionParams(WSRPUtils.getStateChangeFromAccessMode(accessMode));
      interactionParams.getExtensions().addAll(ExtensionAccess.getConsumerExtensionAccessor().getRequestExtensionsFor(InteractionParams.class));

      // interaction state
      StateString interactionState = actionInvocation.getInteractionState();
      if (interactionState != null)
      {
         String state = interactionState.getStringValue();
         if (!StateString.JBPNS_PREFIX.equals(state))  // fix-me: see JBPORTAL-900
         {
            interactionParams.setInteractionState(state);
         }
      }

      // check for multi-part
      try
      {
         MultiPartResult multiPartResult = MultiPartUtil.getMultiPartContent(invocation.getRequestContext());
         if (multiPartResult != null)
         {
            interactionParams.getFormParameters().addAll(multiPartResult.getFormParameters());
            interactionParams.getUploadContexts().addAll(multiPartResult.getUploadContexts());
         }

         // Also check for form parameters from the Invocation
         Map<String, String[]> params = actionInvocation.getForm();
         if (params != null && !params.isEmpty())
         {
            int capacity = params.size();
            List<NamedString> formParameters = new ArrayList<NamedString>(capacity);
            for (Map.Entry param : params.entrySet())
View Full Code Here

      allParams.putAll(servletRequest.getParameterMap());
      allParams.putAll(this.getPublicParameters());
      allParams.remove(ExoPortletInvocationContext.NAVIGATIONAL_STATE_PARAM_NAME);
      if (type.equals(ActionInvocation.class))
      {
         ActionInvocation actionInvocation = new ActionInvocation(pic);
         actionInvocation.setForm(allParams);
         actionInvocation.setRequestContext(new AbstractRequestContext(servletRequest));

         String interactionState =
            servletRequest.getParameter(ExoPortletInvocationContext.INTERACTION_STATE_PARAM_NAME);
         if (interactionState != null)
         {
            actionInvocation.setInteractionState(StateString.create(interactionState));
         }

         invocation = type.cast(actionInvocation);
      }
      else if (type.equals(ResourceInvocation.class))
View Full Code Here

         // set the public render parameters from the request before creating the invocation
         HttpServletRequest request = prcontext.getRequest();
         setupPublicRenderParams(uiPortlet, request.getParameterMap());

         //
         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 = updatedCtx.getState();
            uiPortlet.update(portletState);
View Full Code Here

        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

      return WSRPUtils.getAccessModeFromStateChange(stateChange);
   }

   PortletInvocation initInvocation(WSRPPortletInvocationContext context)
   {
      ActionInvocation invocation = new ActionInvocation(context);
      InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();

      // Request context
      WSRPRequestContext requestContext = WSRPRequestContext.createRequestContext(markupRequest, interactionParams);
      invocation.setRequestContext(requestContext);

      // Interaction state, navigational state is already taken care of in RequestProcessor.prepareInvocation
      StateString interactionState = createNavigationalState(interactionParams.getInteractionState());
      invocation.setInteractionState(interactionState);

      // Form parameters
      invocation.setForm(requestContext.getForm());

      // Extensions
      processExtensionsFrom(interactionParams.getClass(), interactionParams.getExtensions());

      return invocation;
View Full Code Here

      if (!(invocation instanceof ActionInvocation))
      {
         throw new IllegalArgumentException("ActionHandler can only handle ActionInvocations!");
      }

      ActionInvocation actionInvocation = (ActionInvocation)invocation;

      PortletContext portletContext = requestPrecursor.getPortletContext();
      if (debug)
      {
         log.debug("Consumer about to attempt action on portlet '" + portletContext.getPortletHandle() + "'");
      }

      // access mode
      InstanceContext instanceContext = invocation.getInstanceContext();
      ParameterValidation.throwIllegalArgExceptionIfNull(instanceContext, "instance context");
      AccessMode accessMode = instanceContext.getAccessMode();
      ParameterValidation.throwIllegalArgExceptionIfNull(accessMode, "access mode");
      if (debug)
      {
         log.debug("Portlet is requesting " + accessMode + " access mode");
      }
      InteractionParams interactionParams = WSRPTypeFactory.createInteractionParams(WSRPUtils.getStateChangeFromAccessMode(accessMode));
      interactionParams.getExtensions().addAll(ExtensionAccess.getConsumerExtensionAccessor().getRequestExtensionsFor(InteractionParams.class));

      // interaction state
      StateString interactionState = actionInvocation.getInteractionState();
      if (interactionState != null)
      {
         String state = interactionState.getStringValue();
         if (!StateString.JBPNS_PREFIX.equals(state))  // fix-me: see JBPORTAL-900
         {
            interactionParams.setInteractionState(state);
         }
      }

      // check for multi-part
      RequestContextWrapper requestContext = new RequestContextWrapper(actionInvocation.getRequestContext());
      try
      {
         MultiPartResult multiPartResult = MultiPartUtil.getMultiPartContent(invocation.getRequestContext());
         if (multiPartResult != null)
         {
            interactionParams.getFormParameters().addAll(multiPartResult.getFormParameters());
            interactionParams.getUploadContexts().addAll(multiPartResult.getUploadContexts());
         }

         // Also check for form parameters from the Invocation
         Map<String, String[]> params = actionInvocation.getForm();
         if (params != null && !params.isEmpty())
         {
            int capacity = params.size();
            List<NamedString> formParameters = new ArrayList<NamedString>(capacity);
            for (Map.Entry param : params.entrySet())
View Full Code Here

      {
         publicNS = context.getStateControllerContext().getPublicWindowNavigationalState(context, pageNavigationalState, windowId);
      }

      PortletInvocationContext portletInvocationContext = context.createPortletInvocationContext(windowId, pageNavigationalState);
      ActionInvocation actionInvocation = new ActionInvocation(portletInvocationContext);

      //
      actionInvocation.setMode(mode);
      actionInvocation.setWindowState(windowState);
      actionInvocation.setNavigationalState(windowNavigationalState.getPortletNavigationalState());
      actionInvocation.setPublicNavigationalState(publicNS);
      actionInvocation.setInteractionState(interactionState);
      actionInvocation.setForm(bodyParameters != null ? ParameterMap.clone(bodyParameters) : null);

      //
      return context.invoke(windowId, actionInvocation);
   }
View Full Code Here

            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

Related Classes of org.gatein.pc.api.invocation.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.