Overview | Package | Class | Tree | Deprecated | Index | Help
| OracleAS PDK for Java 9.0.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.portal.provider.v2.url
Class UrlUtils

    java.lang.Object
      |
      +--oracle.portal.provider.v2.url.UrlUtils

public class UrlUtils
extends java.lang.Object

Contains utility methods and constants for urls.

Field Summary
`static int` | `BACK_LINK`
`static int` | `DESIGN_LINK`
`static int` | `EVENT_LINK`
`static int` | `LOGIN_LINK`
`static int` | `PAGE_LINK`
`static int` | `REQUEST_LINK`

Constructor Summary
`UrlUtils()`

Method Summary
`static java.lang.String` | `absoluteLink(PortletRenderRequest pr, java.lang.String relativePath)` Returns a fully-qualified URI for a path relative to the current request.
`static java.lang.String` | `constructDetailHTMLLink(PortletRenderRequest pr, oracle.portal.utils.NameValue[] params, java.lang.String displayText, java.lang.String otherHtmlAttributes, boolean encodeParams, boolean replaceParams)` Create a parameterized link for a portlet detail page By default, a portlet can have a single "detail" page that allows you to view portlet information in a full-screen mode.
`static java.lang.String` | `constructHelpHTMLLink(PortletRenderRequest pr, oracle.portal.utils.NameValue[] params, java.lang.String displayText, java.lang.String otherHtmlAttributes, boolean encodeParams, boolean replaceParams)` Create a parameterized link for a portlet help page By default, a portlet can have a single "help" page that allows you to display help information for your portlet in a full-screen mode.
`static java.lang.String` | `constructHTMLLink(PortletRenderRequest pr, int linkType, java.lang.String displayText, java.lang.String otherHtmlAttributes, oracle.portal.utils.NameValue[] params, boolean encodeParams, boolean replaceParams)` Generic utility to build a HTML link.
`static java.lang.String` | `constructJavascriptLink(PortletRenderRequest pr, int linkType, oracle.portal.utils.NameValue[] params, boolean encodeParams, boolean replaceParams)` Generic utility to generate a javascript call that append parameters to a link.
`static java.lang.String` | `constructLink(PortletRenderRequest pr, int linkType, oracle.portal.utils.NameValue[] params, boolean encodeParams, boolean replaceParams)` Generic utility to append parameters to a link.
`static java.lang.String` | `constructLink(PortletRenderRequest pr, java.lang.String link, oracle.portal.utils.NameValue[] params, boolean encodeParams, boolean replaceParams)` Generic utility to append parameters to a link.
`static java.lang.String` | `emitHiddenField(java.lang.String name, java.lang.String value)` Utility to emit a single HTML hidden field with a specified name and value.
`static java.lang.String` | `encodeParameter(java.lang.String param, PortletRenderRequest pr)` Encodes a parameter for inclusion in a URL.
`static java.lang.String` | `htmlFormActionLink(PortletRenderRequest pr, int linkType)` Transforms one of the various URIs known to the request into the appropriate form to be used in a FORM action tag.
`static java.lang.String` | `htmlFormActionLink(java.lang.String ref)` Transforms a URI into the appropriate form to be used in a FORM action tag.
`static java.lang.String` | `htmlFormHiddenFields(PortletRenderRequest pr, int linkType)` Enables the parameters in the query string to be POSTED when the form is submited.
`static java.lang.String` | `htmlFormHiddenFields(PortletRenderRequest pr, int linkType, java.lang.String formName)` Enables the parameters in the query string to be POSTED when the form is submited.
`static java.lang.String` | `htmlFormHiddenFields(java.lang.String ref)` Encodes the parameters in the query string of the passed URL as hidden form fields.
`static java.lang.String` | `htmlFormName(PortletRenderRequest pr, java.lang.String formWithinPortletName)` Generic utility to construct a unique name for a form on a portlet page The form name is "f" + portletRef + formWithinPortletName eg f73_35680_73_35673_35673
`static java.lang.String` | `parameterizeLink(PortletRenderRequest pr, int linkType, java.lang.String queryString)` Adds new parameters to an existing link.
`static java.lang.String` | `parameterizeLink(java.lang.String link, java.lang.String queryString)` Adds new parameters to an existing link.

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

Field Detail

### PAGE_LINK

    public static final int PAGE_LINK

See Also:
  Constant Field Values

### DESIGN_LINK

    public static final int DESIGN_LINK

See Also:
  Constant Field Values

### REQUEST_LINK

    public static final int REQUEST_LINK

