|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hyperic.hq.ui.util.RequestUtils
public class RequestUtils
Utilities class that provides many convenience methods for logging, request parameter processing, etc.
Constructor Summary | |
---|---|
RequestUtils()
|
Method Summary | |
---|---|
static void |
bustaCache(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
|
static void |
bustaCache(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
boolean expire)
When you really really want to defeat a browser's cache, expire the content and set the no-cache header |
static void |
dumpRequestParams(javax.servlet.ServletRequest request,
org.apache.commons.logging.Log log,
boolean html)
|
static void |
dumpRequestParams(javax.servlet.ServletRequest request,
java.io.OutputStream out,
boolean html)
|
static void |
dumpRequestParams(javax.servlet.ServletRequest request,
java.io.PrintWriter out,
boolean html)
A development aid. |
static java.lang.String |
dumpRequestParamsToString(javax.servlet.ServletRequest request,
boolean html)
|
static java.lang.String |
generateSessionKey(javax.servlet.http.HttpServletRequest request)
|
static java.lang.Integer |
getAutogroupResourceTypeId(javax.servlet.http.HttpServletRequest request)
Retrieve the Integer value of the
AUTOGROUP_TYPE_ID_PARAM parameter from the
HTTP request. |
static AppdefEntityTypeID |
getChildResourceTypeId(javax.servlet.http.HttpServletRequest request)
Retrieve the AppdefEntityTypeID value of the
CHILD_RESOURCE_TYPE_ID_PARAM parameter from the
HTTP request. |
static AppdefEntityID |
getEntityId(javax.servlet.http.HttpServletRequest req)
Get the appdefEntityID value of the eid param from the http request also works with rid/type attribute combination |
static AppdefEntityID[] |
getEntityIds(javax.servlet.http.HttpServletRequest request)
Retrieve the AppdefEntityID[] value of the
ENTITY_ID_PARAM ("eid") parameters from the HTTP request. |
static AppdefEntityTypeID |
getEntityTypeId(javax.servlet.http.HttpServletRequest req)
Get the appdefEntityTypeID value of the aetid param from the http request |
static java.lang.Integer |
getIntParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String name)
Fetchs the int value of the parameter from the request |
static java.lang.Integer |
getIntParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String name,
java.lang.Integer def)
Fetchs the int value of the parameter from the request |
static java.lang.Integer |
getMetricId(javax.servlet.http.HttpServletRequest request)
Retrieve the Integer value of the
METRIC_BASELINE_PARAM parameter from the HTTP request. |
static java.lang.String |
getMode(javax.servlet.http.HttpServletRequest request)
Extract the subcontroller mode from the Constants.MODE_PARAM parameter of the HTTP
request. |
static PageControl |
getPageControl(javax.servlet.http.HttpServletRequest request)
Create and return a PageControl object by
examining various request parameters. |
static PageControl |
getPageControl(javax.servlet.http.HttpServletRequest request,
java.lang.String pageSizeParam,
java.lang.String pageNumParam,
java.lang.String sortOrderParam,
java.lang.String sortColParam)
Create and return a PageControl object by
examining various request parameters. |
static int |
getPageNum(javax.servlet.http.HttpServletRequest request,
java.lang.String param)
Retrieve the int value of the
Constants.PAGENUM_PARAM request parameter, or
Constants.PAGENUM_DEFAULT if the parameter was not
found or not specified as an integer. |
static int |
getPageSize(javax.servlet.http.HttpServletRequest request,
java.lang.String param)
Retrieve the int value of the
Constants.PAGESIZE_PARAM request parameter, or
Constants.PAGESIZE_DEFAULT if the parameter was not
found or not specified as an integer. |
static AppdefResourceValue |
getResource(javax.servlet.http.HttpServletRequest request)
Retrieve the AppdefResourceValue value of the
RESOURCE_ATTR parameter from the HTTP
request. |
static java.lang.Integer |
getResourceId(javax.servlet.http.HttpServletRequest request)
Retrieve the Integer value of the
RESOURCE_PARAM parameter from the HTTP request. |
static java.lang.Integer |
getResourceTypeId(javax.servlet.http.HttpServletRequest request)
Retrieve the Integer value of the
RESOURCE_TYPE_ID_PARAM parameter from the HTTP request. |
static java.lang.Integer |
getRoleId(javax.servlet.http.HttpServletRequest request)
Retrieve the Integer value of the
ROLE_PARAM parameter from the HTTP request. |
static java.lang.Integer |
getScheduleId(javax.servlet.http.HttpServletRequest request)
Retrieve the Integer value of the
SCHEDULE_PARAM parameter from the HTTP request. |
static java.lang.Integer |
getSessionId(javax.servlet.http.HttpServletRequest request)
Extract the BizApp session id as an Integer from
the web session. |
static int |
getSessionIdInt(javax.servlet.http.HttpServletRequest request)
|
static int |
getSortCol(javax.servlet.http.HttpServletRequest request,
java.lang.String param)
Retrieve the int value of the
Constants.SORTCOL_PARAM request parameter, or
Constants.SORTCOL_DEFAULT if the parameter was not
found or not specified as an integer. |
static int |
getSortOrder(javax.servlet.http.HttpServletRequest request,
java.lang.String param)
Retrieve the int value of the
Constants.SORTORDER_PARAM request parameter, or
Constants.SORTORDER_DEFAULT if the parameter was not
found or not specified as an integer. |
static java.lang.String |
getStringParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String name)
Fetches the String value of the parameter from the request |
static java.lang.String |
getStringParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String name,
java.lang.String def)
Fetchs the String value of the parameter from the request |
static java.lang.String |
getUrl(javax.servlet.http.HttpServletRequest request)
Retrieve the String value of the
URL_ATTR parameter from the HTTP
request. |
static java.lang.Integer |
getUserId(javax.servlet.http.HttpServletRequest request)
Retrieve the Integer value of the
USER_PARAM parameter from the HTTP request. |
static WebUser |
getWebUser(javax.servlet.http.HttpServletRequest request)
Return the WebUser representing the person currently
interacting with the product. |
static WebUser |
getWebUser(javax.servlet.http.HttpSession session)
Return the WebUser representing the person currently
interacting with the product. |
static boolean |
isAddClicked(javax.servlet.http.HttpServletRequest request)
Examine the request to see if an "add" button was clicked on the previous page. |
static boolean |
isCancelClicked(javax.servlet.http.HttpServletRequest request)
Examine the request to see if an "cancel" button was clicked on the previous page. |
static boolean |
isEditClicked(javax.servlet.http.HttpServletRequest request)
Examine the request to see if an "edit" button was clicked on the previous page. |
static boolean |
isNewClicked(javax.servlet.http.HttpServletRequest request)
Examine the request to see if an "new" button was clicked on the previous page. |
static boolean |
isOkAssignClicked(javax.servlet.http.HttpServletRequest request)
Examine the request to see if an "okassign" button was clicked on the previous page. |
static boolean |
isOkClicked(javax.servlet.http.HttpServletRequest request)
Examine the request to see if an "ok" button was clicked on the previous page. |
static boolean |
isRemoveClicked(javax.servlet.http.HttpServletRequest request)
Examine the request to see if a "remove" button was clicked on the previous page. |
static boolean |
isResetClicked(javax.servlet.http.HttpServletRequest request)
Examine the request to see if an "reset" button was clicked on the previous page. |
static java.lang.String |
message(javax.servlet.http.HttpServletRequest request,
java.lang.String key)
Get an i18n message from the application resource bundle. |
static java.lang.String |
message(javax.servlet.http.HttpServletRequest request,
java.lang.String key,
java.lang.Object[] args)
Get an i18n message from the application resource bundle. |
static java.lang.String |
message(javax.servlet.http.HttpServletRequest request,
java.lang.String bundle,
java.lang.String locale,
java.lang.String key)
Get an i18n message from the application resource bundle. |
static java.lang.String |
message(javax.servlet.http.HttpServletRequest request,
java.lang.String bundle,
java.lang.String locale,
java.lang.String key,
java.lang.Object[] args)
Get an i18n message from the application resource bundle. |
static boolean |
parameterExists(javax.servlet.http.HttpServletRequest request,
java.lang.String name)
Verify if a parameter exists in the request |
static void |
propogateParam(javax.servlet.http.HttpServletRequest request,
java.util.Map params,
java.lang.String param)
Propogate a request parameter. |
static void |
setConfirmation(javax.servlet.http.HttpServletRequest request,
java.lang.String key)
Set a confirmation message upon completion of a user action. |
static void |
setConfirmation(javax.servlet.http.HttpServletRequest request,
java.lang.String key,
java.lang.Object value0)
Set a confirmation message with a replacement value upon completion of a user action. |
static void |
setError(javax.servlet.http.HttpServletRequest request,
org.apache.struts.action.ActionMessage msg,
java.lang.String property)
|
static void |
setError(javax.servlet.http.HttpServletRequest request,
java.lang.String key)
Set an error message when a user action fails with a user-level error. |
static void |
setError(javax.servlet.http.HttpServletRequest request,
java.lang.String key,
java.lang.Object value0)
Set an error message with a replacement value when a user action fails with a user-level error. |
static void |
setError(javax.servlet.http.HttpServletRequest request,
java.lang.String key,
java.lang.Object value0,
java.lang.String property)
Set an error message with a replacement value when a user action fails with a user-level error. |
static void |
setError(javax.servlet.http.HttpServletRequest request,
java.lang.String key,
java.lang.String property)
Set an error message when a user action fails with a user-level error. |
static void |
setErrorObject(javax.servlet.http.HttpServletRequest request,
java.lang.String key,
java.lang.String object)
Set an error message when a user action fails with a user-level error. |
static void |
setErrors(javax.servlet.http.HttpServletRequest request,
org.apache.struts.action.ActionErrors errs)
sets an ActionErrors object into the request object. |
static void |
setErrorWithNullCheck(javax.servlet.http.HttpServletRequest request,
java.lang.Exception e,
java.lang.String nullMsg,
java.lang.String regularMsg)
|
static void |
setResource(javax.servlet.http.HttpServletRequest request,
AppdefResourceValue resource)
Set the AppdefResourceValue value in the
RESOURCE_ATTR parameter of the HTTP
request. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RequestUtils()
Method Detail |
---|
public static java.lang.String generateSessionKey(javax.servlet.http.HttpServletRequest request)
public static boolean parameterExists(javax.servlet.http.HttpServletRequest request, java.lang.String name)
name
- The name of the parameter in the request
public static java.lang.String getStringParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name) throws ParameterNotFoundException
name
- The name of the parameter in the request
ParameterNotFoundException
- If the parameter name is not found in the requestpublic static java.lang.String getStringParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name, java.lang.String def)
name
- The name of the parameter in the requestdef
- The default value to return if the parameter is not found
public static java.lang.Integer getIntParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name) throws ParameterNotFoundException, java.lang.NumberFormatException
name
- The name of the parameter in the request
ParameterNotFoundException
- If the parameter name is not found in the request
java.lang.NumberFormatException
- If the parameter value is not a valid integerpublic static java.lang.Integer getIntParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name, java.lang.Integer def)
name
- The name of the parameter in the requestdef
- The default value to return if the parameter is not found
public static WebUser getWebUser(javax.servlet.http.HttpServletRequest request) throws javax.servlet.ServletException
WebUser
representing the person currently
interacting with the product.
javax.servlet.ServletException
- if the session cannot be accessedpublic static WebUser getWebUser(javax.servlet.http.HttpSession session) throws javax.servlet.ServletException
WebUser
representing the person currently
interacting with the product.
session
- The servlet session object
javax.servlet.ServletException
- if the session cannot be accessedpublic static java.lang.Integer getSessionId(javax.servlet.http.HttpServletRequest request) throws javax.servlet.ServletException
Integer
from
the web session.
javax.servlet.ServletException
- if the session cannot be accessedpublic static int getSessionIdInt(javax.servlet.http.HttpServletRequest request) throws javax.servlet.ServletException
javax.servlet.ServletException
public static java.lang.String getMode(javax.servlet.http.HttpServletRequest request)
Constants.MODE_PARAM
parameter of the HTTP
request.
public static java.lang.Integer getRoleId(javax.servlet.http.HttpServletRequest request) throws ParameterNotFoundException
Integer
value of the
ROLE_PARAM parameter from the HTTP request.
ParameterNotFoundException
- if the parameter was not specifiedpublic static AppdefResourceValue getResource(javax.servlet.http.HttpServletRequest request)
AppdefResourceValue
value of the
RESOURCE_ATTR parameter from the HTTP
request. If the resource is not cached in the request, set a
user error and return null
.
public static void setResource(javax.servlet.http.HttpServletRequest request, AppdefResourceValue resource)
AppdefResourceValue
value in the
RESOURCE_ATTR parameter of the HTTP
request.
public static void setErrorWithNullCheck(javax.servlet.http.HttpServletRequest request, java.lang.Exception e, java.lang.String nullMsg, java.lang.String regularMsg)
public static AppdefEntityTypeID getEntityTypeId(javax.servlet.http.HttpServletRequest req) throws ParameterNotFoundException
ParameterNotFoundException
public static AppdefEntityID getEntityId(javax.servlet.http.HttpServletRequest req) throws ParameterNotFoundException
ParameterNotFoundException
public static AppdefEntityID[] getEntityIds(javax.servlet.http.HttpServletRequest request) throws ParameterNotFoundException
AppdefEntityID[]
value of the
ENTITY_ID_PARAM ("eid") parameters from the HTTP request.
For backwards compatibility, RESOURCE_TYPE_ID_PARAM ("type")
and RESOURCE_PARAM ("rid") are also acceptable parameters as
well.
ParameterNotFoundException
- if the parameter was not specifiedpublic static java.lang.Integer getResourceId(javax.servlet.http.HttpServletRequest request) throws ParameterNotFoundException
Integer
value of the
RESOURCE_PARAM parameter from the HTTP request.
ParameterNotFoundException
- if the parameter was not specifiedpublic static java.lang.Integer getScheduleId(javax.servlet.http.HttpServletRequest request) throws ParameterNotFoundException
Integer
value of the
SCHEDULE_PARAM parameter from the HTTP request.
ParameterNotFoundException
- if the parameter was not specifiedpublic static java.lang.Integer getResourceTypeId(javax.servlet.http.HttpServletRequest request) throws ParameterNotFoundException
Integer
value of the
RESOURCE_TYPE_ID_PARAM parameter from the HTTP request.
ParameterNotFoundException
- if the parameter was not specifiedpublic static AppdefEntityTypeID getChildResourceTypeId(javax.servlet.http.HttpServletRequest request) throws ParameterNotFoundException
AppdefEntityTypeID
value of the
CHILD_RESOURCE_TYPE_ID_PARAM parameter from the
HTTP request.
ParameterNotFoundException
- if the parameter was not specifiedpublic static java.lang.Integer getAutogroupResourceTypeId(javax.servlet.http.HttpServletRequest request) throws ParameterNotFoundException
Integer
value of the
AUTOGROUP_TYPE_ID_PARAM parameter from the
HTTP request.
ParameterNotFoundException
- if the parameter was not specifiedpublic static java.lang.Integer getUserId(javax.servlet.http.HttpServletRequest request) throws ParameterNotFoundException
Integer
value of the
USER_PARAM parameter from the HTTP request.
ParameterNotFoundException
- if the parameter was not specifiedpublic static java.lang.Integer getMetricId(javax.servlet.http.HttpServletRequest request) throws ParameterNotFoundException
Integer
value of the
METRIC_BASELINE_PARAM parameter from the HTTP request.
ParameterNotFoundException
- if the parameter was not specifiedpublic static java.lang.String getUrl(javax.servlet.http.HttpServletRequest request)
String
value of the
URL_ATTR parameter from the HTTP
request.
ParameterNotFoundException
- if the parameter was not specifiedpublic static PageControl getPageControl(javax.servlet.http.HttpServletRequest request, java.lang.String pageSizeParam, java.lang.String pageNumParam, java.lang.String sortOrderParam, java.lang.String sortColParam)
PageControl
object by
examining various request parameters.
public static PageControl getPageControl(javax.servlet.http.HttpServletRequest request)
PageControl
object by
examining various request parameters.
public static int getPageNum(javax.servlet.http.HttpServletRequest request, java.lang.String param)
int
value of the
Constants.PAGENUM_PARAM
request parameter, or
Constants.PAGENUM_DEFAULT
if the parameter was not
found or not specified as an integer.
public static int getPageSize(javax.servlet.http.HttpServletRequest request, java.lang.String param)
int
value of the
Constants.PAGESIZE_PARAM
request parameter, or
Constants.PAGESIZE_DEFAULT
if the parameter was not
found or not specified as an integer.
public static int getSortOrder(javax.servlet.http.HttpServletRequest request, java.lang.String param)
int
value of the
Constants.SORTORDER_PARAM
request parameter, or
Constants.SORTORDER_DEFAULT
if the parameter was not
found or not specified as an integer.
public static int getSortCol(javax.servlet.http.HttpServletRequest request, java.lang.String param)
int
value of the
Constants.SORTCOL_PARAM
request parameter, or
Constants.SORTCOL_DEFAULT
if the parameter was not
found or not specified as an integer.
public static void setConfirmation(javax.servlet.http.HttpServletRequest request, java.lang.String key)
key
- the message resource keypublic static void setConfirmation(javax.servlet.http.HttpServletRequest request, java.lang.String key, java.lang.Object value0)
key
- the message resource keyvalue0
- the replacement valuepublic static void setError(javax.servlet.http.HttpServletRequest request, java.lang.String key)
key
- the message resource keypublic static void setError(javax.servlet.http.HttpServletRequest request, java.lang.String key, java.lang.String property)
key
- the message resource keyproperty
- the form property for which the error occurredpublic static void setErrorObject(javax.servlet.http.HttpServletRequest request, java.lang.String key, java.lang.String object)
key
- the message resource keyproperty
- the form property for which the error occurredpublic static void setError(javax.servlet.http.HttpServletRequest request, org.apache.struts.action.ActionMessage msg, java.lang.String property)
public static void setErrors(javax.servlet.http.HttpServletRequest request, org.apache.struts.action.ActionErrors errs)
public static void setError(javax.servlet.http.HttpServletRequest request, java.lang.String key, java.lang.Object value0)
key
- the message resource keyvalue0
- the replacement valuepublic static void setError(javax.servlet.http.HttpServletRequest request, java.lang.String key, java.lang.Object value0, java.lang.String property)
key
- the message resource keyvalue0
- the replacement valueproperty
- the form property for which the error occurredpublic static boolean isCancelClicked(javax.servlet.http.HttpServletRequest request)
Constants.CANCEL_PARAM
or
Constants.CANCEL_X_PARAM
parameters will exist.
public static boolean isOkClicked(javax.servlet.http.HttpServletRequest request)
Constants.OK_PARAM
or
Constants.OK_X_PARAM
parameters will exist.
public static boolean isOkAssignClicked(javax.servlet.http.HttpServletRequest request)
Constants.OK_ASSIGN_PARAM
or
Constants.OK_ASSIGN_X_PARAM
parameters will exist.
public static boolean isResetClicked(javax.servlet.http.HttpServletRequest request)
Constants.RESET_PARAM
or
Constants.RESET_X_PARAM
parameters will exist.
public static boolean isNewClicked(javax.servlet.http.HttpServletRequest request)
Constants.NEW_PARAM
or
Constants.NEW_X_PARAM
parameters will exist.
public static boolean isEditClicked(javax.servlet.http.HttpServletRequest request)
Constants.EDIT_PARAM
or
Constants.EDIT_X_PARAM
parameters will exist.
public static boolean isAddClicked(javax.servlet.http.HttpServletRequest request)
Constants.ADD_PARAM
or
Constants.ADD_X_PARAM
parameters will exist.
public static boolean isRemoveClicked(javax.servlet.http.HttpServletRequest request)
Constants.REMOVE_PARAM
or
Constants.REMOVE_X_PARAM
parameters will exist.
public static void propogateParam(javax.servlet.http.HttpServletRequest request, java.util.Map params, java.lang.String param)
params
- the parameters passed to the ActionForwardparam
- the parameter name to propogatepublic static java.lang.String message(javax.servlet.http.HttpServletRequest request, java.lang.String key)
key
- the message key we wantpublic static java.lang.String message(javax.servlet.http.HttpServletRequest request, java.lang.String key, java.lang.Object[] args)
key
- the message key we wantargs
- the positional parameters for the messagepublic static java.lang.String message(javax.servlet.http.HttpServletRequest request, java.lang.String bundle, java.lang.String locale, java.lang.String key)
bundle
- the resource bundle namebundle
- the user localekey
- the message key we wantpublic static java.lang.String message(javax.servlet.http.HttpServletRequest request, java.lang.String bundle, java.lang.String locale, java.lang.String key, java.lang.Object[] args)
bundle
- the resource bundle namebundle
- the user localekey
- the message key we wantargs
- the positional parameters for the messagepublic static void bustaCache(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
public static void bustaCache(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, boolean expire)
expire
- set true to have the content expire immediatelypublic static void dumpRequestParams(javax.servlet.ServletRequest request, java.io.PrintWriter out, boolean html)
out
- output the parameter dump to a PrintWriterhtml
- formats the dump with <ol> if truepublic static void dumpRequestParams(javax.servlet.ServletRequest request, java.io.OutputStream out, boolean html)
public static void dumpRequestParams(javax.servlet.ServletRequest request, org.apache.commons.logging.Log log, boolean html)
public static java.lang.String dumpRequestParamsToString(javax.servlet.ServletRequest request, boolean html)
|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |