HDIV API 2.0.4

org.hdiv.util
Class StandardRequestUtilsHDIV

java.lang.Object
  extended by org.hdiv.util.StandardRequestUtilsHDIV

public class StandardRequestUtilsHDIV
extends java.lang.Object

General purpose utility methods related to processing a servlet request.

Since:
HDIV 2.0
Author:
Gorka Vicente

Constructor Summary
StandardRequestUtilsHDIV()
           
 
Method Summary
static java.lang.String addExtraParameters(javax.servlet.http.HttpServletRequest request, org.hdiv.dataComposer.IDataComposer dataComposer, java.lang.String encodedURL)
          Adds webflow (_flowExecutionKey) and HDIV (_HDIV_STATE_) parameters.
static java.lang.String addFlowExecutionParameter(javax.servlet.http.HttpServletRequest request, org.hdiv.dataComposer.IDataComposer dataComposer, java.lang.String url)
          Adds flow execution key (_flowExecutionKey) as url parameter if the attribute flowExecutionKey exists in the request.
static java.lang.String addHDIVParameterIfNecessary(javax.servlet.http.HttpServletRequest request, java.lang.String url)
          Adds HDIV state and webflow's flow execution key as a parameters if url references our application.
static java.lang.String addHDIVState(org.hdiv.dataComposer.IDataComposer dataComposer, java.lang.String encodedURL)
          Adds the HDIV parameter, depending on the strategy defined by the user, to validate the request encodedURL.
static java.lang.String composeAction(java.lang.String url, int questionIndex, java.lang.String charEncoding, org.hdiv.dataComposer.IDataComposer dataComposer)
           It generates a new encoded values for the url parameters.
static java.lang.String composeURL(javax.servlet.http.HttpServletRequest request, java.lang.String finalLocation)
          It creates a new state to store all the parameters and values of the request and it generates a new encoded values for the request parameters and adds the HDIV parameter.
static java.lang.String getContextRelativePath(javax.servlet.ServletRequest request, java.lang.String relativePath)
           
static boolean hasActionOrServletExtension(java.lang.String path, java.util.Hashtable extensions)
          Checks if path has an action extension or a jsp page extension.
static java.lang.String removeRelativePaths(java.lang.String url)
          Removes from url references to relative paths.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardRequestUtilsHDIV

public StandardRequestUtilsHDIV()
Method Detail

addHDIVParameterIfNecessary

public static java.lang.String addHDIVParameterIfNecessary(javax.servlet.http.HttpServletRequest request,
                                                           java.lang.String url)
Adds HDIV state and webflow's flow execution key as a parameters if url references our application.

Parameters:
request - HTTP request
url - URL
Returns:
url with the HDIV state and/or webflow's flow Execution key added as a new parameters

composeURL

public static java.lang.String composeURL(javax.servlet.http.HttpServletRequest request,
                                          java.lang.String finalLocation)
It creates a new state to store all the parameters and values of the request and it generates a new encoded values for the request parameters and adds the HDIV parameter.

Parameters:
request - HTTP request
finalLocation - the location to redirect to
Returns:
URL with encoded parameters and HDIV parameter

addExtraParameters

public static java.lang.String addExtraParameters(javax.servlet.http.HttpServletRequest request,
                                                  org.hdiv.dataComposer.IDataComposer dataComposer,
                                                  java.lang.String encodedURL)
Adds webflow (_flowExecutionKey) and HDIV (_HDIV_STATE_) parameters. Adds the HDIV parameter, depending on the strategy defined by the user, to validate the request encodedURL.

Parameters:
request - HTTP request
dataComposer - HDIV's data composer
encodedURL - URL encoded
Returns:
url with the HDIV state and _flowExecutionKey added as a new parameters.
Since:
HDIV 2.0.3
See Also:
org.hdiv.composer.IDataComposer

addFlowExecutionParameter

public static java.lang.String addFlowExecutionParameter(javax.servlet.http.HttpServletRequest request,
                                                         org.hdiv.dataComposer.IDataComposer dataComposer,
                                                         java.lang.String url)
Adds flow execution key (_flowExecutionKey) as url parameter if the attribute flowExecutionKey exists in the request.

Parameters:
request - HTTP request
dataComposer - HDIV's data composer
url - url
Since:
HDIV 2.0.3

addHDIVState

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

Parameters:
dataComposer - HDIV's data composer
encodedURL - URL encoded
Returns:
url with the HDIV state added as a new parameter
See Also:
org.hdiv.composer.IDataComposer

composeAction

public static java.lang.String composeAction(java.lang.String url,
                                             int questionIndex,
                                             java.lang.String charEncoding,
                                             org.hdiv.dataComposer.IDataComposer dataComposer)

It generates a new encoded values for the url parameters.

The returned values guarantees the confidentiality in the encoded and memory strategies if confidentiality indicator defined by user is true.

Parameters:
url - request url
questionIndex - index of the first question occurrence in url string
charEncoding - character encoding
dataComposer - HDIV's data composer
Returns:
url with encoded values

hasActionOrServletExtension

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

Parameters:
path - path
extensions - extensions table
Returns:
True if path is an action or references a jsp page.

getContextRelativePath

public static java.lang.String getContextRelativePath(javax.servlet.ServletRequest request,
                                                      java.lang.String relativePath)

removeRelativePaths

public static java.lang.String removeRelativePaths(java.lang.String url)
Removes from url references to relative paths.

Parameters:
url - url
Returns:
returns url without relative paths.
Since:
HDIV 2.0.3

HDIV 2.0.4

Copyright © 2008 hdiv.org. All Rights Reserved.