|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.servlet.util.BaseUtil
public class BaseUtil
Utility methods for use within JSP pages and/or servlets.
Field Summary | |
---|---|
static java.lang.String |
AJAX_BASEUTIL_URL_TEMPLATE
|
static java.lang.String |
AJAX_URL_SUFFIX
|
static java.lang.String |
APP_SESSION_TIMEOUT_WARNING_INTERVAL
|
static java.lang.String |
BASE_AJAX_URL
|
static java.lang.String |
COMPONENTS_INIT
|
static java.lang.String |
CONTEXTPATH
|
static java.lang.String |
DIRECTION
|
static java.lang.String |
DOC_TYPE
|
static java.lang.String |
IMAGE_LOCATION
|
static java.lang.String |
JAVASCRIPT_LOCATION
|
static int |
LABEL_ONLY
|
static int |
MNEMONIC_AND_LABEL
|
static int |
MNEMONIC_ONLY
|
static java.lang.String |
POLICY_DISPLAY_SESSION_TIMEOUT_WARNING
|
static java.lang.String |
SELECTOR
|
static java.lang.String |
STYLE_LOCATION
|
static java.lang.String |
TEMPLATE_LOCATION
|
static java.lang.String |
TEXT_PLAIN_MIME_TYPE
|
static int |
TIMEOUT_WARNING_INTERVAL_DEFAULT
|
Constructor Summary | |
---|---|
BaseUtil()
|
Method Summary | |
---|---|
static void |
applyCommandAttributesFromMap(DynamicAttributeCommandInterface command,
java.util.Map attributesMap)
|
static void |
applySingleCommandAttributes(javax.servlet.http.HttpServletRequest request,
java.lang.Object target,
java.lang.String parameterPrefix)
Finds all the request parameters that match attributes on the command object and sets each command attribute with the request paramter's value accordingly. |
static void |
applyTbeanStringParameterValues(javax.servlet.http.HttpServletRequest request,
TransformationInterface tbean,
java.util.Map parameterMap)
Apply String request attributes to tbean component. |
static java.lang.String |
decodeBase64(java.lang.String s)
Decode a base64 encoded string. |
static java.lang.String |
escapeSpecialCharacters(java.lang.String text)
Deprecated. Use Strings.escapeForJavaScript(String)
or (for old behavior) #escapeSpecialQuotesAndBackslash(String) . |
static java.util.Properties |
getApplicationSettings(javax.servlet.http.HttpServletRequest request)
|
protected static com.sas.datatypes.DataTypeInterface |
getDataTypeFromString(java.lang.String typeStr)
|
static java.lang.StringBuffer |
getFormattedMessage(java.lang.Exception ex,
java.util.Locale locale)
|
static java.lang.String |
getInputCharacterEncoding(javax.servlet.http.HttpServletRequest request)
Method that returns back a character encoding String. |
static java.lang.String |
getMnemonicLabel(java.lang.String label,
int showMnemonic)
Returns a mnemonic label created from the passed in text, the text with the & removed or the character in the text immediately after the &. |
static java.lang.Object |
getObjectAttributeValue(java.lang.String[] stringParameterValues,
java.lang.Class attributeTypeClass)
|
static java.lang.String |
getOutputCharacterEncoding(javax.servlet.http.HttpServletRequest request)
Method that returns back the output character encoding to set on the HttpServletResponse. |
static java.beans.PropertyDescriptor[] |
getPropertyDescriptors(java.lang.Object source)
|
static java.lang.String |
getRemoteSessionParameters(javax.servlet.http.HttpServletRequest request,
boolean firstParam)
Gets the RemoteSession additional parameters (session id and session host). |
static java.lang.StringBuffer |
getTimeoutScript(javax.servlet.http.HttpServletRequest request,
java.lang.String url,
int refreshInterval,
java.lang.String function,
boolean dialog,
boolean disableWarning,
boolean frames,
boolean centerWarning)
Returns the timeout script used for checking if the session is timed out and redirect the page to the timeout url. |
static int |
getTimeoutWarningDuration(javax.servlet.http.HttpServletRequest request)
|
static boolean |
isTimeoutWarningEnabled(javax.servlet.http.HttpServletRequest request)
|
static java.lang.String |
replaceSpecialCharacters(java.lang.String inputString,
int browserType)
Utility method for replacing special characters (&,$,<,>,',"). |
static void |
setAttribute(java.lang.Object target,
java.beans.PropertyDescriptor pd,
java.lang.String attributeName,
java.lang.Object objectAttributeValue)
|
static void |
setLabelAndAccessKeyOnButton(BaseButton button,
java.lang.String text)
Sets the access key and mnemonic label for the given BaseButton given the text. |
static void |
writeAdditionalParameters(java.util.HashMap additionalParameters,
java.io.PrintWriter out)
Takes a HashMap containing additional parameters that are specified by a name/value pair. |
Field Detail |
---|
public static final java.lang.String BASE_AJAX_URL
public static final java.lang.String AJAX_URL_SUFFIX
public static final java.lang.String AJAX_BASEUTIL_URL_TEMPLATE
public static int MNEMONIC_ONLY
public static int LABEL_ONLY
public static int MNEMONIC_AND_LABEL
public static java.lang.String COMPONENTS_INIT
public static java.lang.String CONTEXTPATH
public static java.lang.String IMAGE_LOCATION
public static java.lang.String STYLE_LOCATION
public static java.lang.String JAVASCRIPT_LOCATION
public static java.lang.String TEMPLATE_LOCATION
public static java.lang.String SELECTOR
public static java.lang.String DOC_TYPE
public static java.lang.String DIRECTION
public static java.lang.String TEXT_PLAIN_MIME_TYPE
public static final java.lang.String POLICY_DISPLAY_SESSION_TIMEOUT_WARNING
public static final java.lang.String APP_SESSION_TIMEOUT_WARNING_INTERVAL
public static final int TIMEOUT_WARNING_INTERVAL_DEFAULT
Constructor Detail |
---|
public BaseUtil()
Method Detail |
---|
public static java.lang.String decodeBase64(java.lang.String s)
s
- The base64 encoded string
public static java.lang.String replaceSpecialCharacters(java.lang.String inputString, int browserType)
inputString
- The String on which to perform the replacementsbrowserType
- The type of browser
replaced with.
public static java.lang.String escapeSpecialCharacters(java.lang.String text)
Strings.escapeForJavaScript(String)
or (for old behavior) #escapeSpecialQuotesAndBackslash(String)
.
text
- The String on which to perform the escaping
public static void writeAdditionalParameters(java.util.HashMap additionalParameters, java.io.PrintWriter out)
map
- HashMap the map of additional parameters to be written out.out
- the output streamHashMap
public static java.lang.String getInputCharacterEncoding(javax.servlet.http.HttpServletRequest request)
request
- The HttpServletRequest
public static java.lang.String getOutputCharacterEncoding(javax.servlet.http.HttpServletRequest request)
ComponentKeys
.CHARACTER_ENCODING. If not found,
then the method looks for this parameter on the HttpSession. Finally,
if not found, then it returns the outputCharacterEncoding
on the ComponentPropertyManager
.
request
- The HttpServletRequest
public static java.lang.String getRemoteSessionParameters(javax.servlet.http.HttpServletRequest request, boolean firstParam)
request
- The request objectfirstParam
- True if these parameters are the first parameters (an ampersand will be NOT be prepended).
public static void applySingleCommandAttributes(javax.servlet.http.HttpServletRequest request, java.lang.Object target, java.lang.String parameterPrefix)
Finds all the request parameters that match attributes on the command object and sets each command attribute with the request paramter's value accordingly.
request
- The request object that may have parameters with names matching those of
command attributes.target
- The target object on which parameter values from the request will be applied.paramaterPrefix
- The optional prefix that precedes the parameter names on the request.public static java.beans.PropertyDescriptor[] getPropertyDescriptors(java.lang.Object source)
public static void setAttribute(java.lang.Object target, java.beans.PropertyDescriptor pd, java.lang.String attributeName, java.lang.Object objectAttributeValue)
public static java.lang.Object getObjectAttributeValue(java.lang.String[] stringParameterValues, java.lang.Class attributeTypeClass)
public static void applyCommandAttributesFromMap(DynamicAttributeCommandInterface command, java.util.Map attributesMap)
public static void applyTbeanStringParameterValues(javax.servlet.http.HttpServletRequest request, TransformationInterface tbean, java.util.Map parameterMap)
request
- current request objecttbean
- viewerparameterMap
- mapping of attribute names to keyspublic static java.lang.String getMnemonicLabel(java.lang.String label, int showMnemonic)
label
- the original stringshowMnemonic
- indicates the form of the requested return string
public static void setLabelAndAccessKeyOnButton(BaseButton button, java.lang.String text)
button
- the button that is going to have the access key and mnemonic label settext
- the string that contains the mnemonicpublic static java.lang.StringBuffer getFormattedMessage(java.lang.Exception ex, java.util.Locale locale)
protected static com.sas.datatypes.DataTypeInterface getDataTypeFromString(java.lang.String typeStr)
public static java.util.Properties getApplicationSettings(javax.servlet.http.HttpServletRequest request)
public static boolean isTimeoutWarningEnabled(javax.servlet.http.HttpServletRequest request)
public static int getTimeoutWarningDuration(javax.servlet.http.HttpServletRequest request)
public static java.lang.StringBuffer getTimeoutScript(javax.servlet.http.HttpServletRequest request, java.lang.String url, int refreshInterval, java.lang.String function, boolean dialog, boolean disableWarning, boolean frames, boolean centerWarning)
request
- The request objecturl
- timeout url for the applicationrefreshInterval
- session timeout in secondsfunction
- custom functiondialog
- flag for indicating that the script is used for a dialog.disableWarning
- override metadata settings for showing the warning.frames
- write out javascript if inside a frame environmentcenterWarning
- center warning div if present, otherwise place at top of window/frame
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |