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

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


         access,
         context.isStateful() ? ((StatefulContext)context).getProperties() : null,
         invocation instanceof RenderInvocation);

      //
      PortletInvocationResponse response;
      try
      {
         invocation.setTarget(context.getPortletContext());
         invocation.setAttribute(PropertyContext.PREFERENCES_ATTRIBUTE, prefs);
View Full Code Here


      for (Portlet portlet : portlets)
      {
         try
         {
            PortletInvocationResponse response = context.render(properties.getCookies(), pageNavigationalState, portlet.getContext().getId());

            //
            if (response instanceof ContentResponse)
            {
               ContentResponse fragment = (ContentResponse)response;
View Full Code Here

         throw new IllegalArgumentException("Request " + request + " cannot be handled by this handler");
      }

      //
      T req = t.cast(request);
      PortletInvocationResponse response = invoke(controllerContext, req);

      return processResponse(controllerContext, req, response);
   }
View Full Code Here

                     break;
                  }
               }

               //
               PortletInvocationResponse eventResponse;
               try
               {
                  eventResponse = deliverEvent(context, toConsumeEvent, pageNavigationalState, requestProperties.getCookies());
               }
               catch (Exception e)
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

         renderInvocation.setMode(Mode.create(PortletMode.EDIT.toString()));
         renderInvocation.setWindowState(org.gatein.pc.api.WindowState.create(uiPortlet_.getCurrentWindowState()
            .toString()));

         PortletInvocationResponse portletResponse = uiPortlet_.invoke(renderInvocation);

         String content;
         if (portletResponse instanceof FragmentResponse)
         {
            FragmentResponse fragmentResponse = (FragmentResponse)portletResponse;
            content = new String(fragmentResponse.getBytes(), "UTF-8");
         }
         else
         {
            PortletContainerException pcException;

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

            //
            PortletExceptionHandleService portletExceptionService = uiPortlet_.getApplicationComponent(PortletExceptionHandleService.class);
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);
                  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 = uicomponent.getApplicationComponent(PortletExceptionHandleService.class);
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)
         {
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.