|
||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectcom.nurelm.util.WebUtil
Class providing basic Web utility functions.
| Constructor Summary | |
|---|---|
WebUtil()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
addTextToHtmlHead(java.lang.String html,
java.lang.String textToAdd)
Puts specified text into area of HTML. |
static java.lang.String |
cleanHtml(java.lang.String text,
java.lang.String allowedTags,
java.lang.String allowedAttributes,
boolean dropParas)
Cleans up and formats HTML with JTidy library. |
static java.lang.String |
convertQuotesToHtml(java.lang.String inputString)
Replaces ALL quotes (") in a string with the HTML code " Q: Where do we need to use this? A: When displaying a text string in a TEXT type input field, and you want to display the quotes properly and have them stored properly. |
static java.lang.String |
convertServerNameToDomain(java.lang.String serverName)
This method typically accepts a String that is obtained via request.getServerName(). |
static java.lang.String |
convertToHexSpaces(java.lang.String inputString)
Replaces ALL spaces in a string with hex value of '%20'. |
static java.lang.String |
createPopupJS(java.lang.String url,
java.lang.String features)
|
static java.lang.String |
encodeWithNumericCharRefs(java.lang.String input)
Replaces characters in a string that have character values of 160 or above with their equivalent HTML numeric character references. |
static void |
forwardRequest(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
java.lang.String path)
Forwards to the requested address. |
static Browser |
getBrowserObject(java.lang.String userAgent)
This method typically accepts a String and gives Browser Object. |
static java.lang.String |
getEditButton(javax.servlet.http.HttpServletRequest request,
java.lang.String actionName,
java.lang.String altText,
java.lang.String linkFile,
java.util.Map linkParams,
boolean enabled,
boolean openInNewWindow,
java.lang.String anchorName)
Constructs a NuRelm edit button. |
static java.lang.String |
getIconImgTag(java.lang.String iconName,
java.lang.String altText,
boolean enabled,
java.lang.String webFilePath)
Constructs an image tag to the correct NuContent icon based on the parameters provided. |
static java.lang.String |
getInputImgTag(java.lang.String iconName,
java.lang.String altText,
boolean enabled,
java.lang.String webFilePath)
Constructs an input image tag to the correct NuContent icon based on the parameters provided. |
static java.lang.String |
getNucontentWebFilePath(javax.servlet.http.HttpServletRequest request)
Returns absolute path to NuContent's Files directory, including context path at beginning. |
static java.lang.String |
getNucontentWebFilePathNoContext()
|
static java.lang.String |
getNucontentWebPath(javax.servlet.http.HttpServletRequest request)
Returns absolute path to NuContent's Web assets directory, including context path at beginning. |
static java.lang.String |
getNucontentWebPathNoContext()
|
static java.lang.String |
getParamValueFromURL(java.lang.String param,
java.lang.String URL)
Gets the specified parameter's value from the given URL. |
static java.lang.String |
getRefererURINoContextPath(javax.servlet.http.HttpServletRequest request)
Returns the URI of the refering page with no context path. |
static java.lang.String |
getUndecodedParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String parameterName)
Gets given parameter value passed into through the URL without decoding the value. |
static java.lang.String |
getURINoContextPath(javax.servlet.http.HttpServletRequest request)
Returns the URI with no context path. |
static java.lang.String |
htmlToIFrameFormat(java.lang.String text)
The WYSIWYG editor in /home/app/client/cms/web/editContentRich.jsp uses JavaScript that breaks if you include quotes, \r or \n chars. |
static java.lang.String |
htmlToTextAreaFormat(java.lang.String text)
Basically the opposite of textToHtml(). |
static boolean |
isWYSIWYGBrowser(javax.servlet.http.HttpServletRequest request)
Returns true if the client's Web browser supports the WYSIWYG text editor; false otherwise. |
static float |
javaScriptParseFloat(java.lang.String inputs)
|
static void |
printNode(org.w3c.dom.Node node,
java.io.PrintWriter out,
java.lang.String allowedTags,
java.lang.String allowedAttributes)
Prints the specified JTidy DOM node recursively. |
static void |
redirectResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String path)
Redirects to the requested URI. |
static java.lang.String |
replaceStringNull(java.lang.String str)
Returns "" if the string is null, otherwise it returns the passed-in string unchanged. |
static java.lang.String |
setParamValueInURL(java.lang.String param,
java.lang.String value,
java.lang.String URL)
Sets the specified parameter's value in the given URL. |
static java.lang.String |
textToHtml(java.lang.String text)
Takes regular text and makes it "webby" by changing newlines to " ". |
void |
WebUtil()
Constructor. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public WebUtil()
| Method Detail |
public void WebUtil()
public static void forwardRequest(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
java.lang.String path)
request - The current request to be forwarded.response - The current response to be forwarded.path - The path to which we'll forward.
public static void redirectResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String path)
request - The current request, used to determine context path.response - The current response to be redirected.path - The path to which we'll forward.
public static java.lang.String getParamValueFromURL(java.lang.String param,
java.lang.String URL)
param - The parameter whose value should be retrieved from the URL.URL - The URL from which to retrieve a param value.
public static java.lang.String setParamValueInURL(java.lang.String param,
java.lang.String value,
java.lang.String URL)
param - The parameter whose value should be set in the URL.value - The value to set the parameter to.URL - The URL in which to set a param value.
public static java.lang.String getNucontentWebPath(javax.servlet.http.HttpServletRequest request)
request - Current HttpServletRequest for which path will be built.
public static java.lang.String getNucontentWebPathNoContext()
public static java.lang.String getNucontentWebFilePath(javax.servlet.http.HttpServletRequest request)
request - Current HttpServletRequest for which path will be built.
public static java.lang.String getNucontentWebFilePathNoContext()
public static java.lang.String getURINoContextPath(javax.servlet.http.HttpServletRequest request)
request - The request from which to extract URI and context path.
public static java.lang.String getRefererURINoContextPath(javax.servlet.http.HttpServletRequest request)
request - The request from which to extract referer's URI and
current context path.
public static java.lang.String addTextToHtmlHead(java.lang.String html,
java.lang.String textToAdd)
public static java.lang.String getUndecodedParameter(javax.servlet.http.HttpServletRequest request,
java.lang.String parameterName)
A parameter passed in through the URL will always override one passed in through a form.
request - The current request object.parameterName - The name of the param to get.
public static java.lang.String getIconImgTag(java.lang.String iconName,
java.lang.String altText,
boolean enabled,
java.lang.String webFilePath)
iconName - The name of the icon to present.altText - The icon's alt text.enabled - Whether icon should be enabled or disabled.webFilePath - The HTTP path to this context's web files.
public static java.lang.String getInputImgTag(java.lang.String iconName,
java.lang.String altText,
boolean enabled,
java.lang.String webFilePath)
iconName - The name of the icon to present.altText - The icon's alt text.enabled - Whether icon should be enabled or disabled.webFilePath - The HTTP path to this context's web files.
public static java.lang.String createPopupJS(java.lang.String url,
java.lang.String features)
public static java.lang.String getEditButton(javax.servlet.http.HttpServletRequest request,
java.lang.String actionName,
java.lang.String altText,
java.lang.String linkFile,
java.util.Map linkParams,
boolean enabled,
boolean openInNewWindow,
java.lang.String anchorName)
request - The current ServletRequest, which is
used to get information about the current page that is required
for building the link, like the context path, and info about the
current page locking status.actionName - The name of the action the button represents. This
corresponds to icon to present, and will be used to retrieve the icon
image with the same name.altText - The icon's alt text.linkFile - The file path part of the link (no parameters).linkParams - The link parameters, with parameter name/values
corresponding to Map key/values.openInNewWindow - true if link should open in a
new window.
public static java.lang.String cleanHtml(java.lang.String text,
java.lang.String allowedTags,
java.lang.String allowedAttributes,
boolean dropParas)
text - The incoming HTML text to be processed.allowedTags - Comma separated list of tags to be included in
resulting HTML.
public static void printNode(org.w3c.dom.Node node,
java.io.PrintWriter out,
java.lang.String allowedTags,
java.lang.String allowedAttributes)
node - The JTidy Node to be printed.out - The Writer to stream output to.allowedTags - A comma separated list of lowercase tags to include.
All other tags will be removed (but their contents will remain).allowedAttributes - A comma separated list of lowercase tag
attributes to include in tags. All other attributes will be removed.
Note: The list of tags and attributes must start and end with a
comma in order to keep searching simple in this function.public static java.lang.String encodeWithNumericCharRefs(java.lang.String input)
input - String to make replacements on.
public static java.lang.String textToHtml(java.lang.String text)
text - The input text to be "webified"
public static java.lang.String htmlToTextAreaFormat(java.lang.String text)
text - The input text to be "textarea"ified
public static java.lang.String htmlToIFrameFormat(java.lang.String text)
text - The input text to be "IFrame"ified
public static java.lang.String replaceStringNull(java.lang.String str)
str - DOCUMENT ME!
public static java.lang.String convertToHexSpaces(java.lang.String inputString)
inputString - string that needs spaces converted to hex values
public static java.lang.String convertQuotesToHtml(java.lang.String inputString)
inputString - string that needs quotes converted
public static java.lang.String convertServerNameToDomain(java.lang.String serverName)
throws NuPlatformException
serverName - DOCUMENT ME!
NuPlatformException - DOCUMENT ME!public static boolean isWYSIWYGBrowser(javax.servlet.http.HttpServletRequest request)
Microsoft Internet Explorer 5 and up (any browser with
"... MSIE 5(or higher). ... in the user-agent header)
Netscape 7.0 and up (any browser with
"Mozilla ... Netscape/7(or more). ..." or
"Mozilla ... MultiZilla ..." in the user-agent header
Firefox, any version (any browser with "Mozilla ... Firefox ..." in
the user-agent header)
A little header info: http://www.zytrax.com/tech/web/browser_ids.htm
A lot of header info: http://www.pgts.com.au/pgtsj/pgtsj0208j.html
request - The current HttpServletRequest from which to get user agent
public static Browser getBrowserObject(java.lang.String userAgent)
userAgent - Browser detail string UserAgent!
NuPlatformException - DOCUMENT ME!public static float javaScriptParseFloat(java.lang.String inputs)
|
||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||