Package org.apache.pluto.driver.url

Examples of org.apache.pluto.driver.url.PortalURLParameter


              value = st.nextToken();
            }

            // Defect PLUTO-361
            // ADDED
            PortalURLParameter param = decodeParameter( token, value );
            if( param != null )
            {
              portalURL.addParameter( param );
            }
            // REMOVED
View Full Code Here


        StringBuffer query = new StringBuffer("?");
        boolean firstParam = true;
        for (Iterator it = portalURL.getParameters().iterator();
            it.hasNext(); ) {

          PortalURLParameter param = (PortalURLParameter) it.next();

            // Encode action params in the query appended at the end of the URL.
            if (portalURL.getActionWindow() != null
                && portalURL.getActionWindow().equals(param.getWindowId())) {
                for (int i = 0; i < param.getValues().length; i++) {
                    // FIX for PLUTO-247
                    if ( firstParam ) {
                        firstParam = false;
                    } else {
                        query.append("&");
                    }
                    query.append(encodeQueryParam(param.getName())).append("=")
                        .append(encodeQueryParam(param.getValues()[i]));
                }
            }

            // Encode render params as a part of the URL.
            else if (param.getValues() != null
                && param.getValues().length > 0) {
                String valueString = encodeMultiValues(param.getValues());
                if (valueString.length() > 0) {
                  buffer.append("/").append(
                      encodeControlParameter(RENDER_PARAM, param.getWindowId(),
                               param.getName()));
                  buffer.append("/").append(valueString);
                }
            }
        }
View Full Code Here

        // Split multiple values into a value array.
        String[] paramValues = value.split(VALUE_DELIM);

        // Construct portal URL parameter and return.
        return new PortalURLParameter(windowId, paramName, paramValues);
    }
View Full Code Here

     * @param windowId  the window ID.
     */
    public void clearParameters(String windowId) {
      for (Iterator it = parameters.entrySet().iterator(); it.hasNext(); ) {
            Map.Entry entry = (Map.Entry) it.next();
            PortalURLParameter param = (PortalURLParameter) entry.getValue();
            if (param.getWindowId().equals(windowId)) {
              it.remove();
            }
        }
    }
View Full Code Here

     * @param windowId  the window ID.
     */
    public void clearParameters(String windowId) {
      for (Iterator it = parameters.entrySet().iterator(); it.hasNext(); ) {
            Map.Entry entry = (Map.Entry) it.next();
            PortalURLParameter param = (PortalURLParameter) entry.getValue();
            if (param.getWindowId().equals(windowId)) {
              it.remove();
            }
        }
    }
View Full Code Here

        assertEquals( path, underTest.getRenderPath() );
    }

    public void testAddParameter()
    {
        final PortalURLParameter paramOne = PortalURLParameterFactory.createPortalURLParameter();      
        underTest.addParameter( paramOne );
       
        final Collection params = underTest.getParameters();
        assertNotNull( params );
        assertEquals( 1, params.size() );
        assertTrue( params.contains( paramOne ) );
       
        final PortalURLParameter paramTwo = (PortalURLParameter)params.iterator().next();
        assertEquals( paramOne.getName(), paramTwo.getName() );
        assertEquals( paramOne.getValues()[0], paramTwo.getValues()[0] );
        assertEquals( paramOne.getWindowId(), paramTwo.getWindowId() );
    }
View Full Code Here

        assertEquals( paramOne.getWindowId(), paramTwo.getWindowId() );
    }
   
    public void testAddParameters()
    {
        final PortalURLParameter paramOne = PortalURLParameterFactory.createPortalURLParameter();
        final PortalURLParameter paramTwo = PortalURLParameterFactory.createPortalURLParameter();
       
        underTest.addParameter( paramOne );
        underTest.addParameter( paramTwo );
       
        final Collection params = underTest.getParameters();
        assertNotNull( params );
        assertEquals( 2, params.size() );
        assertTrue( params.contains( paramOne ) );
        assertTrue( params.contains( paramTwo ) );
       
        int matchCount = 0;
        Iterator itr = params.iterator();
        while ( itr.hasNext() )
        {           
            final PortalURLParameter param = (PortalURLParameter) itr.next();
            final String name = param.getName();
            final String value = param.getValues()[0];
            final String windowId = param.getWindowId();           
            assertNotNull( name );
            assertNotNull( value );           
            assertNotNull( windowId );
           
            PortalURLParameter expected = null;
            if ( windowId.equals( paramOne.getWindowId() ) )
            {
                expected = paramOne;
                matchCount++;
                itr.remove();
            }
           
            if ( windowId.equals( paramTwo.getWindowId() ) )
            {
                expected = paramTwo;
                matchCount++;
                itr.remove();
            }
           
            assertNotNull( expected );                           
            assertEquals( expected.getName(), name );
            assertEquals( expected.getValues()[0], value );           
        }
       
        assertEquals( 2, matchCount );
    }
View Full Code Here

    }

    public void testGetParameters()
    {
        assertTrue( underTest.getParameters().isEmpty() );
        final PortalURLParameter expected = PortalURLParameterFactory.createPortalURLParameter();
        underTest.addParameter( expected );
        final Collection params = underTest.getParameters();
        assertNotNull( params );
        assertEquals( 1, params.size() );
        final PortalURLParameter param = (PortalURLParameter) params.iterator().next();
        assertEquals( expected.getName(), param.getName() );
        assertEquals( expected.getValues()[0], param.getValues()[0] );
        assertEquals( expected.getWindowId(), param.getWindowId() );
    }
View Full Code Here

        assertEquals( expected, state );
    }

    public void testClearParameters()
    {
        final PortalURLParameter param = PortalURLParameterFactory.createPortalURLParameter();       
        assertTrue( underTest.getParameters().isEmpty() );       
        underTest.addParameter( param );
        assertEquals( 1, underTest.getParameters().size() );
        underTest.clearParameters( param.getWindowId() );
        assertTrue( underTest.getParameters().isEmpty() );
    }
View Full Code Here

    public void testClone()
    {
        final PortletMode mode = PortletMode.VIEW;
        final WindowState state = WindowState.MAXIMIZED;
        final PortalURLParameter param = PortalURLParameterFactory.createPortalURLParameter();
        final String renderPath = "foo";
        final String actionWin = param.getWindowId();
      
        // set the state of the portlet url
        underTest.setActionWindow( actionWin );
        underTest.setPortletMode( actionWin, mode );
        underTest.setRenderPath( renderPath );
View Full Code Here

TOP

Related Classes of org.apache.pluto.driver.url.PortalURLParameter

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.