| java.lang.Object org.blojsom.util.BlojsomUtils
BlojsomUtils | public class BlojsomUtils implements BlojsomConstants(Code) | | BlojsomUtils
author: David Czarnecki since: blojsom 3.0 version: $Id: BlojsomUtils.java,v 1.16 2007/01/21 15:42:48 czarneckid Exp $ |
Method Summary | |
public static String | addSlashes(String input) Add preceeding and trailing slashes to an input string. | public static String | addTrailingSlash(String input) | public static Map | arrayOfStringsToMap(String[] array) Turn an array of strings into a Map where the keys and values are the input strings. | public static String | arrayOfStringsToString(String[] array, String separator) Turn an array of strings into a single string separated by a given delimeter. | public static String | arrayOfStringsToString(String[] array) Turn an array of strings into a single string separated by commas. | public static List | arrayToList(String[] input) | public static Map | blojsomPropertiesToMap(Properties properties) Convert a
Properties object to a
Map . | public static boolean | checkMapForKey(Map map, String key) Check to see if a given map contains a particular key. | public static boolean | checkNullOrBlank(String input) | public static String | checkStartingAndEndingSlash(String input) Add a '/' at the beginning and end of the input string if necessary. | public static String | constructBaseURL(HttpServletRequest httpServletRequest) | public static String | constructBlogURL(HttpServletRequest httpServletRequest, String blogID) | public static String | constructBlogURL(HttpServletRequest httpServletRequest, String blogID, String servletPath) | public static String | convertRequestParams(HttpServletRequest request) | public static String | convertRequestParams(HttpServletRequest request, Map ignoreParams) | public static void | copyDirectory(File sourceDirectory, File targetDirectory) | public static List | csvToList(String valuesAsString) | public static int | daysBetweenDates(Date startDate, Date endDate) | public static boolean | deleteDirectory(File directoryOrFile) | public static boolean | deleteDirectory(File directoryOrFile, boolean removeDirectoryOrFile) | public static String | digestString(String data) | public static String | digestString(String data, String algorithm) | public static String | escapeBrackets(String input) | public static String | escapeMetaAndLink(String input) | public static String | escapeString(String input) | public static String | escapeStringSimple(String input) | public static String | getBlogFromPath(String pathInfo) Returns blog id information from the path provided to the method where the path provided is
assumed to be everything after the servlet instance with a user id at the very beginning of the path. | public static String | getBlogSiteURL(String blogURL, String servletPath) | public static String | getCalendarNavigationUrl(String prefix, int month, int day, int year) | public static String | getCategoryFromPath(String pathInfo) Returns category information from the path provided to the method where the path provided is
assumed to be everything after the servlet instance with a user id at the very beginning of the path. | public static String[] | getCountriesForSystem(Locale locale) | public static String | getDateKey(Date date) | public static FileFilter | getDirectoryFilter() | public static FileFilter | getDirectoryFilter(String[] excludedDirectories) | public static FileFilter | getExtensionFilter(String extension) | public static FileFilter | getExtensionsFilter(String[] extensions) | public static FileFilter | getExtensionsFilter(String[] extensions, String[] excludedDirectories, boolean returnDirectories) | public static String | getFileExtension(String filename) Return the file extension for a given filename or null if no file extension
is present
Parameters: filename - Filename File extension without the . | public static String | getFilename(String filename) | public static File | getFilenameForDate(String filename) Return a filename with the date as a long value before the file extension. | public static String | getFilenameForPermalink(String permalink, String[] blogEntryExtensions) | public static String | getFilenameFromPath(String filenameWithPath) Returns the base file name from the supplied file path. | public static Date | getFirstDateOfYear(Locale locale, int year) | public static Date | getFirstDateOfYearMonth(Locale locale, int year, int month) | public static Date | getFirstDateOfYearMonthDay(Locale locale, int year, int month, int day) | public static String | getFirstLine(String input, int length) | public static String | getFormattedDate(Date date, String format, Locale locale) | public static String | getHashableContent(String content) | public static String | getISO8601Date(Date date) | public static String | getKeysAsStringList(Map input) | public static String[] | getLanguagesForSystem(Locale locale) | public static Date | getLastDateOfYear(Locale locale, int year) | public static Date | getLastDateOfYearMonth(Locale locale, int year, int month) | public static Date | getLastDateOfYearMonthDay(Locale locale, int year, int month, int day) | public static Locale | getLocaleFromString(String locale) | public static String | getPostSlug(String title, String content) | public static String | getRFC822Date(Date date) | public static FileFilter | getRegularExpressionFilter(String[] expressions) | public static String | getRequestValue(String key, HttpServletRequest httpServletRequest) | public static String | getRequestValue(String key, HttpServletRequest httpServletRequest, boolean preferAttributes) | public static String[] | getRequestValues(String key, HttpServletRequest httpServletRequest) | public static String | getTemplateForPage(String flavorTemplate, String page) | public static String[] | getTimeZonesForSystem(Locale locale) | public static String | getUTCDate(Date date) | public static void | listDirectoriesInSubdirectories(File directory, String parentDirectory, List directories) List the sub-directories in a sub-directory of a given directory and strip the parent directory from the path
of the directories added to the list. | public static void | listFilesInSubdirectories(File directory, String parentDirectory, List files) List the files in a sub-directory of a given directory and strip the parent directory from the path
of the files added to the list. | public static String | listToCSV(List values) Convert a list to a comma-separated string. | public static Map | listToMap(List values) Convert a list of values to a
Map . | public static String | listToString(List values, String separator) | public static String | normalize(String path) Normalize a path to remove all ./, ../, .../, //, etc. | public static String | nullToBlank(String input) | public static String[] | parseCommaList(String commaList) | public static String[] | parseDelimitedList(String delimitedList, String delimiter) | public static String[] | parseDelimitedList(String delimitedList, String delimiter, boolean trim) | public static String[] | parseLastComma(String value) | public static String[] | parseOnlyCommaList(String commaList) | public static String[] | parseOnlyCommaList(String commaList, boolean trim) | public static Map | propertiesToMap(Properties properties) Convert a set of
Properties to a
Map Parameters: properties - Properties to be converted to a Map Map object containing all the keys and values from the original Properties object. | public static String | removeInitialSlash(String input) | public static List | removeNullValues(List input) | public static String | removeSlashes(String input) | public static String | removeTrailingSlash(String input) | public static String | replace(String str, String pattern, String replace) Replace any occurances of a string pattern within a string with a different string.
Parameters: str - The source string. | public static void | resolveDynamicBaseAndBlogURL(HttpServletRequest httpServletRequest, Blog blog, String blogID) Check to see if the blog base URL or blog URL are present. | public static void | resolveDynamicBaseAndBlogURL(HttpServletRequest httpServletRequest, Blog blog, String blogID, String servletPath) Check to see if the blog base URL or blog URL are present. | public static void | setNoCacheControlHeaders(HttpServletResponse httpServletResponse) | public static String | stripHTML(String text) | public static String | stripLineTerminators(String input) | public static String | stripLineTerminators(String input, String replacement) | public static String | toHexString(byte[] buf, int offset, int length) | public static String | urlDecode(String input) | public static String | urlEncode(String input) | public static String | urlEncodeForLink(String input) |
FILE_NAME_COMPARATOR | final public static Comparator FILE_NAME_COMPARATOR(Code) | | Return a comparator to sort by name
|
HEX_DIGITS | final static byte[] HEX_DIGITS(Code) | | |
addSlashes | public static String addSlashes(String input)(Code) | | Add preceeding and trailing slashes to an input string. If input is null a "/" is returned.
Parameters: input - Input Input with preceeding and trailing slashes added |
addTrailingSlash | public static String addTrailingSlash(String input)(Code) | | Add a trailing slash to the input
Parameters: input - Input Input with trailing slash added |
arrayOfStringsToMap | public static Map arrayOfStringsToMap(String[] array)(Code) | | Turn an array of strings into a Map where the keys and values are the input strings. If the incoming array is null, this
method returns an empty map.
Parameters: array - Array of strings Map Map containing all the strings from the original array or an empty map if the incoming array is null. |
arrayOfStringsToString | public static String arrayOfStringsToString(String[] array, String separator)(Code) | | Turn an array of strings into a single string separated by a given delimeter. If the incoming array is null, this
method returns the null string.
Parameters: array - Array of strings Parameters: separator - Separator between strings Single string containing all the strings from the original array separated by the given delimeter, or null if the input was null. |
arrayOfStringsToString | public static String arrayOfStringsToString(String[] array)(Code) | | Turn an array of strings into a single string separated by commas. If the incoming array is null, this
method returns the null string.
Parameters: array - Array of strings Single string containing all the strings from the original array separated by commas, or null if the input was null. |
arrayToList | public static List arrayToList(String[] input)(Code) | | Convert a String[] to a List
Parameters: input - String[] List from string array |
blojsomPropertiesToMap | public static Map blojsomPropertiesToMap(Properties properties)(Code) | | Convert a
Properties object to a
Map . If the properties object is null
an emtpy
Map is returned.
Parameters: properties - Properties Map containing keys and values from the properties |
checkMapForKey | public static boolean checkMapForKey(Map map, String key)(Code) | | Check to see if a given map contains a particular key. Returns true if and only if the map and
key are not null and the map contains the key.
Parameters: map - Map to check for given key Parameters: key - Key to check for in map Returns true if and only if the map and key are not null and the map contains the key. |
checkNullOrBlank | public static boolean checkNullOrBlank(String input)(Code) | | Checks to see if the string is null or blank (after trimming)
Parameters: input - Input string true if the string is null or blank (after trimming), false otherwise |
checkStartingAndEndingSlash | public static String checkStartingAndEndingSlash(String input)(Code) | | Add a '/' at the beginning and end of the input string if necessary.
Parameters: input - Input string String with a '/' at the beginning and end of the original string, null if the input was null |
constructBaseURL | public static String constructBaseURL(HttpServletRequest httpServletRequest)(Code) | | Construct a blog base URL from the request
Parameters: httpServletRequest - Request URL of the form http://server:port/context_path |
constructBlogURL | public static String constructBlogURL(HttpServletRequest httpServletRequest, String blogID)(Code) | | Construct a blog URL from the request
Parameters: httpServletRequest - Request Parameters: blogID - Blog ID URL of the form http://server:port/context_path/servlet_path/blog_id/ |
constructBlogURL | public static String constructBlogURL(HttpServletRequest httpServletRequest, String blogID, String servletPath)(Code) | | Construct a blog URL from the request
Parameters: httpServletRequest - Request Parameters: blogID - Blog ID Parameters: servletPath - Servlet path URL of the form http://server:port/context_path/servlet_path/blog_id/ |
convertRequestParams | public static String convertRequestParams(HttpServletRequest request)(Code) | | Convert the request parameters to a string
Parameters: request - Servlet request Request parameters in the form &name=value |
convertRequestParams | public static String convertRequestParams(HttpServletRequest request, Map ignoreParams)(Code) | | Convert the request parameters to a string
Parameters: request - Servlet request Parameters: ignoreParams - Parameters to ignore when converting the request Request parameters in the form &name=value |
copyDirectory | public static void copyDirectory(File sourceDirectory, File targetDirectory) throws IOException(Code) | | Recursively copy a directory from a source to a target
Parameters: sourceDirectory - Source directory Parameters: targetDirectory - Destination directory throws: IOException - If there is an error copying the files and directories |
csvToList | public static List csvToList(String valuesAsString)(Code) | | Return a comma-separated list of Strings as a
List ; trims space around value
Parameters: valuesAsString - Comma-separated values Comma-separated list of Strings as a List |
daysBetweenDates | public static int daysBetweenDates(Date startDate, Date endDate)(Code) | | Return the number of days between two dates
Parameters: startDate - Start date Parameters: endDate - End date Number of days between two dates which may be 0 if either of the dates if null |
deleteDirectory | public static boolean deleteDirectory(File directoryOrFile)(Code) | | Delete a directory (or file) and any sub-directories underneath the directory
Parameters: directoryOrFile - Directory or file to be deleted true if the directory (or file) could be deleted, false otherwise |
deleteDirectory | public static boolean deleteDirectory(File directoryOrFile, boolean removeDirectoryOrFile)(Code) | | Delete a directory (or file) and any sub-directories underneath the directory
Parameters: directoryOrFile - Directory or file to be deleted Parameters: removeDirectoryOrFile - If the directory of file should be deleted in addition to the sub-directories true if the directory (or file) could be deleted, false otherwise |
digestString | public static String digestString(String data)(Code) | | Performs an MD5 Digest onthe given String content
Parameters: data - Content to digest The Hash as Hex String |
digestString | public static String digestString(String data, String algorithm)(Code) | | Performs an Digest onthe given String content for the given algorithm
Parameters: data - Content to digest Parameters: algorithm - the algorithm to use (MD5, SHA1) The Hash as Hex String |
escapeBrackets | public static String escapeBrackets(String input)(Code) | | Return an escaped string where <, > are converted to their HTML equivalents
Parameters: input - Unescaped string Escaped string containing HTML equivalents for <, > |
escapeMetaAndLink | public static String escapeMetaAndLink(String input)(Code) | | Return an escaped string where <meta, <link tags are escaped
Parameters: input - Unescaped string Escaped string where <meta, <link tags are escaped |
escapeString | public static String escapeString(String input)(Code) | | Return an escaped string where &, <, >, ", and ' are converted to their HTML equivalents
Parameters: input - Unescaped string Escaped string containing HTML equivalents for &, <, >, ", and ' |
escapeStringSimple | public static String escapeStringSimple(String input)(Code) | | Return an escaped string where &, <, > are converted to their HTML equivalents
Parameters: input - Unescaped string Escaped string containing HTML equivalents for &, <, > |
getBlogFromPath | public static String getBlogFromPath(String pathInfo)(Code) | | Returns blog id information from the path provided to the method where the path provided is
assumed to be everything after the servlet instance with a user id at the very beginning of the path.
For example, /david/this/is/the/category
Parameters: pathInfo - Path information Everything before the second "/" character in the path |
getBlogSiteURL | public static String getBlogSiteURL(String blogURL, String servletPath)(Code) | | Return a URL to the main blog site without the servlet path requested
Parameters: blogURL - URL for the blog Parameters: servletPath - Servlet path under which the blog is placed URL to the blog up to the servlet path |
getCalendarNavigationUrl | public static String getCalendarNavigationUrl(String prefix, int month, int day, int year)(Code) | | Create a Calendar Navigatation URL
Parameters: prefix - Any URL Prefix Parameters: month - Month of navigation Parameters: day - Day of navigation Parameters: year - Year of navigation Properly formatted calendar navigation url |
getCategoryFromPath | public static String getCategoryFromPath(String pathInfo)(Code) | | Returns category information from the path provided to the method where the path provided is
assumed to be everything after the servlet instance with a user id at the very beginning of the path.
For example, /david/this/is/the/category
Parameters: pathInfo - Path information Everything after the second "/" character in the path |
getCountriesForSystem | public static String[] getCountriesForSystem(Locale locale)(Code) | | Return of a list of locale countries supported on this system (JVM)
Parameters: locale - Locale used for sorting Return of a list of locale countries supported on this system (JVM) |
getDateKey | public static String getDateKey(Date date)(Code) | | Return a string of "YYYYMMDD"
Parameters: date - Date from which to extract "key" String of "YYYYMMDD" |
getDirectoryFilter | public static FileFilter getDirectoryFilter()(Code) | | Return a file filter which only returns directories
File filter appropriate for filtering only directories |
getDirectoryFilter | public static FileFilter getDirectoryFilter(String[] excludedDirectories)(Code) | | Return a file filter which only returns directories that are not one of a list
of excluded directories
Parameters: excludedDirectories - List of directories to exclude File filter appropriate for filtering only directories |
getExtensionFilter | public static FileFilter getExtensionFilter(String extension)(Code) | | Return a file filter which takes a single file extension to look for
Parameters: extension - File extension File filter appropriate for filtering out a single file extension |
getExtensionsFilter | public static FileFilter getExtensionsFilter(String[] extensions)(Code) | | Return a file filter which takes a list of file extensions to look for
Parameters: extensions - List of file extensions File filter appropriate for filtering out a set of file extensions |
getExtensionsFilter | public static FileFilter getExtensionsFilter(String[] extensions, String[] excludedDirectories, boolean returnDirectories)(Code) | | Return a file filter which takes a list of file extensions to look for
Parameters: extensions - List of file extensions Parameters: excludedDirectories - List of excluded directories Parameters: returnDirectories - Whether or not to return File filter appropriate for filtering out a set of file extensions |
getFileExtension | public static String getFileExtension(String filename)(Code) | | Return the file extension for a given filename or null if no file extension
is present
Parameters: filename - Filename File extension without the . or null if no file extension is present |
getFilename | public static String getFilename(String filename)(Code) | | Return the filename without extension for a given filename
Parameters: filename - Filename Filename up to the . |
getFilenameForDate | public static File getFilenameForDate(String filename)(Code) | | Return a filename with the date as a long value before the file extension.
Parameters: filename - Filename with extension Filename as {filename}-{date}.{file extension} or null if there was no file extension |
getFilenameForPermalink | public static String getFilenameForPermalink(String permalink, String[] blogEntryExtensions)(Code) | | Return only the filename of a permalink request
Parameters: permalink - Permalink request Parameters: blogEntryExtensions - Regex for blog entries so that we only pickup requests for valid blog entries Filename portion of permalink request |
getFilenameFromPath | public static String getFilenameFromPath(String filenameWithPath)(Code) | | Returns the base file name from the supplied file path. On the surface,
this would appear to be a trivial task. Apparently, however, some Linux
JDKs do not implement File.getName() correctly for Windows
paths, so we attempt to take care of that here.
Parameters: filenameWithPath - The full path to the file. The base file name, from the end of the path. |
getFirstDateOfYear | public static Date getFirstDateOfYear(Locale locale, int year)(Code) | | Find the first date of a year
Parameters: locale - Locale Parameters: year - Year First date of the requested year |
getFirstDateOfYearMonth | public static Date getFirstDateOfYearMonth(Locale locale, int year, int month)(Code) | | Find the first date of a year/month
Parameters: locale - Locale Parameters: year - Year Parameters: month - Month FIrst date of the requested year/month |
getFirstDateOfYearMonthDay | public static Date getFirstDateOfYearMonthDay(Locale locale, int year, int month, int day)(Code) | | Get the first date of a year/month/day
Parameters: locale - Locale Parameters: year - Year Parameters: month - Month Parameters: day - Day First date of the requested year/month/day |
getFirstLine | public static String getFirstLine(String input, int length)(Code) | | Extracts the first line in a given string, otherwise returns the first n bytes
Parameters: input - String from which to extract the first line Parameters: length - Number of bytes to return if line seperator isnot found the first line of the string |
getFormattedDate | public static String getFormattedDate(Date date, String format, Locale locale)(Code) | | Return a date formatted date
Parameters: date - Date Parameters: format - Date Format String Parameters: locale - Locale Locale for retrieving proper date symbols Date formatted date |
getISO8601Date | public static String getISO8601Date(Date date)(Code) | | Return a date in ISO 8601 style
http://www.w3.org/TR/NOTE-datetime
Parameters: date - Date Date formatted as ISO 8601 |
getKeysAsStringList | public static String getKeysAsStringList(Map input)(Code) | | Return the keys of a map as a comma-separated list
Parameters: input - Map Keys as a comma-separated list or an empty string if the input is null or contains no keys |
getLanguagesForSystem | public static String[] getLanguagesForSystem(Locale locale)(Code) | | Return of a list of locale languages supported on this system (JVM)
Parameters: locale - Locale used for sorting List of locale languages supported on this system (JVM) |
getLastDateOfYear | public static Date getLastDateOfYear(Locale locale, int year)(Code) | | Find the last date of a year
Parameters: locale - Locale Parameters: year - Year Last date of the requested year |
getLastDateOfYearMonth | public static Date getLastDateOfYearMonth(Locale locale, int year, int month)(Code) | | Find the last date of a year/month
Parameters: locale - Locale Parameters: year - Year Parameters: month - Month Last date of the requested year/month |
getLastDateOfYearMonthDay | public static Date getLastDateOfYearMonthDay(Locale locale, int year, int month, int day)(Code) | | Get the last date of a year/month/day
Parameters: locale - Locale Parameters: year - Year Parameters: month - Month Parameters: day - Day Last date of the requested year/month/day |
getLocaleFromString | public static Locale getLocaleFromString(String locale)(Code) | | Create a
Locale object from a string of form language_country_variant
Parameters: locale - Locale string of form language_country_variant Locale object with language, country, variant settings or java.util.Locale.getDefaultif locale input is null or blank |
getPostSlug | public static String getPostSlug(String title, String content)(Code) | | Return a filename appropriate for the blog entry content
Parameters: title - Blog entry title Parameters: content - Blog entry content Filename for the new blog entry |
getRFC822Date | public static String getRFC822Date(Date date)(Code) | | Return a date in RFC 822 style
Parameters: date - Date Date formatted as RFC 822 |
getRegularExpressionFilter | public static FileFilter getRegularExpressionFilter(String[] expressions)(Code) | | Return a file filter which takes a list of regular expressions to look for
Parameters: expressions - List of regular expressions for files to retrieve File filter appropriate for filtering out a set of files based on regular expressions |
getRequestValue | public static String getRequestValue(String key, HttpServletRequest httpServletRequest)(Code) | | Tries to retrieve a given key using getParameter(key) and if not available, will
use getAttribute(key) from the servlet request
Parameters: key - Parameter to retrieve Parameters: httpServletRequest - Request Value of the key as a string, or null if there is no parameter/attribute |
getRequestValue | public static String getRequestValue(String key, HttpServletRequest httpServletRequest, boolean preferAttributes)(Code) | | Tries to retrieve a given key using getParameter(key) and if not available, will
use getAttribute(key) from the servlet request
Parameters: key - Parameter to retrieve Parameters: httpServletRequest - Request Parameters: preferAttributes - If request attributes should be checked before request parameters Value of the key as a string, or null if there is no parameter/attribute |
getRequestValues | public static String[] getRequestValues(String key, HttpServletRequest httpServletRequest)(Code) | | Get request values for a given key and if not available, returns and empty String[]
Parameters: key - Parameter to retrieve Parameters: httpServletRequest - Request Request values for the key as a String[] |
getTemplateForPage | public static String getTemplateForPage(String flavorTemplate, String page)(Code) | | Return the template name for a particular page
Parameters: flavorTemplate - Flavor template filename Parameters: page - Requested page Return an appropriate template name for the flavor template and page combination |
getTimeZonesForSystem | public static String[] getTimeZonesForSystem(Locale locale)(Code) | | Return of a list of time zone IDs supported on this system (JVM)
Parameters: locale - Locale used for sorting Return of a list of time zone IDs supported on this system (JVM) |
getUTCDate | public static String getUTCDate(Date date)(Code) | | Return a date in UTC style
Parameters: date - Date Date formatted as ISO 8601 |
listDirectoriesInSubdirectories | public static void listDirectoriesInSubdirectories(File directory, String parentDirectory, List directories)(Code) | | List the sub-directories in a sub-directory of a given directory and strip the parent directory from the path
of the directories added to the list.
Parameters: directory - Sub-directory to start looking for files Parameters: parentDirectory - Parent directory to strip Parameters: directories - List of directories to add to |
listFilesInSubdirectories | public static void listFilesInSubdirectories(File directory, String parentDirectory, List files)(Code) | | List the files in a sub-directory of a given directory and strip the parent directory from the path
of the files added to the list.
Parameters: directory - Sub-directory to start looking for files Parameters: parentDirectory - Parent directory to strip Parameters: files - List of files to add to |
listToCSV | public static String listToCSV(List values)(Code) | | Convert a list to a comma-separated string. If values in the list are null , a
space is printed. If the input is null or there are no items in the list, an empty
string is returned.
Parameters: values - List of values Comma-separated string |
listToMap | public static Map listToMap(List values)(Code) | | Convert a list of values to a
Map . null values are not placed
in the returned Map .
Parameters: values - List of values Map where each key and value pair is from the list of values |
listToString | public static String listToString(List values, String separator)(Code) | | Return a
List as a string
Parameters: values - List of values Parameters: separator - Separator in-between values List as a string where each item is separated by the separator |
normalize | public static String normalize(String path)(Code) | | Normalize a path to remove all ./, ../, .../, //, etc. type references
Parameters: path - Input path Normalized path |
nullToBlank | public static String nullToBlank(String input)(Code) | | Check to see if the given input string is null and if so, return a blank string instead
Parameters: input - Input string Blank string if the input string is null , otherwise just return the input string |
parseCommaList | public static String[] parseCommaList(String commaList)(Code) | | Parse a comma-separated list of values; also parses over internal spaces
Parameters: commaList - Comma-separated list Individual strings from the comma-separated list |
parseDelimitedList | public static String[] parseDelimitedList(String delimitedList, String delimiter)(Code) | | Parse a delimited list of values
Parameters: delimitedList - Delimited list Parameters: delimiter - Field Delimiter Individual strings from the comma-separated list |
parseDelimitedList | public static String[] parseDelimitedList(String delimitedList, String delimiter, boolean trim)(Code) | | Parse a delimited list of values
Parameters: delimitedList - Delimited list Parameters: delimiter - Field Delimiter Parameters: trim - If the contents of the array should be trimmed Individual strings from the comma-separated list |
parseLastComma | public static String[] parseLastComma(String value)(Code) | | Parse a string into two separate strings based on the last comma in the input value
Parameters: value - Input Parsed string |
parseOnlyCommaList | public static String[] parseOnlyCommaList(String commaList)(Code) | | Parse a comma-separated list of values
Parameters: commaList - Comma-separated list Individual strings from the comma-separated list |
parseOnlyCommaList | public static String[] parseOnlyCommaList(String commaList, boolean trim)(Code) | | Parse a comma-separated list of values
Parameters: commaList - Comma-separated list Parameters: trim - If the contents of the array should be trimmed Individual strings from the comma-separated list |
propertiesToMap | public static Map propertiesToMap(Properties properties)(Code) | | Convert a set of
Properties to a
Map Parameters: properties - Properties to be converted to a Map Map object containing all the keys and values from the original Properties object. If theProperties object was null, a new Map is returned with no values. |
removeInitialSlash | public static String removeInitialSlash(String input)(Code) | | Remove the initial "/" from a string
Parameters: input - Input string Input string without initial "/" removed or null if the input was null |
removeNullValues | public static List removeNullValues(List input)(Code) | | Remove null values from a given list
Parameters: input - List List with null values removed |
removeSlashes | public static String removeSlashes(String input)(Code) | | Remove the "/" from the beginning and end of a string
Parameters: input - Input string Input string with beginning and ending "/" removed or null if the input was null |
removeTrailingSlash | public static String removeTrailingSlash(String input)(Code) | | Remove the trailing "/" from a string
Parameters: input - Input string Input string with trailing "/" removed or null if the input was null |
replace | public static String replace(String str, String pattern, String replace)(Code) | | Replace any occurances of a string pattern within a string with a different string.
Parameters: str - The source string. This is the string that will be searched and have the replacements Parameters: pattern - The pattern to look for in str Parameters: replace - The string to insert in the place of pattern String with replace occurences |
setNoCacheControlHeaders | public static void setNoCacheControlHeaders(HttpServletResponse httpServletResponse)(Code) | | Set various cache control HTTP headers so that the browser does not try and cache the page
Parameters: httpServletResponse - Response |
stripHTML | public static String stripHTML(String text)(Code) | | Strip all HTML from a given piece of text
Parameters: text - Text text stripped of HTML between < and > tags or null if input was null or blank if input was blank |
stripLineTerminators | public static String stripLineTerminators(String input)(Code) | | Strip line terminator characters from an input string
Parameters: input - Input string Input with line terminator characters stripped or null if the input was null |
stripLineTerminators | public static String stripLineTerminators(String input, String replacement)(Code) | | Strip line terminator characters from an input string
Parameters: input - Input string Parameters: replacement - Replacement string Input with line terminator characters stripped or null if the input was null |
toHexString | public static String toHexString(byte[] buf, int offset, int length)(Code) | | Convert a byte array to a hex string
Parameters: buf - Byte array to convert to hex string Parameters: offset - Starting offset for conversion Parameters: length - Length to convert Hex string representing the byte array |
urlDecode | public static String urlDecode(String input)(Code) | | Return a URL decoded string
Parameters: input - Input string URL decoded string or null if either the input was null or there is a decoding exception |
urlEncode | public static String urlEncode(String input)(Code) | | Return an input string URL encoded
Parameters: input - Input string URL encoded string, null if the input was null,or input unmodified there is an encoding exception |
urlEncodeForLink | public static String urlEncodeForLink(String input)(Code) | | Return an input string URL encoded for a URL link where '/' show as '/'
Parameters: input - Input string URL encoded string, null if the input was null,or input unmodified there is an encoding exception |
|
|