Examples of PageNavigationalState


Examples of org.gatein.pc.controller.state.PageNavigationalState

         {
            return new ErrorResponseRenderer((ErrorResponse)response);
         }
         else
         {
            return new PageRenderer(new ResponseProperties(), requestPageNavigationalState != null ? requestPageNavigationalState : new PageNavigationalState(false));
         }
      }

      //
      throw new IllegalArgumentException("Unknown response type: " + response);
View Full Code Here

Examples of org.gatein.pc.controller.state.PageNavigationalState

      {
         ControllerRequestFactory factory = new ControllerRequestFactory(context.getPageNavigationalStateSerialization());
         ControllerRequest request = factory.decode(req);

         // We must have one!!!
         PageNavigationalState tckPageNavigationalState = request.getPageNavigationalState();

         //
         ControllerResponse response = controller.process(context, request);

         //
         ControllerResponseRendererFactory rendererFactory = new ControllerResponseRendererFactory(
            false,
            false,
            request.getPageNavigationalState());

         //
         Renderer renderer = rendererFactory.getRenderer(response);

         //
         renderer.render(new TCKRendererContext(context, tckPageNavigationalState));
      }
      else
      {
         String[] tckParamers = req.getParameterValues(TCK_PORTLET_NAME);
         Collection<Portlet> portlets = context.getPortlets();
         Set<String> involvedPortlets = new LinkedHashSet<String>();
         for (String tckParamer : tckParamers)
         {
            String[] parts = tckParamer.split("/");
            String portletAppName = parts[0];
            String portletName = parts[1];

            //
            for (Portlet portlet : portlets)
            {
               if (portlet.getInfo().getApplicationName().equals(portletAppName)
                  && portlet.getInfo().getName().equals(portletName))
               {
                  involvedPortlets.add(portlet.getContext().getId());
               }
            }
         }

         if (tckParamers.length > 0 && involvedPortlets.isEmpty())
         {
            throw new IllegalStateException("Portlets requested by TCK were not found");
         }

         PageNavigationalState tckPageNavigationalState = new PageNavigationalState(false);

         //
         PageRenderer renderer = new PageRenderer(new ResponseProperties(), tckPageNavigationalState);

         //
View Full Code Here

Examples of org.gatein.pc.controller.state.PageNavigationalState

   {
      Map<String, String> queryParameters = MapAdapters.adapt(queryParameterMap);

      // The nav state provided with the request
      // Unmarshall portal navigational state if it is provided
      PageNavigationalState pageNavigationalState = null;
      String context = queryParameters.get(ControllerRequestParameterNames.PAGE_NAVIGATIONAL_STATE);
      if (context != null)
      {
         byte[] bytes = Base64.decode(context, Base64.EncodingOption.USEURLSAFEENCODING);
         pageNavigationalState = IOTools.unserialize(serialization, SerializationFilter.COMPRESSOR, bytes);
View Full Code Here

Examples of org.gatein.pc.controller.state.PageNavigationalState

         renderer.render(new RendererContextImpl(context));
      }
      else
      {

         PageRenderer renderer = new PageRenderer(new ResponseProperties(), new PageNavigationalState(false));

         //
         renderer.render(new RendererContextImpl(context));
      }
   }
View Full Code Here

Examples of org.gatein.pc.controller.state.PageNavigationalState

   public PageNavigationalState unserialize(InputStream in) throws IOException, IllegalArgumentException
   {
      DataInputStream data = in instanceof DataInputStream ? (DataInputStream)in : new DataInputStream(in);

      //
      PageNavigationalState pageNS = new PageNavigationalState(true);

      //
      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;
         int windowStateHeader = (header & (7 << 1)) >> 1;
         switch (windowStateHeader)
         {
            case 0:
               break;
            case 4:
               windowState = org.gatein.pc.api.WindowState.create(data.readUTF());
               break;
            default:
               windowState = codeToWindowState.get(windowStateHeader);
         }
         org.gatein.pc.api.Mode mode = null;
         int modeStateHeader = (header & (7 << (1 + 3))) >> (1 + 3);
         switch (modeStateHeader)
         {
            case 0:
               break;
            case 4:
               mode = Mode.create(data.readUTF());
               break;
            default:
               mode = codeToMode.get(modeStateHeader);
         }
         WindowNavigationalState windowNS = new WindowNavigationalState(portletNS, mode, windowState);
         pageNS.setWindowNavigationalState(windowId, windowNS);
      }

      //
      size = data.readInt();
      while (size-- > 0)
      {
         String namespaceURI = data.readUTF();
         String localName = data.readUTF();
         QName name = new QName(namespaceURI, localName);
         int length = data.readInt();
         String[] values = new String[length];
         for (int i = 0; i < length; i++)
         {
            values[i] = data.readUTF();
         }
         pageNS.setPublicNavigationalState(name, values);
      }

      //
      return pageNS;
   }
