Package org.gatein.pc.api

Examples of org.gatein.pc.api.StateString


         windowState = WindowState.create(queryParameters.get(ControllerRequestParameterNames.WINDOW_STATE));
      }

      //
      String navigationalStateString = queryParameters.get(ControllerRequestParameterNames.NAVIGATIONAL_STATE);
      StateString navigationalState = null;
      if (navigationalStateString != null)
      {
         navigationalState = StateString.create(navigationalStateString);
      }

      //
      PortletWindowNavigationalState windowNavigationalState = new PortletWindowNavigationalState(navigationalState, mode, windowState);

      //
      String phase = queryParameters.get(ControllerRequestParameterNames.LIFECYCLE_PHASE);
      if (ControllerRequestParameterNames.RESOURCE_PHASE.equals(phase))
      {
         StateString resourceState = StateString.create(queryParameters.get(ControllerRequestParameterNames.RESOURCE_STATE));
         String resourceId = queryParameters.get(ControllerRequestParameterNames.RESOURCE_ID);

         //
         CacheLevel resourceCacheLevel = CacheLevel.valueOf(queryParameters.get(ControllerRequestParameterNames.RESOURCE_CACHEABILITY));

         //
         PortletResourceRequest.Scope scope;
         switch (resourceCacheLevel)
         {
            case FULL:
               scope = new PortletResourceRequest.FullScope();
               break;
            case PORTLET:
               scope = new PortletResourceRequest.PortletScope(windowNavigationalState);
               break;
            case PAGE:
               scope = new PortletResourceRequest.PageScope(windowNavigationalState, pageNavigationalState);
               break;
            default:
               throw new AssertionError();
         }

         //
         return new PortletResourceRequest(
            windowId,
            resourceId,
            resourceState,
            formParameterMap,
            scope);
      }
      else
      {
         if (ControllerRequestParameterNames.ACTION_PHASE.equals(phase))
         {
            StateString interactionState = StateString.create(queryParameters.get(ControllerRequestParameterNames.INTERACTION_STATE));

            //
            return new PortletActionRequest(
               windowId,
               interactionState,
View Full Code Here


            {
               parameters.put(ControllerRequestParameterNames.NAVIGATIONAL_STATE, actionURL.getNavigationalState().getStringValue());
            }

            //
            StateString interactionState = actionURL.getInteractionState();
            parameters.put(ControllerRequestParameterNames.INTERACTION_STATE, interactionState.getStringValue());
         }
         else
         {
            RenderURL renderURL = (RenderURL)containerURL;

            //
            Map<String, String[]> changes = renderURL.getPublicNavigationalStateChanges();
            byte[] bytes = IOTools.serialize(Serialization.PARAMETER_MAP, SerializationFilter.COMPRESSOR, changes);
            String ns = Base64.encodeBytes(bytes, Base64.EncodingOption.USEURLSAFEENCODING);
            parameters.put(ControllerRequestParameterNames.PUBLIC_NAVIGATIONAL_STATE_CHANGES, ns);

            //
            StateString navigationalState = renderURL.getNavigationalState();
            if (navigationalState != null)
            {
               parameters.put(ControllerRequestParameterNames.NAVIGATIONAL_STATE, navigationalState.getStringValue());
            }
         }
      }
      else
      {
         ResourceURL resourceURL = (ResourceURL)containerURL;

         //
         StateString resourceState = resourceURL.getResourceState();
         parameters.put(ControllerRequestParameterNames.RESOURCE_STATE, resourceState.getStringValue());

         //
         String resourceId = resourceURL.getResourceId();
         if (resourceId != null)
         {
View Full Code Here

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

      invocation.setMode(WSRPUtils.getJSR168PortletModeFromWSRPName(markupRequest.getMode()));

      NavigationalContext navigationalContext = params.getNavigationalContext();
      if (navigationalContext != null)
      {
         StateString navigationalState = createNavigationalState(navigationalContext.getOpaqueValue());
         invocation.setNavigationalState(navigationalState);

         List<NamedString> publicParams = navigationalContext.getPublicValues();

View Full Code Here

         windowState = WindowState.create(queryParameters.get(ControllerRequestParameterNames.WINDOW_STATE));
      }

      //
      String navigationalStateString = queryParameters.get(ControllerRequestParameterNames.NAVIGATIONAL_STATE);
      StateString navigationalState = null;
      if (navigationalStateString != null)
      {
         navigationalState = StateString.create(navigationalStateString);
      }

      //
      WindowNavigationalState windowNavigationalState = new WindowNavigationalState(navigationalState, mode, windowState);

      //
      String phase = queryParameters.get(ControllerRequestParameterNames.LIFECYCLE_PHASE);
      if (ControllerRequestParameterNames.RESOURCE_PHASE.equals(phase))
      {
         StateString resourceState = StateString.create(queryParameters.get(ControllerRequestParameterNames.RESOURCE_STATE));
         String resourceId = queryParameters.get(ControllerRequestParameterNames.RESOURCE_ID);

         //
         CacheLevel resourceCacheLevel = CacheLevel.create(queryParameters.get(ControllerRequestParameterNames.RESOURCE_CACHEABILITY));

         //
         PortletResourceRequest.Scope scope;
         if (CacheLevel.FULL.equals(resourceCacheLevel))
         {
            scope = new PortletResourceRequest.FullScope();
         }
         else if (CacheLevel.PORTLET.equals(resourceCacheLevel))
         {
            scope = new PortletResourceRequest.PortletScope(windowNavigationalState);
         }
         else if (CacheLevel.PAGE.equals(resourceCacheLevel))
         {
            scope = new PortletResourceRequest.PageScope(windowNavigationalState, pageNavigationalState);
         }
         else
         {
            throw new AssertionError();
         }

         //
         return new PortletResourceRequest(
            windowId,
            resourceId,
            resourceState,
            formParameterMap,
            scope);
      }
      else
      {
         if (ControllerRequestParameterNames.ACTION_PHASE.equals(phase))
         {
            StateString interactionState = StateString.create(queryParameters.get(ControllerRequestParameterNames.INTERACTION_STATE));

            //
            return new PortletActionRequest(
               windowId,
               interactionState,
View Full Code Here

            {
               parameters.put(ControllerRequestParameterNames.NAVIGATIONAL_STATE, actionURL.getNavigationalState().getStringValue());
            }

            //
            StateString interactionState = actionURL.getInteractionState();
            parameters.put(ControllerRequestParameterNames.INTERACTION_STATE, interactionState.getStringValue());
         }
         else
         {
            RenderURL renderURL = (RenderURL)containerURL;

            //
            Map<String, String[]> changes = renderURL.getPublicNavigationalStateChanges();
            byte[] bytes = IOTools.serialize(Serialization.PARAMETER_MAP, SerializationFilter.COMPRESSOR, changes);
            String ns = Base64.encodeBytes(bytes, Base64.EncodingOption.USEURLSAFEENCODING);
            parameters.put(ControllerRequestParameterNames.PUBLIC_NAVIGATIONAL_STATE_CHANGES, ns);

            //
            StateString navigationalState = renderURL.getNavigationalState();
            if (navigationalState != null)
            {
               parameters.put(ControllerRequestParameterNames.NAVIGATIONAL_STATE, navigationalState.getStringValue());
            }
         }
      }
      else
      {
         ResourceURL resourceURL = (ResourceURL)containerURL;

         //
         StateString resourceState = resourceURL.getResourceState();
         parameters.put(ControllerRequestParameterNames.RESOURCE_STATE, resourceState.getStringValue());

         //
         String resourceId = resourceURL.getResourceId();
         if (resourceId != null)
         {
View Full Code Here

      int size = data.readInt();
      while (size-- > 0)
      {
         String windowId = data.readUTF();
         byte header = data.readByte();
         StateString portletNS = null;
         if ((header & 1) != 0)
         {
            portletNS = StateString.create(data);
         }
         org.gatein.pc.api.WindowState windowState = null;
View Full Code Here

            {
               parameters.put(ControllerRequestParameterNames.NAVIGATIONAL_STATE, actionURL.getNavigationalState().getStringValue());
            }

            //
            StateString interactionState = actionURL.getInteractionState();
            parameters.put(ControllerRequestParameterNames.INTERACTION_STATE, interactionState.getStringValue());
         }
         else
         {
            RenderURL renderURL = (RenderURL)containerURL;

            //
            Map<String, String[]> changes = renderURL.getPublicNavigationalStateChanges();
            byte[] bytes = IOTools.serialize(Serialization.PARAMETER_MAP, SerializationFilter.COMPRESSOR, changes);
            String ns = Base64.encodeBytes(bytes, true);
            parameters.put(ControllerRequestParameterNames.PUBLIC_NAVIGATIONAL_STATE_CHANGES, ns);

            //
            StateString navigationalState = renderURL.getNavigationalState();
            if (navigationalState != null)
            {
               parameters.put(ControllerRequestParameterNames.NAVIGATIONAL_STATE, navigationalState.getStringValue());
            }
         }
      }
      else
      {
         ResourceURL resourceURL = (ResourceURL)containerURL;

         //
         StateString resourceState = resourceURL.getResourceState();
         parameters.put(ControllerRequestParameterNames.RESOURCE_STATE, resourceState.getStringValue());

         //
         String resourceId = resourceURL.getResourceId();
         if (resourceId != null)
         {
View Full Code Here

         windowState = WindowState.create(queryParameters.get(ControllerRequestParameterNames.WINDOW_STATE));
      }

      //
      String navigationalStateString = queryParameters.get(ControllerRequestParameterNames.NAVIGATIONAL_STATE);
      StateString navigationalState = null;
      if (navigationalStateString != null)
      {
         navigationalState = StateString.create(navigationalStateString);
      }

      //
      PortletWindowNavigationalState windowNavigationalState = new PortletWindowNavigationalState(navigationalState, mode, windowState);

      //
      String phase = queryParameters.get(ControllerRequestParameterNames.LIFECYCLE_PHASE);
      if (ControllerRequestParameterNames.RESOURCE_PHASE.equals(phase))
      {
         StateString resourceState = StateString.create(queryParameters.get(ControllerRequestParameterNames.RESOURCE_STATE));
         String resourceId = queryParameters.get(ControllerRequestParameterNames.RESOURCE_ID);

         //
         CacheLevel resourceCacheLevel = CacheLevel.valueOf(queryParameters.get(ControllerRequestParameterNames.RESOURCE_CACHEABILITY));

         //
         PortletResourceRequest.Scope scope;
         switch (resourceCacheLevel)
         {
            case FULL:
               scope = new PortletResourceRequest.FullScope();
               break;
            case PORTLET:
               scope = new PortletResourceRequest.PortletScope(windowNavigationalState);
               break;
            case PAGE:
               scope = new PortletResourceRequest.PageScope(windowNavigationalState, pageNavigationalState);
               break;
            default:
               throw new AssertionError();
         }

         //
         return new PortletResourceRequest(
            windowId,
            resourceId,
            resourceState,
            formParameterMap,
            scope);
      }
      else
      {
         if (ControllerRequestParameterNames.ACTION_PHASE.equals(phase))
         {
            StateString interactionState = StateString.create(queryParameters.get(ControllerRequestParameterNames.INTERACTION_STATE));

            //
            return new PortletActionRequest(
               windowId,
               interactionState,
View Full Code Here

            Collections.singletonList(streamInfo.getMediaType().getValue()), mode, windowState);
         String userAgent = WSRPConsumerImpl.getHttpRequest(invocation).getHeader(USER_AGENT);
         getMarkupParams().setClientData(WSRPTypeFactory.createClientData(userAgent));

         // navigational state
         StateString navigationalState = invocation.getNavigationalState();
         Map<String, String[]> publicNavigationalState = invocation.getPublicNavigationalState();

         // it is possible to get additonal public navigational state from the invocation attributes if the producer used templates:
         String publicNS = (String)invocation.getAttribute(WSRP2RewritingConstants.NAVIGATIONAL_VALUES);
         if (!ParameterValidation.isNullOrEmpty(publicNS))
View Full Code Here

TOP

Related Classes of org.gatein.pc.api.StateString

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.