Package javax.portlet

Examples of javax.portlet.WindowState


        href.setParameterMap(params);

        Assert.assertTrue(href.isRequestedSecure());
        Assert.assertEquals(new PortletMode("help"), href.getRequestedMode());
        Assert.assertEquals(new WindowState("maximized"), href.getRequestedState());
        Assert.assertTrue(href.isAction());

        final Map<String, String[]> actualParams = href.getParameterMap();
        Assert.assertEquals(3, actualParams.size());
        Assert.assertArrayEquals(new String[]{"VAL1"}, actualParams.get("SINGLE_PARAM"));
View Full Code Here


        href.addParameter("SINGLE_PARAM", "VAL1");
        href.addParameter("INT_PARAM", 31337);

        Assert.assertTrue(href.isRequestedSecure());
        Assert.assertEquals(new PortletMode("help"), href.getRequestedMode());
        Assert.assertEquals(new WindowState("maximized"), href.getRequestedState());
        Assert.assertTrue(href.isAction());

        final Map<String, String[]> actualParams = href.getParameterMap();
        Assert.assertEquals(2, actualParams.size());
        Assert.assertArrayEquals(new String[]{"VAL1"}, actualParams.get("SINGLE_PARAM"));
View Full Code Here

                {
                    this.setRequestedState(null);
                }
                else
                {
                    final WindowState state = new WindowState(value);

                    if (!this.portletRequest.isWindowStateAllowed(state))
                    {
                        throw new IllegalArgumentException("WindowState '"
                            + state
View Full Code Here

        if (this.phase.equals(PortletRequest.ACTION_PHASE) &&
            !this.value.equals(request.getParameter(ActionRequest.ACTION_NAME))) {
          return false;
        }
        else if (this.phase.equals(PortletRequest.RENDER_PHASE) &&
            !(new WindowState(this.value)).equals(request.getWindowState())) {
          return false;
        }
        else if (this.phase.equals(PortletRequest.RESOURCE_PHASE) &&
            !this.value.equals(((ResourceRequest) request).getResourceID())) {
          return false;
View Full Code Here

    if (isNonFacesRequest(request, response))
    {
      return doNonFacesDispatch(request, response);
    } else
    {
      WindowState state = request.getWindowState();
      if (!state.equals(WindowState.MINIMIZED))
      {
        doBridgeDispatch(request, response);
      }
      return true;
    }
View Full Code Here

        }
        else if (param.equals(Bridge.PORTLET_WINDOWSTATE_PARAMETER))
        {
          try
          {
            actionURL.setWindowState(new WindowState(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
        }
        else if (param.equals(Bridge.PORTLET_SECURE_PARAMETER))
        {
          try
          {
            actionURL.setSecure(Boolean.getBoolean(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
        }
        else
        {
          actionURL.setParameter(param, queryStr.getParameter(param));
        }
      }

      // TODO hack to workaround double encoding problem
      url = actionURL.toString();
      url = url.replaceAll("\\&amp\\;", "&");
    }
    else
    { // action - write the viewId to navigational state
      ActionResponse actionResponse = (ActionResponse) getResponse();

      // set request params into navigational states
      Enumeration<String> list = queryStr.getParameterNames();
      while (list.hasMoreElements())
      {
        String param = list.nextElement();
        if (param.equals(Bridge.PORTLET_MODE_PARAMETER))
        {
          try
          {
            actionResponse.setPortletMode(new PortletMode(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            //TODO: Ignoring is probably dangerous here as it means that we are
            //      EITHER using exceptions for flow control (which is extreemly
            //      inefficient) or we should log a message saying what the issue
            //      is.  According to the Javadocs an exception is thrown here if the
            //      portlet mode is not allowed or if sendRedirect has already been
            //      called.  In either case we should log an information type message
            //      here.
            ; // do nothing -- just ignore
          }
        }
        else if (param.equals(Bridge.PORTLET_WINDOWSTATE_PARAMETER))
        {
          try
          {
            actionResponse.setWindowState(new WindowState(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
View Full Code Here

          }
          else if (param.equals(Bridge.PORTLET_WINDOWSTATE_PARAMETER))
          {
            try
            {
              actionURL.setWindowState(new WindowState(queryStr.getParameter(param)));
            }
            catch (Exception e)
            {
              ; // do nothing -- just ignore
            }
          }
          else if (param.equals(Bridge.PORTLET_SECURE_PARAMETER))
          {
            try
            {
              actionURL.setSecure(Boolean.getBoolean(queryStr.getParameter(param)));
            }
            catch (Exception e)
            {
              ; // do nothing -- just ignore
            }
          }
          else
          {
            actionURL.setParameter(param, queryStr.getParameter(param));
          }
        }
      }

      // TODO hack to workaround double encoding problem
      String actionURLStr = actionURL.toString();
      actionURLStr = actionURLStr.replaceAll("\\&amp\\;", "&");

      return actionURLStr;
    }
    else
    { // action - write the viewId to navigational state
      ActionResponse actionResponse = (ActionResponse) getResponse();

      actionResponse.setRenderParameter(ACTION_ID_PARAMETER_NAME, viewId);

      // set other request params (if any) into navigational states
      if (queryStr != null)
      {
        Enumeration<String> list = queryStr.getParameterNames();
        while (list.hasMoreElements())
        {
          String param = list.nextElement();
          if (param.equals(Bridge.PORTLET_MODE_PARAMETER))
          {
            try
            {
              actionResponse.setPortletMode(new PortletMode(queryStr.getParameter(param)));
            }
            catch (Exception e)
            {
              //TODO: Ignoring is probably dangerous here as it means that we are
              //      EITHER using exceptions for flow control (which is extreemly
              //      inefficient) or we should log a message saying what the issue
              //      is.  According to the Javadocs an exception is thrown here if the
              //      portlet mode is not allowed or if sendRedirect has already been
              //      called.  In either case we should log an information type message
              //      here.
              ; // do nothing -- just ignore
            }
          }
          else if (param.equals(Bridge.PORTLET_WINDOWSTATE_PARAMETER))
          {
            try
            {
              actionResponse.setWindowState(new WindowState(queryStr.getParameter(param)));
            }
            catch (Exception e)
            {
              ; // do nothing -- just ignore
            }
View Full Code Here

  {
    String modeDefaultViewId = getDefaultViewId(request, request.getPortletMode());
   
    if (modeDefaultViewId != null)
    {
      WindowState state = request.getWindowState();
      if (!state.equals(WindowState.MINIMIZED))
      {
        doBridgeDispatch(request, response, modeDefaultViewId);
      }
      return true;
    }
View Full Code Here

     * Ensure a custom window state is supported by both the portal and portlet.
     */
    public void testIsCustomWindowStateSupported()
    {
        assertTrue(underTest.isWindowStateSupported("some.id", "a-custom-state"));
        assertTrue(underTest.isWindowStateSupported("some.id", new WindowState("a-custom-state").toString()));
    }
View Full Code Here

     * or the portlet.
     */
    public void testIsNonExistantWindowStateSupported()
    {
        assertFalse(underTest.isWindowStateSupported("some.id", "a-nonexistant-state"));
        assertFalse(underTest.isWindowStateSupported("some.id", new WindowState("a-nonexistant-state").toString()));
    }
View Full Code Here

TOP

Related Classes of javax.portlet.WindowState

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.