See Also:
  Constant Field Values

### LOGIN_LINK

    public static final int LOGIN_LINK

See Also:
  Constant Field Values

### BACK_LINK

    public static final int BACK_LINK

See Also:
  Constant Field Values

### EVENT_LINK

    public static final int EVENT_LINK

See Also:
  Constant Field Values

Constructor Detail

### UrlUtils

    public UrlUtils()

Method Detail

### constructHTMLLink

    public static java.lang.String constructHTMLLink(PortletRenderRequest pr,
                                                     int linkType,
                                                     java.lang.String displayText,
                                                     java.lang.String otherHtmlAttributes,
                                                     oracle.portal.utils.NameValue[] params,
                                                     boolean encodeParams,
                                                     boolean replaceParams)
                                              throws java.lang.IllegalArgumentException,
                                                     java.io.IOException

  Generic utility to build a HTML link. If UrlRewriting is being used it will generate `<A onclick=javascriptMethod(params, replaceParams) otherHtmlAttributes>displayText</A>` otherwise `<A href=link+params otherHtmlAttributes>displayText </A>` either way the generated HTML links behave in the same way.

  Parameters:
    `pr` - render request
    `linkType` - the link to use. Constants representing these types are defined in UrlUtils.
    `displayText` - text displayed for this link
    `otherHtmlAttributes` - other attributes for the HTML link. No need for pre or end spaces in the string.
    `params` - array of NameValue objects representing the parameters
    `encodeParams` - flag indicating whether parameter names and values should be encoded
    `replaceParams` - flag indicating whether parameters contained in the params array should replace existing parameters of the same name. true = replace or overwrite existing parameters. false = simply add parameters
  Returns:
    A HTML link eg `<A ...>displayText</A>`
    `java.lang.IllegalArgumentException`
    `java.io.IOException`

### constructJavascriptLink

    public static java.lang.String constructJavascriptLink(PortletRenderRequest pr,
                                                           int linkType,
                                                           oracle.portal.utils.NameValue[] params,
                                                           boolean encodeParams,
                                                           boolean replaceParams)
                                                    throws java.lang.IllegalArgumentException,
                                                           java.io.IOException

  Generic utility to generate a javascript call that append parameters to a link.

  Parameters:
    `pr` - render request
    `linkType` - the link to use. Constants representing these types are defined in UrlUtils.
    `params` - array of NameValue objects representing the parameters
    `encodeParams` - flag indicating whether parameter names and values should be encoded
    `replaceParams` - flag indicating whether parameters contained in the params array should replace existing parameters of the same name. true = replace or overwrite existing parameters. false = simply add parameters
  Returns:
    call to a javascript function that will append the parameters to a link and call that link
    `java.lang.IllegalArgumentException`
    `java.io.IOException`

### htmlFormName

    public static java.lang.String htmlFormName(PortletRenderRequest pr,
                                                java.lang.String formWithinPortletName)

  Generic utility to construct a unique name for a form on a portlet page The form name is "f" + portletRef + formWithinPortletName eg f73_35680_73_35673_35673

  Parameters:
    `pr` - render request
    `formWithinPortletName` - There may be more than one form per portlet this name is used to destinguish between different forms within a portlet. This may be null or empty if there is only one form in a portlet.
  Returns:
    A form name that is unique on a portal page

### constructLink

    public static java.lang.String constructLink(PortletRenderRequest pr,
                                                 int linkType,
                                                 oracle.portal.utils.NameValue[] params,
                                                 boolean encodeParams,
                                                 boolean replaceParams)
                                          throws java.lang.IllegalArgumentException,
                                                 java.io.IOException

  Generic utility to append parameters to a link.

  Parameters:
    `pr` - render request
    `linkType` - the link to use. Constants representing these types are defined in UrlUtils.
    `params` - array of NameValue objects representing the parameters
    `encodeParams` - flag indicating whether parameter names and values should be encoded
    `replaceParams` - flag indicating whether parameters contained in the params array should replace existing parameters of the same name. true = replace or overwrite existing parameters. false = simply add parameters
  Returns:
    original link with additional parameters or a javascript call to the original link with additional parameters.
    `java.lang.IllegalArgumentException`
    `java.io.IOException`

