|
HDIV API 2.0.4 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hdiv.util.HDIVUtil
public class HDIVUtil
Class containing utility methods for access HDIV components: IDataComposer, IDataValidator, IApplication, ISession.
This class is initialized from a Listener and a Filter.
| Constructor Summary | |
|---|---|
HDIVUtil()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
actionName(javax.servlet.http.HttpServletRequest request)
Return the URL representing the current request. |
static java.lang.String |
composeAction(java.lang.String url,
int questionIndex,
java.lang.String charEncoding)
It generates a new encoded values for the url parameters. |
static java.lang.String |
createRandomToken(int n)
Generates a random number between 0 (inclusive) and n (exclusive). |
static java.lang.String |
getActionMappingName(java.lang.String url)
Return the form action converted into an action mapping path. |
static IApplication |
getApplication()
|
static IDataComposer |
getDataComposer()
|
static IDataComposer |
getDataComposer(javax.servlet.http.HttpServletRequest request)
Returns data composer object from request. |
static java.lang.String |
getDataComposerName()
|
static IDataValidator |
getDataValidator()
|
static javax.servlet.http.HttpSession |
getHttpSession()
|
static java.lang.String |
getMessage(java.lang.String key)
Try to resolve the message. |
static java.lang.String |
getMessage(java.lang.String key,
java.lang.String o)
Try to resolve the message. |
static java.lang.String |
getMessage(java.lang.String key,
java.lang.String o,
java.util.Locale userLocale)
Try to resolve the message. |
static UidGenerator |
getRandomTokenGenerator()
|
static javax.servlet.ServletContext |
getServletContext()
|
static ISession |
getSession()
|
static void |
initFactory()
Find the root WebApplicationContext for this web app, which is typically loaded via ContextLoaderListener or ContextLoaderServlet. |
static java.lang.String |
protectCharacters(java.lang.String par)
Function to protect meaningful characters of regular expressions (+,*,...) |
static java.net.URL |
requestURL(javax.servlet.http.HttpServletRequest request)
Return the URL representing the current request. |
static void |
resetLocalData()
ThreadLocales is always guaranteed to be cleaned up when returning the thread to the server's pool. |
static void |
setHttpSession(javax.servlet.http.HttpSession httpSession2)
|
static void |
setServletContext(javax.servlet.ServletContext servletContext)
|
static void |
setSession(ISession sessionHDIV)
Only for testing. |
static java.lang.String |
stripSession(java.lang.String url)
Strips a servlet session ID from url. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HDIVUtil()
| Method Detail |
|---|
public static void resetLocalData()
public static IDataComposer getDataComposer(javax.servlet.http.HttpServletRequest request)
request. If it is null,
it returns data composer from thread local.
request - HTTP servlet request
public static IDataComposer getDataComposer()
public static IDataValidator getDataValidator()
public static ISession getSession()
public static void setSession(ISession sessionHDIV)
sessionHDIV - The session to set.public static javax.servlet.ServletContext getServletContext()
public static void setServletContext(javax.servlet.ServletContext servletContext)
servletContext - the ServletContext that the request runs in.public static void initFactory()
WebApplicationContextUtils.getRequiredWebApplicationContext(javax.servlet.ServletContext)public static IApplication getApplication()
public static javax.servlet.http.HttpSession getHttpSession()
public static void setHttpSession(javax.servlet.http.HttpSession httpSession2)
public static java.lang.String getMessage(java.lang.String key)
key - the code to lookup up, such as 'calculator.noRateSet'
public static java.lang.String getMessage(java.lang.String key,
java.lang.String o)
key - the code to lookup up, such as 'calculator.noRateSet'o - Array of arguments that will be filled in for params within the
message (params look like "{0}", "{1,date}", "{2,time}" within
a message), or null if none.
public static java.lang.String getMessage(java.lang.String key,
java.lang.String o,
java.util.Locale userLocale)
key - the code to lookup up, such as 'calculator.noRateSet'o - Array of arguments that will be filled in for params within the
message (params look like "{0}", "{1,date}", "{2,time}" within
a message), or null if none.userLocale - locale
public static java.lang.String getActionMappingName(java.lang.String url)
action property is manipulated as follows in
computing the name of the requested mapping:
url - URL representing the current request
public static java.lang.String stripSession(java.lang.String url)
public static java.lang.String actionName(javax.servlet.http.HttpServletRequest request)
throws java.lang.Exception
request - The servlet request we are processing
java.lang.Exception - if a URL cannot be created
public static java.net.URL requestURL(javax.servlet.http.HttpServletRequest request)
throws java.net.MalformedURLException
HttpServletRequest.getRequestURL() in Servlet 2.3.
request - The servlet request we are processing
java.net.MalformedURLException - if a URL cannot be createdpublic static java.lang.String protectCharacters(java.lang.String par)
par - Parameter to encode
public static java.lang.String composeAction(java.lang.String url,
int questionIndex,
java.lang.String charEncoding)
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.
url - request urlquestionIndex - index of the first question occurrence in
url stringcharEncoding - character encoding
public static java.lang.String createRandomToken(int n)
n - the bound on the random number to be returned. Must be positive.
n (exclusive).public static java.lang.String getDataComposerName()
public static UidGenerator getRandomTokenGenerator()
|
HDIV 2.0.4 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||