Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts2.portlet.util
Class PortletUrlHelper

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

    public class PortletUrlHelper

extends 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 String` | `ENCODING`
`private static Log` | `LOG`

Constructor Summary
`PortletUrlHelper()`

Method Summary
`static String` | `buildResourceUrl(String value, Map params)` Encode an url to a non Struts action resource, like stylesheet, image or servlet.
`static String` | `buildUrl(String action, String namespace, Map params, String type, String mode, String state)` Create a portlet URL with for the specified action and namespace.
`static String` | `buildUrl(String action, String namespace, Map params, String scheme, String type, String portletMode, String windowState, boolean includeContext, boolean encodeResult)` Create a portlet URL with for the specified action and namespace.
`static Map` | `ensureParamsAreStringArrays(Map params)` Will ensure that all entries in `params` are String arrays, as requried by the setParameters on the PortletURL.
`private static javax.portlet.PortletMode` | `getPortletMode(javax.portlet.RenderRequest portletReq, String portletMode)` Convert the given String to a PortletMode object.
`private static javax.portlet.WindowState` | `getWindowState(javax.portlet.RenderRequest portletReq, String windowState)` Convert the given String to a WindowState object.
`private static String` | `prependNamespace(String namespace, String portletMode)` Prepend the namespace configuration for the specified namespace and PortletMode.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ENCODING

    public static final String ENCODING

See Also:
  Constant Field Values

### LOG

    private static final Log LOG

Constructor Detail

### PortletUrlHelper

    public PortletUrlHelper()

Method Detail

### buildUrl

    public static String buildUrl(String action,
                                  String namespace,
                                  Map params,
                                  String type,
                                  String mode,
                                  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.
    `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 String buildUrl(String action,
                                  String namespace,
                                  Map params,
                                  String scheme,
                                  String type,
                                  String portletMode,
                                  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)`

### prependNamespace

    private static String prependNamespace(String namespace,
                                           String portletMode)

  Prepend the namespace configuration for the specified namespace and PortletMode.

  Parameters:
    `namespace` - The base namespace.
    `portletMode` - The PortletMode.
  Returns:
    prepended namespace.

### buildResourceUrl

    public static String buildResourceUrl(String value,
                                          Map 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 Map ensureParamsAreStringArrays(Map 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.

### getWindowState

    private static javax.portlet.WindowState getWindowState(javax.portlet.RenderRequest portletReq,
                                                            String windowState)

  Convert the given String to a WindowState object.

  Parameters:
    `portletReq` - The RenderRequest.
    `windowState` - The WindowState as a String.
  Returns:
    The WindowState that mathces the `windowState` String, or if the Sring is blank, the current WindowState.

### getPortletMode

    private static javax.portlet.PortletMode getPortletMode(javax.portlet.RenderRequest portletReq,
                                                            String portletMode)

  Convert the given String to a PortletMode object.

  Parameters:
    `portletReq` - The RenderRequest.
    `portletMode` - The PortletMode as a String.
  Returns:
    The PortletMode that mathces the `portletMode` String, or if the Sring is blank, the current PortletMode.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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