org.apache.struts2.portlet.util
Class PortletUrlHelper

java.lang.Object
  extended by org.apache.struts2.portlet.util.PortletUrlHelper

public class PortletUrlHelper
extends java.lang.Object

Helper class for creating Portlet URLs. Portlet URLs are fundamentally different from regular servlet URLs since they never target the application itself; all requests go through the portlet container and must therefore be programatically constructed using the RenderResponse.createActionURL() and RenderResponse.createRenderURL() APIs.


Field Summary
static java.lang.String ENCODING
           
 
Constructor Summary
PortletUrlHelper()
           
 
Method Summary
static java.lang.String buildResourceUrl(java.lang.String value, java.util.Map<java.lang.String,java.lang.Object> params)
          Encode an url to a non Struts action resource, like stylesheet, image or servlet.
static java.lang.String buildUrl(java.lang.String action, java.lang.String namespace, java.lang.String method, java.util.Map params, java.lang.String type, java.lang.String mode, java.lang.String state)
          Create a portlet URL with for the specified action and namespace.
static java.lang.String buildUrl(java.lang.String action, java.lang.String namespace, java.lang.String method, java.util.Map params, java.lang.String scheme, java.lang.String type, java.lang.String portletMode, java.lang.String windowState, boolean includeContext, boolean encodeResult)
          Create a portlet URL with for the specified action and namespace.
static java.util.Map ensureParamsAreStringArrays(java.util.Map<java.lang.String,java.lang.Object> params)
          Will ensure that all entries in params are String arrays, as requried by the setParameters on the PortletURL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENCODING

public static final java.lang.String ENCODING
See Also:
Constant Field Values
Constructor Detail

PortletUrlHelper

public PortletUrlHelper()
Method Detail

buildUrl

public static java.lang.String buildUrl(java.lang.String action,
                                        java.lang.String namespace,
                                        java.lang.String method,
                                        java.util.Map params,
                                        java.lang.String type,
                                        java.lang.String mode,
                                        java.lang.String state)
Create a portlet URL with for the specified action and namespace.

Parameters:
action - The action the URL should invoke.
namespace - The namespace of the action to invoke.
method - The method of the action to invoke.
params - The parameters of the URL.
type - The type of the url, either action or render
mode - The PortletMode of the URL.
state - The WindowState of the URL.
Returns:
The URL String.

buildUrl

public static java.lang.String buildUrl(java.lang.String action,
                                        java.lang.String namespace,
                                        java.lang.String method,
                                        java.util.Map params,
                                        java.lang.String scheme,
                                        java.lang.String type,
                                        java.lang.String portletMode,
                                        java.lang.String windowState,
                                        boolean includeContext,
                                        boolean encodeResult)
Create a portlet URL with for the specified action and namespace.

See Also:
#buildUrl(String, String, Map, String, String, String)

buildResourceUrl

public static java.lang.String buildResourceUrl(java.lang.String value,
                                                java.util.Map<java.lang.String,java.lang.Object> params)
Encode an url to a non Struts action resource, like stylesheet, image or servlet.

Parameters:
value -
Returns:
encoded url to non Struts action resources.

ensureParamsAreStringArrays

public static java.util.Map ensureParamsAreStringArrays(java.util.Map<java.lang.String,java.lang.Object> params)
Will ensure that all entries in params are String arrays, as requried by the setParameters on the PortletURL.

Parameters:
params - The parameters to the URL.
Returns:
A Map with all parameters as String arrays.


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.