jp.terasoluna.fw.web
Class RequestUtil

java.lang.Object
  extended by jp.terasoluna.fw.web.RequestUtil

public class RequestUtil
extends java.lang.Object

Utility class related to the Request.


Constructor Summary
RequestUtil()
           
 
Method Summary
static java.lang.String deleteUrlParam(java.lang.String url, java.lang.String key)
          When the parameter of argument key is present in argument url, delete that parameter and return the argument url. Example:Before deletion:test.do?no=2&r=8331352040140757427&no=1 After deletion:test.do?no=2&no=1
static java.lang.String dumpRequest(javax.servlet.http.HttpServletRequest req)
          Dumps the parameters of "request" and attributes of "request".
static java.lang.String dumpRequestAttributes(javax.servlet.http.HttpServletRequest req)
          Dumps the attributes of "request".
static java.lang.String dumpRequestParameters(javax.servlet.http.HttpServletRequest req)
          Dumps the parameters of"request".
static java.lang.String getPathInfo(javax.servlet.ServletRequest request)
          From the ServletRequest class instance, fetch the URIpathInfo after context path. Please note that "pathInfo" referred here differs from the usual extended path information.
static javax.servlet.ServletContext getServletContext(javax.servlet.http.HttpServletRequest request)
          Fetches servlet context.
static java.lang.String getSessionHash(javax.servlet.http.HttpServletRequest req)
          Fetches hash value of HTTP session ID.
static boolean isChanged(javax.servlet.ServletRequest request)
          Checks the path to decide whether it has been navigated to other module.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestUtil

public RequestUtil()
Method Detail

getPathInfo

public static java.lang.String getPathInfo(javax.servlet.ServletRequest request)
From the ServletRequest class instance, fetch the URIpathInfo after context path. Please note that the "pathInfo" referred here differs from the usual extended path information.

Parameters:
request - ServletRequest class instance which is used to derive the pathInfo.
Returns:
Path that begins with a slash and do not include context. null when null is passed to the "request" argument. Blank string when there is no specification given after the context.

getServletContext

public static javax.servlet.ServletContext getServletContext(javax.servlet.http.HttpServletRequest request)
Fetches servlet context.

Parameters:
request - Request information
Returns:
Servlet context. null when null is passed to the "request" argument.

isChanged

public static boolean isChanged(javax.servlet.ServletRequest request)
Checks the path to decide whether it has been navigated to the other module.

Parameters:
request - Request
Returns:
true when it has been navigated to the other module. true when null is passed to the "request"argument.

getSessionHash

public static java.lang.String getSessionHash(javax.servlet.http.HttpServletRequest req)
Fetches the hash value of HTTP session ID.

Parameters:
req - HTTP request
Returns:
Hash value. null when null is passed to the "request" argument.

dumpRequest

public static java.lang.String dumpRequest(javax.servlet.http.HttpServletRequest req)
Dumps parameters of "request" and attributes of "request".

Parameters:
req - HTTP Request
Returns:
Dumped string

dumpRequestAttributes

public static java.lang.String dumpRequestAttributes(javax.servlet.http.HttpServletRequest req)
Dumps the attributes of "Request".

Parameters:
req - HTTP request
Returns:
Dumped string. null when null is passed to the "request" argument.

dumpRequestParameters

public static java.lang.String dumpRequestParameters(javax.servlet.http.HttpServletRequest req)
Dumps the parameters of "request" .

Parameters:
req - HTTP request
Returns:
Dumped string. null when null is passed to the "request" argument.

deleteUrlParam

public static java.lang.String deleteUrlParam(java.lang.String url,
                                              java.lang.String key)
If the parameter of argument key is added in the argument url, delete the parameter and return the argument url. Example:Before deletion:test.do?no=2&r=8331352040140757427&no=1 After deletion:test.do?no=2&no=1

Parameters:
url - URL used for deletion
key - String which is the key to be deleted.
Returns:
URL after deletion