Package ubic.gemma.web.util
Class RequestUtil
- java.lang.Object
-
- ubic.gemma.web.util.RequestUtil
-
public class RequestUtil extends Object
RequestUtil utility classGood ol' copy-n-paste from http://www.javaworld.com/javaworld/jw-02-2002/ssl/utilityclass.txt which is referenced in the following article: http://www.javaworld.com/javaworld/jw-02-2002/jw-0215-ssl.html
From Appfuse.- Author:
- pavlidis
-
-
Constructor Summary
Constructors Constructor Description RequestUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringBuffer
createQueryStringFromMap(Map<String,String[]> m, String ampersand)
Builds a query string from a given map of parametersstatic void
deleteCookie(javax.servlet.http.HttpServletResponse response, javax.servlet.http.Cookie cookie, String path)
Convenience method for deleting a cookie by namestatic String
getAppURL(javax.servlet.http.HttpServletRequest request)
Convenience method to get the application's URL based on request variables.static javax.servlet.http.Cookie
getCookie(javax.servlet.http.HttpServletRequest request, String name)
Convenience method to get a cookie by namestatic String
getRequestParameters(javax.servlet.http.HttpServletRequest aRequest)
static void
reclaimRequestAttributes(javax.servlet.http.HttpServletRequest aRequest)
Returns request attributes from session to requeststatic void
setCookie(javax.servlet.http.HttpServletResponse response, String name, String value, String path)
static void
stowRequestAttributes(javax.servlet.http.HttpServletRequest aRequest)
Stores request attributes in session
-
-
-
Method Detail
-
createQueryStringFromMap
public static StringBuffer createQueryStringFromMap(Map<String,String[]> m, String ampersand)
Builds a query string from a given map of parameters- Parameters:
m
- A map of parametersampersand
- String to use for ampersands (e.g. "&" or "&" )- Returns:
- query string (with no leading "?")
-
deleteCookie
public static void deleteCookie(javax.servlet.http.HttpServletResponse response, javax.servlet.http.Cookie cookie, String path)
Convenience method for deleting a cookie by name- Parameters:
response
- the current web responsecookie
- the cookie to removepath
- the path on which the cookie was set (i.e. /appfuse)
-
getAppURL
public static String getAppURL(javax.servlet.http.HttpServletRequest request)
Convenience method to get the application's URL based on request variables. NOTE: this is pretty useless if running behind a proxy.- Parameters:
request
- request- Returns:
- app url
-
getCookie
public static javax.servlet.http.Cookie getCookie(javax.servlet.http.HttpServletRequest request, String name)
Convenience method to get a cookie by name- Parameters:
request
- the current requestname
- the name of the cookie to find- Returns:
- the cookie (if found), null if not found
-
getRequestParameters
public static String getRequestParameters(javax.servlet.http.HttpServletRequest aRequest)
- Parameters:
aRequest
- request- Returns:
- Creates query String from request body parameters
-
reclaimRequestAttributes
public static void reclaimRequestAttributes(javax.servlet.http.HttpServletRequest aRequest)
Returns request attributes from session to request- Parameters:
aRequest
- DOCUMENT ME!
-
setCookie
public static void setCookie(javax.servlet.http.HttpServletResponse response, String name, String value, String path)
-
stowRequestAttributes
public static void stowRequestAttributes(javax.servlet.http.HttpServletRequest aRequest)
Stores request attributes in session- Parameters:
aRequest
- the current request
-
-