Package org.gatein.pc.api.invocation

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


        try {
            PortalRequestContext prcontext = (PortalRequestContext) WebuiRequestContext.getCurrentInstance();
            prcontext.ignoreAJAXUpdateOnPortlets(true);

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


                for (String publicParamName : paramMap.get("removePP")) {
                    uiPortal.getPublicParameters().remove(publicParamName);
                }
            }

            RenderInvocation renderInvocation = uicomponent.create(RenderInvocation.class, prcontext);

            String appStatus = uicomponent.getProperties().get("appStatus");
            if ("Window".equals(uicomponent.getPortletStyle()) && !("SHOW".equals(appStatus) || "HIDE".equals(appStatus))) {
                markup = Text.create("<span></span>");
            } else {
View Full Code Here

         {
           uiPortal.getPublicParameters().remove(publicParamName);
         }
       }
      
         RenderInvocation renderInvocation = uicomponent.create(RenderInvocation.class, prcontext);

         if (uicomponent.getCurrentWindowState() != WindowState.MINIMIZED)
         {
            String appStatus = uicomponent.getProperties().get("appStatus");
            if ("Window".equals(uicomponent.getPortletStyle())
View Full Code Here

      {
         invocation = type.cast(new EventInvocation(pic));
      }
      else if (type.equals(RenderInvocation.class))
      {
         invocation = type.cast(new RenderInvocation(pic));
      }
      else
      {
         throw new AssertionError();
      }
View Full Code Here

         ExoPortletInvocationContext portletInvocationContext = new ExoPortletInvocationContext(prcontext, uiPortlet_);

         List<Cookie> requestCookies = new ArrayList<Cookie>(Arrays.asList(prcontext.getRequest().getCookies()));

         RenderInvocation renderInvocation = new RenderInvocation(portletInvocationContext);
         renderInvocation.setClientContext(new AbstractClientContext(prcontext.getRequest(), requestCookies));
         renderInvocation.setServerContext(new AbstractServerContext(prcontext.getRequest(), prcontext.getResponse()));


         // instance context
         InstanceContext instanceContext;
         if (portletContext.getType() instanceof WSRPPortletStateType)
         {
            WSRP wsrp = (WSRP)portletContext.getState();
            AccessMode accessMode = AccessMode.CLONE_BEFORE_WRITE;
            if (wsrp.isCloned())
            {
               accessMode = AccessMode.READ_WRITE;
            }
            instanceContext = new ExoPortletInstanceContext(wsrp.getPortletId(), accessMode);
         }
         else
         {
            ExoPortletState exo = (ExoPortletState)portletContext.getState();
            instanceContext = new ExoPortletInstanceContext(exo.getPortletId());
         }
         renderInvocation.setInstanceContext(instanceContext);

         renderInvocation.setUserContext(new AbstractUserContext(prcontext.getRequest()));
         renderInvocation.setWindowContext(new AbstractWindowContext(uiPortlet_.getWindowId()));
         renderInvocation.setPortalContext(new AbstractPortalContext(Collections.singletonMap(
            "javax.portlet.markup.head.element.support", "true")));
         renderInvocation.setSecurityContext(new AbstractSecurityContext(prcontext.getRequest()));
         renderInvocation.setTarget(portletContext);

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

                for (String publicParamName : paramMap.get("removePP")) {
                    uiPortal.getPublicParameters().remove(publicParamName);
                }
            }

            RenderInvocation renderInvocation = uicomponent.create(RenderInvocation.class, prcontext);

            String appStatus = uicomponent.getProperties().get("appStatus");
            if ("Window".equals(uicomponent.getPortletStyle()) && !("SHOW".equals(appStatus) || "HIDE".equals(appStatus))) {
                markup = Text.create("<span></span>");
            } else {
View Full Code Here

            invocation = type.cast(resourceInvocation);
        } else if (type.equals(EventInvocation.class)) {
            invocation = type.cast(new EventInvocation(pic));
        } else if (type.equals(RenderInvocation.class)) {
            invocation = type.cast(new RenderInvocation(pic));
        } else {
            throw new AssertionError();
        }

        //
View Full Code Here

      UserContext userContext = invocation.getUserContext();

      //
      if (invocation instanceof RenderInvocation)
      {
         RenderInvocation renderInvocation = (RenderInvocation)invocation;

         //
         StateString navigationalState = renderInvocation.getNavigationalState();
         Map<String, String[]> publicNavigationalState = renderInvocation.getPublicNavigationalState();
         WindowState windowState = renderInvocation.getWindowState();
         Mode mode = renderInvocation.getMode();

         //
         CacheEntry cachedEntry = (CacheEntry)userContext.getAttribute(scopeKey);

         //
         if (cachedEntry != null)
         {
            // Check time validity for fragment
            boolean useEntry = false;
            StateString entryNavigationalState = cachedEntry.navigationalState;
            Map<String, String[]> entryPublicNavigationalState = cachedEntry.publicNavigationalState;

            // Then check nav state equality
            if (navigationalState == null)
            {
               if (entryNavigationalState == null)
               {
                  useEntry = true;
               }
               else if (entryNavigationalState instanceof ParametersStateString)
               {
                  // We consider a parameters state string empty equivalent to a null value
                  useEntry = ((ParametersStateString)entryNavigationalState).getSize() == 0;
               }
            }
            else if (entryNavigationalState == null)
            {
               if (navigationalState instanceof ParametersStateString)
               {
                  useEntry = ((ParametersStateString)navigationalState).getSize() == 0;
               }
            }
            else
            {
               useEntry = navigationalState.equals(entryNavigationalState);
            }

            // Check public nav state equality
            if (useEntry)
            {
               if (publicNavigationalState == null)
               {
                  if (entryPublicNavigationalState == null)
                  {
                     //
                  }
                  else
                  {
                     useEntry = entryPublicNavigationalState.size() == 0;
                  }
               }
               else if (entryPublicNavigationalState == null)
               {
                  useEntry = publicNavigationalState.size() == 0;
               }
               else
               {
                  ParameterMap publicPM = ParameterMap.wrap(publicNavigationalState);
                  ParameterMap entryPM = ParameterMap.wrap(entryPublicNavigationalState);
                  useEntry = publicPM.equals(entryPM);
               }
            }

            // Then check window state equality
            useEntry &= windowState.equals(cachedEntry.windowState);

            // Then check mode equality
            useEntry &= mode.equals(cachedEntry.mode);

            // Clean if it is null
            if (!useEntry)
            {
               cachedEntry = null;
               userContext.setAttribute(scopeKey, null);
            }
         }

         ContentResponse fragment = cachedEntry != null ? cachedEntry.contentRef.getContent() : null;

         // If no valid fragment we must invoke
         if (fragment == null || cachedEntry.expirationTimeMillis < System.currentTimeMillis())
         {
            // Set validation token for revalidation only we have have a fragment
            if (fragment != null)
            {
               renderInvocation.setValidationToken(cachedEntry.validationToken);
            }

            // Invoke
            PortletInvocationResponse response = super.invoke(invocation);
View Full Code Here

      return markupResponse.getExtensions();
   }

   protected PortletInvocation internalInitInvocation(WSRPPortletInvocationContext context)
   {
      final RenderInvocation renderInvocation = new RenderInvocation(context);
      renderInvocation.setEncoding(markupRequest.getCharacterSet());
      return renderInvocation;
   }
View Full Code Here

      UserContext userContext = invocation.getUserContext();

      //
      if (invocation instanceof RenderInvocation)
      {
         RenderInvocation renderInvocation = (RenderInvocation)invocation;

         //
         StateString navigationalState = renderInvocation.getNavigationalState();
         Map<String, String[]> publicNavigationalState = renderInvocation.getPublicNavigationalState();
         WindowState windowState = renderInvocation.getWindowState();
         Mode mode = renderInvocation.getMode();

         //
         CacheEntry cachedEntry = (CacheEntry)userContext.getAttribute(scopeKey);

         //
         if (cachedEntry != null)
         {
            // Check time validity for fragment
            boolean useEntry = false;
            StateString entryNavigationalState = cachedEntry.navigationalState;
            Map<String, String[]> entryPublicNavigationalState = cachedEntry.publicNavigationalState;

            // Then check nav state equality
            if (navigationalState == null)
            {
               if (entryNavigationalState == null)
               {
                  useEntry = true;
               }
               else if (entryNavigationalState instanceof ParametersStateString)
               {
                  // We consider a parameters state string empty equivalent to a null value
                  useEntry = ((ParametersStateString)entryNavigationalState).getSize() == 0;
               }
            }
            else if (entryNavigationalState == null)
            {
               if (navigationalState instanceof ParametersStateString)
               {
                  useEntry = ((ParametersStateString)navigationalState).getSize() == 0;
               }
            }
            else
            {
               useEntry = navigationalState.equals(entryNavigationalState);
            }

            // Check public nav state equality
            if (useEntry)
            {
               if (publicNavigationalState == null)
               {
                  if (entryPublicNavigationalState == null)
                  {
                     //
                  }
                  else
                  {
                     useEntry = entryPublicNavigationalState.size() == 0;
                  }
               }
               else if (entryPublicNavigationalState == null)
               {
                  useEntry = publicNavigationalState.size() == 0;
               }
               else
               {
                  ParameterMap publicPM = ParameterMap.wrap(publicNavigationalState);
                  ParameterMap entryPM = ParameterMap.wrap(entryPublicNavigationalState);
                  useEntry = publicPM.equals(entryPM);
               }
            }

            // Then check window state equality
            useEntry &= windowState.equals(cachedEntry.windowState);

            // Then check mode equality
            useEntry &= mode.equals(cachedEntry.mode);

            // Clean if it is null
            if (!useEntry)
            {
               cachedEntry = null;
               userContext.setAttribute(scopeKey, null);
            }
         }

         //
         final ContentResponse cachedContent = cachedEntry != null ? cachedEntry.contentRef.getContent() : null;

         // If no valid content we must invoke
         long now = System.currentTimeMillis();
         if (cachedContent == null || cachedEntry.expirationTimeMillis < now)
         {
            // Set validation token for revalidation only we have have a content
            if (cachedContent != null)
            {
               renderInvocation.setValidationToken(cachedEntry.validationToken);
            }

            // Invoke
            PortletInvocationResponse response = super.invoke(invocation);
View Full Code Here

TOP

Related Classes of org.gatein.pc.api.invocation.RenderInvocation

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.