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.jasig.portal.utils
Class URLUtil

    java.lang.Object
      org.jasig.portal.utils.URLUtil

    public class URLUtil

extends java.lang.Object

The URLUtil class offers static helper methods for manipulating the request parameters and URLs of both HTTP GET and HTTP POST requests and performing redirections based on the new parameters and URLs. and request parameters.

Version:
  $Revision: 1.10 $
Author:
  Andreas Christoforides, achristoforides@unicon.net, Nick Bolton, nbolton@unicon.net

Field Summary
`static java.lang.String` | `HTTP_GET_REQUEST`
`static java.lang.String` | `HTTP_POST_REQUEST`
`private static org.apache.commons.logging.Log` | `log`
`static int` | `REDIRECT_URL_LIMIT`

Constructor Summary
`URLUtil()`

Method Summary
`private static void` | `buildHeader(javax.servlet.http.HttpServletRequest req, java.net.HttpURLConnection uconn)`
`private static java.lang.String` | `buildRequestParams(javax.servlet.http.HttpServletRequest req, java.lang.String[] ignoreParams)` Uses an HttpServletRequest object and a String array that contains the names of parameters to be ignored to construct a filtered name-value pair string.
`private static UPFileSpec` | `buildUPFileSpec(java.lang.String targetNodeId, java.lang.String extras, boolean asRoot)` Constructs a generic UPFileSpec object using the specified target node id.
`private static boolean` | `parameterExistsIn(java.lang.String param, java.lang.String[] params)` Determines if the specified parameter exists within the specified String array.
`static void` | `redirect(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, java.lang.String targetNodeId, boolean asRoot, java.lang.String[] ignoreParams, java.lang.String charset)` Performs a redirect for both HTTP GET and HTTP POST requests based on the the specified target channel and parameters to be ignored.
`static void` | `redirectGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, UPFileSpec up, java.lang.String[] ignoreParams)` Performs a HTTP GET redirect using the specified UPFileSpec and parameters to be ignored.
`static void` | `redirectPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, UPFileSpec up, java.lang.String[] ignoreParams, java.lang.String charset)` Performs a HTTP POST redirect using the specified UPFileSpec and parameters to be ignored.

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

Field Detail

### log

    private static final org.apache.commons.logging.Log log

### REDIRECT_URL_LIMIT

    public static final int REDIRECT_URL_LIMIT

See Also:
  Constant Field Values

### HTTP_GET_REQUEST

    public static final java.lang.String HTTP_GET_REQUEST

See Also:
  Constant Field Values

### HTTP_POST_REQUEST

    public static final java.lang.String HTTP_POST_REQUEST

See Also:
  Constant Field Values

Constructor Detail

### URLUtil

    public URLUtil()

Method Detail

### redirect

    public static void redirect(javax.servlet.http.HttpServletRequest req,
                                javax.servlet.http.HttpServletResponse res,
                                java.lang.String targetNodeId,
                                boolean asRoot,
                                java.lang.String[] ignoreParams,
                                java.lang.String charset)
                         throws PortalException

  Performs a redirect for both HTTP GET and HTTP POST requests based on the the specified target channel and parameters to be ignored.

  Parameters:
    `req` - An HttpServletRequest object.
    `res` - An HttpServletResponse object.
    `targetNodeId` - The target node Id of a channel.
    `ignoreParams` - An array of String objects containing the parameters to be ignored.
  Throws:
    `PortalException`

### buildRequestParams

    private static java.lang.String buildRequestParams(javax.servlet.http.HttpServletRequest req,
                                                       java.lang.String[] ignoreParams)

  Uses an HttpServletRequest object and a String array that contains the names of parameters to be ignored to construct a filtered name-value pair string.

  Parameters:
    `req` - A HttpServletRequest object.
    `ignoreParams` - An array of String objects representing the parameters to be ignored.
  Returns:
    A String of name-value pairs representing a query string. .

### parameterExistsIn

    private static boolean parameterExistsIn(java.lang.String param,
                                             java.lang.String[] params)

  Determines if the specified parameter exists within the specified String array.

  Parameters:
    `param` - The parameter name to search for in the array of parameters.
    `params` - The array of parameters to search in.
  Returns:
    Returns true if the parameter name is found, false otherwise.

### buildUPFileSpec

    private static UPFileSpec buildUPFileSpec(java.lang.String targetNodeId,
                                              java.lang.String extras,
                                              boolean asRoot)
                                       throws PortalException

  Constructs a generic UPFileSpec object using the specified target node id.

  Parameters:
    `targetNodeId` - The target node id to be used in the UPFileSpec object.
  Returns:
    A generic UPFileSpec object.
  Throws:
    `PortalException`

### redirectGet

    public static void redirectGet(javax.servlet.http.HttpServletRequest req,
                                   javax.servlet.http.HttpServletResponse res,
                                   UPFileSpec up,
                                   java.lang.String[] ignoreParams)
                            throws PortalException

  Performs a HTTP GET redirect using the specified UPFileSpec and parameters to be ignored.

  Parameters:
    `req` - An HttpServletRequest object.
    `res` - An HttpServletResponse object.
    `up` - the uPortal file spec.
    `ignoreParams` - An array of String objects containing the parameters to be ignored.
  Throws:
    `PortalException`

### buildHeader

    private static void buildHeader(javax.servlet.http.HttpServletRequest req,
                                    java.net.HttpURLConnection uconn)

### redirectPost

    public static void redirectPost(javax.servlet.http.HttpServletRequest req,
                                    javax.servlet.http.HttpServletResponse res,
                                    UPFileSpec up,
                                    java.lang.String[] ignoreParams,
                                    java.lang.String charset)
                             throws PortalException

  Performs a HTTP POST redirect using the specified UPFileSpec and parameters to be ignored.

  Parameters:
    `req` - An HttpServletRequest object.
    `res` - An HttpServletResponse object.
    `up` - the uPortal file spec.
    `ignoreParams` - An array of String objects containing the parameters to be ignored.
  Throws:
    `PortalException`

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