### constructLink

    public static java.lang.String constructLink(PortletRenderRequest pr,
                                                 java.lang.String link,
                                                 oracle.portal.utils.NameValue[] params,
                                                 boolean encodeParams,
                                                 boolean replaceParams)
                                          throws java.lang.IllegalArgumentException,
                                                 java.io.IOException

  Generic utility to append parameters to a link.

  Parameters:
    `pr` - render request
    `link` - the link to be parameterized
    `params` - array of NameValue objects representing the parameters
    `encodeParams` - flag indicating whether parameter names and values should be encoded
    `replaceParams` - flag indicating whether parameters contained in the params array should replace existing parameters of the same name. true = replace or overwrite existing parameters. false = simply add parameters
  Returns:
    original link with additional parameters.
    `java.lang.IllegalArgumentException`
    `java.io.IOException`

### htmlFormHiddenFields

    public static java.lang.String htmlFormHiddenFields(PortletRenderRequest pr,
                                                        int linkType)
                                                 throws java.lang.IllegalArgumentException

  Enables the parameters in the query string to be POSTED when the form is submited. This code generates hidden parameters when rewriteUrls is false or by setting the action value of the form to be the whole url when rewriteUrls is true. This function can only be used if there are only one form on a portlet. This utility method either generates the hidden field tags from this that will alter the forms action to be the URL and returns the javascript as a String.

  Parameters:
    `pr` - the request
    `linkType` - the link to use. Constants representing these types are defined in UrlUtils.
    `java.lang.IllegalArgumentException`

### htmlFormHiddenFields

    public static java.lang.String htmlFormHiddenFields(PortletRenderRequest pr,
                                                        int linkType,
                                                        java.lang.String formName)
                                                 throws java.lang.IllegalArgumentException

  Enables the parameters in the query string to be POSTED when the form is submited. This code generates hidden parameters when rewriteUrls is false or by setting the action value of the form to be the whole url when rewriteUrls is true. This utility method either generates the hidden field tags from this URL and returns them as a String. Or generates a javascript fragment that will alter the forms action to be the URL and returns the javascript as a String.

  Parameters:
    `pr` - the request
    `linkType` - the link to use. Constants representing these types are defined in PortletRendererUtil.
    `formName` - unique name of a form within a page. Use htmlFormName() to generate this name.
    `java.lang.IllegalArgumentException`

### htmlFormHiddenFields

    public static java.lang.String htmlFormHiddenFields(java.lang.String ref)

  Encodes the parameters in the query string of the passed URL as hidden form fields. When "linking" back to the portlet via a form, the URI parameters must be added as hidden fields. These parameters are found in the querystring of your URI. This utility method generates the hidden field tags from this URL and returns them as a String.

  Parameters:
    `ref` - the URI

### emitHiddenField

    public static java.lang.String emitHiddenField(java.lang.String name,
                                                   java.lang.String value)

  Utility to emit a single HTML hidden field with a specified name and value.

  Parameters:
    `name` - the encoded name of the hidden field
    `value` - the encoded value of the hidden field
  Returns:
    a string containing the HTML hidden field markup

### encodeParameter

    public static java.lang.String encodeParameter(java.lang.String param,
                                                   PortletRenderRequest pr)
                                            throws java.io.IOException

  Encodes a parameter for inclusion in a URL. Parameter is encoded using the same character set that was used when the portal encoded the request parameters. The character sets must be the same so that parameters that may be intended for another portlet implemented in pl/sql can decode them correctly.

  Parameters:
    `param` - the parameter to be encoded
    `pr` - PortletRenderRequest object for this request
  Returns:
    encoded parameter, suitable for inclusion in a URL
    `java.io.IOException`

### parameterizeLink

    public static java.lang.String parameterizeLink(PortletRenderRequest pr,
                                                    int linkType,
                                                    java.lang.String queryString)
                                             throws java.lang.IllegalArgumentException

  Adds new parameters to an existing link. There are various links available to the portlet for use while rendering its response. This utility method conveniently adds parameters to one of these links. The method overrides existing parameters is they exist. I.e. existing (queryString) parameters will be removed if it duplicates (by name) a new parameter.

  Parameters:
    `pr` - the request.
    `linkType` - the id for the link we want to parameterize. ID constants are defined IN UrlUtils
    `queryString` - the parameters to be added in properly encodes queryString form. the String should begin with the first parameter name not a "?".
    `java.lang.IllegalArgumentException`

### parameterizeLink

    public static java.lang.String parameterizeLink(java.lang.String link,
                                                    java.lang.String queryString)

  Adds new parameters to an existing link. There are various links available to the portlet for use while rendering its response. This utility method conveniently adds parameters to one of these links. The method overrides existing parameters is they exist. I.e. existing (queryString) parameters will be removed if it duplicates (by name) a new parameter.

  Parameters:
    `link` - the link to add parameters to.
    `queryString` - the parameters to be added in properly encodes queryString form. The String should begin with the first parameter name not a "?".

