Package org.gatein.pc.api.invocation.response

Examples of org.gatein.pc.api.invocation.response.PortletInvocationResponse


         //
         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)
         {
View Full Code Here


            //
            ResourceInvocation resourceInvocation = uiPortlet.create(ResourceInvocation.class, context);

            //
            PortletInvocationResponse portletResponse = uiPortlet.invoke(resourceInvocation);

            // todo: handle the error response better than this.
            if (!(portletResponse instanceof ContentResponse))
            {
               if (portletResponse instanceof ErrorResponse)
View Full Code Here

            //
            eventInvocation.setName(event.getQName());
            eventInvocation.setPayload(event.getValue());

            //
            PortletInvocationResponse piResponse = uiPortlet.invoke(eventInvocation);

            //
            ExoPortletInstanceContext instanceCtx = (ExoPortletInstanceContext) eventInvocation.getInstanceContext();
            if (instanceCtx.getModifiedContext() != null) {
                StatefulPortletContext<C> updatedCtx = (StatefulPortletContext<C>) instanceCtx.getModifiedContext();
View Full Code Here

            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();
View Full Code Here

                // set the resourceId to be used in case of a problem
                resourceId = resourceInvocation.getResourceId();

                //
                PortletInvocationResponse portletResponse = uiPortlet.invoke(resourceInvocation);

                //
                int statusCode;
                MultiValuedPropertyMap<String> transportHeaders;
                String contentType;
View Full Code Here

            PortletInvocation portletInvocation = uiPortlet_.create(RenderInvocation.class, prcontext);
            RenderInvocation renderInvocation = (RenderInvocation) portletInvocation;
            // make sure we are in the EDIT mode, and not whatever the current portlet mode is for the Portlet
            renderInvocation.setMode(Mode.create(PortletMode.EDIT.toString()));

            PortletInvocationResponse portletResponse = uiPortlet_.invoke(renderInvocation);
            StringWriter writer = new StringWriter();
            uiPortlet_.generateRenderMarkup(portletResponse, prcontext).writeTo(writer);

            return writer.toString();
        } catch (Throwable ex) {
View Full Code Here

                // Check mode of portal, portlet and permission for viewable
                if ((portalMode == UIPortalApplication.NORMAL_MODE || portalMode == UIPortalApplication.APP_VIEW_EDIT_MODE
                        || portalMode == UIPortalApplication.CONTAINER_VIEW_EDIT_MODE || uicomponent.getCurrentPortletMode()
                        .equals(PortletMode.EDIT)) && uicomponent.hasPermission()) {
                    PortletInvocationResponse response = uicomponent.invoke(renderInvocation);
                    markup = uicomponent.generateRenderMarkup(response, prcontext);
                } else {
                    uicomponent.setConfiguredTitle(null);
                }
            }
View Full Code Here

      }

      try
      {
         // invoke the handler
         final PortletInvocationResponse response = handler.handle(invocation);

         // and let the consumer delegate process the response
         if (delegate != null)
         {
            delegate.processInvocationResponse(response, invocation);
View Full Code Here

      catch (Exception e)
      {
         // if we didn't get a straight PortletInvokerException (which means we already asserted that the WSRP can't deal with it), try to transform it into something we can deal with
         if (!(e instanceof PortletInvokerException))
         {
            final PortletInvocationResponse response = dealWithError(e, invocation, getRuntimeContextFrom(request));
            if (response instanceof ErrorResponse)
            {
               return unwrapWSRPError((ErrorResponse)response);
            }
View Full Code Here

            else
            {
               int portalMode = Util.getUIPortalApplication().getModeState();
               if (portalMode % 2 == 0 || uicomponent.getCurrentPortletMode().equals(PortletMode.EDIT))
               {
                  PortletInvocationResponse response = uicomponent.invoke(renderInvocation);
                  if (response instanceof FragmentResponse)
                  {
                    FragmentResponse fragmentResponse = (FragmentResponse)response;
                    switch (fragmentResponse.getType())
                    {
                    case FragmentResponse.TYPE_CHARS:
                      markup = Text.create(fragmentResponse.getContent());
                      break;
                    case FragmentResponse.TYPE_BYTES:
                      markup = Text.create(fragmentResponse.getBytes(), Charset.forName("UTF-8"));
                      break;
                    case FragmentResponse.TYPE_EMPTY:
                      markup = Text.create("");
                      break;
                    }
                    portletTitle = fragmentResponse.getTitle();

                    // setup portlet properties
                    if (fragmentResponse.getProperties() != null)
                    {
                      //setup transport headers
                      if (fragmentResponse.getProperties().getTransportHeaders() != null)
                      {
                        MultiValuedPropertyMap<String> transportHeaders =
                          fragmentResponse.getProperties().getTransportHeaders();
                        for (String key : transportHeaders.keySet())
                        {
                          for (String value : transportHeaders.getValues(key))
                          {
                            prcontext.getResponse().setHeader(key, value);
                          }
                        }
                      }
                     
                      //setup up portlet cookies
                      if (fragmentResponse.getProperties().getCookies() != null)
                      {
                         List<Cookie> cookies = fragmentResponse.getProperties().getCookies();
                         for (Cookie cookie : cookies)
                         {
                            prcontext.getResponse().addCookie(cookie);
                         }
                      }

                      //setup markup headers
                      if (fragmentResponse.getProperties().getMarkupHeaders() != null)
                      {
                        MultiValuedPropertyMap<Element> markupHeaders =
                          fragmentResponse.getProperties().getMarkupHeaders();

                        List<Element> markupElements = markupHeaders.getValues(MimeResponse.MARKUP_HEAD_ELEMENT);
                        if (markupElements != null)
                        {
                          for (Element element : markupElements)
                          {
                            if ("title".equals(element.getNodeName().toLowerCase()) && element.getFirstChild() != null)
                            {
                              String title = element.getFirstChild().getTextContent();
                              prcontext.getRequest().setAttribute(PortalRequestContext.REQUEST_TITLE, title);
                            }
                            else
                            {
                              prcontext.addExtraMarkupHeader(element);
                            }
                          }
                        }
                      }
                    }

                  }
                  else
                  {

                     PortletContainerException pcException;

                     if (response instanceof ErrorResponse)
                     {
                        ErrorResponse errorResponse = (ErrorResponse)response;
                        pcException =
                           new PortletContainerException(errorResponse.getMessage(), errorResponse.getCause());
                     }
                     else
                     {
                        pcException =
                           new PortletContainerException("Unknown invocation response type [" + response.getClass()
                              + "]. Expected a FragmentResponse or an ErrorResponse");
                     }

                     PortletExceptionHandleService portletExceptionService =
                        (PortletExceptionHandleService)container
View Full Code Here

TOP

Related Classes of org.gatein.pc.api.invocation.response.PortletInvocationResponse

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.