View Full Code Here

Examples of org.gatein.pc.controller.state.PageNavigationalState

      PortletInvocationResponse response) throws PortletInvokerException
   {
      // The page navigational state we will operate on during the request
      // Either we have nothing in the request so we create a new one
      // Or we have one but we copy it as we should not modify the input state provided
      PageNavigationalState pageNavigationalState = portletRequest.getPageNavigationalState();
      if (pageNavigationalState == null)
      {
         pageNavigationalState = new PageNavigationalState(true);
      }
      else
      {
         pageNavigationalState = new PageNavigationalState(pageNavigationalState, true);
      }

      //
      ResponseProperties requestProperties = new ResponseProperties();
View Full Code Here

Examples of org.gatein.pc.controller.state.PageNavigationalState

   @Override
   public PortletInvocationResponse invoke(ControllerContext context) throws PortletInvokerException
   {
      Mode mode = null;
      org.gatein.pc.api.WindowState windowState = null;
      PageNavigationalState pageNavigationalState = null;
      Map<String, String[]> publicNS = null;
      StateString portletNS = null;
      CacheLevel cacheability;

      if (scope instanceof PortletResourceRequest.PortletScope)
View Full Code Here

Examples of org.gatein.pc.controller.state.PageNavigationalState

   /** . */
   private StateControllerContextImpl cc = new StateControllerContextImpl();

   public void testMarshalling1()
   {
      PageNavigationalState pageNS = new PageNavigationalState(true);
      assertMarshallable(pageNS);
   }
View Full Code Here

Examples of org.gatein.pc.controller.state.PageNavigationalState

      test(params, org.gatein.pc.api.Mode.create("foo"), WindowState.create("bar"));
   }

   private void test(StateString portletNavigationalState, org.gatein.pc.api.Mode mode, WindowState windowState)
   {
      PageNavigationalState pageNS = new PageNavigationalState(true);
      pageNS.setWindowNavigationalState("foo", new WindowNavigationalState(portletNavigationalState, mode, windowState));
      assertMarshallable(pageNS);
   }
View Full Code Here

Examples of org.gatein.pc.controller.state.PageNavigationalState

   }

   private void assertMarshallable(PageNavigationalState pageNS)
   {
      byte[] bytes = IOTools.serialize(new PageNavigationalStateSerialization(cc), /*SerializationFilter.COMPRESSOR, */pageNS);
      PageNavigationalState expectedPageNS = IOTools.unserialize(new PageNavigationalStateSerialization(cc), /*SerializationFilter.COMPRESSOR, */bytes);
      assertEquals(expectedPageNS.getWindowIds(), pageNS.getWindowIds());
      for (String windowId : expectedPageNS.getWindowIds())
      {
         WindowNavigationalState windowNS = expectedPageNS.getWindowNavigationalState(windowId);
         WindowNavigationalState expectedWindowNS = pageNS.getWindowNavigationalState(windowId);
         assertEquals(windowNS.getPortletNavigationalState(), expectedWindowNS.getPortletNavigationalState());
         assertEquals(windowNS.getMode(), expectedWindowNS.getMode());
         assertEquals(windowNS.getWindowState(), expectedWindowNS.getWindowState());
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.