### absoluteLink

    public static java.lang.String absoluteLink(PortletRenderRequest pr,
                                                java.lang.String relativePath)

  Returns a fully-qualified URI for a path relative to the current request. As Web (Http) Portlets are called indirectly via the portal the client browser's current path is to the portal not to the portlet. Because of this all HREFs must be expressed using fully qualified paths vs. the traditional relative paths. This method allows you to properly encode a relative path. Note: this is equivalent to portletLink(). I.e the method only differs when the renderer is reached via a "forward" as is the case with a servlet or JSP.

  Parameters:
    `pr` - the PortletRenderRequest
    `relativePath` - the path we want to make absolute

### htmlFormActionLink

    public static java.lang.String htmlFormActionLink(java.lang.String ref)

  Transforms a URI into the appropriate form to be used in a FORM action tag.

  Parameters:
    `ref` - the URI to be transformed

### htmlFormActionLink

    public static java.lang.String htmlFormActionLink(PortletRenderRequest pr,
                                                      int linkType)
                                               throws java.lang.IllegalArgumentException

  Transforms one of the various URIs known to the request into the appropriate form to be used in a FORM action tag.

  Parameters:
    `pr` - the PortletRenderRequest
    `linkType` - the link in this request that should be used.
    `java.lang.IllegalArgumentException`

### constructDetailHTMLLink

    public static java.lang.String constructDetailHTMLLink(PortletRenderRequest pr,
                                                           oracle.portal.utils.NameValue[] params,
                                                           java.lang.String displayText,
                                                           java.lang.String otherHtmlAttributes,
                                                           boolean encodeParams,
                                                           boolean replaceParams)
                                                    throws PortletException,
                                                           java.io.IOException

  Create a parameterized link for a portlet detail page By default, a portlet can have a single "detail" page that allows you to view portlet information in a full-screen mode. This methods allows you to create many "detail" links with different sets of parameters. You can use these links anywhere in the body of your portlet to create a portlet that has more than one detail page. When a user clicks on a detail link within your portlet, your portlet will be called and the renderer associated with "detail" mode will be invoked. You can use the parameters you add to the detail link to determine which "detail page" the renderer should emit.

  Parameters:
    `pr` - the render request.
    `params` - an array of NameValue objects representing the parameter names and associated values. Names cannot be NULL
    `displayText` - text displayed for this link
    `otherHtmlAttributes` - other attributes for the HTML link. No need for pre or end spaces in the string.
    `encodeParams` - flag indicating whether the parameter names and values should be URL encoded using the multibyte URL encoder.
    `replaceParams` - flag indicating whether parameters contained in the params array should replace existing parameters of the same name. true = replace or overwrite existing parameters. false = simply add parameters
    `PortletException`
    `java.io.IOException`

### constructHelpHTMLLink

    public static java.lang.String constructHelpHTMLLink(PortletRenderRequest pr,
                                                         oracle.portal.utils.NameValue[] params,
                                                         java.lang.String displayText,
                                                         java.lang.String otherHtmlAttributes,
                                                         boolean encodeParams,
                                                         boolean replaceParams)
                                                  throws PortletException,
                                                         java.io.IOException

  Create a parameterized link for a portlet help page By default, a portlet can have a single "help" page that allows you to display help information for your portlet in a full-screen mode. This methods allows you to create many "help" links with different sets of parameters. You can use these links anywhere in the body of your portlet to create context sensitive help pages. When a user clicks on a help link within your portlet, your portlet will be called and the renderer associated with "help" mode will be invoked. You can use the parameters you add to the detail link to determine which "help page" the renderer should emit.

  Parameters:
    `pr` - the render request.
    `params` - an array of NameValue objects representing the parameter names and associated values. Names cannot be NULL
    `displayText` - text displayed for this link
    `otherHtmlAttributes` - other attributes for the HTML link. No need for pre or end spaces in the string.
    `encodeParams` - flag indicating whether the parameter names and values should be URL encoded using the multibyte URL encoder.
    `replaceParams` - flag indicating whether parameters contained in the params array should replace existing parameters of the same name. true = replace or overwrite existing parameters. false = simply add parameters
    `PortletException`
    `java.io.IOException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| OracleAS PDK for Java 9.0.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2002,2003 Oracle Corporation. All Rights Reserved.