HDIV API 2.0.4

org.hdiv.taglib.util
Class RequestUtilsHDIV

java.lang.Object
  extended by org.apache.struts.util.RequestUtils
      extended by org.hdiv.taglib.util.RequestUtilsHDIV

public class RequestUtilsHDIV
extends org.apache.struts.util.RequestUtils

General purpose utility methods related to processing a servlet request.

Author:
Gorka Vicente
See Also:
RequestUtils

Field Summary
 
Fields inherited from class org.apache.struts.util.RequestUtils
log
 
Constructor Summary
RequestUtilsHDIV()
           
 
Method Summary
static java.lang.String addHDIVParameterIfNecessary(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String url)
          Adds HDIV state as a parameter if url references our application.
static java.lang.String addHDIVState(java.lang.String encodedURL, java.lang.String anchor)
          Adds the HDIV parameter, depending on the strategy defined by the user, to validate the request encodedURL.
static java.lang.String encodeURLParameters(javax.servlet.http.HttpServletRequest request, java.lang.String url, java.lang.String charEncoding)
          It generates a new encoded values for the url parameters.
static java.lang.String encodeValues(java.lang.String url, java.lang.String urlWithoutRelativePaths, java.lang.String charEncoding)
          Generate url with encoded parameters.
static java.lang.String getRelativePath(javax.servlet.http.HttpServletRequest request, java.lang.String url, java.lang.String contextName)
          It deletes from the URL url all the references to relative directories.
static java.lang.String getURLWithoutRelativePaths(javax.servlet.http.HttpServletRequest request, java.lang.String url)
          It deletes from the URL url all the references to relative directories.
static boolean hasActionOrServletExtension(java.lang.String path)
          Checks if path has an action extension or a jsp page extension.
 
Methods inherited from class org.apache.struts.util.RequestUtils
absoluteURL, actionURL, applicationClass, applicationInstance, computeParameters, computeURL, computeURL, computeURL, createActionForm, createActionForm, createServerStringBuffer, createServerUriStringBuffer, encodeURL, forwardURL, forwardURL, getActionErrors, getActionMappingName, getActionMappingURL, getActionMessages, getModuleConfig, getModuleConfig, getModuleName, getModuleName, getModulePrefixes, getRequestModuleConfig, getScope, getUserLocale, isXhtml, lookup, lookup, message, message, pageURL, populate, populate, present, printableURL, requestToServerStringBuffer, requestToServerUriStringBuffer, requestURL, retrieveUserLocale, saveException, selectModule, selectModule, serverURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestUtilsHDIV

public RequestUtilsHDIV()
Method Detail

addHDIVParameterIfNecessary

public static java.lang.String addHDIVParameterIfNecessary(javax.servlet.http.HttpServletRequest request,
                                                           javax.servlet.http.HttpServletResponse response,
                                                           java.lang.String url)
Adds HDIV state as a parameter if url references our application.

Parameters:
request - HTTP request
response - The servlet response we are creating
url - URL
Returns:
url with the HDIV state added as a new parameter
Since:
HDIV 2.0.1

encodeValues

public static java.lang.String encodeValues(java.lang.String url,
                                            java.lang.String urlWithoutRelativePaths,
                                            java.lang.String charEncoding)
                                     throws javax.servlet.jsp.JspException
Generate url with encoded parameters.

Parameters:
url - URL to encode
urlWithoutRelativePaths - URL without relative paths
charEncoding - character encoding
Returns:
URL with encoded parameters
Throws:
javax.servlet.jsp.JspException - if a JSP exception has occurred

getURLWithoutRelativePaths

public static java.lang.String getURLWithoutRelativePaths(javax.servlet.http.HttpServletRequest request,
                                                          java.lang.String url)
                                                   throws javax.servlet.jsp.JspException
It deletes from the URL url all the references to relative directories.

Parameters:
HttpServletRequest - request HTTP request
url - URL
Returns:
If the url has references to relative directories, it returns the absolute path deleting these relative references. If the url is relative and it does not reference our application, it will return null. If the url is not relative, it is returned as it is.
Throws:
javax.servlet.jsp.JspException - if a JSP exception has occurred

hasActionOrServletExtension

public static boolean hasActionOrServletExtension(java.lang.String path)
Checks if path has an action extension or a jsp page extension.

Parameters:
path - path
Returns:
True if path is an action or references a jsp page.
Since:
HDIV 2.0.4

getRelativePath

public static java.lang.String getRelativePath(javax.servlet.http.HttpServletRequest request,
                                               java.lang.String url,
                                               java.lang.String contextName)
                                        throws javax.servlet.jsp.JspException
It deletes from the URL url all the references to relative directories.

Parameters:
HttpServletRequest - request HTTP request
url - URL
contextName - application context
Returns:
If the url has references to relative directories, it returns the absolute path deleting these relative references. If the url is relative and it does not reference our application, it will return null.
Throws:
javax.servlet.jsp.JspException - if a JSP exception has occurred

addHDIVState

public static java.lang.String addHDIVState(java.lang.String encodedURL,
                                            java.lang.String anchor)
Adds the HDIV parameter, depending on the strategy defined by the user, to validate the request encodedURL.

Parameters:
encodedURL - URL encoded
See Also:
org.hdiv.composer.IDataComposer

encodeURLParameters

public static java.lang.String encodeURLParameters(javax.servlet.http.HttpServletRequest request,
                                                   java.lang.String url,
                                                   java.lang.String charEncoding)
                                            throws javax.servlet.jsp.JspException
It generates a new encoded values for the url parameters.

Parameters:
HttpServletRequest - request HTTP request
url - request url
charEncoding - character encoding
Returns:
URL with encoded parameters
Throws:
javax.servlet.jsp.JspException - if a JSP exception has occurred

HDIV 2.0.4

Copyright © 2008 hdiv.org. All Rights Reserved.