Package javax.portlet

Examples of javax.portlet.PortletURL


    }
   
    public void testGetURLUnencoding()
    {
        IRequestCycle cycle = newCycle();
        PortletURL url = new PortletURLFixture("this=foo&that=bar");

        MockControl control = newControl(QueryParameterMap.class);
        QueryParameterMap parameters = (QueryParameterMap) control.getMock();

        parameters.getParameterNames();
View Full Code Here


    }   

    public void testGetURLIncludeParameters()
    {
        IRequestCycle cycle = newCycle();
        PortletURL url = newPortletURL();

        MockControl control = newControl(QueryParameterMap.class);
        QueryParameterMap parameters = (QueryParameterMap) control.getMock();

        String[] values =
        { "Fred", "Barney" };

        parameters.getParameterNames();
        control.setReturnValue(new String[]
        { "bedrock" });
        parameters.getParameterValues("bedrock");
        control.setReturnValue(values);

        url.setParameter("bedrock", values);

        replayControls();

        ILink link = new PortletLink(cycle, url, parameters, false);

        assertEquals(url.toString(), link.getURL());

        verifyControls();
    }
View Full Code Here

        verifyControls();
    }

    public void testGetURLStatefulWithAnchor()
    {
        PortletURL url = newPortletURL();

        MockControl cyclec = newControl(IRequestCycle.class);
        IRequestCycle cycle = (IRequestCycle) cyclec.getMock();

        cycle.encodeURL(url.toString());
        cyclec.setReturnValue("/encoded-url");

        QueryParameterMap parameters = newParameters();

        replayControls();
View Full Code Here

            action = sb.append(action).toString();
            LOG.debug("Resulting actionPath: " + action);
        }
        params.put(PortletActionConstants.ACTION_PARAM, new String[] { action });

        PortletURL url = null;
        if ("action".equalsIgnoreCase(type)) {
            LOG.debug("Creating action url");
            url = response.createActionURL();
        } else {
            LOG.debug("Creating render url");
            url = response.createRenderURL();
        }

        params.put(PortletActionConstants.MODE_PARAM, portletMode);
        url.setParameters(ensureParamsAreStringArrays(params));

        if ("HTTPS".equalsIgnoreCase(scheme)) {
            try {
                url.setSecure(true);
            } catch (PortletSecurityException e) {
                LOG.error("Cannot set scheme to https", e);
            }
        }
        try {
            url.setPortletMode(getPortletMode(request, portletMode));
            url.setWindowState(getWindowState(request, windowState));
        } catch (Exception e) {
            LOG.error("Unable to set mode or state:" + e.getMessage(), e);
        }
        result = url.toString();
        // TEMP BUG-WORKAROUND FOR DOUBLE ESCAPING OF AMPERSAND
        if(result.indexOf("&") >= 0) {
            result = StringUtils.replace(result, "&", "&");
        }
        return result;
View Full Code Here

    public String getActionURL(FacesContext context, String viewId)
    {
        if (PortletUtil.isRenderResponse(context))
        {
            RenderResponse response = (RenderResponse) context.getExternalContext().getResponse();
            PortletURL url = response.createActionURL();
            url.setParameter(MyFacesGenericPortlet.VIEW_ID, viewId);
            return url.toString();
        }
        return super.getActionURL(context, viewId);
    }
View Full Code Here

     * @see org.displaytag.util.Href#toString()
     */
    @Override
    public String toString()
    {
        final PortletURL url;
        if (this.isAction())
        {
            url = this.renderResponse.createActionURL();
        }
        else
        {
            url = this.renderResponse.createRenderURL();
        }

        if (this.isRequestedSecure())
        {
            try
            {
                url.setSecure(true);
            }
            catch (PortletSecurityException pse)
            {
                throw new RuntimeException("Creating secure PortletURL Failed.", pse);
            }
        }

        if (this.getRequestedMode() != null)
        {
            try
            {
                url.setPortletMode(this.getRequestedMode());
            }
            catch (PortletModeException pme)
            {
                final IllegalStateException ise = new IllegalStateException("Requested PortletMode='"
                    + this.getRequestedMode()
                    + "' could not be set.");
                ise.initCause(pme);
                throw ise;
            }
        }

        if (this.getRequestedState() != null)
        {
            try
            {
                url.setWindowState(this.getRequestedState());
            }
            catch (WindowStateException wse)
            {
                final IllegalStateException ise = new IllegalStateException("Requested WindowState='"
                    + this.getRequestedState()
                    + "' could not be set.");
                ise.initCause(wse);
                throw ise;
            }
        }

        for (final Iterator<Entry<String, String[]>> paramItr = this.parameters.entrySet().iterator(); paramItr
            .hasNext();)
        {
            final Entry<String, String[]> entry = paramItr.next();

            final String name = entry.getKey();
            final String[] value = entry.getValue();

            url.setParameter(name, value);
        }

        if (this.getAnchor() == null)
        {
            return url.toString();
        }
        else
        {
            return url.toString() + "#" + this.getAnchor();
        }
    }
View Full Code Here

  public String getContentType() {
    return this.contentType;
  }

  public PortletURL createRenderURL() {
    PortletURL url = new MockPortletURL(getPortalContext(), MockPortletURL.URL_TYPE_RENDER);
    return url;
  }
View Full Code Here

    PortletURL url = new MockPortletURL(getPortalContext(), MockPortletURL.URL_TYPE_RENDER);
    return url;
  }

  public PortletURL createActionURL() {
    PortletURL url = new MockPortletURL(getPortalContext(), MockPortletURL.URL_TYPE_ACTION);
    return url;
  }
View Full Code Here

    if (path != null)
    {
      path = getQualifiedPath(path);
      if (renderResponse != null)
      {
        PortletURL url = renderResponse.createActionURL();
        url.setParameter(wicketUrlPortletParameter, path.toString());
        path = saveLastEncodedUrl(url.toString(), path.toString());
      }
    }
    return path;
  }
View Full Code Here

    if (path != null)
    {
      path = getQualifiedPath(path);
      if (renderResponse != null)
      {
        PortletURL url = renderResponse.createRenderURL();
        url.setParameter(wicketUrlPortletParameter +
          portletRequest.getPortletMode().toString(), path.toString());
        path = saveLastEncodedUrl(url.toString(), path.toString());
      }
    }
    return path;
  }
View Full Code Here

TOP

Related Classes of javax.portlet.PortletURL

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.