public class RequestUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
clearRequestMessages(javax.servlet.http.HttpServletRequest request)
Add a list of general messages to the request.
|
static void |
forwardRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.util.Hashtable<java.lang.String,java.lang.String[]> params)
Forward a request that was received by this servlet on to another JSP
page or servlet to continue handling the request.
|
static void |
forwardRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String destinationUrl,
java.util.Hashtable<java.lang.String,java.lang.String[]> params)
Forward a request that was received by this servlet on to another JSP
page or servlet to continue handling the request.
|
static java.lang.String |
get(java.lang.String urlString,
java.util.Hashtable<java.lang.String,java.lang.String[]> params) |
static javax.servlet.http.Cookie |
getCookie(javax.servlet.http.HttpServletRequest request,
java.lang.String cookieName)
Get a cookie from a request by the cookie name
|
static java.util.Hashtable<java.lang.String,java.lang.String[]> |
getParameters(javax.servlet.http.HttpServletRequest request)
Get a cookie from a request by the cookie name
|
static SessionData |
getSessionData(javax.servlet.http.HttpServletRequest request)
Get the session data from a request.
|
static SessionData |
getSessionDataFromToken(javax.servlet.http.HttpServletRequest request)
Get SessionData from the DataONE auth token
|
static java.lang.String |
post(org.apache.http.client.HttpClient httpclient,
java.lang.String url,
java.util.HashMap<java.lang.String,java.lang.String> paramMap)
Post a request and return the response body
|
static void |
setRequestErrors(javax.servlet.http.HttpServletRequest request,
java.util.Vector<java.lang.String> errorVector)
Add a list of errors to the request.
|
static void |
setRequestFormErrors(javax.servlet.http.HttpServletRequest request,
java.util.Vector<java.lang.String> errorVector)
Add a list of form errors to the request.
|
static void |
setRequestMessage(javax.servlet.http.HttpServletRequest request,
java.util.Vector<java.lang.String> messageVector)
Add a list of general messages to the request.
|
static void |
setRequestSuccess(javax.servlet.http.HttpServletRequest request,
java.util.Vector<java.lang.String> successVector)
Add a list of success messages to the request.
|
static void |
setUserId(javax.servlet.http.HttpServletRequest request,
java.lang.String userId)
Add the user's login id to the session on this request
|
public static void forwardRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String destinationUrl, java.util.Hashtable<java.lang.String,java.lang.String[]> params) throws MetacatUtilException
request
- to be forwardedresponse
- that can be used for writing output to the clientdestination
- the context-relative URL to which the request is forwardedparams
- the request parameters. these will be added to the requestMetacatUtilException
public static void forwardRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.util.Hashtable<java.lang.String,java.lang.String[]> params) throws MetacatUtilException
request
- to be forwardedresponse
- that can be used for writing output to the clientparams
- the request parameters. these will be added to the request.MetacatUtilException
public static java.lang.String post(org.apache.http.client.HttpClient httpclient, java.lang.String url, java.util.HashMap<java.lang.String,java.lang.String> paramMap) throws java.io.IOException, org.apache.http.HttpException
httpClient
- The HttpClient to use in the post. This is passed in because
the same client may be used in several postsurl
- the url to post toparamMap
- map of parameters to add to the postjava.io.IOException
org.apache.http.HttpException
public static java.lang.String get(java.lang.String urlString, java.util.Hashtable<java.lang.String,java.lang.String[]> params) throws MetacatUtilException
MetacatUtilException
public static javax.servlet.http.Cookie getCookie(javax.servlet.http.HttpServletRequest request, java.lang.String cookieName)
request
- the request from which to get the cookiecookieName
- the name of the cookie to look forpublic static SessionData getSessionData(javax.servlet.http.HttpServletRequest request)
request
- the request from which to get the session datapublic static SessionData getSessionDataFromToken(javax.servlet.http.HttpServletRequest request)
request
- public static java.util.Hashtable<java.lang.String,java.lang.String[]> getParameters(javax.servlet.http.HttpServletRequest request)
request
- the request from which to get the cookiecookieName
- the name of the cookie to look forpublic static void setRequestErrors(javax.servlet.http.HttpServletRequest request, java.util.Vector<java.lang.String> errorVector)
request
- the request that will get forwardederrorVector
- a list of error stringspublic static void setRequestFormErrors(javax.servlet.http.HttpServletRequest request, java.util.Vector<java.lang.String> errorVector)
request
- the request that will get forwardederrorVector
- a list of form error stringspublic static void setRequestSuccess(javax.servlet.http.HttpServletRequest request, java.util.Vector<java.lang.String> successVector)
request
- the request that will get forwardederrorVector
- a list of success message stringspublic static void setRequestMessage(javax.servlet.http.HttpServletRequest request, java.util.Vector<java.lang.String> messageVector)
request
- the request that will get forwardederrorVector
- a list of general message stringspublic static void clearRequestMessages(javax.servlet.http.HttpServletRequest request)
request
- the request that will get forwardederrorVector
- a list of general message stringspublic static void setUserId(javax.servlet.http.HttpServletRequest request, java.lang.String userId)
request
- the request that will get forwardeduserId
- the user's login idCopyright © 2020 Regents of the University of California. All Rights Reserved.